[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - editeng/source

Caolán McNamara caolanm at redhat.com
Mon Dec 8 02:42:09 PST 2014


 editeng/source/editeng/impedit2.cxx |    2 +-
 editeng/source/editeng/textconv.cxx |    7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)

New commits:
commit 45be83689bc661a9b3077dd7c8e5563fdf7f04db
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
    (cherry picked from commit 6d10a42d5b1690b3b1ed81d99a3a1bc9b65c30d9)

diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 3f030d1..7a0ade2 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 b7ac644..f2231c2 100644
--- a/editeng/source/editeng/textconv.cxx
+++ b/editeng/source/editeng/textconv.cxx
@@ -374,11 +374,11 @@ void TextConvWrapper::ReplaceUnit(
 
     // remember current original language for kater 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 );
@@ -388,7 +388,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 );
 
@@ -398,7 +398,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();
 


More information about the Libreoffice-commits mailing list