diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2016-05-08 08:08:17 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-05-09 07:55:10 +0000 |
commit | 1edcad0daca7f00559fe7cf100438e105623b3eb (patch) | |
tree | ef0be4f736cf9b0977ff14e4e58e9a405f4a59e1 | |
parent | 116cf0b298ed62f26a60db51164f6510007d2579 (diff) |
convert SFX_STYLE_ITEM to scoped enum
Change-Id: I929603a12c29931074a467d1472ef686c1d4e8ee
Reviewed-on: https://gerrit.libreoffice.org/24751
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r-- | include/rsc/rscsfx.hxx | 15 | ||||
-rw-r--r-- | rsc/inc/rscclass.hxx | 4 | ||||
-rw-r--r-- | rsc/inc/rsctop.hxx | 6 | ||||
-rw-r--r-- | rsc/source/parser/rscicpx.cxx | 12 | ||||
-rw-r--r-- | rsc/source/parser/rscyacc.y | 10 | ||||
-rw-r--r-- | rsc/source/res/rscclass.cxx | 10 | ||||
-rw-r--r-- | rsc/source/res/rsctop.cxx | 11 | ||||
-rw-r--r-- | sfx2/source/dialog/styfitem.cxx | 12 |
8 files changed, 57 insertions, 23 deletions
diff --git a/include/rsc/rscsfx.hxx b/include/rsc/rscsfx.hxx index cc6a23fea579..a3a6304cc123 100644 --- a/include/rsc/rscsfx.hxx +++ b/include/rsc/rscsfx.hxx @@ -38,12 +38,15 @@ enum SfxStyleFamily { SFX_STYLE_FAMILY_CHAR = 1, // SfxTemplate -#define RSC_SFX_STYLE_ITEM_LIST 0x1 -#define RSC_SFX_STYLE_ITEM_BITMAP 0x2 -#define RSC_SFX_STYLE_ITEM_TEXT 0x4 -#define RSC_SFX_STYLE_ITEM_HELPTEXT 0x8 -#define RSC_SFX_STYLE_ITEM_STYLEFAMILY 0x10 -#define RSC_SFX_STYLE_ITEM_IMAGE 0x20 +enum class SfxStyleItem { + None = 0x00, + List = 0x01, + Bitmap = 0x02, + Text = 0x04, + HelpText = 0x08, + StyleFamily = 0x10, + Image = 0x20 +}; // SfxSlotInfo diff --git a/rsc/inc/rscclass.hxx b/rsc/inc/rscclass.hxx index be4854ae1ba6..976423056f2c 100644 --- a/rsc/inc/rscclass.hxx +++ b/rsc/inc/rscclass.hxx @@ -64,6 +64,10 @@ public: void Pre_dtor() override; ERRTYPE SetVariable( Atom nVarName, RscTop * pClass, RSCINST * pDflt, + RSCVAR nVarType, SfxStyleItem nMask, + Atom nDataBaseName ) override; + ERRTYPE SetVariable( Atom nVarName, RscTop * pClass, + RSCINST * pDflt, RSCVAR nVarType, sal_uInt32 nMask, Atom nDataBaseName ) override; virtual void EnumVariables( void * pData, VarEnumCallbackProc ) override; diff --git a/rsc/inc/rsctop.hxx b/rsc/inc/rsctop.hxx index 1f5f44c18e9d..1c3c739411a2 100644 --- a/rsc/inc/rsctop.hxx +++ b/rsc/inc/rsctop.hxx @@ -23,6 +23,7 @@ #include <rsctools.hxx> #include <rschash.hxx> #include <rscclobj.hxx> +#include <rsc/rscsfx.hxx> typedef sal_uInt32 RSCVAR; #define VAR_POINTER 0x0001 @@ -81,6 +82,11 @@ public: // sets the variable virtual ERRTYPE SetVariable( Atom nVarName, RscTop * pClass, + RSCINST * pDflt, + RSCVAR nVarType, SfxStyleItem nMask, + Atom nDataBaseName = InvalidAtom ); + + virtual ERRTYPE SetVariable( Atom nVarName, RscTop * pClass, RSCINST * pDflt = nullptr, RSCVAR nVarType = 0, sal_uInt32 nMask = 0, Atom nDataBaseName = InvalidAtom ); diff --git a/rsc/source/parser/rscicpx.cxx b/rsc/source/parser/rscicpx.cxx index 95bb420bcf8a..0582b764be35 100644 --- a/rsc/source/parser/rscicpx.cxx +++ b/rsc/source/parser/rscicpx.cxx @@ -1297,16 +1297,16 @@ RscTop * RscTypCont::InitClassSfxStyleFamilyItem( RscTop * pSuper, nId = aNmTb.Put( "FilterList", VARNAME ); pClassSfxFamilyStyleItem->SetVariable( nId, pStrLst, nullptr, 0, - RSC_SFX_STYLE_ITEM_LIST ); + SfxStyleItem::List ); nId = aNmTb.Put( "StyleBitmap", VARNAME ); pClassSfxFamilyStyleItem->SetVariable( nId, pClassBitmap, nullptr, 0, - RSC_SFX_STYLE_ITEM_BITMAP ); + SfxStyleItem::Bitmap ); nId = aNmTb.Put( "Text", VARNAME ); pClassSfxFamilyStyleItem->SetVariable( nId, &aLangString, nullptr, 0, - RSC_SFX_STYLE_ITEM_TEXT ); + SfxStyleItem::Text ); nId = aNmTb.Put( "HelpText", VARNAME ); pClassSfxFamilyStyleItem->SetVariable( nId, &aLangString, nullptr, 0, - RSC_SFX_STYLE_ITEM_HELPTEXT ); + SfxStyleItem::HelpText ); { RscEnum * pSfxStyleFamily; pSfxStyleFamily = new RscEnum( pHS->getID( "StyleFamily" ), @@ -1321,11 +1321,11 @@ RscTop * RscTypCont::InitClassSfxStyleFamilyItem( RscTop * pSuper, nId = aNmTb.Put( "StyleFamily", VARNAME ); pClassSfxFamilyStyleItem->SetVariable( nId, pSfxStyleFamily, nullptr, 0, - RSC_SFX_STYLE_ITEM_STYLEFAMILY ); + SfxStyleItem::StyleFamily ); } nId = aNmTb.Put( "StyleImage", VARNAME ); pClassSfxFamilyStyleItem->SetVariable( nId, pClassImage, nullptr, 0, - RSC_SFX_STYLE_ITEM_IMAGE ); + SfxStyleItem::Image ); return pClassSfxFamilyStyleItem; } diff --git a/rsc/source/parser/rscyacc.y b/rsc/source/parser/rscyacc.y index 8a67316fb31f..43272f2fc8c8 100644 --- a/rsc/source/parser/rscyacc.y +++ b/rsc/source/parser/rscyacc.y @@ -40,7 +40,7 @@ ObjectStack S; RscTop * pCurClass; -sal_uInt32 nCurMask; +SfxStyleItem nCurMask; char szErrBuf[ 100 ]; RSCINST GetVarInst( const RSCINST & rInst, const char * pVarName ) @@ -450,14 +450,14 @@ new_class_definition_header // Klasse anlegen Atom nId = pHS->getID( $2 ); pCurClass = new RscClass( nId, lType, $5 ); - nCurMask = 1; + nCurMask = SfxStyleItem::List; pTC->aNmTb.Put( nId, CLASSNAME, pCurClass ); pTC->GetRoot()->Insert( pCurClass ); } | CLASS CLASSNAME id_expression ':' CLASSNAME { pCurClass = $2; - nCurMask = 1; + nCurMask = SfxStyleItem::List; } ; @@ -472,12 +472,12 @@ property_definition // Variable anlegen Atom nId = pTC->aNmTb.Put( $3, VARNAME ); pCurClass->SetVariable( nId, $2, nullptr, $1, nCurMask ); - nCurMask <<= 1; + nCurMask = SfxStyleItem(((int)nCurMask) << 1); } | type_flags type VARNAME { pCurClass->SetVariable( $3, $2, nullptr, $1, nCurMask ); - nCurMask <<= 1; + nCurMask = SfxStyleItem(((int)nCurMask) << 1); } ; diff --git a/rsc/source/res/rscclass.cxx b/rsc/source/res/rscclass.cxx index c88cf082b664..5447270e649e 100644 --- a/rsc/source/res/rscclass.cxx +++ b/rsc/source/res/rscclass.cxx @@ -278,6 +278,16 @@ ERRTYPE RscClass::SetVariable( Atom nVarName, return ERR_OK; } +ERRTYPE RscClass::SetVariable( Atom nVarName, + RscTop * pClass, + RSCINST * pDflt, + RSCVAR nVarType, + SfxStyleItem nMask, + Atom nDataBaseName) +{ + return SetVariable(nVarName, pClass, pDflt, nVarType, (sal_uInt32)nMask, nDataBaseName); +} + void RscClass::EnumVariables( void * pData, VarEnumCallbackProc pProc ) { sal_uInt32 i; diff --git a/rsc/source/res/rsctop.cxx b/rsc/source/res/rsctop.cxx index 02ee9413632e..210e7c3f258a 100644 --- a/rsc/source/res/rsctop.cxx +++ b/rsc/source/res/rsctop.cxx @@ -102,6 +102,17 @@ ERRTYPE RscTop::SetVariable( Atom nVarName, RscTop * pClass, return ERR_UNKNOWN_METHOD; } +ERRTYPE RscTop::SetVariable( Atom nVarName, RscTop * pClass, + RSCINST * pDflt, RSCVAR nVarType, SfxStyleItem nMask, + Atom nDataBaseName ) +{ + if( pSuperClass ) + return pSuperClass->SetVariable( nVarName, pClass, pDflt, + nVarType, nMask, nDataBaseName ); + else + return ERR_UNKNOWN_METHOD; +} + void RscTop::EnumVariables( void * pData, VarEnumCallbackProc pProc ) { if( pSuperClass ) diff --git a/sfx2/source/dialog/styfitem.cxx b/sfx2/source/dialog/styfitem.cxx index 4abdb0a35629..c851670650a1 100644 --- a/sfx2/source/dialog/styfitem.cxx +++ b/sfx2/source/dialog/styfitem.cxx @@ -31,7 +31,7 @@ SfxStyleFamilyItem::SfxStyleFamilyItem( const ResId &rResId ) : { const sal_Int32 nMask = ReadLongRes(); - if(nMask & RSC_SFX_STYLE_ITEM_LIST) + if(nMask & (sal_uInt32)SfxStyleItem::List) { const sal_Int32 nCount = ReadLongRes(); for( sal_Int32 i = 0; i < nCount; ++i ) @@ -42,26 +42,26 @@ SfxStyleFamilyItem::SfxStyleFamilyItem( const ResId &rResId ) : aFilterList.push_back( pTupel ); } } - if(nMask & RSC_SFX_STYLE_ITEM_BITMAP) + if(nMask & (sal_uInt32)SfxStyleItem::Bitmap) { aBitmap = Bitmap(ResId(static_cast<RSHEADER_TYPE *>(GetClassRes()),*rResId.GetResMgr())); IncrementRes( GetObjSizeRes( static_cast<RSHEADER_TYPE *>(GetClassRes()) ) ); } - if(nMask & RSC_SFX_STYLE_ITEM_TEXT) + if(nMask & (sal_uInt32)SfxStyleItem::Text) { aText = ReadStringRes(); } - if(nMask & RSC_SFX_STYLE_ITEM_HELPTEXT) + if(nMask & (sal_uInt32)SfxStyleItem::HelpText) { aHelpText = ReadStringRes(); } - if(nMask & RSC_SFX_STYLE_ITEM_STYLEFAMILY) + if(nMask & (sal_uInt32)SfxStyleItem::StyleFamily) { nFamily = static_cast<sal_uInt16>(ReadLongRes()); } else nFamily = SFX_STYLE_FAMILY_PARA; - if(nMask & RSC_SFX_STYLE_ITEM_IMAGE) + if(nMask & (sal_uInt32)SfxStyleItem::Image) { aImage = Image(ResId(static_cast<RSHEADER_TYPE *>(GetClassRes()),*rResId.GetResMgr())); IncrementRes( GetObjSizeRes( static_cast<RSHEADER_TYPE *>(GetClassRes()) ) ); |