Kaydet (Commit) 6d10a42d authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolves: fdo#86931 wrong offsets used to set language

after Chinese conversion. the _aOldSel is the one
that has the start and end index set to the end of the
replacement text and so the calculation only makes
sense on that selection

Change-Id: I152067550d7741579bfc6ca026072b16ac7c2dd6
üst f3c24b48
......@@ -3956,7 +3956,7 @@ long ImpEditEngine::GetXPos(
if( pLine->GetCharPosArray().size() )
{
sal_Int32 nPos = nIndex - 1 - pLine->GetStart();
if( nPos >= (sal_Int32)pLine->GetCharPosArray().size() )
if (nPos < 0 || nPos >= (sal_Int32)pLine->GetCharPosArray().size())
{
nPos = pLine->GetCharPosArray().size()-1;
OSL_FAIL("svx::ImpEditEngine::GetXPos(), index out of range!");
......
......@@ -373,11 +373,11 @@ void TextConvWrapper::ReplaceUnit(
// remember current original language for later use
ImpEditEngine *pImpEditEng = m_pEditView->GetImpEditEngine();
ESelection _aOldSel = m_pEditView->GetSelection();
ESelection aOldSel = m_pEditView->GetSelection();
//EditSelection aOldEditSel = pEditView->GetImpEditView()->GetEditSelection();
#ifdef DBG_UTIL
LanguageType nOldLang = pImpEditEng->GetLanguage( pImpEditEng->CreateSel( _aOldSel ).Min() );
LanguageType nOldLang = pImpEditEng->GetLanguage( pImpEditEng->CreateSel( aOldSel ).Min() );
#endif
pImpEditEng->UndoActionStart( EDITUNDO_INSERT );
......@@ -387,7 +387,7 @@ void TextConvWrapper::ReplaceUnit(
// Thus we do this only for Chinese translation...
bool bIsChineseConversion = IsChinese( GetSourceLanguage() );
if (bIsChineseConversion)
ChangeText( aNewTxt, rOrigText, &rOffsets, &_aOldSel );
ChangeText( aNewTxt, rOrigText, &rOffsets, &aOldSel );
else
ChangeText( aNewTxt, rOrigText, NULL, NULL );
......@@ -397,7 +397,6 @@ void TextConvWrapper::ReplaceUnit(
DBG_ASSERT( GetTargetLanguage() == LANGUAGE_CHINESE_SIMPLIFIED || GetTargetLanguage() == LANGUAGE_CHINESE_TRADITIONAL,
"TextConvWrapper::ReplaceUnit : unexpected target language" );
ESelection aOldSel = m_pEditView->GetSelection();
ESelection aNewSel( aOldSel );
aNewSel.nStartPos = aNewSel.nStartPos - aNewTxt.getLength();
......
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