diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2023-12-15 21:37:04 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-12-17 10:33:52 +0100 |
commit | 40cec25c21f3ea5d7348d778c1ab5343fa7bb456 (patch) | |
tree | 148b20fb61e3924d6d67d1b6c205d4e0d47d7490 /chart2 | |
parent | e4c8f63c90ad8396f22186045399fabcd65958cd (diff) |
unique_ptr to optional in chart2
Change-Id: I642f6f1fb7df9f0a7525155b22a99344a02d9cf8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160839
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2')
17 files changed, 55 insertions, 51 deletions
diff --git a/chart2/source/controller/inc/AxisItemConverter.hxx b/chart2/source/controller/inc/AxisItemConverter.hxx index c9f3049356a0..c14ef82bd595 100644 --- a/chart2/source/controller/inc/AxisItemConverter.hxx +++ b/chart2/source/controller/inc/AxisItemConverter.hxx @@ -19,11 +19,12 @@ #pragma once #include "ItemConverter.hxx" +#include <com/sun/star/awt/Size.hpp> #include <rtl/ref.hxx> +#include <optional> #include <vector> -namespace com::sun::star::awt { struct Size; } namespace com::sun::star::beans { class XPropertySet; } namespace com::sun::star::chart2 { class XAxis; } namespace com::sun::star::chart2 { class XChartDocument; } @@ -45,7 +46,7 @@ public: const rtl::Reference<::chart::ChartModel> & xChartDoc, ExplicitScaleData const * pScale, ExplicitIncrementData const * pIncrement, - const css::awt::Size* pRefSize ); + const std::optional<css::awt::Size>& pRefSize ); virtual ~AxisItemConverter() override; diff --git a/chart2/source/controller/inc/CharacterPropertyItemConverter.hxx b/chart2/source/controller/inc/CharacterPropertyItemConverter.hxx index a3d6ed6b26b3..65ff58ea45ab 100644 --- a/chart2/source/controller/inc/CharacterPropertyItemConverter.hxx +++ b/chart2/source/controller/inc/CharacterPropertyItemConverter.hxx @@ -35,7 +35,7 @@ public: CharacterPropertyItemConverter( const css::uno::Reference<css::beans::XPropertySet>& rPropertySet, SfxItemPool& rItemPool, - const css::awt::Size* pRefSize, + const std::optional<css::awt::Size>& pRefSize, OUString aRefSizePropertyName, const css::uno::Reference<css::beans::XPropertySet>& rRefSizePropSet = css::uno::Reference<css::beans::XPropertySet>() ); diff --git a/chart2/source/controller/inc/DataPointItemConverter.hxx b/chart2/source/controller/inc/DataPointItemConverter.hxx index 3c6e276ff763..720cc0fef2e7 100644 --- a/chart2/source/controller/inc/DataPointItemConverter.hxx +++ b/chart2/source/controller/inc/DataPointItemConverter.hxx @@ -20,14 +20,14 @@ #include "ItemConverter.hxx" #include "GraphicPropertyItemConverter.hxx" +#include <com/sun/star/awt/Size.hpp> #include <com/sun/star/uno/Sequence.h> #include <tools/color.hxx> #include <rtl/ref.hxx> - +#include <optional> #include <vector> -namespace com::sun::star::awt { struct Size; } namespace com::sun::star::chart2 { class XDataSeries; } namespace com::sun::star::frame { class XModel; } namespace com::sun::star::uno { class XComponentContext; } @@ -49,7 +49,7 @@ public: SdrModel& rDrawModel, const css::uno::Reference<css::lang::XMultiServiceFactory>& xNamedPropertyContainerFactory, GraphicObjectType eMapTo, - const css::awt::Size* pRefSize = nullptr, + const std::optional<css::awt::Size>& pRefSize = std::nullopt, bool bDataSeries = false, bool bUseSpecialFillColor = false, sal_Int32 nSpecialFillColor = 0, diff --git a/chart2/source/controller/inc/LegendItemConverter.hxx b/chart2/source/controller/inc/LegendItemConverter.hxx index 3e9315acc20d..cbb657edf0d3 100644 --- a/chart2/source/controller/inc/LegendItemConverter.hxx +++ b/chart2/source/controller/inc/LegendItemConverter.hxx @@ -19,10 +19,10 @@ #pragma once #include "ItemConverter.hxx" - +#include <com/sun/star/awt/Size.hpp> +#include <optional> #include <vector> -namespace com::sun::star::awt { struct Size; } namespace com::sun::star::lang { class XMultiServiceFactory; } class SdrModel; @@ -38,7 +38,7 @@ public: SfxItemPool& rItemPool, SdrModel& rDrawModel, const css::uno::Reference< css::lang::XMultiServiceFactory > & xNamedPropertyContainerFactory, - const css::awt::Size* pRefSize ); + const std::optional<css::awt::Size>& pRefSize ); virtual ~LegendItemConverter() override; diff --git a/chart2/source/controller/inc/MultipleChartConverters.hxx b/chart2/source/controller/inc/MultipleChartConverters.hxx index 4fe1bb1de066..8fc9f33b4367 100644 --- a/chart2/source/controller/inc/MultipleChartConverters.hxx +++ b/chart2/source/controller/inc/MultipleChartConverters.hxx @@ -19,9 +19,10 @@ #pragma once #include "MultipleItemConverter.hxx" +#include <com/sun/star/awt/Size.hpp> #include <rtl/ref.hxx> +#include <optional> -namespace com::sun::star::awt { struct Size; } namespace com::sun::star::frame { class XModel; } namespace com::sun::star::lang { class XMultiServiceFactory; } namespace chart { class ChartModel; } @@ -36,7 +37,7 @@ public: const rtl::Reference<::chart::ChartModel> & xChartModel, SfxItemPool& rItemPool, SdrModel& rDrawModel, - const css::awt::Size* pRefSize ); + const std::optional<css::awt::Size>& pRefSize ); virtual ~AllAxisItemConverter() override; diff --git a/chart2/source/controller/inc/RegressionEquationItemConverter.hxx b/chart2/source/controller/inc/RegressionEquationItemConverter.hxx index 0b32e4b9ed7c..83394b1ea45d 100644 --- a/chart2/source/controller/inc/RegressionEquationItemConverter.hxx +++ b/chart2/source/controller/inc/RegressionEquationItemConverter.hxx @@ -19,10 +19,10 @@ #pragma once #include "ItemConverter.hxx" - +#include <com/sun/star/awt/Size.hpp> +#include <optional> #include <vector> -namespace com::sun::star::awt { struct Size; } namespace com::sun::star::beans { class XPropertySet; } namespace com::sun::star::lang { class XMultiServiceFactory; } @@ -38,7 +38,7 @@ public: SfxItemPool& rItemPool, SdrModel& rDrawModel, const css::uno::Reference< css::lang::XMultiServiceFactory > & xNamedPropertyContainerFactory, - const css::awt::Size* pRefSize ); + const std::optional<css::awt::Size>& pRefSize ); virtual ~RegressionEquationItemConverter() override; diff --git a/chart2/source/controller/inc/TextLabelItemConverter.hxx b/chart2/source/controller/inc/TextLabelItemConverter.hxx index 9df2a65e1696..cb5406cf6a01 100644 --- a/chart2/source/controller/inc/TextLabelItemConverter.hxx +++ b/chart2/source/controller/inc/TextLabelItemConverter.hxx @@ -20,11 +20,12 @@ #include "ItemConverter.hxx" +#include <com/sun/star/awt/Size.hpp> #include <com/sun/star/uno/Sequence.h> #include <rtl/ref.hxx> +#include <optional> #include <vector> -namespace com::sun::star::awt { struct Size; } namespace com::sun::star::chart2 { class XDataSeries; } namespace com::sun::star::frame { class XModel; } namespace chart { class ChartModel; } @@ -40,7 +41,7 @@ public: const css::uno::Reference<css::beans::XPropertySet>& rPropertySet, const rtl::Reference<::chart::DataSeries>& xSeries, SfxItemPool& rItemPool, - const css::awt::Size* pRefSize, + const std::optional<css::awt::Size>& pRefSize, bool bDataSeries, sal_Int32 nNumberFormat, sal_Int32 nPercentNumberFormat ); diff --git a/chart2/source/controller/inc/TitleItemConverter.hxx b/chart2/source/controller/inc/TitleItemConverter.hxx index 5a2686d62814..4a306b690363 100644 --- a/chart2/source/controller/inc/TitleItemConverter.hxx +++ b/chart2/source/controller/inc/TitleItemConverter.hxx @@ -20,9 +20,10 @@ #include "ItemConverter.hxx" +#include <com/sun/star/awt/Size.hpp> +#include <optional> #include <vector> -namespace com::sun::star::awt { struct Size; } namespace com::sun::star::lang { class XMultiServiceFactory; } class SdrModel; @@ -36,7 +37,7 @@ public: const css::uno::Reference<css::beans::XPropertySet>& rPropertySet, SfxItemPool& rItemPool, SdrModel& rDrawModel, const css::uno::Reference<css::lang::XMultiServiceFactory>& xNamedPropertyContainerFactory, - const css::awt::Size* pRefSize ); + const std::optional<css::awt::Size>& pRefSize ); virtual ~TitleItemConverter() override; diff --git a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx index 79020e023af2..c17d26a08d87 100644 --- a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx @@ -85,7 +85,7 @@ AxisItemConverter::AxisItemConverter( const rtl::Reference<::chart::ChartModel> & xChartDoc, ::chart::ExplicitScaleData const * pScale /* = NULL */, ::chart::ExplicitIncrementData const * pIncrement /* = NULL */, - const awt::Size* pRefSize ) : + const std::optional<awt::Size>& pRefSize ) : ItemConverter( rPropertySet, rItemPool ), m_xChartDoc( xChartDoc ) { diff --git a/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx b/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx index ee498d4f4a50..a338ae70b4b8 100644 --- a/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx @@ -74,7 +74,7 @@ CharacterPropertyItemConverter::CharacterPropertyItemConverter( CharacterPropertyItemConverter::CharacterPropertyItemConverter( const uno::Reference< beans::XPropertySet > & rPropertySet, SfxItemPool& rItemPool, - const awt::Size* pRefSize, + const std::optional<awt::Size>& pRefSize, OUString aRefSizePropertyName, const uno::Reference< beans::XPropertySet > & rRefSizePropSet ) : ItemConverter( rPropertySet, rItemPool ), diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx index 02542a91b832..3da0b398c893 100644 --- a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx @@ -211,7 +211,7 @@ DataPointItemConverter::DataPointItemConverter( SdrModel& rDrawModel, const uno::Reference<lang::XMultiServiceFactory>& xNamedPropertyContainerFactory, GraphicObjectType eMapTo, - const awt::Size* pRefSize, + const std::optional<awt::Size>& pRefSize, bool bDataSeries, bool bUseSpecialFillColor, sal_Int32 nSpecialFillColor, diff --git a/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx b/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx index cf2d2e69bb4b..255445764b04 100644 --- a/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx @@ -41,7 +41,7 @@ LegendItemConverter::LegendItemConverter( SfxItemPool& rItemPool, SdrModel& rDrawModel, const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory, - const awt::Size* pRefSize ) : + const std::optional<awt::Size>& pRefSize ) : ItemConverter( rPropertySet, rItemPool ) { m_aConverters.emplace_back( new GraphicPropertyItemConverter( diff --git a/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx b/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx index 12630b7084b4..42595efd8b29 100644 --- a/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx +++ b/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx @@ -47,7 +47,7 @@ AllAxisItemConverter::AllAxisItemConverter( const rtl::Reference<::chart::ChartModel> & xChartModel, SfxItemPool& rItemPool, SdrModel& rDrawModel, - const awt::Size* pRefSize ) + const std::optional<awt::Size>& pRefSize ) : MultipleItemConverter( rItemPool ) { rtl::Reference< Diagram > xDiagram( xChartModel->getFirstChartDiagram() ); @@ -121,7 +121,7 @@ AllDataLabelItemConverter::AllDataLabelItemConverter( new ::chart::wrapper::DataPointItemConverter( xChartModel, xContext, series, series, rItemPool, rDrawModel, xNamedPropertyContainerFactory, GraphicObjectType::FilledDataPoint, - nullptr, true, false, 0, true, nNumberFormat, nPercentNumberFormat)); + std::nullopt, true, false, 0, true, nNumberFormat, nPercentNumberFormat)); } } @@ -150,7 +150,7 @@ AllTitleItemConverter::AllTitleItemConverter( uno::Reference< beans::XPropertySet > xObjectProperties( xTitle ); m_aConverters.emplace_back( new ::chart::wrapper::TitleItemConverter( - xObjectProperties, rItemPool, rDrawModel, xNamedPropertyContainerFactory, nullptr)); + xObjectProperties, rItemPool, rDrawModel, xNamedPropertyContainerFactory, std::nullopt)); } } diff --git a/chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx b/chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx index 22fc379b2a2c..9b10afd4f79d 100644 --- a/chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx @@ -49,7 +49,7 @@ RegressionEquationItemConverter::RegressionEquationItemConverter( SfxItemPool& rItemPool, SdrModel& rDrawModel, const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory, - const awt::Size* pRefSize ) : + const std::optional<awt::Size>& pRefSize ) : ItemConverter( rPropertySet, rItemPool ) { m_aConverters.emplace_back( new GraphicPropertyItemConverter( diff --git a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx index 9bf0883d6c94..0f4019546592 100644 --- a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx @@ -202,7 +202,7 @@ TextLabelItemConverter::TextLabelItemConverter( const rtl::Reference<::chart::ChartModel>& xChartModel, const uno::Reference<beans::XPropertySet>& rPropertySet, const rtl::Reference<DataSeries>& xSeries, - SfxItemPool& rItemPool, const awt::Size* pRefSize, + SfxItemPool& rItemPool, const std::optional<awt::Size>& pRefSize, bool bDataSeries, sal_Int32 nNumberFormat, sal_Int32 nPercentNumberFormat ) : ItemConverter(rPropertySet, rItemPool), mnNumberFormat(nNumberFormat), diff --git a/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx index 7a3f57af5703..1327a0a0d91b 100644 --- a/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx @@ -50,7 +50,7 @@ public: FormattedStringsConverter( const uno::Sequence< uno::Reference< chart2::XFormattedString > > & aStrings, SfxItemPool & rItemPool, - const awt::Size* pRefSize, + const std::optional<awt::Size>& pRefSize, const uno::Reference< beans::XPropertySet > & xParentProp ); protected: @@ -62,7 +62,7 @@ protected: FormattedStringsConverter::FormattedStringsConverter( const uno::Sequence< uno::Reference< chart2::XFormattedString > > & aStrings, SfxItemPool & rItemPool, - const awt::Size* pRefSize, + const std::optional<awt::Size>& pRefSize, const uno::Reference< beans::XPropertySet > & xParentProp ) : MultipleItemConverter( rItemPool ) { @@ -92,7 +92,7 @@ TitleItemConverter::TitleItemConverter( SfxItemPool& rItemPool, SdrModel& rDrawModel, const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory, - const awt::Size* pRefSize ) : + const std::optional<awt::Size>& pRefSize ) : ItemConverter( rPropertySet, rItemPool ) { m_aConverters.emplace_back( new GraphicPropertyItemConverter( diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx index 27d167bf70f9..9dccb435ebf0 100644 --- a/chart2/source/controller/main/ChartController_Properties.cxx +++ b/chart2/source/controller/main/ChartController_Properties.cxx @@ -112,26 +112,26 @@ wrapper::ItemConverter* createItemConverter( break; case OBJECTTYPE_TITLE: { - std::unique_ptr<awt::Size> pRefSize; + std::optional<awt::Size> pRefSize; if (pRefSizeProvider) - pRefSize.reset(new awt::Size(pRefSizeProvider->getPageSize())); + pRefSize.emplace(pRefSizeProvider->getPageSize()); pItemConverter = new wrapper::TitleItemConverter( xObjectProperties, rDrawModel.GetItemPool(), rDrawModel, xChartModel, - pRefSize.get()); + pRefSize); } break; case OBJECTTYPE_LEGEND: { - std::unique_ptr<awt::Size> pRefSize; + std::optional<awt::Size> pRefSize; if (pRefSizeProvider) - pRefSize.reset( new awt::Size( pRefSizeProvider->getPageSize())); + pRefSize.emplace( pRefSizeProvider->getPageSize() ); pItemConverter = new wrapper::LegendItemConverter( xObjectProperties, rDrawModel.GetItemPool(), rDrawModel, xChartModel, - pRefSize.get()); + pRefSize); } break; case OBJECTTYPE_LEGEND_ENTRY: @@ -147,9 +147,9 @@ wrapper::ItemConverter* createItemConverter( break; case OBJECTTYPE_AXIS: { - std::unique_ptr<awt::Size> pRefSize; + std::optional<awt::Size> pRefSize; if (pRefSizeProvider) - pRefSize.reset( new awt::Size( pRefSizeProvider->getPageSize())); + pRefSize.emplace( pRefSizeProvider->getPageSize() ); // the second property set contains the property CoordinateOrigin // nOriginIndex is the index of the corresponding index of the @@ -167,7 +167,7 @@ wrapper::ItemConverter* createItemConverter( rDrawModel, xChartModel, &aExplicitScale, &aExplicitIncrement, - pRefSize.get() ); + pRefSize ); } break; case OBJECTTYPE_AXIS_UNITLABEL: @@ -175,9 +175,9 @@ wrapper::ItemConverter* createItemConverter( case OBJECTTYPE_DATA_LABELS: case OBJECTTYPE_DATA_LABEL: { - std::unique_ptr<awt::Size> pRefSize; + std::optional<awt::Size> pRefSize; if (pRefSizeProvider) - pRefSize.reset( new awt::Size( pRefSizeProvider->getPageSize())); + pRefSize.emplace( pRefSizeProvider->getPageSize() ); rtl::Reference<DataSeries> xSeries = ObjectIdentifier::getDataSeriesForCID(aObjectCID, xChartModel); @@ -189,16 +189,16 @@ wrapper::ItemConverter* createItemConverter( pItemConverter = new wrapper::TextLabelItemConverter( xChartModel, xObjectProperties, xSeries, - rDrawModel.GetItemPool(), pRefSize.get(), bDataSeries, + rDrawModel.GetItemPool(), pRefSize, bDataSeries, nNumberFormat, nPercentNumberFormat); } break; case OBJECTTYPE_DATA_SERIES: case OBJECTTYPE_DATA_POINT: { - std::unique_ptr<awt::Size> pRefSize; + std::optional<awt::Size> pRefSize; if (pRefSizeProvider) - pRefSize.reset( new awt::Size( pRefSizeProvider->getPageSize())); + pRefSize.emplace( pRefSizeProvider->getPageSize() ); wrapper::GraphicObjectType eMapTo = wrapper::GraphicObjectType::FilledDataPoint; @@ -243,7 +243,7 @@ wrapper::ItemConverter* createItemConverter( pItemConverter = new wrapper::DataPointItemConverter( xChartModel, xContext, xObjectProperties, xSeries, rDrawModel.GetItemPool(), rDrawModel, xChartModel, - eMapTo, pRefSize.get(), bDataSeries, bUseSpecialFillColor, nSpecialFillColor, true, + eMapTo, pRefSize, bDataSeries, bUseSpecialFillColor, nSpecialFillColor, true, nNumberFormat, nPercentNumberFormat, nPointIndex ); break; } @@ -273,14 +273,14 @@ wrapper::ItemConverter* createItemConverter( break; case OBJECTTYPE_DATA_CURVE_EQUATION: { - std::unique_ptr<awt::Size> pRefSize; + std::optional<awt::Size> pRefSize; if (pRefSizeProvider) - pRefSize.reset(new awt::Size(pRefSizeProvider->getPageSize())); + pRefSize.emplace(pRefSizeProvider->getPageSize()); pItemConverter = new wrapper::RegressionEquationItemConverter( xObjectProperties, rDrawModel.GetItemPool(), rDrawModel, xChartModel, - pRefSize.get()); + pRefSize); break; } case OBJECTTYPE_DATA_STOCK_RANGE: @@ -314,13 +314,13 @@ wrapper::ItemConverter* createItemConverter( break; case OBJECTTYPE_AXIS: { - std::unique_ptr<awt::Size> pRefSize; + std::optional<awt::Size> pRefSize; if (pRefSizeProvider) - pRefSize.reset( new awt::Size( pRefSizeProvider->getPageSize())); + pRefSize.emplace( pRefSizeProvider->getPageSize() ); pItemConverter = new wrapper::AllAxisItemConverter( xChartModel, rDrawModel.GetItemPool(), - rDrawModel, pRefSize.get()); + rDrawModel, pRefSize ); } break; case OBJECTTYPE_GRID: |