summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2023-10-09 20:21:34 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2023-10-10 10:51:57 +0200
commitd1bb851b37cd41fb122c03986389439fd47492c5 (patch)
treec1890cb0a1b5bb8116c9ed5b63948e6c8240d1cd
parentc107793bdca1da86fc4a6081dbcc4f64455580b4 (diff)
sw: SwTbxAutoTextCtrl should sort groups by title
Change-Id: I2134492fd681393da6f4fc29aec95117145e8e97 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157735 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit 07e46bb789915b8046b192b2bd6389e9ef5cb5ce)
-rw-r--r--sw/source/uibase/ribbar/workctrl.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx
index f62059f661e5..d7260fdfe1d2 100644
--- a/sw/source/uibase/ribbar/workctrl.cxx
+++ b/sw/source/uibase/ribbar/workctrl.cxx
@@ -97,15 +97,18 @@ VclPtr<SfxPopupWindow> SwTbxAutoTextCtrl::CreatePopupWindow()
ScopedVclPtrInstance<PopupMenu> pPopup;
SwGlossaryList* pGlossaryList = ::GetGlossaryList();
const size_t nGroupCount = pGlossaryList->GetGroupCount();
+ o3tl::sorted_vector<OUString> titles;
for(size_t i = 1; i <= nGroupCount; ++i)
{
OUString sTitle = pGlossaryList->GetGroupTitle(i - 1);
const sal_uInt16 nBlockCount = pGlossaryList->GetBlockCount(i -1);
+ auto const [it, _] = titles.insert(sTitle);
+ size_t const menuIndex(::std::distance(titles.begin(), it));
if(nBlockCount)
{
sal_uInt16 nIndex = static_cast<sal_uInt16>(100*i);
// but insert without extension
- pPopup->InsertItem( i, sTitle);
+ pPopup->InsertItem(i, sTitle, MenuItemBits::NONE, {}, menuIndex);
VclPtrInstance<PopupMenu> pSub;
pSub->SetSelectHdl(aLnk);
pPopup->SetPopupMenu(i, pSub);