summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2016-05-25 20:33:30 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-05-26 07:22:01 +0000
commit12eec0ce0ce0d2008e80f294c4b2d4d3e6e3ef55 (patch)
tree2ed75302689433c31897df0d4bc28a58e43464ba
parentba91f894cc135ee4ea3a9ba945fb32e27eba2638 (diff)
Convert METRICFORMATTER to scoped enum
Change-Id: If7004e0ca3f2dc229b1b36c07811eef09456b437 Reviewed-on: https://gerrit.libreoffice.org/25464 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r--include/tools/rc.h9
-rw-r--r--rsc/source/parser/rscicpx.cxx4
-rw-r--r--vcl/source/control/field.cxx6
3 files changed, 12 insertions, 7 deletions
diff --git a/include/tools/rc.h b/include/tools/rc.h
index 8b6d5ea67daa..f39e0e7388fb 100644
--- a/include/tools/rc.h
+++ b/include/tools/rc.h
@@ -98,8 +98,13 @@ namespace o3tl {
template<> struct typed_flags<RscNumFormatterFlags> : is_typed_flags<RscNumFormatterFlags, 0x37> {};
}
-#define METRICFORMATTER_UNIT 0x01
-#define METRICFORMATTER_CUSTOMUNITTEXT 0x02
+enum class RscMetricFormatterFlags {
+ Unit = 0x01,
+ CustomUnitText = 0x02
+};
+namespace o3tl {
+ template<> struct typed_flags<RscMetricFormatterFlags> : is_typed_flags<RscMetricFormatterFlags, 0x03> {};
+}
#define NUMERICFIELD_FIRST 0x01
#define NUMERICFIELD_LAST 0x02
diff --git a/rsc/source/parser/rscicpx.cxx b/rsc/source/parser/rscicpx.cxx
index 20e05a5bab82..1ec99f235f1d 100644
--- a/rsc/source/parser/rscicpx.cxx
+++ b/rsc/source/parser/rscicpx.cxx
@@ -850,10 +850,10 @@ RscTop * RscTypCont::InitClassMetricFormatter( RscTop * pSuper,
// initialize variables
nId = aNmTb.Put( "Unit", VARNAME );
pClassMetric->SetVariable( nId, pFieldUnits, nullptr,
- 0, METRICFORMATTER_UNIT );
+ 0, (sal_uInt32)RscMetricFormatterFlags::Unit );
nId = aNmTb.Put( "CustomUnitText", VARNAME );
pClassMetric->SetVariable( nId, &aLangString, nullptr,
- 0, METRICFORMATTER_CUSTOMUNITTEXT );
+ 0, (sal_uInt32)RscMetricFormatterFlags::CustomUnitText );
return pClassMetric;
}
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index 40c2fffc9d25..1997cc1077e9 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -1416,9 +1416,9 @@ void MetricFormatter::ImplLoadRes( const ResId& rResId )
ResMgr* pMgr = rResId.GetResMgr();
if( pMgr )
{
- sal_uLong nMask = pMgr->ReadLong();
+ RscMetricFormatterFlags nMask = (RscMetricFormatterFlags)pMgr->ReadLong();
- if ( METRICFORMATTER_UNIT & nMask )
+ if ( RscMetricFormatterFlags::Unit & nMask )
{
sal_uLong nUnit = pMgr->ReadLong();
assert(nUnit <= FUNIT_MILLISECOND && "out of FieldUnit bounds");
@@ -1426,7 +1426,7 @@ void MetricFormatter::ImplLoadRes( const ResId& rResId )
meUnit = (FieldUnit)nUnit;
}
- if ( METRICFORMATTER_CUSTOMUNITTEXT & nMask )
+ if ( RscMetricFormatterFlags::CustomUnitText & nMask )
maCustomUnitText = pMgr->ReadString();
}
}