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

Caolán McNamara caolanm at redhat.com
Tue Sep 17 00:25:00 PDT 2013


 cui/source/inc/autocdlg.hxx      |    2 +-
 cui/source/tabpages/autocdlg.cxx |   21 ++++++++++++++++++---
 2 files changed, 19 insertions(+), 4 deletions(-)

New commits:
commit 8af5a2b08dd8fa319ae02d9947f0906ecb1a4805
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Sep 16 15:04:47 2013 +0100

    Resolves: fdo#67697 source formatting option list in autocorrect
    
    regression from 0513e10635c85fc1aa214948de4992d4b76d555c
    "fdo#49350 Speedup "OK" action of auto-correct dialog"
    
    Change-Id: Iede6063729433beb3ac50dbdb45230c1d774cea0
    (cherry picked from commit 95e566b9a0df06d130e118181058273f034bcf2c)
    Reviewed-on: https://gerrit.libreoffice.org/5956
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/cui/source/inc/autocdlg.hxx b/cui/source/inc/autocdlg.hxx
index 3d518d2..ee72856 100644
--- a/cui/source/inc/autocdlg.hxx
+++ b/cui/source/inc/autocdlg.hxx
@@ -280,7 +280,7 @@ public:
 
     void    SetLanguage(LanguageType eSet);
     void    DeleteEntry(String sShort, String sLong);
-    void    NewEntry(String sShort, String sLong);
+    void    NewEntry(String sShort, String sLong, bool bKeepSourceFormatting);
 };
 
 // class OfaAutocorrExceptPage ---------------------------------------------
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index bfde63b..df874d7 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -943,6 +943,17 @@ sal_Bool OfaAutocorrReplacePage::FillItemSet( SfxItemSet& )
         for (sal_uInt32 i = 0; i < rStringChangeList.aNewEntries.size(); i++)
         {
             DoubleString& newEntry = rStringChangeList.aNewEntries[i];
+
+            //fdo#67697 if the user data is set then we want to retain the
+            //source formatting of the entry, so don't use the optimized
+            //text-only MakeCombinedChanges for this entry
+            bool bKeepSourceFormatting = newEntry.pUserData == &bHasSelectionText;
+            if (bKeepSourceFormatting)
+            {
+                pAutoCorrect->PutText(newEntry.sShort, *SfxObjectShell::Current(), eCurrentLang);
+                continue;
+            }
+
             SvxAutocorrWord aNewWord( newEntry.sShort, newEntry.sLong );
             aNewWords.push_back( aNewWord );
         }
@@ -1120,7 +1131,7 @@ IMPL_LINK(OfaAutocorrReplacePage, SelectHdl, SvTabListBox*, pBox)
     return 0;
 };
 
-void OfaAutocorrReplacePage::NewEntry(String sShort, String sLong)
+void OfaAutocorrReplacePage::NewEntry(String sShort, String sLong, bool bKeepSourceFormatting)
 {
     DoubleStringArray& rNewArray = aChangesTable[eLang].aNewEntries;
     for (sal_uInt32 i = 0; i < rNewArray.size(); i++)
@@ -1146,6 +1157,8 @@ void OfaAutocorrReplacePage::NewEntry(String sShort, String sLong)
     aNewString.sShort = sShort;
     aNewString.sLong = sLong;
     rNewArray.push_back(aNewString);
+    if (bKeepSourceFormatting)
+        rNewArray.back().pUserData = &bHasSelectionText;
 }
 
 void OfaAutocorrReplacePage::DeleteEntry(String sShort, String sLong)
@@ -1197,7 +1210,9 @@ IMPL_LINK(OfaAutocorrReplacePage, NewDelHdl, PushButton*, pBtn)
         if(sEntry.Len() && ( !m_pReplaceED->GetText().isEmpty() ||
                 ( bHasSelectionText && bSWriter ) ))
         {
-            NewEntry(m_pShortED->GetText(), m_pReplaceED->GetText());
+            bool bKeepSourceFormatting = !bReplaceEditChanged && !m_pTextOnlyCB->IsChecked();
+
+            NewEntry(m_pShortED->GetText(), m_pReplaceED->GetText(), bKeepSourceFormatting);
             m_pReplaceTLB->SetUpdateMode(sal_False);
             sal_uInt32 nPos = UINT_MAX;
             sEntry += '\t';
@@ -1221,7 +1236,7 @@ IMPL_LINK(OfaAutocorrReplacePage, NewDelHdl, PushButton*, pBtn)
             SvTreeListEntry* pInsEntry = m_pReplaceTLB->InsertEntry(
                                         sEntry, static_cast< SvTreeListEntry * >(NULL), false,
                                         nPos == UINT_MAX ? LIST_APPEND : nPos);
-            if( !bReplaceEditChanged && !m_pTextOnlyCB->IsChecked())
+            if (bKeepSourceFormatting)
             {
                 pInsEntry->SetUserData(&bHasSelectionText); // new formatted text
             }


More information about the Libreoffice-commits mailing list