diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-09-16 15:04:47 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-09-19 19:21:01 +0000 |
commit | feb79618508ce7888ae684dcd4501124579eeac2 (patch) | |
tree | 05b35becb44faa22cd2b8911ed9031a12aabbfee | |
parent | 19a9dda3ec36874d337de65364c265946c7004df (diff) |
Resolves: fdo#67697 source formatting option list in autocorrect
regression from 0513e10635c85fc1aa214948de4992d4b76d555c
"fdo#49350 Speedup "OK" action of auto-correct dialog"
(cherry picked from commit 95e566b9a0df06d130e118181058273f034bcf2c)
Conflicts:
cui/source/tabpages/autocdlg.cxx
Change-Id: Iede6063729433beb3ac50dbdb45230c1d774cea0
Reviewed-on: https://gerrit.libreoffice.org/5958
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r-- | cui/source/inc/autocdlg.hxx | 2 | ||||
-rw-r--r-- | cui/source/tabpages/autocdlg.cxx | 21 |
2 files changed, 19 insertions, 4 deletions
diff --git a/cui/source/inc/autocdlg.hxx b/cui/source/inc/autocdlg.hxx index abaf70c7f121..f76be9c602c2 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 f8a5fe54ebb1..cb4cf9d5e065 100644 --- a/cui/source/tabpages/autocdlg.cxx +++ b/cui/source/tabpages/autocdlg.cxx @@ -945,6 +945,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 ); } @@ -1122,7 +1133,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++) @@ -1148,6 +1159,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) @@ -1199,7 +1212,9 @@ IMPL_LINK(OfaAutocorrReplacePage, NewDelHdl, PushButton*, pBtn) if(sEntry.Len() && ( aReplaceED.GetText().Len() || ( bHasSelectionText && bSWriter ) )) { - NewEntry(aShortED.GetText(), aReplaceED.GetText()); + bool bKeepSourceFormatting = !bReplaceEditChanged && !aTextOnlyCB.IsChecked(); + + NewEntry(aShortED.GetText(), aReplaceED.GetText(), bKeepSourceFormatting); aReplaceTLB.SetUpdateMode(sal_False); sal_uInt32 nPos = UINT_MAX; sEntry += '\t'; @@ -1223,7 +1238,7 @@ IMPL_LINK(OfaAutocorrReplacePage, NewDelHdl, PushButton*, pBtn) SvTreeListEntry* pInsEntry = aReplaceTLB.InsertEntry( sEntry, static_cast< SvTreeListEntry * >(NULL), false, nPos == UINT_MAX ? LIST_APPEND : nPos); - if( !bReplaceEditChanged && !aTextOnlyCB.IsChecked()) + if (bKeepSourceFormatting) { pInsEntry->SetUserData(&bHasSelectionText); // new formatted text } |