diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-12-08 10:36:10 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-12-08 10:38:10 +0000 |
commit | 6d10a42d5b1690b3b1ed81d99a3a1bc9b65c30d9 (patch) | |
tree | 28c7c6928cb82ab654ced798f9096bcfd9bc806a /editeng | |
parent | f3c24b488388032d069bee0a7e0d88f6e61430e2 (diff) |
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
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/textconv.cxx | 7 |
2 files changed, 4 insertions, 5 deletions
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index cf226c1175b8..4233b3ea9422 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -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!"); diff --git a/editeng/source/editeng/textconv.cxx b/editeng/source/editeng/textconv.cxx index ea3181a73aec..f22478e7d94b 100644 --- a/editeng/source/editeng/textconv.cxx +++ b/editeng/source/editeng/textconv.cxx @@ -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(); |