summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-03-10 12:30:45 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-03-10 15:44:27 +0000
commit8b3ffd089b2a3d8eb4f1b61b7f7ee645f34523be (patch)
tree71f9d4d944d7b83d91034590fa406887ebe64d11
parent3191c67deefa13f8c664e0ea1ed27c218b1b6144 (diff)
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 <noel.grandin@collabora.co.uk>
-rw-r--r--chart2/Library_chartcontroller.mk1
-rw-r--r--chart2/source/controller/drawinglayer/DrawViewWrapper.cxx14
-rw-r--r--chart2/source/controller/inc/ConfigurationAccess.hxx38
-rw-r--r--chart2/source/controller/main/ConfigurationAccess.cxx93
4 files changed, 12 insertions, 134 deletions
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: */