[Libreoffice-commits] core.git: editeng/source

Stephan Bergmann sbergman at redhat.com
Wed Apr 20 05:57:18 UTC 2016


 editeng/source/editeng/impedit.cxx  |    3 +--
 editeng/source/editeng/impedit2.cxx |    9 ++++-----
 2 files changed, 5 insertions(+), 7 deletions(-)

New commits:
commit 6b7594a84eaff5594d019ecc0ad324ebaa6f760d
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Apr 20 07:56:54 2016 +0200

    Use IsRightToLeft()
    
    ...instead of computing this from GetRightToLeftLevel()
    
    Change-Id: If0068c8aae581b6f097ba3897b4a3031db8d9afd

diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index f1c8d40..d22c03c 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -962,8 +962,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor )
         {
             sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nTextPortionStart, (nShowCursorFlags & GETCRSR_PREFERPORTIONSTART) != 0 );
             const TextPortion& rTextPortion = pParaPortion->GetTextPortions()[nTextPortion];
-            sal_uInt16 nRTLLevel = rTextPortion.GetRightToLeftLevel();
-            if ( nRTLLevel%2 )
+            if (rTextPortion.IsRightToLeft())
                 nCursorDir = CursorDirection::RTL;
             else
                 nCursorDir = CursorDirection::LTR;
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 9addb3d..6d19ff0 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -949,8 +949,7 @@ EditPaM ImpEditEngine::CursorVisualStartEnd( EditView* pEditView, const EditPaM&
         sal_Int32 nTmp;
         sal_Int32 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nTmp, true );
         const TextPortion& rTextPortion = pParaPortion->GetTextPortions()[nTextPortion];
-        sal_Int32 nRTLLevel = rTextPortion.GetRightToLeftLevel();
-        bool bPortionRTL = (nRTLLevel%2) != 0;
+        bool bPortionRTL = rTextPortion.IsRightToLeft();
 
         if ( bStart )
         {
@@ -1092,7 +1091,7 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM
             sal_Int32 nPortionStart;
             sal_Int32 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nPortionStart, bBeforePortion );
             const TextPortion& rTextPortion = pParaPortion->GetTextPortions()[nTextPortion];
-            bool bRTLPortion = (rTextPortion.GetRightToLeftLevel() % 2) != 0;
+            bool bRTLPortion = rTextPortion.IsRightToLeft();
 
             // -1: We are 'behind' the character
             long nVisPos = (long)ubidi_getVisualIndex( pBidi, bWasBehind ? nPosInLine-1 : nPosInLine, &nError );
@@ -1119,9 +1118,9 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM
                 // sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nPortionStart, !bRTLPortion );
                 sal_Int32 _nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), _nPortionStart, true );
                 const TextPortion& _rTextPortion = pParaPortion->GetTextPortions()[_nTextPortion];
-                if ( bVisualToLeft && !bRTLPortion && ( _rTextPortion.GetRightToLeftLevel() % 2 ) )
+                if ( bVisualToLeft && !bRTLPortion && _rTextPortion.IsRightToLeft() )
                     aPaM.SetIndex( aPaM.GetIndex()+1 );
-                else if ( !bVisualToLeft && bRTLPortion && ( bWasBehind || !(_rTextPortion.GetRightToLeftLevel() % 2 )) )
+                else if ( !bVisualToLeft && bRTLPortion && ( bWasBehind || !_rTextPortion.IsRightToLeft() ) )
                     aPaM.SetIndex( aPaM.GetIndex()+1 );
 
                 pEditView->pImpEditView->SetCursorBidiLevel( _nPortionStart );


More information about the Libreoffice-commits mailing list