summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2014-09-15 15:27:58 +0200
committerJan Holesovsky <kendy@collabora.com>2014-09-15 20:16:26 +0200
commit44c394344668134c4d842aa93a454218ccdfec7c (patch)
tree1a005c1439eb790c2b180bed5ee62c645cb97a40
parent58d0b8f1b2ab67b2e60ad85c1487ba8c17a63fbb (diff)
vcl menu: Move ImplLoadRes()'s body to PopupMenu constructor.
No MenuBar is read via ResId any more. Change-Id: I7aa9ada7fb8ce1b272c6c92b5429812708027162
-rw-r--r--include/vcl/menu.hxx1
-rw-r--r--vcl/source/window/menu.cxx61
2 files changed, 27 insertions, 35 deletions
diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index fcd9b7476511..9fdabcb080e0 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -153,7 +153,6 @@ private:
SalMenu* mpSalMenu;
protected:
- SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId );
SAL_DLLPRIVATE Menu* ImplGetStartMenu();
SAL_DLLPRIVATE Menu* ImplFindSelectMenu();
SAL_DLLPRIVATE Menu* ImplFindMenu( sal_uInt16 nId );
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 )