[Libreoffice-commits] core.git: 2 commits - editeng/source
Caolán McNamara
caolanm at redhat.com
Mon Dec 8 02:38:45 PST 2014
editeng/source/editeng/impedit2.cxx | 2 +-
editeng/source/editeng/textconv.cxx | 9 ++++-----
2 files changed, 5 insertions(+), 6 deletions(-)
New commits:
commit 6d10a42d5b1690b3b1ed81d99a3a1bc9b65c30d9
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Dec 8 10:36:10 2014 +0000
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
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index cf226c1..4233b3e 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 ea3181a..f22478e 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();
commit f3c24b488388032d069bee0a7e0d88f6e61430e2
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Dec 8 10:25:37 2014 +0000
kater->later
Change-Id: If9eaf54c2d706144e2b7c34a3004ad9604dd420f
diff --git a/editeng/source/editeng/textconv.cxx b/editeng/source/editeng/textconv.cxx
index 8a057cc..ea3181a 100644
--- a/editeng/source/editeng/textconv.cxx
+++ b/editeng/source/editeng/textconv.cxx
@@ -371,7 +371,7 @@ void TextConvWrapper::ReplaceUnit(
}
m_nUnitOffset = m_nUnitOffset + nUnitStart + aNewTxt.getLength();
- // remember current original language for kater use
+ // remember current original language for later use
ImpEditEngine *pImpEditEng = m_pEditView->GetImpEditEngine();
ESelection _aOldSel = m_pEditView->GetSelection();
//EditSelection aOldEditSel = pEditView->GetImpEditView()->GetEditSelection();
More information about the Libreoffice-commits
mailing list