[Libreoffice-commits] core.git: include/rsc rsc/inc rsc/source sfx2/source
Noel Grandin
noelgrandin at gmail.com
Mon May 9 07:55:36 UTC 2016
include/rsc/rscsfx.hxx | 15 +++++++++------
rsc/inc/rscclass.hxx | 4 ++++
rsc/inc/rsctop.hxx | 6 ++++++
rsc/source/parser/rscicpx.cxx | 12 ++++++------
rsc/source/parser/rscyacc.y | 10 +++++-----
rsc/source/res/rscclass.cxx | 10 ++++++++++
rsc/source/res/rsctop.cxx | 11 +++++++++++
sfx2/source/dialog/styfitem.cxx | 12 ++++++------
8 files changed, 57 insertions(+), 23 deletions(-)
New commits:
commit 1edcad0daca7f00559fe7cf100438e105623b3eb
Author: Noel Grandin <noelgrandin at gmail.com>
Date: Sun May 8 08:08:17 2016 +0200
convert SFX_STYLE_ITEM to scoped enum
Change-Id: I929603a12c29931074a467d1472ef686c1d4e8ee
Reviewed-on: https://gerrit.libreoffice.org/24751
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/include/rsc/rscsfx.hxx b/include/rsc/rscsfx.hxx
index cc6a23f..a3a6304 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 be4854a..9764230 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 1f5f44c..1c3c739 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 95bb420..0582b76 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 8a67316..43272f2 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 c88cf08..5447270 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 02ee941..210e7c3 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 4abdb0a..c851670 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()) ) );
More information about the Libreoffice-commits
mailing list