Use IsRightToLeft()

...instead of computing this from GetRightToLeftLevel()

Change-Id: If0068c8aae581b6f097ba3897b4a3031db8d9afd
This commit is contained in:
Stephan Bergmann
2016-04-20 07:56:54 +02:00
parent 97725c3a1f
commit 6b7594a84e
2 changed files with 5 additions and 7 deletions

View File

@@ -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;

View File

@@ -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 );