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>
This commit is contained in:
parent
e4c8f63c90
commit
40cec25c21
17 changed files with 55 additions and 51 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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>() );
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
|
|
@ -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 ),
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue