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

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


 include/tools/rc.h            |   17 ++++++++++-------
 rsc/source/parser/rscicpx.cxx |   13 +++++--------
 vcl/source/control/field.cxx  |   15 ++++++---------
 3 files changed, 21 insertions(+), 24 deletions(-)

New commits:
commit 52372ae0370cb755ed810eead456d75c8cb1adf3
Author: Noel Grandin <noelgrandin at gmail.com>
Date:   Sun May 15 17:55:48 2016 +0200

    convert NUMERICFORMATTER to scoped enum
    
    Change-Id: Ia6762153a73f01a237bfc03bf9a95a4117d1d998
    Reviewed-on: https://gerrit.libreoffice.org/25010
    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 dbf028d..1aed995 100644
--- a/include/tools/rc.h
+++ b/include/tools/rc.h
@@ -94,13 +94,16 @@ namespace o3tl {
 
 // For "Field" resources:
 
-#define NUMERICFORMATTER_MIN            0x01
-#define NUMERICFORMATTER_MAX            0x02
-#define NUMERICFORMATTER_STRICTFORMAT   0x04
-//#define NUMERICFORMATTER_I12          0x08 // removed (2005-06-17)
-#define NUMERICFORMATTER_DECIMALDIGITS  0x10
-#define NUMERICFORMATTER_VALUE          0x20
-#define NUMERICFORMATTER_NOTHOUSANDSEP  0x40
+enum class RscNumFormatterFlags {
+    Min            = 0x01,
+    Max            = 0x02,
+    StrictFormat   = 0x04,
+    DecimalDigits  = 0x10,
+    Value          = 0x20,
+};
+namespace o3tl {
+    template<> struct typed_flags<RscNumFormatterFlags> : is_typed_flags<RscNumFormatterFlags, 0x37> {};
+}
 
 #define METRICFORMATTER_UNIT            0x01
 #define METRICFORMATTER_CUSTOMUNITTEXT  0x02
diff --git a/rsc/source/parser/rscicpx.cxx b/rsc/source/parser/rscicpx.cxx
index fc13647..9bd53b5 100644
--- a/rsc/source/parser/rscicpx.cxx
+++ b/rsc/source/parser/rscicpx.cxx
@@ -862,22 +862,19 @@ RscTop * RscTypCont::InitClassNumericFormatter( RscTop * pSuper )
     // initialize variables
     nId = aNmTb.Put( "Minimum", VARNAME );
     pClassNumeric->SetVariable( nId, &aIdLong, nullptr,
-                                0, NUMERICFORMATTER_MIN );
+                                0, (sal_uInt32)RscNumFormatterFlags::Min );
     nId = aNmTb.Put( "Maximum", VARNAME );
     pClassNumeric->SetVariable( nId, &aIdLong, nullptr,
-                                0, NUMERICFORMATTER_MAX );
+                                0, (sal_uInt32)RscNumFormatterFlags::Max );
     nId = aNmTb.Put( "StrictFormat", VARNAME );
     pClassNumeric->SetVariable( nId, &aBool, nullptr,
-                                0, NUMERICFORMATTER_STRICTFORMAT );
+                                0, (sal_uInt32)RscNumFormatterFlags::StrictFormat );
     nId = aNmTb.Put( "DecimalDigits", VARNAME );
     pClassNumeric->SetVariable( nId, &aUShort, nullptr,
-                                0, NUMERICFORMATTER_DECIMALDIGITS );
+                                0, (sal_uInt32)RscNumFormatterFlags::DecimalDigits );
     nId = aNmTb.Put( "Value", VARNAME );
     pClassNumeric->SetVariable( nId, &aIdLong, nullptr,
-                                0, NUMERICFORMATTER_VALUE );
-    nId = aNmTb.Put( "NoThousandSep", VARNAME );
-    pClassNumeric->SetVariable( nId, &aBool, nullptr,
-                                0, NUMERICFORMATTER_NOTHOUSANDSEP );
+                                0, (sal_uInt32)RscNumFormatterFlags::Value );
 
     return pClassNumeric;
 }
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index 849f2f0..4ae9436 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -531,28 +531,25 @@ void NumericFormatter::ImplLoadRes( const ResId& rResId )
 
     if( pMgr )
     {
-        sal_uLong nMask = pMgr->ReadLong();
+        RscNumFormatterFlags nMask = (RscNumFormatterFlags)pMgr->ReadLong();
 
-        if ( NUMERICFORMATTER_MIN & nMask )
+        if ( RscNumFormatterFlags::Min & nMask )
             mnMin = pMgr->ReadLong();
 
-        if ( NUMERICFORMATTER_MAX & nMask )
+        if ( RscNumFormatterFlags::Max & nMask )
             mnMax = pMgr->ReadLong();
 
-        if ( NUMERICFORMATTER_STRICTFORMAT & nMask )
+        if ( RscNumFormatterFlags::StrictFormat & nMask )
             SetStrictFormat( pMgr->ReadShort() != 0 );
 
-        if ( NUMERICFORMATTER_DECIMALDIGITS & nMask )
+        if ( RscNumFormatterFlags::DecimalDigits & nMask )
             SetDecimalDigits( pMgr->ReadShort() );
 
-        if ( NUMERICFORMATTER_VALUE & nMask )
+        if ( RscNumFormatterFlags::Value & nMask )
         {
             mnFieldValue = ClipAgainstMinMax(pMgr->ReadLong());
             mnLastValue = mnFieldValue;
         }
-
-        if ( NUMERICFORMATTER_NOTHOUSANDSEP & nMask )
-            SetUseThousandSep( pMgr->ReadShort() == 0 );
     }
 }
 


More information about the Libreoffice-commits mailing list