[Libreoffice-commits] core.git: include/tools reportdesign/source rsc/inc rsc/source vcl/source

Noel Grandin noelgrandin at gmail.com
Mon May 30 08:09:12 UTC 2016


 include/tools/rc.h                        |   17 ++++++++-------
 reportdesign/source/ui/dlg/CondFormat.src |    1 
 rsc/inc/rscdb.hxx                         |    3 --
 rsc/source/parser/rscicpx.cxx             |   23 ++++----------------
 rsc/source/parser/rscinit.cxx             |    3 --
 vcl/source/window/toolbox.cxx             |   33 ++++--------------------------
 6 files changed, 21 insertions(+), 59 deletions(-)

New commits:
commit 284ca1a5840c5fcbf4f9d1eff02ae607cdc2c222
Author: Noel Grandin <noelgrandin at gmail.com>
Date:   Sat May 28 14:38:03 2016 +0200

    Convert RSC_TOOLBOX to scoped enum
    
    and drop unused (in .src files) constants
    
    Change-Id: I1ef085d128893dc3234592e248451f248efb08ba
    Reviewed-on: https://gerrit.libreoffice.org/25581
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/include/tools/rc.h b/include/tools/rc.h
index cd09254..ff8ea13 100644
--- a/include/tools/rc.h
+++ b/include/tools/rc.h
@@ -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
diff --git a/reportdesign/source/ui/dlg/CondFormat.src b/reportdesign/source/ui/dlg/CondFormat.src
index 9d602e0..287c778 100644
--- a/reportdesign/source/ui/dlg/CondFormat.src
+++ b/reportdesign/source/ui/dlg/CondFormat.src
@@ -58,7 +58,6 @@ ToolBox RID_TB_SORTING
     Pos = MAP_APPFONT ( 0,0 ) ;
     ButtonType = BUTTON_SYMBOL;
     Align = BOXALIGN_TOP;
-    Customize = FALSE;
     ItemList =
     {
         ToolBoxItem
diff --git a/rsc/inc/rscdb.hxx b/rsc/inc/rscdb.hxx
index 1fbbb18..f137e4a 100644
--- a/rsc/inc/rscdb.hxx
+++ b/rsc/inc/rscdb.hxx
@@ -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,
diff --git a/rsc/source/parser/rscicpx.cxx b/rsc/source/parser/rscicpx.cxx
index ae3b865..73b58ca 100644
--- a/rsc/source/parser/rscicpx.cxx
+++ b/rsc/source/parser/rscicpx.cxx
@@ -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)
diff --git a/rsc/source/parser/rscinit.cxx b/rsc/source/parser/rscinit.cxx
index eb02f71..c24e757 100644
--- a/rsc/source/parser/rscinit.cxx
+++ b/rsc/source/parser/rscinit.cxx
@@ -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
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 8cb37f2..3cb978a 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -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();
 


More information about the Libreoffice-commits mailing list