diff options
-rw-r--r-- | include/vcl/menu.hxx | 4 | ||||
-rw-r--r-- | vcl/source/window/menu.cxx | 26 |
2 files changed, 22 insertions, 8 deletions
diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index a5a1ec48c5bb..9466443c37d2 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -185,6 +185,10 @@ protected: SAL_DLLPRIVATE void ImplAddDel( ImplMenuDelData &rDel ); SAL_DLLPRIVATE void ImplRemoveDel( ImplMenuDelData &rDel ); + SAL_DLLPRIVATE MenuItemData* NbcInsertItem(sal_uInt16 nId, MenuItemBits nBits, + const OUString& rStr, Menu* pMenu, + size_t nPos, const OString &rIdent); + /// Close the 'pStartedFrom' menu window. virtual void ClosePopup(Menu* pMenu) = 0; diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 30b8cdc96806..078e1bb31ec9 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -366,6 +366,21 @@ void Menu::RemoveEventListener( const Link& rEventListener ) maEventListeners.removeListener( rEventListener ); } +MenuItemData* Menu::NbcInsertItem(sal_uInt16 nId, MenuItemBits nBits, + const OUString& rStr, Menu* pMenu, + size_t nPos, const OString &rIdent) +{ + // put Item in MenuItemList + MenuItemData* pData = pItemList->Insert(nId, MenuItemType::STRING, + nBits, rStr, Image(), pMenu, nPos, rIdent); + + // update native menu + if (ImplGetSalMenu() && pData->pSalMenuItem) + ImplGetSalMenu()->InsertItem(pData->pSalMenuItem, nPos); + + return pData; +} + void Menu::InsertItem(sal_uInt16 nItemId, const OUString& rStr, MenuItemBits nItemBits, const OString &rIdent, sal_uInt16 nPos) { @@ -378,12 +393,7 @@ void Menu::InsertItem(sal_uInt16 nItemId, const OUString& rStr, MenuItemBits nIt nPos = MENU_APPEND; // put Item in MenuItemList - MenuItemData* pData = pItemList->Insert(nItemId, MenuItemType::STRING, - nItemBits, rStr, Image(), this, nPos, rIdent); - - // update native menu - if( ImplGetSalMenu() && pData->pSalMenuItem ) - ImplGetSalMenu()->InsertItem( pData->pSalMenuItem, nPos ); + NbcInsertItem(nItemId, nItemBits, rStr, this, nPos, rIdent); vcl::Window* pWin = ImplGetWindow(); delete mpLayoutData, mpLayoutData = NULL; @@ -2877,8 +2887,8 @@ sal_uInt16 PopupMenu::ImplExecute( vcl::Window* pW, const Rectangle& rRect, sal_ if( pResMgr ) { OUString aTmpEntryText( ResId( SV_RESID_STRING_NOSELECTIONPOSSIBLE, *pResMgr ) ); - MenuItemData* pData = pItemList->Insert( - 0xFFFF, MenuItemType::STRING, MenuItemBits::NONE, aTmpEntryText, Image(), NULL, 0xFFFF, OString() ); + + MenuItemData* pData = NbcInsertItem(0xFFFF, MenuItemBits::NONE, aTmpEntryText, NULL, 0xFFFF, OString()); size_t nPos = 0; pData = pItemList->GetData( pData->nId, nPos ); assert(pData); |