summaryrefslogtreecommitdiff
path: root/sw/source/ui/ribbar/workctrl.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/ui/ribbar/workctrl.cxx')
-rw-r--r--sw/source/ui/ribbar/workctrl.cxx19
1 files changed, 16 insertions, 3 deletions
diff --git a/sw/source/ui/ribbar/workctrl.cxx b/sw/source/ui/ribbar/workctrl.cxx
index e0c79b28b3..7d74426231 100644
--- a/sw/source/ui/ribbar/workctrl.cxx
+++ b/sw/source/ui/ribbar/workctrl.cxx
@@ -239,6 +239,18 @@ SwTbxAutoTextCtrl::~SwTbxAutoTextCtrl()
/**********************************************************************
**********************************************************************/
+void lcl_InsertSorted( PopupMenu& rPopup, const XubString& rTitle, USHORT nItemId )
+{
+ USHORT nPosition = 0;
+ for( USHORT nEntry = 0; nEntry < rPopup.GetItemCount(); ++nEntry )
+ {
+ String sEntry = rPopup.GetItemText( rPopup.GetItemId( nEntry ));
+ if( COMPARE_LESS == rTitle.CompareIgnoreCaseToAscii( sEntry))
+ break;
+ ++nPosition;
+ }
+ rPopup.InsertItem( nItemId, rTitle, 0, nPosition);
+}
SfxPopupWindow* SwTbxAutoTextCtrl::CreatePopupWindow()
@@ -282,8 +294,9 @@ SfxPopupWindow* SwTbxAutoTextCtrl::CreatePopupWindow()
if(nBlockCount)
{
USHORT nIndex = 100 * (i);
- // aber ohne extension einfuegen
- pPopup->InsertItem( i, sTitle);//sGroupName.GetToken(0, GLOS_DELIM));
+ // insert without extension
+ //b6919254
+ lcl_InsertSorted( *pPopup, sTitle, i );
PopupMenu* pSub = new PopupMenu;
pSub->SetSelectHdl(aLnk);
pPopup->SetPopupMenu(i, pSub);
@@ -293,7 +306,7 @@ SfxPopupWindow* SwTbxAutoTextCtrl::CreatePopupWindow()
String sLongName(pGlossaryList->GetBlockName(i - 1, j, sEntry));
sEntry.AppendAscii(" - ");
sEntry += sLongName;
- pSub->InsertItem(++nIndex, sEntry);
+ lcl_InsertSorted( *pSub, sEntry, ++nIndex );
}
}
}