summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2016-05-14 19:52:29 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-05-16 06:42:47 +0000
commit743cdf36d128bc1d0ea3315675b0bb5f85388099 (patch)
treee606586a0d8e0a38edf51912f2142c1a52bc18b4
parent1938fd869b8226af00925caa7ac991618d35ee0c (diff)
convert RSC_MENU to scoped enum
Change-Id: Ice3784b4168738550d2c0f5ee6da1bd49d15becf Reviewed-on: https://gerrit.libreoffice.org/24997 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r--include/tools/rc.h12
-rw-r--r--rsc/source/parser/rscicpx.cxx6
-rw-r--r--vcl/source/window/menu.cxx8
3 files changed, 16 insertions, 10 deletions
diff --git a/include/tools/rc.h b/include/tools/rc.h
index 211eb253faac..6b5c90065116 100644
--- a/include/tools/rc.h
+++ b/include/tools/rc.h
@@ -53,6 +53,7 @@ namespace o3tl {
#define WINDOW_HELPID 0x4000
// For "WorkWindow" resources:
+
#define WORKWIN_SHOWNORMAL 0
#define WORKWIN_SHOWMINIMIZED 1
#define WORKWIN_SHOWMAXIMIZED 2
@@ -61,9 +62,14 @@ namespace o3tl {
#define RSC_FIXEDIMAGE_IMAGE 0x0001
// For all menu resources:
-#define RSC_MENU_ITEMS 0x01
-#define RSC_MENU_TEXT 0x02
-#define RSC_MENU_DEFAULTITEMID 0x04
+enum class RscMenu {
+ Items = 0x01,
+ Text = 0x02,
+ DefaultItemId = 0x04
+};
+namespace o3tl {
+ template<> struct typed_flags<RscMenu> : is_typed_flags<RscMenu, 0x07> {};
+}
// "MenuItem" resource options:
#define RSC_MENUITEM_SEPARATOR 0x001
diff --git a/rsc/source/parser/rscicpx.cxx b/rsc/source/parser/rscicpx.cxx
index 4b4862410db8..1bbd9fdab778 100644
--- a/rsc/source/parser/rscicpx.cxx
+++ b/rsc/source/parser/rscicpx.cxx
@@ -899,13 +899,13 @@ RscTop * RscTypCont::InitClassMenu( RscTop * pSuper,
aBaseLst.push_back( pCont = new RscCont( pHS->getID( "ContMenuItem" ), RSC_NOTYPE ) );
pCont->SetTypeClass( pClassMenuItem );
nId = aNmTb.Put( "ItemList", VARNAME );
- pClassMenu->SetVariable( nId, pCont, nullptr, 0, RSC_MENU_ITEMS );
+ pClassMenu->SetVariable( nId, pCont, nullptr, 0, (sal_uInt32)RscMenu::Items );
}
nId = aNmTb.Put( "Text", VARNAME );
- pClassMenu->SetVariable( nId, &aLangString, nullptr, 0, RSC_MENU_TEXT );
+ pClassMenu->SetVariable( nId, &aLangString, nullptr, 0, (sal_uInt32)RscMenu::Text );
nId = aNmTb.Put( "DefaultItemId", VARNAME );
pClassMenu->SetVariable( nId, &aIdUShort, nullptr, 0,
- RSC_MENU_DEFAULTITEMID );
+ (sal_uInt32)RscMenu::DefaultItemId );
return pClassMenu;
}
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 096faeeb54f9..075c53b8fb16 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2805,9 +2805,9 @@ PopupMenu::PopupMenu( const ResId& rResId )
rResId.SetRT( RSC_MENU );
GetRes( rResId );
- sal_uLong nObjMask = ReadLongRes();
+ RscMenu nObjMask = (RscMenu)ReadLongRes();
- if( nObjMask & RSC_MENU_ITEMS )
+ if( nObjMask & RscMenu::Items )
{
sal_uLong nObjFollows = ReadLongRes();
// insert menu items
@@ -2818,11 +2818,11 @@ PopupMenu::PopupMenu( const ResId& rResId )
}
}
- if( nObjMask & RSC_MENU_TEXT )
+ if( nObjMask & RscMenu::Text )
{
aTitleText = ReadStringRes();
}
- if( nObjMask & RSC_MENU_DEFAULTITEMID )
+ if( nObjMask & RscMenu::DefaultItemId )
SetDefaultItem( sal::static_int_cast<sal_uInt16>(ReadLongRes()) );
}