summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2019-08-05 18:26:31 +0200
committerJulien Nabet <serval2412@yahoo.fr>2019-08-05 21:28:43 +0200
commit86ab2b2fcd95c6d14d0fd91dd1adaee5e7fd5713 (patch)
tree84329d846e6969e44f7da12d027928da416c003c
parent909c81028d75d672a914c7169d8ecd31de5c8afa (diff)
tdf#126663: optimize style list display in sidebar
See Flamegraph perf: https://bugs.documentfoundation.org/attachment.cgi?id=153129 + according to Xisco, time takes 15s instead of 145s (See https://bugs.documentfoundation.org/show_bug.cgi?id=126663#c7 + https://bugs.documentfoundation.org/show_bug.cgi?id=126663#c8) Change-Id: Ib02bbd0793ec8e903359d5f59f7c33809028bb02 Reviewed-on: https://gerrit.libreoffice.org/76988 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
-rw-r--r--sfx2/source/dialog/templdlg.cxx10
1 files changed, 5 insertions, 5 deletions
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 8cc0240f5f6f..c9e654afed45 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -1184,13 +1184,13 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(StyleFlags nFlags)
while( pStyle )
{
- //Bubblesort
- size_t nPos;
- for(nPos = aStrings.size(); nPos && aSorter.compare(aStrings[nPos-1], pStyle->GetName()) > 0; --nPos)
- {};
- aStrings.insert(aStrings.begin() + nPos, pStyle->GetName());
+ aStrings.push_back(pStyle->GetName());
pStyle = pStyleSheetPool->Next();
}
+ std::sort(aStrings.begin(), aStrings.end(),
+ [&aSorter](const OUString& rLHS, const OUString& rRHS) {
+ return aSorter.compare(rLHS, rRHS) < 0;
+ });
size_t nCount = aStrings.size();
size_t nPos = 0;