Convert set of #define to enum class in helpopt

Change-Id: Ic6c31f810fa9e2ab64390702c85fcb4e3db5fad3
Reviewed-on: https://gerrit.libreoffice.org/26140
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
Xisco Fauli
2016-06-10 02:23:03 +02:00
committed by Noel Grandin
parent 10fa03258f
commit be9f916fdf

View File

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