[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - cui/source

Mike Kaganski mike.kaganski at collabora.com
Thu Apr 26 09:21:05 UTC 2018


 cui/source/dialogs/SpellDialog.cxx |   21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

New commits:
commit 8933edda55b10901f4cd9f673a7884e0007f0963
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date:   Mon Apr 16 14:25:16 2018 +0100

    tdf#116725: justify selection to handle right-to-left selections
    
    Change-Id: I6298a87170236059ff08a1f891ead21236be663a
    Reviewed-on: https://gerrit.libreoffice.org/52979
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    (cherry picked from commit f7de9473b2fddd84d03fb521709d805486292800)
    Reviewed-on: https://gerrit.libreoffice.org/53044
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index a81b3ede251a..c99efacc7217 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -1247,15 +1247,16 @@ bool SentenceEditWindow_Impl::PreNotify( NotifyEvent& rNEvt )
         {
             TextEngine* pTextEngine = GetTextEngine();
             TextView* pTextView = pTextEngine->GetActiveView();
-            const TextSelection& rCurrentSelection = pTextView->GetSelection();
+            TextSelection aCurrentSelection = pTextView->GetSelection();
+            aCurrentSelection.Justify();
             //determine if the selection contains a field
             bool bHasFieldLeft = false;
             bool bHasErrorLeft = false;
 
-            bool bHasRange = rCurrentSelection.HasRange();
+            bool bHasRange = aCurrentSelection.HasRange();
             sal_uInt8 nSelectionType = 0; // invalid type!
 
-            TextPaM aCursor(rCurrentSelection.GetStart());
+            TextPaM aCursor(aCurrentSelection.GetStart());
             const TextCharAttrib* pBackAttr = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_BACKGROUND );
             const TextCharAttrib* pErrorAttr = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_ERROR );
             const TextCharAttrib* pBackAttrLeft = nullptr;
@@ -1266,21 +1267,21 @@ bool SentenceEditWindow_Impl::PreNotify( NotifyEvent& rNEvt )
             if(bHasRange)
             {
                 if(pBackAttr &&
-                        pBackAttr->GetStart() == rCurrentSelection.GetStart().GetIndex() &&
-                        pBackAttr->GetEnd() == rCurrentSelection.GetEnd().GetIndex())
+                        pBackAttr->GetStart() == aCurrentSelection.GetStart().GetIndex() &&
+                        pBackAttr->GetEnd() == aCurrentSelection.GetEnd().GetIndex())
                 {
                     nSelectionType = FULL;
                 }
                 else if(pErrorAttr &&
-                        pErrorAttr->GetStart() <= rCurrentSelection.GetStart().GetIndex() &&
-                        pErrorAttr->GetEnd() >= rCurrentSelection.GetEnd().GetIndex())
+                        pErrorAttr->GetStart() <= aCurrentSelection.GetStart().GetIndex() &&
+                        pErrorAttr->GetEnd() >= aCurrentSelection.GetEnd().GetIndex())
                 {
                     nSelectionType = INSIDE_YES;
                 }
                 else
                 {
                     nSelectionType = bHasField||bHasError ? BRACE : OUTSIDE_NO;
-                    while(aCursor.GetIndex() < rCurrentSelection.GetEnd().GetIndex())
+                    while(aCursor.GetIndex() < aCurrentSelection.GetEnd().GetIndex())
                     {
                         ++aCursor.GetIndex();
                         const TextCharAttrib* pIntBackAttr = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_BACKGROUND );
@@ -1301,8 +1302,8 @@ bool SentenceEditWindow_Impl::PreNotify( NotifyEvent& rNEvt )
                 const TextCharAttrib* pCurAttr = pBackAttr ? pBackAttr : pErrorAttr;
                 if(pCurAttr)
                 {
-                    nSelectionType = pCurAttr->GetStart() == rCurrentSelection.GetStart().GetIndex() ?
-                            LEFT_NO : pCurAttr->GetEnd() == rCurrentSelection.GetEnd().GetIndex() ? RIGHT_NO : INSIDE_NO;
+                    nSelectionType = pCurAttr->GetStart() == aCurrentSelection.GetStart().GetIndex() ?
+                            LEFT_NO : pCurAttr->GetEnd() == aCurrentSelection.GetEnd().GetIndex() ? RIGHT_NO : INSIDE_NO;
                 }
                 else
                     nSelectionType = OUTSIDE_NO;


More information about the Libreoffice-commits mailing list