chart2/Library_chartcontroller.mk                         |    1 
 chart2/source/controller/drawinglayer/DrawViewWrapper.cxx |   14 +-
 chart2/source/controller/inc/ConfigurationAccess.hxx      |   38 -----
 chart2/source/controller/main/ConfigurationAccess.cxx     |   93 --------------
 4 files changed, 12 insertions(+), 134 deletions(-)

New commits:
commit 8b3ffd089b2a3d8eb4f1b61b7f7ee645f34523be
Author:     Noel Grandin <[email protected]>
AuthorDate: Fri Mar 10 12:30:45 2023 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Fri Mar 10 15:44:27 2023 +0000

    Use officecfg instead of chart::ConfigurationAccess
    
    Change-Id: I078c53af6a261da2a618c1cc4e99f26bc03e65c3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148602
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/chart2/Library_chartcontroller.mk 
b/chart2/Library_chartcontroller.mk
index cc25cdd907ae..56a80ea9e43d 100644
--- a/chart2/Library_chartcontroller.mk
+++ b/chart2/Library_chartcontroller.mk
@@ -184,7 +184,6 @@ $(eval $(call 
gb_Library_add_exception_objects,chartcontroller,\
     chart2/source/controller/main/ChartWindow \
     chart2/source/controller/main/CommandDispatchContainer \
     chart2/source/controller/main/CommandDispatch \
-    chart2/source/controller/main/ConfigurationAccess \
     chart2/source/controller/main/ControllerCommandDispatch \
     chart2/source/controller/main/DragMethod_Base \
     chart2/source/controller/main/DragMethod_PieSegment \
diff --git a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx 
b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
index 10062a6b1a95..15cac92fc011 100644
--- a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
+++ b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
@@ -19,9 +19,10 @@
 
 #include <DrawViewWrapper.hxx>
 #include <chartview/DrawModelWrapper.hxx>
-#include <ConfigurationAccess.hxx>
 
 #include <unotools/lingucfg.hxx>
+#include <unotools/syslocale.hxx>
+#include <unotools/localedatawrapper.hxx>
 #include <editeng/eeitem.hxx>
 #include <editeng/langitem.hxx>
 #include <svl/intitem.hxx>
@@ -40,6 +41,7 @@
 
 #include <sfx2/objsh.hxx>
 #include <svx/helperhittest3d.hxx>
+#include <officecfg/Office/Calc.hxx>
 
 using namespace ::com::sun::star;
 
@@ -255,6 +257,14 @@ SdrOutliner* DrawViewWrapper::getOutliner() const
 
 SfxItemSet DrawViewWrapper::getPositionAndSizeItemSetFromMarkedObject() const
 {
+    SvtSysLocale aSysLocale;
+    MeasurementSystem eSys = 
aSysLocale.GetLocaleData().getMeasurementSystemEnum();
+    sal_uInt16 nAttrMetric;
+    if( eSys == MeasurementSystem::Metric )
+        nAttrMetric = 
officecfg::Office::Calc::Layout::Other::MeasureUnit::Metric::get();
+    else
+        nAttrMetric = 
officecfg::Office::Calc::Layout::Other::MeasureUnit::NonMetric::get();
+
     SfxItemSet aFullSet(
         GetModel().GetItemPool(),
         svl::Items<
@@ -264,7 +274,7 @@ SfxItemSet 
DrawViewWrapper::getPositionAndSizeItemSetFromMarkedObject() const
             SID_ATTR_METRIC, SID_ATTR_METRIC>);
     SfxItemSet aGeoSet( E3dView::GetGeoAttrFromMarked() );
     aFullSet.Put( aGeoSet );
-    aFullSet.Put( SfxUInt16Item(SID_ATTR_METRIC,static_cast< sal_uInt16 >( 
ConfigurationAccess::getFieldUnit())));
+    aFullSet.Put( SfxUInt16Item(SID_ATTR_METRIC, nAttrMetric) );
     return aFullSet;
 }
 
diff --git a/chart2/source/controller/inc/ConfigurationAccess.hxx 
b/chart2/source/controller/inc/ConfigurationAccess.hxx
deleted file mode 100644
index 2fb4636d2217..000000000000
--- a/chart2/source/controller/inc/ConfigurationAccess.hxx
+++ /dev/null
@@ -1,38 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#pragma once
-
-#include <tools/fldunit.hxx>
-
-namespace chart::ConfigurationAccess
-{
-/** @descr Retrieve the FieldUnit to be used for the UI.  This unit is 
retrieved
-    from the registry settings of the Calc application.
-
-    If this setting can not be found there is a fallback to cm which is the 
most
-    common setting worldwide (or not?)
-
-    @return the FieldUnit enum.  See <vcl/fldunit.hxx> for definition
-    */
-FieldUnit getFieldUnit();
-
-} //namespace chart
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/main/ConfigurationAccess.cxx 
b/chart2/source/controller/main/ConfigurationAccess.cxx
deleted file mode 100644
index f6dfecc60113..000000000000
--- a/chart2/source/controller/main/ConfigurationAccess.cxx
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <ConfigurationAccess.hxx>
-
-#include <unotools/syslocale.hxx>
-#include <unotools/configitem.hxx>
-#include <unotools/localedatawrapper.hxx>
-
-namespace chart
-{
-using namespace ::com::sun::star;
-
-namespace
-{
-bool lcl_IsMetric()
-{
-    SvtSysLocale aSysLocale;
-    MeasurementSystem eSys = 
aSysLocale.GetLocaleData().getMeasurementSystemEnum();
-
-    return ( eSys == MeasurementSystem::Metric );
-}
-
-class CalcConfigItem : public ::utl::ConfigItem
-{
-private:
-    virtual void                    ImplCommit() override;
-
-public:
-    CalcConfigItem();
-
-    FieldUnit getFieldUnit();
-    virtual void                    Notify( const uno::Sequence<OUString>& 
aPropertyNames) override;
-};
-
-}//end anonymous namespace
-
-CalcConfigItem::CalcConfigItem()
-    : ConfigItem( "Office.Calc/Layout" )
-{
-}
-
-void CalcConfigItem::ImplCommit() {}
-void CalcConfigItem::Notify( const uno::Sequence<OUString>& ) {}
-
-FieldUnit CalcConfigItem::getFieldUnit()
-{
-    FieldUnit eResult( FieldUnit::CM );
-
-    uno::Sequence< OUString > aNames;
-    if( lcl_IsMetric() )
-        aNames = { "Other/MeasureUnit/Metric" };
-    else
-        aNames = { "Other/MeasureUnit/NonMetric" };
-
-    uno::Sequence< uno::Any > aResult( GetProperties( aNames ));
-    sal_Int32 nValue = 0;
-    if( aResult[ 0 ] >>= nValue )
-        eResult = static_cast< FieldUnit >( nValue );
-
-    return eResult;
-}
-
-namespace ConfigurationAccess
-{
-    FieldUnit getFieldUnit()
-    {
-        //a CalcConfigItem Singleton
-        static CalcConfigItem SINGLETON;
-        FieldUnit aUnit( SINGLETON.getFieldUnit() );
-        return aUnit;
-    }
-} //namespace ConfigurationAccess
-
-} //namespace chart
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to