cui/source/options/optdict.cxx | 31 +++++++++++++++++++++++-------- sw/source/ui/frmdlg/cption.cxx | 2 +- 2 files changed, 24 insertions(+), 9 deletions(-)
New commits: commit 91fe06b250645babad6df68a26d7ff3361b8ccc3 Author: Mike Kaganski <[email protected]> Date: Fri Jun 22 14:40:13 2018 +0200 tdf#118316: fix off-by-1 error (outline level is 0-based) regression since commit 4730b23b1da929b802d527611e974ff1b1e6d6c5 Change-Id: I50627cde3a9a91189db61e19850768412b058064 Reviewed-on: https://gerrit.libreoffice.org/56295 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> (cherry picked from commit 28f45e406da9ca2c87d1e4285b0138c081125ec8) Reviewed-on: https://gerrit.libreoffice.org/56307 diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx index 135eefb21216..cb9d63b4036e 100644 --- a/sw/source/ui/frmdlg/cption.cxx +++ b/sw/source/ui/frmdlg/cption.cxx @@ -379,7 +379,7 @@ void SwCaptionDialog::DrawSample() if( pFieldType && pFieldType->GetOutlineLvl() < MAXLEVEL ) { SwNumberTree::tNumberVector aNumVector; - aNumVector.insert(aNumVector.end(), pFieldType->GetOutlineLvl(), 1); + aNumVector.insert(aNumVector.end(), pFieldType->GetOutlineLvl() + 1, 1); OUString sNumber( rSh.GetOutlineNumRule()-> MakeNumString(aNumVector, false )); commit a054308741ebae0b65a425be1ab30d3b9e1af871 Author: Noel Grandin <[email protected]> Date: Mon Jun 25 11:05:16 2018 +0200 tdf#109269 very slow loading of user-defined dictionary word list this is about 10x faster for me Reviewed-on: https://gerrit.libreoffice.org/56378 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> (cherry picked from commit a07bb28d3199542c0b90884a947c2bac02bad07d) Change-Id: I1d308c78dbdd04beaa432b546ba3b89bd617d57e Reviewed-on: https://gerrit.libreoffice.org/56385 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx index b5f7665ebfa0..d92db5c93134 100644 --- a/cui/source/options/optdict.cxx +++ b/cui/source/options/optdict.cxx @@ -460,10 +460,8 @@ void SvxEditDictionaryDialog::ShowWords_Impl( sal_uInt16 nId ) EnterWait(); - OUString aStr; - - pWordED->SetText(aStr); - pReplaceED->SetText(aStr); + pWordED->SetText(OUString()); + pReplaceED->SetText(OUString()); bool bIsNegative = xDic->getDictionaryType() != DictionaryType_POSITIVE; bool bLangNone = LanguageTag( @@ -517,17 +515,34 @@ void SvxEditDictionaryDialog::ShowWords_Impl( sal_uInt16 nId ) Sequence< Reference< XDictionaryEntry > > aEntries( xDic->getEntries() ); const Reference< XDictionaryEntry > *pEntry = aEntries.getConstArray(); sal_Int32 nCount = aEntries.getLength(); - + std::vector<OUString> aSortedDicEntries; + aSortedDicEntries.reserve(nCount); for (sal_Int32 i = 0; i < nCount; i++) { - aStr = pEntry[i]->getDictionaryWord(); - sal_uLong nPos = GetLBInsertPos( aStr ); + OUString aStr = pEntry[i]->getDictionaryWord(); if(!pEntry[i]->getReplacementText().isEmpty()) { aStr += "\t" + pEntry[i]->getReplacementText(); } - pWordsLB->InsertEntry(aStr, nullptr, false, nPos == TREELIST_ENTRY_NOTFOUND ? TREELIST_APPEND : nPos); + aSortedDicEntries.push_back(aStr); + } + + IntlWrapper aIntlWrapper(SvtSysLocale().GetUILanguageTag()); + const CollatorWrapper* pCollator = aIntlWrapper.getCollator(); + std::sort(aSortedDicEntries.begin(), aSortedDicEntries.end(), + [&] (OUString const & lhs, OUString const & rhs) + { + sal_Int32 nCmpRes = pCollator-> + compareString( getNormDicEntry_Impl(lhs), getNormDicEntry_Impl( rhs ) ); + return nCmpRes < 0; + }); + + pWordsLB->SetUpdateMode(false); // speed up insert + for (OUString const & rStr : aSortedDicEntries) + { + pWordsLB->InsertEntry(rStr, nullptr, false, TREELIST_APPEND); } + pWordsLB->SetUpdateMode(true); if (pWordsLB->GetEntryCount()) { _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
