diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 4fe4712cca2f..e3e595051d68 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -1872,25 +1872,9 @@ IMPL_LINK( ToolBarManager, MenuButton, ToolBox*, pToolBar ) if ( m_bDisposed ) return 1; - PopupMenu * pMenu = GetToolBarCustomMenu(pToolBar); - if (pMenu) - { - sal_uInt16 nObsoleteItems = 6; - sal_uInt16 positionInMenu; - sal_uInt32 obsoleteItems[] = { MENUITEM_TOOLBAR_CLOSE , - MENUITEM_TOOLBAR_VISIBLEBUTTON , - MENUITEM_TOOLBAR_CUSTOMIZETOOLBAR, - MENUITEM_TOOLBAR_LOCKTOOLBARPOSITION, - MENUITEM_TOOLBAR_DOCKTOOLBAR, - MENUITEM_TOOLBAR_DOCKALLTOOLBAR - }; - for( int i = 0 ; i < nObsoleteItems ; i++ ) - { - positionInMenu = pMenu->GetItemPos( obsoleteItems[i] ); - if ( positionInMenu != MENU_ITEM_NOTFOUND ) - pMenu->RemoveItem( positionInMenu ); - } - } + pToolBar->UpdateCustomMenu(); + // remove all entries that do not come from the toolbar itself (fdo#38276) + ImplClearPopupMenu( pToolBar ); return 0; }