diff options
author | Jan Holesovsky <kendy@collabora.com> | 2014-09-15 15:27:58 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2014-09-15 20:16:26 +0200 |
commit | 44c394344668134c4d842aa93a454218ccdfec7c (patch) | |
tree | 1a005c1439eb790c2b180bed5ee62c645cb97a40 /vcl/source/window/menu.cxx | |
parent | 58d0b8f1b2ab67b2e60ad85c1487ba8c17a63fbb (diff) |
vcl menu: Move ImplLoadRes()'s body to PopupMenu constructor.
No MenuBar is read via ResId any more.
Change-Id: I7aa9ada7fb8ce1b272c6c92b5429812708027162
Diffstat (limited to 'vcl/source/window/menu.cxx')
-rw-r--r-- | vcl/source/window/menu.cxx | 61 |
1 files changed, 27 insertions, 34 deletions
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index d6191ac99de2..4ca8287aa02a 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -175,39 +175,6 @@ Menu::~Menu() ImplSetSalMenu( NULL ); } -void Menu::ImplLoadRes( const ResId& rResId ) -{ - ResMgr* pMgr = rResId.GetResMgr(); - if( ! pMgr ) - return; - - rResId.SetRT( RSC_MENU ); - GetRes( rResId ); - - sal_uLong nObjMask = ReadLongRes(); - - if( nObjMask & RSC_MENU_ITEMS ) - { - sal_uLong nObjFollows = ReadLongRes(); - // insert menu items - for( sal_uLong i = 0; i < nObjFollows; i++ ) - { - InsertItem( ResId( (RSHEADER_TYPE*)GetClassRes(), *pMgr ) ); - IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) ); - } - } - - if( nObjMask & RSC_MENU_TEXT ) - { - if (IsMenuBar()) // no title in menubar - ReadStringRes(); - else - aTitleText = ReadStringRes(); - } - if( nObjMask & RSC_MENU_DEFAULTITEMID ) - SetDefaultItem( sal::static_int_cast<sal_uInt16>(ReadLongRes()) ); -} - void Menu::CreateAutoMnemonics() { MnemonicGenerator aMnemonicGenerator; @@ -2691,7 +2658,33 @@ PopupMenu::PopupMenu( const ResId& rResId ) : pRefAutoSubMenu(NULL) { mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu(false, this); - ImplLoadRes( rResId ); + + ResMgr* pMgr = rResId.GetResMgr(); + if( ! pMgr ) + return; + + rResId.SetRT( RSC_MENU ); + GetRes( rResId ); + + sal_uLong nObjMask = ReadLongRes(); + + if( nObjMask & RSC_MENU_ITEMS ) + { + sal_uLong nObjFollows = ReadLongRes(); + // insert menu items + for( sal_uLong i = 0; i < nObjFollows; i++ ) + { + InsertItem( ResId( (RSHEADER_TYPE*)GetClassRes(), *pMgr ) ); + IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) ); + } + } + + if( nObjMask & RSC_MENU_TEXT ) + { + aTitleText = ReadStringRes(); + } + if( nObjMask & RSC_MENU_DEFAULTITEMID ) + SetDefaultItem( sal::static_int_cast<sal_uInt16>(ReadLongRes()) ); } PopupMenu::PopupMenu( const PopupMenu& rMenu ) |