summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2016-05-21 15:41:43 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-05-22 17:54:00 +0000
commit44e20713ebcd3b3ed9a490f54b0b17bd6cd57372 (patch)
treeb5661c56a32c37ee3369c926d35be1662b0afceb
parentef0e063938d1821f362a975ae83c2ab212267b98 (diff)
Convert RSC_IMAGEBUTTON to scoped enum
Change-Id: Iedb0cfa8678627dbd0445e05524bd26a2c5838a2 Reviewed-on: https://gerrit.libreoffice.org/25258 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r--include/tools/rc.h11
-rw-r--r--rsc/source/parser/rscicpx.cxx6
-rw-r--r--vcl/source/control/button.cxx8
3 files changed, 15 insertions, 10 deletions
diff --git a/include/tools/rc.h b/include/tools/rc.h
index 87c7713935c1..714ea98b5236 100644
--- a/include/tools/rc.h
+++ b/include/tools/rc.h
@@ -143,9 +143,14 @@ namespace o3tl {
#define RSC_DOCKINGWINDOW_FLOATING 0x08
// For "ImageButtons":
-#define RSC_IMAGEBUTTON_IMAGE 0x01
-#define RSC_IMAGEBUTTON_SYMBOL 0x02
-#define RSC_IMAGEBUTTON_STATE 0x04
+enum class RscImageButtonFlags {
+ Image = 0x01,
+ Symbol = 0x02,
+ State = 0x04
+};
+namespace o3tl {
+ template<> struct typed_flags<RscImageButtonFlags> : is_typed_flags<RscImageButtonFlags, 0x07> {};
+}
// For "Image":
#define RSC_IMAGE_IMAGEBITMAP 0x01
diff --git a/rsc/source/parser/rscicpx.cxx b/rsc/source/parser/rscicpx.cxx
index 86a9a299bf15..815677929cbe 100644
--- a/rsc/source/parser/rscicpx.cxx
+++ b/rsc/source/parser/rscicpx.cxx
@@ -378,7 +378,7 @@ RscTop * RscTypCont::InitClassImageButton( RscTop * pSuper,
{
nId = aNmTb.Put( "ButtonImage", VARNAME );
pClassImageButton->SetVariable( nId, pClassImage, nullptr, 0,
- RSC_IMAGEBUTTON_IMAGE );
+ (sal_uInt32)RscImageButtonFlags::Image );
}
// initialize variables
{
@@ -415,11 +415,11 @@ RscTop * RscTypCont::InitClassImageButton( RscTop * pSuper,
// add variable
nVarId = aNmTb.Put( "Symbol", VARNAME );
pClassImageButton->SetVariable( nVarId, pSymbol, nullptr, 0,
- RSC_IMAGEBUTTON_SYMBOL );
+ (sal_uInt32)RscImageButtonFlags::Symbol );
}
nId = aNmTb.Put( "State", VARNAME );
pClassImageButton->SetVariable( nId, pTriState, nullptr, 0,
- RSC_IMAGEBUTTON_STATE );
+ (sal_uInt32)RscImageButtonFlags::State );
INS_WINBIT(pClassImageButton,Repeat)
INS_WINBIT(pClassImageButton,SmallStyle)
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 46d9f19b6ee3..75e92e58dc27 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -3800,18 +3800,18 @@ ImageButton::ImageButton( vcl::Window* pParent, WinBits nStyle ) :
ImageButton::ImageButton( vcl::Window* pParent, const ResId& rResId ) :
PushButton( pParent, rResId.SetRT( RSC_IMAGEBUTTON ) )
{
- sal_uLong nObjMask = ReadLongRes();
+ RscImageButtonFlags nObjMask = (RscImageButtonFlags)ReadLongRes();
- if ( RSC_IMAGEBUTTON_IMAGE & nObjMask )
+ if ( RscImageButtonFlags::Image & nObjMask )
{
SetModeImage( Image( ResId( static_cast<RSHEADER_TYPE*>(GetClassRes()), *rResId.GetResMgr() ) ) );
IncrementRes( GetObjSizeRes( static_cast<RSHEADER_TYPE*>(GetClassRes()) ) );
}
- if ( RSC_IMAGEBUTTON_SYMBOL & nObjMask )
+ if ( RscImageButtonFlags::Symbol & nObjMask )
SetSymbol( (SymbolType)ReadLongRes() );
- if ( RSC_IMAGEBUTTON_STATE & nObjMask )
+ if ( RscImageButtonFlags::State & nObjMask )
SetState( (TriState)ReadLongRes() );
ImplInitStyle();