sw/source/uibase/ribbar/workctrl.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
New commits: commit 07e46bb789915b8046b192b2bd6389e9ef5cb5ce Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Mon Oct 9 20:21:34 2023 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Tue Oct 10 10:51:01 2023 +0200 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.st...@allotropia.de> diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx index 03c883dc0155..be1315e59de0 100644 --- a/sw/source/uibase/ribbar/workctrl.cxx +++ b/sw/source/uibase/ribbar/workctrl.cxx @@ -87,15 +87,18 @@ void 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 = o3tl::narrowing<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);