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

Noel Grandin noelgrandin at gmail.com
Mon May 16 06:43:18 UTC 2016


 include/tools/rc.h            |   27 +++++++-------
 include/tools/rcid.h          |    2 -
 rsc/inc/rscdb.hxx             |    5 --
 rsc/source/parser/rscicpx.cxx |   81 +++++-------------------------------------
 rsc/source/parser/rscinit.cxx |   16 +-------
 tools/source/rc/resmgr.cxx    |    2 -
 vcl/source/window/menu.cxx    |   35 ++++++------------
 7 files changed, 40 insertions(+), 128 deletions(-)

New commits:
commit b852642ecdcba105d14b1927309cfb176fb7d417
Author: Noel Grandin <noelgrandin at gmail.com>
Date:   Sun May 15 15:33:17 2016 +0200

    remove unused RSC_SYSWINDOW and RSC_WORKWIN
    
    Change-Id: I2c7db8a635c6770ff3221ee28b9349668d8d5881
    Reviewed-on: https://gerrit.libreoffice.org/25004
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/include/tools/rcid.h b/include/tools/rcid.h
index c41a2f3..122c48e 100644
--- a/include/tools/rcid.h
+++ b/include/tools/rcid.h
@@ -45,8 +45,6 @@
 #define RSC_IMAGELIST           (RSC_NOTYPE + 0x24)
 
 #define RSC_WINDOW              (RSC_NOTYPE + 0x35)
-#define RSC_SYSWINDOW           (RSC_NOTYPE + 0x36)
-#define RSC_WORKWIN             (RSC_NOTYPE + 0x37)
 
 #define RSC_CONTROL             (RSC_NOTYPE + 0x44)
 #define RSC_BUTTON              (RSC_NOTYPE + 0x45)
diff --git a/rsc/inc/rscdb.hxx b/rsc/inc/rscdb.hxx
index a84af73..d6a2408 100644
--- a/rsc/inc/rscdb.hxx
+++ b/rsc/inc/rscdb.hxx
@@ -182,8 +182,6 @@ class RscTypCont
                                     RscTop * pClassColor, RscCont * pStrLst );
     RscTop *    InitClassWindow( RscTop * pSuper, RscEnum * pMapUnit,
                                  RscArray * pLangGeo );
-    RscTop *    InitClassSystemWindow( RscTop * pSuper );
-    RscTop *    InitClassWorkWindow( RscTop * pSuper );
     RscTop *    InitClassControl( RscTop * pSuper );
     RscTop *    InitClassCheckBox( RscTop * pSuper );
     RscTop *    InitClassPushButton( RscTop * pSuper );
diff --git a/rsc/source/parser/rscicpx.cxx b/rsc/source/parser/rscicpx.cxx
index cb8648c..fc13647 100644
--- a/rsc/source/parser/rscicpx.cxx
+++ b/rsc/source/parser/rscicpx.cxx
@@ -302,60 +302,6 @@ RscTop * RscTypCont::InitClassWindow( RscTop * pSuper, RscEnum * pMapUnit,
     return pClassWindow;
 }
 
-RscTop * RscTypCont::InitClassSystemWindow( RscTop * pSuper )
-{
-    Atom        nId;
-    RscTop *    pClassSystemWindow;
-
-    // initialize class
-    nId = pHS->getID( "SystemWindow" );
-    pClassSystemWindow = new RscClass( nId, RSC_SYSWINDOW, pSuper );
-    pClassSystemWindow->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
-    aNmTb.Put( nId, CLASSNAME, pClassSystemWindow );
-
-    INS_WINBIT(pClassSystemWindow,Sizeable)
-    INS_WINBIT(pClassSystemWindow,Moveable)
-    InsWinBit( pClassSystemWindow, "Minable", nMinimizeId );
-    InsWinBit( pClassSystemWindow, "Maxable", nMaximizeId );
-    INS_WINBIT(pClassSystemWindow,Closeable)
-    INS_WINBIT(pClassSystemWindow,App)
-    INS_WINBIT(pClassSystemWindow,SysWin)
-
-    return pClassSystemWindow ;
-}
-
-RscTop * RscTypCont::InitClassWorkWindow( RscTop * pSuper )
-{
-    Atom        nId;
-    RscTop *    pClassWorkWindow;
-
-    // initialize class
-    nId = pHS->getID( "WorkWindow" );
-    pClassWorkWindow = new RscClass( nId, RSC_WORKWIN, pSuper );
-    pClassWorkWindow->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
-
-    aNmTb.Put( nId, CLASSNAME, pClassWorkWindow );
-
-    // initialize variables
-    {
-        Atom        nVarId;
-        RscEnum   * pShow;
-
-        aBaseLst.push_back( pShow = new RscEnum( pHS->getID( "EnumShowState" ), RSC_NOTYPE ) );
-
-        SETCONST( pShow, "SHOW_NORMAL",        WORKWIN_SHOWNORMAL    );
-        SETCONST( pShow, "SHOW_MINIMIZED",     WORKWIN_SHOWMINIMIZED );
-        SETCONST( pShow, "SHOW_MAXIMIZED",     WORKWIN_SHOWMAXIMIZED );
-
-
-        // add variable
-        nVarId = aNmTb.Put( "Show", VARNAME );
-        pClassWorkWindow->SetVariable( nVarId, pShow );
-    }
-
-    return pClassWorkWindow;
-}
-
 RscTop * RscTypCont::InitClassControl( RscTop * pSuper )
 {
     Atom        nId;
diff --git a/rsc/source/parser/rscinit.cxx b/rsc/source/parser/rscinit.cxx
index b796c62..e7a55ac 100644
--- a/rsc/source/parser/rscinit.cxx
+++ b/rsc/source/parser/rscinit.cxx
@@ -66,8 +66,6 @@ void RscTypCont::Init()
     RscTop   *  pClassImage;
     RscTop   *  pClassImageList;
     RscTop   *  pClassWindow;
-    RscTop   *  pClassSystemWindow;
-    RscTop   *  pClassWorkWindow;
     RscTop   *  pClassControl;
     RscTop   *  pClassButton;
     RscTop   *  pClassCheckBox;
@@ -309,15 +307,6 @@ void RscTypCont::Init()
     pRoot->Insert( pClassWindow );
 }
 {
-
-    pClassSystemWindow = InitClassSystemWindow( pClassWindow );
-    //aBaseLst.Insert( pClassSystemWindow, LIST_APPEND );
-    pRoot->Insert( pClassSystemWindow );
-
-    pClassWorkWindow = InitClassWorkWindow( pClassSystemWindow );
-    pRoot->Insert( pClassWorkWindow );
-}
-{
     pClassControl = InitClassControl( pClassWindow );
     pRoot->Insert( pClassControl );
 
diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx
index 668b414..2b46d4b 100644
--- a/tools/source/rc/resmgr.cxx
+++ b/tools/source/rc/resmgr.cxx
@@ -1411,7 +1411,6 @@ OString ResMgr::GetAutoHelpId()
         // auto help ids for top level windows
         switch( pRC->pResource->GetRT() ) {
             case RSC_DOCKINGWINDOW:     aHID.append( "DockingWindow" );    break;
-            case RSC_WORKWIN:           aHID.append( "WorkWindow" );       break;
             default: return OString();
         }
     }
@@ -1421,7 +1420,6 @@ OString ResMgr::GetAutoHelpId()
         const ImpRCStack *pRC1 = StackTop(1);
         switch( pRC1->pResource->GetRT() ) {
             case RSC_DOCKINGWINDOW:
-            case RSC_WORKWIN:
                 // intentionally no breaks!
                 // auto help ids for controls
                 switch( pRC->pResource->GetRT() ) {
commit ee6af9f72c298972d7f255aa92f365b33a9e53b2
Author: Noel Grandin <noelgrandin at gmail.com>
Date:   Sat May 14 20:11:29 2016 +0200

    convert RSC_MENUITEM to scoped enum
    
    Change-Id: I35469edc7d8e5621f016f5eba613474d45711cd3
    Reviewed-on: https://gerrit.libreoffice.org/24998
    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 6b5c900..dbf028d 100644
--- a/include/tools/rc.h
+++ b/include/tools/rc.h
@@ -72,18 +72,21 @@ namespace o3tl {
 }
 
 // "MenuItem" resource options:
-#define RSC_MENUITEM_SEPARATOR          0x001
-#define RSC_MENUITEM_ID                 0x002
-#define RSC_MENUITEM_STATUS             0x004
-#define RSC_MENUITEM_TEXT               0x008
-#define RSC_MENUITEM_BITMAP             0x010
-#define RSC_MENUITEM_HELPTEXT           0x020
-#define RSC_MENUITEM_HELPID             0x040
-#define RSC_MENUITEM_KEYCODE            0x080
-#define RSC_MENUITEM_MENU               0x100
-#define RSC_MENUITEM_CHECKED            0x200
-#define RSC_MENUITEM_DISABLE            0x400
-#define RSC_MENUITEM_COMMAND            0x800
+enum class RscMenuItem {
+    Separator          = 0x001,
+    Id                 = 0x002,
+    Status             = 0x004,
+    Text               = 0x008,
+    Bitmap             = 0x010,
+    HelpText           = 0x020,
+    HelpId             = 0x040,
+    Menu               = 0x100,
+    Disable            = 0x400,
+    Command            = 0x800
+};
+namespace o3tl {
+    template<> struct typed_flags<RscMenuItem> : is_typed_flags<RscMenuItem, 0xd7f> {};
+}
 
 // "AccelKey" resource options:
 #define ACCELITEM_ACCEL                 0x01
diff --git a/rsc/inc/rscdb.hxx b/rsc/inc/rscdb.hxx
index 07db859..a84af73 100644
--- a/rsc/inc/rscdb.hxx
+++ b/rsc/inc/rscdb.hxx
@@ -198,8 +198,7 @@ class RscTypCont
     RscTop *    InitClassKeyCode( RscTop * pSuper, RscEnum * pKey );
     RscTop *    InitClassAccelItem( RscTop * pSuper, RscTop * pKeyCode );
     RscTop *    InitClassAccel( RscTop * pSuper, RscTop * pClassAccelItem );
-    RscTop *    InitClassMenuItem( RscTop * pSuper, RscTop * pClassBitmap,
-                                   RscTop * pClassKeyCode );
+    RscTop *    InitClassMenuItem( RscTop * pSuper, RscTop * pClassBitmap );
     RscTop *    InitClassMenu( RscTop * pSuper, RscTop * pMenuItem );
 
     RscTop *    InitClassNumericFormatter( RscTop * pSuper );
diff --git a/rsc/source/parser/rscicpx.cxx b/rsc/source/parser/rscicpx.cxx
index 1bbd9fd..cb8648c 100644
--- a/rsc/source/parser/rscicpx.cxx
+++ b/rsc/source/parser/rscicpx.cxx
@@ -771,8 +771,7 @@ RscTop * RscTypCont::InitClassAccel( RscTop * pSuper, RscTop * pClassAccelItem )
 }
 
 RscTop * RscTypCont::InitClassMenuItem( RscTop * pSuper,
-                                        RscTop * pClassBitmap,
-                                                                                RscTop * pClassKeyCode )
+                                        RscTop * pClassBitmap )
 {
     Atom        nId;
     RscTop *    pClassMenuItem;
@@ -785,10 +784,10 @@ RscTop * RscTypCont::InitClassMenuItem( RscTop * pSuper,
     // initialize variables
     nId = aNmTb.Put( "Separator", VARNAME );
     pClassMenuItem->SetVariable( nId, &aBool, nullptr, 0,
-                                 RSC_MENUITEM_SEPARATOR );
+                                 (sal_uInt32)RscMenuItem::Separator );
     nId = aNmTb.Put( "Identifier", VARNAME );
     pClassMenuItem->SetVariable( nId, &aIdNoZeroUShort, nullptr, 0,
-                                 RSC_MENUITEM_ID );
+                                 (sal_uInt32)RscMenuItem::Id );
     {
         RscFlag *   pFlag;
         RscClient * pClient;
@@ -813,7 +812,7 @@ RscTop * RscTypCont::InitClassMenuItem( RscTop * pSuper,
         nVarId = aNmTb.Put( "_MenuItemFlags", VARNAME );
         pClassMenuItem->SetVariable( nVarId, pFlag, nullptr,
                                      VAR_HIDDEN | VAR_NOENUM,
-                                     RSC_MENUITEM_STATUS );
+                                     (sal_uInt32)RscMenuItem::Status );
 
         // add client variables
         aBaseLst.push_back(
@@ -854,28 +853,22 @@ RscTop * RscTypCont::InitClassMenuItem( RscTop * pSuper,
     }
     nId = aNmTb.Put( "Text", VARNAME );
     pClassMenuItem->SetVariable( nId, &aLangString, nullptr, 0,
-                                 RSC_MENUITEM_TEXT );
+                                 (sal_uInt32)RscMenuItem::Text );
     nId = aNmTb.Put( "ItemBitmap", VARNAME );
     pClassMenuItem->SetVariable( nId, pClassBitmap, nullptr, 0,
-                                 RSC_MENUITEM_BITMAP );
+                                 (sal_uInt32)RscMenuItem::Bitmap );
     nId = aNmTb.Put( "HelpText", VARNAME );
     pClassMenuItem->SetVariable( nId, &aLangString, nullptr, 0,
-                                 RSC_MENUITEM_HELPTEXT );
+                                 (sal_uInt32)RscMenuItem::HelpText );
     nId = aNmTb.Put( "HelpID", VARNAME );
     pClassMenuItem->SetVariable( nId, &aStringLiteral, nullptr, 0,
-                                 RSC_MENUITEM_HELPID );
-    nId = aNmTb.Put( "AccelKey", VARNAME );
-    pClassMenuItem->SetVariable( nId, pClassKeyCode, nullptr, 0,
-                                 RSC_MENUITEM_KEYCODE );
-    nId = aNmTb.Put( "Check", VARNAME );
-    pClassMenuItem->SetVariable( nId, &aBool, nullptr, 0,
-                                 RSC_MENUITEM_CHECKED );
+                                 (sal_uInt32)RscMenuItem::HelpId );
     nId = aNmTb.Put( "Disable", VARNAME );
     pClassMenuItem->SetVariable( nId, &aBool, nullptr, 0,
-                                 RSC_MENUITEM_DISABLE );
+                                 (sal_uInt32)RscMenuItem::Disable );
     nId = aNmTb.Put( "Command", VARNAME );
     pClassMenuItem->SetVariable( nId, &aString, nullptr, 0,
-                                    RSC_MENUITEM_COMMAND );
+                                    (sal_uInt32)RscMenuItem::Command );
 
     return pClassMenuItem;
 }
diff --git a/rsc/source/parser/rscinit.cxx b/rsc/source/parser/rscinit.cxx
index eca02aa..b796c62 100644
--- a/rsc/source/parser/rscinit.cxx
+++ b/rsc/source/parser/rscinit.cxx
@@ -380,8 +380,7 @@ void RscTypCont::Init()
     pClassAccelItem->SetVariable( nId, pClassAccel, nullptr, VAR_SVDYNAMIC,
                                ACCELITEM_ACCEL );
 
-    RscTop* pClassMenuItem = InitClassMenuItem( pClassMgr, pClassBitmap,
-                                        pLangClassKeyCode );
+    RscTop* pClassMenuItem = InitClassMenuItem( pClassMgr, pClassBitmap);
     pRoot->Insert( pClassMenuItem );
 
     RscTop* pClassMenu = InitClassMenu( pClassMgr, pClassMenuItem );
@@ -390,7 +389,7 @@ void RscTypCont::Init()
     // pClassMenu is only completely defined here
     nId = aNmTb.Put( "SubMenu", VARNAME );
     pClassMenuItem->SetVariable( nId, pClassMenu, nullptr, VAR_SVDYNAMIC,
-                                 RSC_MENUITEM_MENU );
+                                 (sal_uInt32)RscMenuItem::Menu );
 }
 {
     // initialize class
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 075c53b..ce465f9 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -427,29 +427,29 @@ void Menu::InsertItem( const ResId& rResId )
     if( ! pMgr )
         return;
 
-    sal_uLong              nObjMask;
+    RscMenuItem              nObjMask;
 
     GetRes( rResId.SetRT( RSC_MENUITEM ) );
-    nObjMask    = ReadLongRes();
+    nObjMask    = (RscMenuItem)ReadLongRes();
 
     bool bSep = false;
-    if ( nObjMask & RSC_MENUITEM_SEPARATOR )
+    if ( nObjMask & RscMenuItem::Separator )
         bSep = ReadShortRes() != 0;
 
     sal_uInt16 nItemId = 1;
-    if ( nObjMask & RSC_MENUITEM_ID )
+    if ( nObjMask & RscMenuItem::Id )
         nItemId = sal::static_int_cast<sal_uInt16>(ReadLongRes());
 
     MenuItemBits nStatus = MenuItemBits::NONE;
-    if ( nObjMask & RSC_MENUITEM_STATUS )
+    if ( nObjMask & RscMenuItem::Status )
         nStatus = sal::static_int_cast<MenuItemBits>(ReadLongRes());
 
     OUString aText;
-    if ( nObjMask & RSC_MENUITEM_TEXT )
+    if ( nObjMask & RscMenuItem::Text )
         aText = ReadStringRes();
 
     // create item
-    if ( nObjMask & RSC_MENUITEM_BITMAP )
+    if ( nObjMask & RscMenuItem::Bitmap )
     {
         if ( !bSep )
         {
@@ -468,14 +468,14 @@ void Menu::InsertItem( const ResId& rResId )
         InsertSeparator();
 
     OUString aHelpText;
-    if ( nObjMask & RSC_MENUITEM_HELPTEXT )
+    if ( nObjMask & RscMenuItem::HelpText )
     {
         aHelpText = ReadStringRes();
         if( !bSep )
             SetHelpText( nItemId, aHelpText );
     }
 
-    if ( nObjMask & RSC_MENUITEM_HELPID )
+    if ( nObjMask & RscMenuItem::HelpId )
     {
         OString aHelpId( ReadByteStringRes() );
         if ( !bSep )
@@ -485,29 +485,18 @@ void Menu::InsertItem( const ResId& rResId )
     if( !bSep )
         SetHelpText( nItemId, aHelpText );
 
-    if ( nObjMask & RSC_MENUITEM_KEYCODE )
-    {
-        if ( !bSep )
-            SetAccelKey( nItemId, KeyCode( ResId( static_cast<RSHEADER_TYPE*>(GetClassRes()), *pMgr ) ) );
-        IncrementRes( GetObjSizeRes( static_cast<RSHEADER_TYPE*>(GetClassRes()) ) );
-    }
-    if( nObjMask & RSC_MENUITEM_CHECKED )
-    {
-        if ( !bSep )
-            CheckItem( nItemId, ReadShortRes() != 0 );
-    }
-    if ( nObjMask & RSC_MENUITEM_DISABLE )
+    if ( nObjMask & RscMenuItem::Disable )
     {
         if ( !bSep )
             EnableItem( nItemId, ReadShortRes() == 0 );
     }
-    if ( nObjMask & RSC_MENUITEM_COMMAND )
+    if ( nObjMask & RscMenuItem::Command )
     {
         OUString aCommandStr = ReadStringRes();
         if ( !bSep )
             SetItemCommand( nItemId, aCommandStr );
     }
-    if ( nObjMask & RSC_MENUITEM_MENU )
+    if ( nObjMask & RscMenuItem::Menu )
     {
         if ( !bSep )
         {


More information about the Libreoffice-commits mailing list