Convert RSC_TOOLBOXITEM to scoped enum
Change-Id: Ic90b6950016417d5f57963ab69fd20905a943bb7 Reviewed-on: https://gerrit.libreoffice.org/25683 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
+14
-12
@@ -118,18 +118,20 @@ namespace o3tl {
|
||||
}
|
||||
|
||||
// For "ToolBoxItem" resources:
|
||||
#define RSC_TOOLBOXITEM_ID 0x0001
|
||||
#define RSC_TOOLBOXITEM_TYPE 0x0002
|
||||
#define RSC_TOOLBOXITEM_STATUS 0x0004
|
||||
#define RSC_TOOLBOXITEM_HELPID 0x0008
|
||||
#define RSC_TOOLBOXITEM_TEXT 0x0010
|
||||
#define RSC_TOOLBOXITEM_HELPTEXT 0x0020
|
||||
#define RSC_TOOLBOXITEM_BITMAP 0x0040
|
||||
#define RSC_TOOLBOXITEM_IMAGE 0x0080
|
||||
#define RSC_TOOLBOXITEM_DISABLE 0x0100
|
||||
#define RSC_TOOLBOXITEM_STATE 0x0200
|
||||
#define RSC_TOOLBOXITEM_HIDE 0x0400
|
||||
#define RSC_TOOLBOXITEM_COMMAND 0x0800
|
||||
enum class RscToolboxItemFlags {
|
||||
Id = 0x0001,
|
||||
Type = 0x0002,
|
||||
Status = 0x0004,
|
||||
HelpId = 0x0008,
|
||||
Text = 0x0010,
|
||||
Bitmap = 0x0040,
|
||||
Disable = 0x0100,
|
||||
Hide = 0x0400,
|
||||
Command = 0x0800
|
||||
};
|
||||
namespace o3tl {
|
||||
template<> struct typed_flags<RscToolboxItemFlags> : is_typed_flags<RscToolboxItemFlags, 0xd5f> {};
|
||||
}
|
||||
|
||||
// For "ToolBox" resources:
|
||||
enum class RscToolboxFlags {
|
||||
|
||||
+1
-3
@@ -206,9 +206,7 @@ class RscTypCont
|
||||
|
||||
RscTop * InitClassDockingWindow( RscTop * pSuper,
|
||||
RscEnum * pMapUnit );
|
||||
RscTop * InitClassToolBoxItem( RscTop * pSuper, RscTop * pClassBitmap,
|
||||
RscTop * pClassImage,
|
||||
RscEnum * pTriState );
|
||||
RscTop * InitClassToolBoxItem( RscTop * pSuper, RscTop * pClassBitmap );
|
||||
RscTop * InitClassToolBox( RscTop * pSuper, RscTop * pClassToolBoxItem );
|
||||
RscTop * InitClassSfxStyleFamilyItem( RscTop * pSuper,
|
||||
RscTop * pClassBitmap,
|
||||
|
||||
@@ -933,9 +933,7 @@ RscTop * RscTypCont::InitClassDockingWindow( RscTop * pSuper,
|
||||
}
|
||||
|
||||
RscTop * RscTypCont::InitClassToolBoxItem( RscTop * pSuper,
|
||||
RscTop * pClassBitmap,
|
||||
RscTop * pClassImage,
|
||||
RscEnum * pTriState )
|
||||
RscTop * pClassBitmap )
|
||||
{
|
||||
Atom nId;
|
||||
RscTop * pClassToolBoxItem;
|
||||
@@ -948,7 +946,7 @@ RscTop * RscTypCont::InitClassToolBoxItem( RscTop * pSuper,
|
||||
// initialize variables
|
||||
nId = aNmTb.Put( "Identifier", VARNAME );
|
||||
pClassToolBoxItem->SetVariable( nId, &aIdNoZeroUShort, nullptr, 0,
|
||||
RSC_TOOLBOXITEM_ID );
|
||||
(sal_uInt32)RscToolboxItemFlags::Id );
|
||||
{
|
||||
RscEnum * pEnum;
|
||||
|
||||
@@ -961,7 +959,7 @@ RscTop * RscTypCont::InitClassToolBoxItem( RscTop * pSuper,
|
||||
// add variable
|
||||
nId = aNmTb.Put( "Type", VARNAME );
|
||||
pClassToolBoxItem->SetVariable( nId, pEnum, nullptr, 0,
|
||||
RSC_TOOLBOXITEM_TYPE );
|
||||
(sal_uInt32)RscToolboxItemFlags::Type );
|
||||
}
|
||||
{
|
||||
RscFlag * pFlag;
|
||||
@@ -988,7 +986,7 @@ RscTop * RscTypCont::InitClassToolBoxItem( RscTop * pSuper,
|
||||
l_nVarId = aNmTb.Put( "_ToolBoxItemFlags", VARNAME );
|
||||
pClassToolBoxItem->SetVariable( l_nVarId, pFlag, nullptr,
|
||||
VAR_HIDDEN | VAR_NOENUM,
|
||||
RSC_TOOLBOXITEM_STATUS );
|
||||
(sal_uInt32)RscToolboxItemFlags::Status );
|
||||
|
||||
// add client variables
|
||||
aBaseLst.push_back(
|
||||
@@ -1029,35 +1027,23 @@ RscTop * RscTypCont::InitClassToolBoxItem( RscTop * pSuper,
|
||||
}
|
||||
nId = aNmTb.Put( "HelpID", VARNAME );
|
||||
pClassToolBoxItem->SetVariable( nId, &aStringLiteral, nullptr, 0,
|
||||
RSC_TOOLBOXITEM_HELPID );
|
||||
(sal_uInt32)RscToolboxItemFlags::HelpId );
|
||||
nId = aNmTb.Put( "Text", VARNAME );
|
||||
pClassToolBoxItem->SetVariable( nId, &aLangString, nullptr, 0,
|
||||
RSC_TOOLBOXITEM_TEXT );
|
||||
nId = aNmTb.Put( "HelpText", VARNAME );
|
||||
pClassToolBoxItem->SetVariable( nId, &aLangString, nullptr, 0,
|
||||
RSC_TOOLBOXITEM_HELPTEXT );
|
||||
(sal_uInt32)RscToolboxItemFlags::Text );
|
||||
nId = aNmTb.Put( "ItemBitmap", VARNAME );
|
||||
pClassToolBoxItem->SetVariable( nId, pClassBitmap, nullptr, 0,
|
||||
RSC_TOOLBOXITEM_BITMAP );
|
||||
nId = aNmTb.Put( "ItemImage", VARNAME );
|
||||
pClassToolBoxItem->SetVariable( nId, pClassImage, nullptr, 0,
|
||||
RSC_TOOLBOXITEM_IMAGE );
|
||||
(sal_uInt32)RscToolboxItemFlags::Bitmap );
|
||||
nId = aNmTb.Put( "Disable", VARNAME );
|
||||
pClassToolBoxItem->SetVariable( nId, &aBool, nullptr, 0,
|
||||
RSC_TOOLBOXITEM_DISABLE );
|
||||
(sal_uInt32)RscToolboxItemFlags::Disable );
|
||||
|
||||
nId = aNmTb.Put( "State", VARNAME );
|
||||
pClassToolBoxItem->SetVariable( nId, pTriState, nullptr, 0,
|
||||
RSC_TOOLBOXITEM_STATE );
|
||||
nId = aNmTb.Put( "Hide", VARNAME );
|
||||
pClassToolBoxItem->SetVariable( nId, &aBool, nullptr, 0,
|
||||
RSC_TOOLBOXITEM_HIDE );
|
||||
nId = aNmTb.Put( "Hide", VARNAME );
|
||||
pClassToolBoxItem->SetVariable( nId, &aBool, nullptr, 0,
|
||||
RSC_TOOLBOXITEM_HIDE );
|
||||
(sal_uInt32)RscToolboxItemFlags::Hide );
|
||||
nId = aNmTb.Put( "Command", VARNAME );
|
||||
pClassToolBoxItem->SetVariable( nId, &aString, nullptr, 0,
|
||||
RSC_TOOLBOXITEM_COMMAND );
|
||||
(sal_uInt32)RscToolboxItemFlags::Command );
|
||||
|
||||
return pClassToolBoxItem;
|
||||
}
|
||||
|
||||
@@ -413,8 +413,7 @@ void RscTypCont::Init()
|
||||
RscTop* pClassDockingWindow = InitClassDockingWindow( pClassWindow, pMapUnit );
|
||||
pRoot->Insert( pClassDockingWindow );
|
||||
|
||||
RscTop* pClassToolBoxItem = InitClassToolBoxItem( pClassMgr, pClassBitmap,
|
||||
pClassImage, pTriState );
|
||||
RscTop* pClassToolBoxItem = InitClassToolBoxItem( pClassMgr, pClassBitmap );
|
||||
pRoot->Insert( pClassToolBoxItem );
|
||||
|
||||
RscTop* pClassToolBox = InitClassToolBox( pClassDockingWindow, pClassToolBoxItem );
|
||||
|
||||
@@ -442,38 +442,36 @@ void ToolBox::Select()
|
||||
|
||||
void ToolBox::InsertItem( const ResId& rResId )
|
||||
{
|
||||
sal_uLong nObjMask;
|
||||
RscToolboxItemFlags nObjMask;
|
||||
bool bImage = false; // has image
|
||||
|
||||
// create item
|
||||
ImplToolItem aItem;
|
||||
|
||||
GetRes( rResId.SetRT( RSC_TOOLBOXITEM ) );
|
||||
nObjMask = ReadLongRes();
|
||||
nObjMask = (RscToolboxItemFlags)ReadLongRes();
|
||||
|
||||
if ( nObjMask & RSC_TOOLBOXITEM_ID )
|
||||
if ( nObjMask & RscToolboxItemFlags::Id )
|
||||
aItem.mnId = sal::static_int_cast<sal_uInt16>(ReadLongRes());
|
||||
else
|
||||
aItem.mnId = 1;
|
||||
|
||||
if ( nObjMask & RSC_TOOLBOXITEM_TYPE )
|
||||
if ( nObjMask & RscToolboxItemFlags::Type )
|
||||
aItem.meType = (ToolBoxItemType)ReadLongRes();
|
||||
|
||||
if ( nObjMask & RSC_TOOLBOXITEM_STATUS )
|
||||
if ( nObjMask & RscToolboxItemFlags::Status )
|
||||
aItem.mnBits = (ToolBoxItemBits)ReadLongRes();
|
||||
|
||||
if( nObjMask & RSC_TOOLBOXITEM_HELPID )
|
||||
if( nObjMask & RscToolboxItemFlags::HelpId )
|
||||
aItem.maHelpId = ReadByteStringRes();
|
||||
|
||||
if ( nObjMask & RSC_TOOLBOXITEM_TEXT )
|
||||
if ( nObjMask & RscToolboxItemFlags::Text )
|
||||
{
|
||||
aItem.maText = ReadStringRes();
|
||||
aItem.maText = MnemonicGenerator::EraseAllMnemonicChars(aItem.maText);
|
||||
}
|
||||
if ( nObjMask & RSC_TOOLBOXITEM_HELPTEXT )
|
||||
aItem.maHelpText = ReadStringRes();
|
||||
|
||||
if ( nObjMask & RSC_TOOLBOXITEM_BITMAP )
|
||||
if ( nObjMask & RscToolboxItemFlags::Bitmap )
|
||||
{
|
||||
Bitmap aBmp = Bitmap( ResId( static_cast<RSHEADER_TYPE*>(GetClassRes()), *rResId.GetResMgr() ) );
|
||||
IncrementRes( GetObjSizeRes( static_cast<RSHEADER_TYPE*>(GetClassRes()) ) );
|
||||
@@ -481,22 +479,13 @@ void ToolBox::InsertItem( const ResId& rResId )
|
||||
aItem.maImageOriginal = aItem.maImage;
|
||||
bImage = true;
|
||||
}
|
||||
if ( nObjMask & RSC_TOOLBOXITEM_IMAGE )
|
||||
{
|
||||
aItem.maImage = Image( ResId( static_cast<RSHEADER_TYPE*>(GetClassRes()), *rResId.GetResMgr() ) );
|
||||
IncrementRes( GetObjSizeRes( static_cast<RSHEADER_TYPE*>(GetClassRes()) ) );
|
||||
bImage = true;
|
||||
}
|
||||
if ( nObjMask & RSC_TOOLBOXITEM_DISABLE )
|
||||
if ( nObjMask & RscToolboxItemFlags::Disable )
|
||||
aItem.mbEnabled = ReadShortRes() == 0;
|
||||
|
||||
if ( nObjMask & RSC_TOOLBOXITEM_STATE )
|
||||
aItem.meState = (TriState)ReadLongRes();
|
||||
|
||||
if ( nObjMask & RSC_TOOLBOXITEM_HIDE )
|
||||
if ( nObjMask & RscToolboxItemFlags::Hide )
|
||||
aItem.mbVisible = ReadShortRes() == 0;
|
||||
|
||||
if ( nObjMask & RSC_TOOLBOXITEM_COMMAND )
|
||||
if ( nObjMask & RscToolboxItemFlags::Command )
|
||||
aItem.maCommandStr = ReadStringRes();
|
||||
|
||||
// if no image is loaded, try to load one from the image list
|
||||
|
||||
Reference in New Issue
Block a user