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>
(cherry picked from commit 86ab2b2fcd95c6d14d0fd91dd1adaee5e7fd5713)
Reviewed-on: https://gerrit.libreoffice.org/76994
Tested-by: Jenkins
Reviewed-by: Xisco FaulĂ­ <xiscofauli@libreoffice.org>
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 98db808..55acfa1 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -1184,13 +1184,13 @@

    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;