Kaydet (Commit) 7a683c31 authored tarafından Khaled Hosny's avatar Khaled Hosny

tdf#116157: Always apply Unicode Bidi in editeng

Similar to commit 270d6db6 which fixed
the same issue in Writer. Surely having two text engines duplicating the
same bugs sounded like a brilliant idea to someone.

Change-Id: If85315fb00a2c0be78d502df0bfb9b50d9191368
Reviewed-on: https://gerrit.libreoffice.org/50921Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarKhaled Hosny <khaledhosny@eglug.org>
üst d6b33e49
...@@ -1909,19 +1909,7 @@ void ImpEditEngine::InitWritingDirections( sal_Int32 nPara ) ...@@ -1909,19 +1909,7 @@ void ImpEditEngine::InitWritingDirections( sal_Int32 nPara )
WritingDirectionInfos& rInfos = pParaPortion->aWritingDirectionInfos; WritingDirectionInfos& rInfos = pParaPortion->aWritingDirectionInfos;
rInfos.clear(); rInfos.clear();
bool bCTL = false; if (pParaPortion->GetNode()->Len())
ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos;
for (ScriptTypePosInfo & rType : rTypes)
{
if ( rType.nScriptType == i18n::ScriptType::COMPLEX )
{
bCTL = true;
break;
}
}
const UBiDiLevel nBidiLevel = IsRightToLeft( nPara ) ? 1 /*RTL*/ : 0 /*LTR*/;
if ( ( bCTL || ( nBidiLevel == 1 /*RTL*/ ) ) && pParaPortion->GetNode()->Len() )
{ {
const OUString aText = pParaPortion->GetNode()->GetString(); const OUString aText = pParaPortion->GetNode()->GetString();
...@@ -1931,6 +1919,7 @@ void ImpEditEngine::InitWritingDirections( sal_Int32 nPara ) ...@@ -1931,6 +1919,7 @@ void ImpEditEngine::InitWritingDirections( sal_Int32 nPara )
UBiDi* pBidi = ubidi_openSized( aText.getLength(), 0, &nError ); UBiDi* pBidi = ubidi_openSized( aText.getLength(), 0, &nError );
nError = U_ZERO_ERROR; nError = U_ZERO_ERROR;
const UBiDiLevel nBidiLevel = IsRightToLeft(nPara) ? 1 /*RTL*/ : 0 /*LTR*/;
ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(aText.getStr()), aText.getLength(), nBidiLevel, nullptr, &nError ); ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(aText.getStr()), aText.getLength(), nBidiLevel, nullptr, &nError );
nError = U_ZERO_ERROR; nError = U_ZERO_ERROR;
...@@ -1954,7 +1943,7 @@ void ImpEditEngine::InitWritingDirections( sal_Int32 nPara ) ...@@ -1954,7 +1943,7 @@ void ImpEditEngine::InitWritingDirections( sal_Int32 nPara )
ubidi_close( pBidi ); ubidi_close( pBidi );
} }
// No infos mean no CTL and default dir is L2R... // No infos mean ubidi error, default to LTR
if ( rInfos.empty() ) if ( rInfos.empty() )
rInfos.emplace_back( 0, 0, pParaPortion->GetNode()->Len() ); rInfos.emplace_back( 0, 0, pParaPortion->GetNode()->Len() );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment