[Libreoffice-commits] core.git: svtools/source

Xisco Fauli anistenis at gmail.com
Fri Jun 10 08:34:48 UTC 2016


 svtools/source/config/helpopt.cxx |   40 ++++++++++++++++++++------------------
 1 file changed, 22 insertions(+), 18 deletions(-)

New commits:
commit be9f916fdf6a561746391945d2bc2a823f62fa9d
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Fri Jun 10 02:23:03 2016 +0200

    Convert set of #define to enum class in helpopt
    
    Change-Id: Ic6c31f810fa9e2ab64390702c85fcb4e3db5fad3
    Reviewed-on: https://gerrit.libreoffice.org/26140
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/svtools/source/config/helpopt.cxx b/svtools/source/config/helpopt.cxx
index 6f612ef..94edac0 100644
--- a/svtools/source/config/helpopt.cxx
+++ b/svtools/source/config/helpopt.cxx
@@ -40,11 +40,14 @@ using namespace com::sun::star;
 static SvtHelpOptions_Impl* pOptions = nullptr;
 static sal_Int32           nRefCount = 0;
 
-#define EXTENDEDHELP        0
-#define HELPTIPS            1
-#define LOCALE              2
-#define SYSTEM              3
-#define STYLESHEET          4
+enum class HelpProperty
+{
+    ExtendedHelp    = 0,
+    HelpTips        = 1,
+    Locale          = 2,
+    System          = 3,
+    StyleSheet      = 4
+};
 
 class SvtHelpOptions_Impl : public utl::ConfigItem
 {
@@ -158,12 +161,13 @@ void  SvtHelpOptions_Impl::Load(const uno::Sequence< OUString>& rPropertyNames)
                 sal_Int32 nTmpInt = 0;
                 if ( pValues[nProp] >>= bTmp )
                 {
-                    switch ( lcl_MapPropertyName(rPropertyNames[nProp], aInternalPropertyNames) )
+                    switch ( static_cast< HelpProperty >(
+                        lcl_MapPropertyName(rPropertyNames[nProp], aInternalPropertyNames) ) )
                     {
-                        case EXTENDEDHELP :
+                        case HelpProperty::ExtendedHelp:
                             bExtendedHelp = bTmp;
                             break;
-                        case HELPTIPS :
+                        case HelpProperty::HelpTips:
                             bHelpTips = bTmp;
                             break;
                         default:
@@ -173,16 +177,16 @@ void  SvtHelpOptions_Impl::Load(const uno::Sequence< OUString>& rPropertyNames)
                 }
                 else if ( pValues[nProp] >>= aTmpStr )
                 {
-                    switch ( nProp )
+                    switch ( static_cast< HelpProperty >(nProp) )
                     {
-                        case LOCALE:
+                        case HelpProperty::Locale:
                             aLocale = aTmpStr;
                             break;
 
-                        case SYSTEM:
+                        case HelpProperty::System:
                             aSystem = aTmpStr;
                             break;
-                        case STYLESHEET :
+                        case HelpProperty::StyleSheet:
                             sHelpStyleSheet = aTmpStr;
                         break;
                         default:
@@ -215,24 +219,24 @@ void SvtHelpOptions_Impl::ImplCommit()
     Any* pValues = aValues.getArray();
     for ( int nProp = 0; nProp < aNames.getLength(); nProp++ )
     {
-        switch ( nProp )
+        switch ( static_cast< HelpProperty >(nProp) )
         {
-            case EXTENDEDHELP :
+            case HelpProperty::ExtendedHelp:
                 pValues[nProp] <<= bExtendedHelp;
                 break;
 
-            case HELPTIPS :
+            case HelpProperty::HelpTips:
                 pValues[nProp] <<= bHelpTips;
                 break;
 
-            case LOCALE:
+            case HelpProperty::Locale:
                 pValues[nProp] <<= OUString(aLocale);
                 break;
 
-            case SYSTEM:
+            case HelpProperty::System:
                 pValues[nProp] <<= OUString(aSystem);
                 break;
-            case STYLESHEET :
+            case HelpProperty::StyleSheet:
                 pValues[nProp] <<= OUString(sHelpStyleSheet);
             break;
 


More information about the Libreoffice-commits mailing list