[Libreoffice-commits] core.git: chart2/source extensions/source filter/source include/unotools reportdesign/source sc/source sd/source starmath/source svtools/source sw/source unotools/source vcl/source

Noel Grandin noel.grandin at collabora.co.uk
Wed Apr 19 06:26:24 UTC 2017


 chart2/source/controller/main/ConfigurationAccess.cxx |    2 +-
 extensions/source/propctrlr/propertyhandler.cxx       |    2 +-
 filter/source/graphic/GraphicExportDialog.cxx         |    2 +-
 include/unotools/localedatawrapper.hxx                |    6 +++---
 reportdesign/source/ui/inspection/GeometryHandler.cxx |    2 +-
 reportdesign/source/ui/report/ReportController.cxx    |    2 +-
 reportdesign/source/ui/report/ReportWindow.cxx        |    2 +-
 reportdesign/source/ui/report/StartMarker.cxx         |    2 +-
 sc/source/core/tool/optutil.cxx                       |    2 +-
 sd/source/ui/app/optsitem.cxx                         |    2 +-
 starmath/source/unomodel.cxx                          |    2 +-
 svtools/source/filter/SvFilterOptionsDialog.cxx       |    2 +-
 sw/source/core/doc/docdesc.cxx                        |    2 +-
 sw/source/ui/misc/pgfnote.cxx                         |    2 +-
 sw/source/uibase/config/usrpref.cxx                   |    2 +-
 sw/source/uibase/config/viewopt.cxx                   |    2 +-
 unotools/source/i18n/localedatawrapper.cxx            |    4 ++--
 vcl/source/window/printdlg.cxx                        |    4 ++--
 18 files changed, 22 insertions(+), 22 deletions(-)

New commits:
commit 6390d77a1498ff2474522031af4a68af5e865d8d
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Apr 13 14:23:41 2017 +0200

    convert MeasurementSystem to scoped enum
    
    Change-Id: I5d26c50aa0e2c68edab6ee217ae6bdb0ee45dc09
    Reviewed-on: https://gerrit.libreoffice.org/36525
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/chart2/source/controller/main/ConfigurationAccess.cxx b/chart2/source/controller/main/ConfigurationAccess.cxx
index 3ae27a6b858f..a032c53ca3e9 100644
--- a/chart2/source/controller/main/ConfigurationAccess.cxx
+++ b/chart2/source/controller/main/ConfigurationAccess.cxx
@@ -36,7 +36,7 @@ bool lcl_IsMetric()
     const LocaleDataWrapper* pLocWrapper = aSysLocale.GetLocaleDataPtr();
     MeasurementSystem eSys = pLocWrapper->getMeasurementSystemEnum();
 
-    return ( eSys == MEASURE_METRIC );
+    return ( eSys == MeasurementSystem::Metric );
 }
 }//end anonymous namespace
 
diff --git a/extensions/source/propctrlr/propertyhandler.cxx b/extensions/source/propctrlr/propertyhandler.cxx
index a3da0893b05e..9f197d22a476 100644
--- a/extensions/source/propctrlr/propertyhandler.cxx
+++ b/extensions/source/propctrlr/propertyhandler.cxx
@@ -396,7 +396,7 @@ namespace pcr
         if ( FUNIT_NONE == eUnit )
         {
             MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
-            eUnit = MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH;
+            eUnit = MeasurementSystem::Metric == eSystem ? FUNIT_CM : FUNIT_INCH;
         }
 
         return VCLUnoHelper::ConvertToMeasurementUnit( eUnit, 1 );
diff --git a/filter/source/graphic/GraphicExportDialog.cxx b/filter/source/graphic/GraphicExportDialog.cxx
index 1c86d6bc2588..a4318dbc65c6 100644
--- a/filter/source/graphic/GraphicExportDialog.cxx
+++ b/filter/source/graphic/GraphicExportDialog.cxx
@@ -140,7 +140,7 @@ void GraphicExportDialog::setSourceDocument( const Reference<XComponent>& xDocum
             OUString aPropertyName;
             SvtSysLocale aSysLocale;
 
-            if ( aSysLocale.GetLocaleDataPtr()->getMeasurementSystemEnum() == MEASURE_METRIC )
+            if ( aSysLocale.GetLocaleDataPtr()->getMeasurementSystemEnum() == MeasurementSystem::Metric )
             {
                 aPropertyName = "Metric";
             }
diff --git a/include/unotools/localedatawrapper.hxx b/include/unotools/localedatawrapper.hxx
index 3a6ed7c3389a..944ec80db624 100644
--- a/include/unotools/localedatawrapper.hxx
+++ b/include/unotools/localedatawrapper.hxx
@@ -46,9 +46,9 @@ enum class DateOrder {
     YMD,
 };
 
-enum MeasurementSystem {
-    MEASURE_METRIC,
-    MEASURE_US
+enum class MeasurementSystem {
+    Metric,
+    US
 };
 
 class UNOTOOLS_DLLPUBLIC LocaleDataWrapper
diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx
index 32bc6233b347..0e2f21884dbd 100644
--- a/reportdesign/source/ui/inspection/GeometryHandler.cxx
+++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx
@@ -861,7 +861,7 @@ inspection::LineDescriptor SAL_CALL GeometryHandler::describePropertyLine(const
         )
     {
         const MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
-        const sal_Int16 nDisplayUnit = VCLUnoHelper::ConvertToMeasurementUnit( MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH, 1 );
+        const sal_Int16 nDisplayUnit = VCLUnoHelper::ConvertToMeasurementUnit( MeasurementSystem::Metric == eSystem ? FUNIT_CM : FUNIT_INCH, 1 );
         uno::Reference< inspection::XNumericControl > xNumericControl(aOut.Control,uno::UNO_QUERY);
         xNumericControl->setDecimalDigits( 2 );
         xNumericControl->setValueUnit( util::MeasureUnit::MM_100TH );
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index 01f3bde4ce2a..cb15da1463ff 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -2349,7 +2349,7 @@ void OReportController::openPageDialog(const uno::Reference<report::XSection>& _
     };
 
     MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
-    FieldUnit eUserMetric = MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH;
+    FieldUnit eUserMetric = MeasurementSystem::Metric == eSystem ? FUNIT_CM : FUNIT_INCH;
     static const sal_uInt16 pRanges[] =
     {
         RPTUI_ID_LRSPACE, XATTR_FILL_LAST,
diff --git a/reportdesign/source/ui/report/ReportWindow.cxx b/reportdesign/source/ui/report/ReportWindow.cxx
index 510f455d2cd7..857038f63a2a 100644
--- a/reportdesign/source/ui/report/ReportWindow.cxx
+++ b/reportdesign/source/ui/report/ReportWindow.cxx
@@ -76,7 +76,7 @@ OReportWindow::OReportWindow(OScrollWindowHelper* _pParent,ODesignView* _pView)
     m_aHRuler->SetMargin1();
     m_aHRuler->SetMargin2();
     const MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
-    m_aHRuler->SetUnit(MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH);
+    m_aHRuler->SetUnit(MeasurementSystem::Metric == eSystem ? FUNIT_CM : FUNIT_INCH);
 
     ImplInitSettings();
     m_pReportListener = addStyleListener(_pView->getController().getReportDefinition(),this);
diff --git a/reportdesign/source/ui/report/StartMarker.cxx b/reportdesign/source/ui/report/StartMarker.cxx
index 9f1b7954be94..90d35d2c43f3 100644
--- a/reportdesign/source/ui/report/StartMarker.cxx
+++ b/reportdesign/source/ui/report/StartMarker.cxx
@@ -69,7 +69,7 @@ OStartMarker::OStartMarker(OSectionWindow* _pParent,const OUString& _sColorEntry
     m_aVRuler->SetMargin1();
     m_aVRuler->SetMargin2();
     const MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
-    m_aVRuler->SetUnit(MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH);
+    m_aVRuler->SetUnit(MeasurementSystem::Metric == eSystem ? FUNIT_CM : FUNIT_INCH);
     EnableChildTransparentMode();
     SetParentClipMode( ParentClipMode::NoClip );
     SetPaintTransparent( true );
diff --git a/sc/source/core/tool/optutil.cxx b/sc/source/core/tool/optutil.cxx
index cdf55deeb13a..d3da3eba31b0 100644
--- a/sc/source/core/tool/optutil.cxx
+++ b/sc/source/core/tool/optutil.cxx
@@ -33,7 +33,7 @@ bool ScOptionsUtil::IsMetricSystem()
 
     MeasurementSystem eSys = ScGlobal::pLocaleData->getMeasurementSystemEnum();
 
-    return ( eSys == MEASURE_METRIC );
+    return ( eSys == MeasurementSystem::Metric );
 }
 
 ScLinkConfigItem::ScLinkConfigItem( const OUString& rSubTree ) :
diff --git a/sd/source/ui/app/optsitem.cxx b/sd/source/ui/app/optsitem.cxx
index 3643af570c78..8848dddce805 100644
--- a/sd/source/ui/app/optsitem.cxx
+++ b/sd/source/ui/app/optsitem.cxx
@@ -160,7 +160,7 @@ bool SdOptionsGeneric::isMetricSystem()
     SvtSysLocale aSysLocale;
     MeasurementSystem eSys = aSysLocale.GetLocaleDataPtr()->getMeasurementSystemEnum();
 
-    return ( eSys == MEASURE_METRIC );
+    return ( eSys == MeasurementSystem::Metric );
 }
 
 /*************************************************************************
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index 8e9f584ce64a..5f9fed57c271 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -911,7 +911,7 @@ static Size lcl_GuessPaperSize()
 {
     Size aRes;
     const LocaleDataWrapper& rLocWrp( AllSettings().GetLocaleDataWrapper() );
-    if( MEASURE_METRIC == rLocWrp.getMeasurementSystemEnum() )
+    if( MeasurementSystem::Metric == rLocWrp.getMeasurementSystemEnum() )
     {
         // in 100th mm
         PaperInfo aInfo( PAPER_A4 );
diff --git a/svtools/source/filter/SvFilterOptionsDialog.cxx b/svtools/source/filter/SvFilterOptionsDialog.cxx
index a3d91ce6e47d..ffc9d68cd2ac 100644
--- a/svtools/source/filter/SvFilterOptionsDialog.cxx
+++ b/svtools/source/filter/SvFilterOptionsDialog.cxx
@@ -248,7 +248,7 @@ void SvFilterOptionsDialog::setSourceDocument( const uno::Reference< lang::XComp
             FilterConfigItem aConfigItem( aConfigPath );
             OUString aPropertyName;
             SvtSysLocale aSysLocale;
-            if ( aSysLocale.GetLocaleDataPtr()->getMeasurementSystemEnum() == MEASURE_METRIC )
+            if ( aSysLocale.GetLocaleDataPtr()->getMeasurementSystemEnum() == MeasurementSystem::Metric )
                 aPropertyName = "Metric";
             else
                 aPropertyName = "NonMetric";
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index 108496c9677f..0f84d04324c3 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -93,7 +93,7 @@ static void lcl_DefaultPageFormat( sal_uInt16 nPoolFormatId,
         nMinRight = nMinTop = nMinBottom = GetMetricVal( CM_1 );
         nMinLeft = nMinRight * 2;
     }
-    else if (!utl::ConfigManager::IsAvoidConfig() && MEASURE_METRIC == SvtSysLocale().GetLocaleData().getMeasurementSystemEnum() )
+    else if (!utl::ConfigManager::IsAvoidConfig() && MeasurementSystem::Metric == SvtSysLocale().GetLocaleData().getMeasurementSystemEnum() )
     {
         nMinTop = nMinBottom = nMinLeft = nMinRight = 1134; // 2 centimeters
     }
diff --git a/sw/source/ui/misc/pgfnote.cxx b/sw/source/ui/misc/pgfnote.cxx
index 82aeb6d88379..b89ad0779d89 100644
--- a/sw/source/ui/misc/pgfnote.cxx
+++ b/sw/source/ui/misc/pgfnote.cxx
@@ -122,7 +122,7 @@ SwFootNotePage::SwFootNotePage(vcl::Window *pParent, const SfxItemSet &rSet)
     SetMetric(*m_pDistEdit, aMetric);
     SetMetric(*m_pLineDistEdit, aMetric);
     MeasurementSystem eSys = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
-    long nHeightValue = MEASURE_METRIC != eSys ? 1440 : 1134;
+    long nHeightValue = MeasurementSystem::Metric != eSys ? 1440 : 1134;
     m_pMaxHeightEdit->SetValue(m_pMaxHeightEdit->Normalize(nHeightValue),FUNIT_TWIP);
 }
 
diff --git a/sw/source/uibase/config/usrpref.cxx b/sw/source/uibase/config/usrpref.cxx
index 7fb9e59d7e33..a1390547da21 100644
--- a/sw/source/uibase/config/usrpref.cxx
+++ b/sw/source/uibase/config/usrpref.cxx
@@ -66,7 +66,7 @@ SwMasterUsrPref::SwMasterUsrPref(bool bWeb) :
         return;
     }
     MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
-    m_eUserMetric = MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH;
+    m_eUserMetric = MeasurementSystem::Metric == eSystem ? FUNIT_CM : FUNIT_INCH;
     m_eHScrollMetric = m_eVScrollMetric = m_eUserMetric;
 
     m_aContentConfig.Load();
diff --git a/sw/source/uibase/config/viewopt.cxx b/sw/source/uibase/config/viewopt.cxx
index bbfe62092f80..9bc84e223d4d 100644
--- a/sw/source/uibase/config/viewopt.cxx
+++ b/sw/source/uibase/config/viewopt.cxx
@@ -194,7 +194,7 @@ SwViewOption::SwViewOption() :
         ViewOptFlags2::GrfKeepZoom |
         ViewOptFlags2::AnyRuler;
 
-    if (!utl::ConfigManager::IsAvoidConfig() && MEASURE_METRIC != SvtSysLocale().GetLocaleData().getMeasurementSystemEnum())
+    if (!utl::ConfigManager::IsAvoidConfig() && MeasurementSystem::Metric != SvtSysLocale().GetLocaleData().getMeasurementSystemEnum())
         m_aSnapSize.Width() = m_aSnapSize.Height() = 720;   // 1/2"
     else
         m_aSnapSize.Width() = m_aSnapSize.Height() = 567;   // 1 cm
diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index 477794e23667..147125c38a83 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -471,9 +471,9 @@ MeasurementSystem LocaleDataWrapper::mapMeasurementStringToEnum( const OUString&
 {
 //! TODO: could be cached too
     if ( rMS.equalsIgnoreAsciiCase( "metric" ) )
-        return MEASURE_METRIC;
+        return MeasurementSystem::Metric;
 //! TODO: other measurement systems? => extend enum MeasurementSystem
-    return MEASURE_US;
+    return MeasurementSystem::US;
 }
 
 void LocaleDataWrapper::getSecondaryCalendarImpl()
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index ad623fb09830..dac298bc7c9d 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -236,7 +236,7 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi
     const LocaleDataWrapper& rLocWrap( GetSettings().GetLocaleDataWrapper() );
     MapUnit eUnit = MapUnit::MapMM;
     int nDigits = 0;
-    if( rLocWrap.getMeasurementSystemEnum() == MEASURE_US )
+    if( rLocWrap.getMeasurementSystemEnum() == MeasurementSystem::US )
     {
         eUnit = MapUnit::Map100thInch;
         nDigits = 2;
@@ -447,7 +447,7 @@ void PrintDialog::NUpTabPage::initFromMultiPageSetup( const vcl::PrinterControll
     const LocaleDataWrapper& rLocWrap( mpPageMarginEdt->GetLocaleDataWrapper() );
     FieldUnit eUnit = FUNIT_MM;
     sal_uInt16 nDigits = 0;
-    if( rLocWrap.getMeasurementSystemEnum() == MEASURE_US )
+    if( rLocWrap.getMeasurementSystemEnum() == MeasurementSystem::US )
     {
         eUnit = FUNIT_INCH;
         nDigits = 2;


More information about the Libreoffice-commits mailing list