Kaydet (Commit) 284ca1a5 authored tarafından Noel Grandin's avatar Noel Grandin

Convert RSC_TOOLBOX to scoped enum

and drop unused (in .src files) constants

Change-Id: I1ef085d128893dc3234592e248451f248efb08ba
Reviewed-on: https://gerrit.libreoffice.org/25581Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst aa0b05f1
......@@ -128,14 +128,15 @@ namespace o3tl {
#define RSC_TOOLBOXITEM_COMMAND 0x0800
// For "ToolBox" resources:
#define RSC_TOOLBOX_BUTTONTYPE 0x01
#define RSC_TOOLBOX_ALIGN 0x02
#define RSC_TOOLBOX_LINECOUNT 0x04
#define RSC_TOOLBOX_FLOATLINES 0x08
#define RSC_TOOLBOX_CUSTOMIZE 0x10
#define RSC_TOOLBOX_MENUSTRINGS 0x20
#define RSC_TOOLBOX_ITEMIMAGELIST 0x40
#define RSC_TOOLBOX_ITEMLIST 0x80
enum class RscToolboxFlags {
ButtonType = 0x01,
Align = 0x02,
LineCount = 0x04,
ItemList = 0x80
};
namespace o3tl {
template<> struct typed_flags<RscToolboxFlags> : is_typed_flags<RscToolboxFlags, 0x87> {};
}
// For "DockingWindow" resources:
#define RSC_DOCKINGWINDOW_XYMAPMODE 0x01
......
......@@ -58,7 +58,6 @@ ToolBox RID_TB_SORTING
Pos = MAP_APPFONT ( 0,0 ) ;
ButtonType = BUTTON_SYMBOL;
Align = BOXALIGN_TOP;
Customize = FALSE;
ItemList =
{
ToolBoxItem
......
......@@ -210,8 +210,7 @@ class RscTypCont
RscTop * InitClassToolBoxItem( RscTop * pSuper, RscTop * pClassBitmap,
RscTop * pClassImage,
RscEnum * pTriState );
RscTop * InitClassToolBox( RscTop * pSuper, RscTop * pClassToolBoxItem,
RscTop * pClassImageList );
RscTop * InitClassToolBox( RscTop * pSuper, RscTop * pClassToolBoxItem );
RscTop * InitClassSfxStyleFamilyItem( RscTop * pSuper,
RscTop * pClassBitmap,
RscTop * pClassImage,
......
......@@ -1065,8 +1065,7 @@ RscTop * RscTypCont::InitClassToolBoxItem( RscTop * pSuper,
}
RscTop * RscTypCont::InitClassToolBox( RscTop * pSuper,
RscTop * pClassToolBoxItem,
RscTop * pClassImageList )
RscTop * pClassToolBoxItem )
{
Atom nId;
RscTop * pClassToolBox;
......@@ -1089,7 +1088,7 @@ RscTop * RscTypCont::InitClassToolBox( RscTop * pSuper,
// add variable
nId = aNmTb.Put( "ButtonType", VARNAME );
pClassToolBox->SetVariable( nId, pEnum, nullptr, 0,
RSC_TOOLBOX_BUTTONTYPE );
(sal_uInt32)RscToolboxFlags::ButtonType );
}
{
RscEnum * pEnum;
......@@ -1103,23 +1102,11 @@ RscTop * RscTypCont::InitClassToolBox( RscTop * pSuper,
// add variable
nId = aNmTb.Put( "Align", VARNAME );
pClassToolBox->SetVariable( nId, pEnum, nullptr, 0,
RSC_TOOLBOX_ALIGN );
(sal_uInt32)RscToolboxFlags::Align );
}
nId = aNmTb.Put( "LineCount", VARNAME );
pClassToolBox->SetVariable( nId, &aIdNoZeroUShort, nullptr, 0,
RSC_TOOLBOX_LINECOUNT );
nId = aNmTb.Put( "FloatingLines", VARNAME );
pClassToolBox->SetVariable( nId, &aUShort, nullptr, 0,
RSC_TOOLBOX_FLOATLINES );
nId = aNmTb.Put( "Customize", VARNAME );
pClassToolBox->SetVariable( nId, &aBool, nullptr, 0,
RSC_TOOLBOX_CUSTOMIZE );
nId = aNmTb.Put( "MenuStrings", VARNAME );
pClassToolBox->SetVariable( nId, &aBool, nullptr, 0,
RSC_TOOLBOX_MENUSTRINGS );
nId = aNmTb.Put( "ItemImageList", VARNAME );
pClassToolBox->SetVariable( nId, pClassImageList, nullptr, 0,
RSC_TOOLBOX_ITEMIMAGELIST );
(sal_uInt32)RscToolboxFlags::LineCount );
{
RscLangArray* pLA;
RscCont * pCont;
......@@ -1135,7 +1122,7 @@ RscTop * RscTypCont::InitClassToolBox( RscTop * pSuper,
);
nId = aNmTb.Put( "ItemList", VARNAME );
pClassToolBox->SetVariable( nId, pLA, nullptr, 0,
RSC_TOOLBOX_ITEMLIST );
(sal_uInt32)RscToolboxFlags::ItemList );
}
INS_WINBIT(pClassToolBox,Scroll)
INS_WINBIT(pClassToolBox,LineSpacing)
......
......@@ -417,8 +417,7 @@ void RscTypCont::Init()
pClassImage, pTriState );
pRoot->Insert( pClassToolBoxItem );
RscTop* pClassToolBox = InitClassToolBox( pClassDockingWindow, pClassToolBoxItem,
pClassImageList );
RscTop* pClassToolBox = InitClassToolBox( pClassDockingWindow, pClassToolBoxItem );
pRoot->Insert( pClassToolBox );
// initialize class
......
......@@ -1542,41 +1542,18 @@ void ToolBox::ImplLoadRes( const ResId& rResId )
DockingWindow::ImplLoadRes( rResId );
sal_uLong nObjMask;
RscToolboxFlags nObjMask = (RscToolboxFlags)ReadLongRes();
nObjMask = ReadLongRes();
if ( nObjMask & RSC_TOOLBOX_BUTTONTYPE )
if ( nObjMask & RscToolboxFlags::ButtonType )
SetButtonType( (ButtonType)ReadLongRes() );
if ( nObjMask & RSC_TOOLBOX_ALIGN )
if ( nObjMask & RscToolboxFlags::Align )
SetAlign( (WindowAlign)ReadLongRes() );
if ( nObjMask & RSC_TOOLBOX_LINECOUNT )
if ( nObjMask & RscToolboxFlags::LineCount )
SetLineCount( sal::static_int_cast<sal_uInt16>(ReadLongRes()) );
if ( nObjMask & RSC_TOOLBOX_CUSTOMIZE )
{
bool bCust = ReadShortRes();
EnableCustomize( bCust );
}
if ( nObjMask & RSC_TOOLBOX_MENUSTRINGS )
{
bool bCust = ReadShortRes();
EnableMenuStrings( bCust );
}
if ( nObjMask & RSC_TOOLBOX_FLOATLINES )
SetFloatingLines( ReadShortRes() );
if ( nObjMask & RSC_TOOLBOX_ITEMIMAGELIST )
{
maImageList = ImageList( ResId( static_cast<RSHEADER_TYPE*>(GetClassRes()), *pMgr ) );
IncrementRes( GetObjSizeRes( static_cast<RSHEADER_TYPE*>(GetClassRes()) ) );
}
if ( nObjMask & RSC_TOOLBOX_ITEMLIST )
if ( nObjMask & RscToolboxFlags::ItemList )
{
sal_uLong nEle = ReadLongRes();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment