From 6b7594a84eaff5594d019ecc0ad324ebaa6f760d Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 20 Apr 2016 07:56:54 +0200 Subject: Use IsRightToLeft() ...instead of computing this from GetRightToLeftLevel() Change-Id: If0068c8aae581b6f097ba3897b4a3031db8d9afd --- editeng/source/editeng/impedit.cxx | 3 +-- editeng/source/editeng/impedit2.cxx | 9 ++++----- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'editeng') diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index f1c8d40e5bc6..d22c03c86214 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 9addb3db6b9d..6d19ff01ce87 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 ); -- cgit