Kaydet (Commit) 6d157312 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in chart2 *ItemConverter

Change-Id: I83da56774b37b1c9c6abc4d6b1e7624db3f66de4
Reviewed-on: https://gerrit.libreoffice.org/55696Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 7f19b2fa
...@@ -68,7 +68,7 @@ protected: ...@@ -68,7 +68,7 @@ protected:
virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override; virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override;
private: private:
std::vector< ItemConverter * > m_aConverters; std::vector< std::unique_ptr<ItemConverter> > m_aConverters;
bool m_bDataSeries; bool m_bDataSeries;
bool m_bOverwriteLabelsForAttributedDataPointsAlso; bool m_bOverwriteLabelsForAttributedDataPointsAlso;
bool m_bUseSpecialFillColor; bool m_bUseSpecialFillColor;
......
...@@ -55,7 +55,7 @@ protected: ...@@ -55,7 +55,7 @@ protected:
virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override; virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override;
private: private:
std::vector< ItemConverter * > m_aConverters; std::vector< std::unique_ptr<ItemConverter> > m_aConverters;
}; };
} // namespace wrapper } // namespace wrapper
......
...@@ -41,7 +41,7 @@ public: ...@@ -41,7 +41,7 @@ public:
protected: protected:
MultipleItemConverter( SfxItemPool& rItemPool ); MultipleItemConverter( SfxItemPool& rItemPool );
std::vector< ItemConverter * > m_aConverters; std::vector< std::unique_ptr<ItemConverter> > m_aConverters;
}; };
}} }}
......
...@@ -55,7 +55,7 @@ protected: ...@@ -55,7 +55,7 @@ protected:
virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override; virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override;
private: private:
std::vector< ItemConverter * > m_aConverters; std::vector< std::unique_ptr<ItemConverter> > m_aConverters;
}; };
}} }}
......
...@@ -55,7 +55,7 @@ protected: ...@@ -55,7 +55,7 @@ protected:
virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override; virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override;
private: private:
std::vector<ItemConverter*> maConverters; std::vector<std::unique_ptr<ItemConverter>> maConverters;
sal_Int32 mnNumberFormat; sal_Int32 mnNumberFormat;
sal_Int32 mnPercentNumberFormat; sal_Int32 mnPercentNumberFormat;
css::uno::Sequence<sal_Int32> maAvailableLabelPlacements; css::uno::Sequence<sal_Int32> maAvailableLabelPlacements;
......
...@@ -51,7 +51,7 @@ protected: ...@@ -51,7 +51,7 @@ protected:
virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override; virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override;
private: private:
std::vector< ItemConverter * > m_aConverters; std::vector< std::unique_ptr<ItemConverter> > m_aConverters;
}; };
}} }}
......
...@@ -215,13 +215,13 @@ DataPointItemConverter::DataPointItemConverter( ...@@ -215,13 +215,13 @@ DataPointItemConverter::DataPointItemConverter(
m_aAvailableLabelPlacements(), m_aAvailableLabelPlacements(),
m_bForbidPercentValue(true) m_bForbidPercentValue(true)
{ {
m_aConverters.push_back( new GraphicPropertyItemConverter( m_aConverters.emplace_back( new GraphicPropertyItemConverter(
rPropertySet, rItemPool, rDrawModel, xNamedPropertyContainerFactory, eMapTo )); rPropertySet, rItemPool, rDrawModel, xNamedPropertyContainerFactory, eMapTo ));
m_aConverters.push_back( new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize")); m_aConverters.emplace_back( new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize"));
if( bDataSeries ) if( bDataSeries )
{ {
m_aConverters.push_back( new StatisticsItemConverter( xChartModel, rPropertySet, rItemPool )); m_aConverters.emplace_back( new StatisticsItemConverter( xChartModel, rPropertySet, rItemPool ));
m_aConverters.push_back( new SeriesOptionsItemConverter( xChartModel, xContext, rPropertySet, rItemPool )); m_aConverters.emplace_back( new SeriesOptionsItemConverter( xChartModel, xContext, rPropertySet, rItemPool ));
} }
uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram(xChartModel) ); uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram(xChartModel) );
...@@ -236,7 +236,6 @@ DataPointItemConverter::DataPointItemConverter( ...@@ -236,7 +236,6 @@ DataPointItemConverter::DataPointItemConverter(
DataPointItemConverter::~DataPointItemConverter() DataPointItemConverter::~DataPointItemConverter()
{ {
std::for_each(m_aConverters.begin(), m_aConverters.end(), std::default_delete<ItemConverter>());
} }
void DataPointItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const void DataPointItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
......
...@@ -49,17 +49,16 @@ LegendItemConverter::LegendItemConverter( ...@@ -49,17 +49,16 @@ LegendItemConverter::LegendItemConverter(
const awt::Size* pRefSize ) : const awt::Size* pRefSize ) :
ItemConverter( rPropertySet, rItemPool ) ItemConverter( rPropertySet, rItemPool )
{ {
m_aConverters.push_back( new GraphicPropertyItemConverter( m_aConverters.emplace_back( new GraphicPropertyItemConverter(
rPropertySet, rItemPool, rDrawModel, xNamedPropertyContainerFactory, rPropertySet, rItemPool, rDrawModel, xNamedPropertyContainerFactory,
GraphicObjectType::LineAndFillProperties )); GraphicObjectType::LineAndFillProperties ));
m_aConverters.push_back( new CharacterPropertyItemConverter( m_aConverters.emplace_back( new CharacterPropertyItemConverter(
rPropertySet, rItemPool, pRefSize, rPropertySet, rItemPool, pRefSize,
"ReferencePageSize" )); "ReferencePageSize" ));
} }
LegendItemConverter::~LegendItemConverter() LegendItemConverter::~LegendItemConverter()
{ {
std::for_each( m_aConverters.begin(), m_aConverters.end(), std::default_delete<ItemConverter>());
} }
void LegendItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const void LegendItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
......
...@@ -51,7 +51,7 @@ AllAxisItemConverter::AllAxisItemConverter( ...@@ -51,7 +51,7 @@ AllAxisItemConverter::AllAxisItemConverter(
for( sal_Int32 nA = 0; nA < aElementList.getLength(); nA++ ) for( sal_Int32 nA = 0; nA < aElementList.getLength(); nA++ )
{ {
uno::Reference< beans::XPropertySet > xObjectProperties(aElementList[nA], uno::UNO_QUERY); uno::Reference< beans::XPropertySet > xObjectProperties(aElementList[nA], uno::UNO_QUERY);
m_aConverters.push_back( new ::chart::wrapper::AxisItemConverter( m_aConverters.emplace_back( new ::chart::wrapper::AxisItemConverter(
xObjectProperties, rItemPool, rDrawModel, xObjectProperties, rItemPool, rDrawModel,
uno::Reference< chart2::XChartDocument >( xChartModel, uno::UNO_QUERY ), nullptr, nullptr, uno::Reference< chart2::XChartDocument >( xChartModel, uno::UNO_QUERY ), nullptr, nullptr,
pRefSize)); pRefSize));
...@@ -80,7 +80,7 @@ AllGridItemConverter::AllGridItemConverter( ...@@ -80,7 +80,7 @@ AllGridItemConverter::AllGridItemConverter(
for( sal_Int32 nA = 0; nA < aElementList.getLength(); nA++ ) for( sal_Int32 nA = 0; nA < aElementList.getLength(); nA++ )
{ {
Reference< beans::XPropertySet > xObjectProperties(aElementList[nA]); Reference< beans::XPropertySet > xObjectProperties(aElementList[nA]);
m_aConverters.push_back( new ::chart::wrapper::GraphicPropertyItemConverter( m_aConverters.emplace_back( new ::chart::wrapper::GraphicPropertyItemConverter(
xObjectProperties, rItemPool, rDrawModel, xNamedPropertyContainerFactory, xObjectProperties, rItemPool, rDrawModel, xNamedPropertyContainerFactory,
::chart::wrapper::GraphicObjectType::LineProperties ) ); ::chart::wrapper::GraphicObjectType::LineProperties ) );
} }
...@@ -115,7 +115,7 @@ AllDataLabelItemConverter::AllDataLabelItemConverter( ...@@ -115,7 +115,7 @@ AllDataLabelItemConverter::AllDataLabelItemConverter(
sal_Int32 nPercentNumberFormat=ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForDataLabel( sal_Int32 nPercentNumberFormat=ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForDataLabel(
xObjectProperties,uno::Reference< util::XNumberFormatsSupplier >(xChartModel, uno::UNO_QUERY)); xObjectProperties,uno::Reference< util::XNumberFormatsSupplier >(xChartModel, uno::UNO_QUERY));
m_aConverters.push_back( m_aConverters.emplace_back(
new ::chart::wrapper::DataPointItemConverter( new ::chart::wrapper::DataPointItemConverter(
xChartModel, xContext, xObjectProperties, series, rItemPool, rDrawModel, xChartModel, xContext, xObjectProperties, series, rItemPool, rDrawModel,
xNamedPropertyContainerFactory, GraphicObjectType::FilledDataPoint, xNamedPropertyContainerFactory, GraphicObjectType::FilledDataPoint,
...@@ -146,7 +146,7 @@ AllTitleItemConverter::AllTitleItemConverter( ...@@ -146,7 +146,7 @@ AllTitleItemConverter::AllTitleItemConverter(
if(!xTitle.is()) if(!xTitle.is())
continue; continue;
uno::Reference< beans::XPropertySet > xObjectProperties( xTitle, uno::UNO_QUERY); uno::Reference< beans::XPropertySet > xObjectProperties( xTitle, uno::UNO_QUERY);
m_aConverters.push_back( m_aConverters.emplace_back(
new ::chart::wrapper::TitleItemConverter( new ::chart::wrapper::TitleItemConverter(
xObjectProperties, rItemPool, rDrawModel, xNamedPropertyContainerFactory, nullptr)); xObjectProperties, rItemPool, rDrawModel, xNamedPropertyContainerFactory, nullptr));
} }
...@@ -173,7 +173,7 @@ AllSeriesStatisticsConverter::AllSeriesStatisticsConverter( ...@@ -173,7 +173,7 @@ AllSeriesStatisticsConverter::AllSeriesStatisticsConverter(
for (auto const& series : aSeriesList) for (auto const& series : aSeriesList)
{ {
uno::Reference< beans::XPropertySet > xObjectProperties(series, uno::UNO_QUERY); uno::Reference< beans::XPropertySet > xObjectProperties(series, uno::UNO_QUERY);
m_aConverters.push_back( new ::chart::wrapper::StatisticsItemConverter( m_aConverters.emplace_back( new ::chart::wrapper::StatisticsItemConverter(
xChartModel, xObjectProperties, rItemPool )); xChartModel, xObjectProperties, rItemPool ));
} }
} }
......
...@@ -33,13 +33,12 @@ MultipleItemConverter::MultipleItemConverter( SfxItemPool& rItemPool ) ...@@ -33,13 +33,12 @@ MultipleItemConverter::MultipleItemConverter( SfxItemPool& rItemPool )
} }
MultipleItemConverter::~MultipleItemConverter() MultipleItemConverter::~MultipleItemConverter()
{ {
std::for_each( m_aConverters.begin(), m_aConverters.end(), std::default_delete<ItemConverter>());
} }
void MultipleItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const void MultipleItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
{ {
std::vector< ItemConverter* >::const_iterator aIter = m_aConverters.begin(); auto aIter = m_aConverters.begin();
const std::vector< ItemConverter* >::const_iterator aEnd = m_aConverters.end(); auto aEnd = m_aConverters.end();
if( aIter != aEnd ) if( aIter != aEnd )
{ {
(*aIter)->FillItemSet( rOutItemSet ); (*aIter)->FillItemSet( rOutItemSet );
......
...@@ -55,18 +55,17 @@ RegressionEquationItemConverter::RegressionEquationItemConverter( ...@@ -55,18 +55,17 @@ RegressionEquationItemConverter::RegressionEquationItemConverter(
const awt::Size* pRefSize ) : const awt::Size* pRefSize ) :
ItemConverter( rPropertySet, rItemPool ) ItemConverter( rPropertySet, rItemPool )
{ {
m_aConverters.push_back( new GraphicPropertyItemConverter( m_aConverters.emplace_back( new GraphicPropertyItemConverter(
rPropertySet, rItemPool, rDrawModel, rPropertySet, rItemPool, rDrawModel,
xNamedPropertyContainerFactory, xNamedPropertyContainerFactory,
GraphicObjectType::LineAndFillProperties )); GraphicObjectType::LineAndFillProperties ));
m_aConverters.push_back( m_aConverters.emplace_back(
new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize")); new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize"));
} }
RegressionEquationItemConverter::~RegressionEquationItemConverter() RegressionEquationItemConverter::~RegressionEquationItemConverter()
{ {
std::for_each(m_aConverters.begin(), m_aConverters.end(), std::default_delete<ItemConverter>());
} }
void RegressionEquationItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const void RegressionEquationItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
......
...@@ -194,7 +194,7 @@ TextLabelItemConverter::TextLabelItemConverter( ...@@ -194,7 +194,7 @@ TextLabelItemConverter::TextLabelItemConverter(
mbDataSeries(bDataSeries), mbDataSeries(bDataSeries),
mbForbidPercentValue(true) mbForbidPercentValue(true)
{ {
maConverters.push_back(new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize")); maConverters.emplace_back(new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize"));
uno::Reference<XDiagram> xDiagram(ChartModelHelper::findDiagram(xChartModel)); uno::Reference<XDiagram> xDiagram(ChartModelHelper::findDiagram(xChartModel));
uno::Reference<XChartType> xChartType(DiagramHelper::getChartTypeOfSeries(xDiagram, xSeries)); uno::Reference<XChartType> xChartType(DiagramHelper::getChartTypeOfSeries(xDiagram, xSeries));
...@@ -208,7 +208,6 @@ TextLabelItemConverter::TextLabelItemConverter( ...@@ -208,7 +208,6 @@ TextLabelItemConverter::TextLabelItemConverter(
TextLabelItemConverter::~TextLabelItemConverter() TextLabelItemConverter::~TextLabelItemConverter()
{ {
std::for_each(maConverters.begin(), maConverters.end(), std::default_delete<ItemConverter>());
} }
void TextLabelItemConverter::FillItemSet( SfxItemSet& rOutItemSet ) const void TextLabelItemConverter::FillItemSet( SfxItemSet& rOutItemSet ) const
......
...@@ -74,11 +74,11 @@ FormattedStringsConverter::FormattedStringsConverter( ...@@ -74,11 +74,11 @@ FormattedStringsConverter::FormattedStringsConverter(
if( xProp.is()) if( xProp.is())
{ {
if( bHasRefSize ) if( bHasRefSize )
m_aConverters.push_back( m_aConverters.emplace_back(
new CharacterPropertyItemConverter( new CharacterPropertyItemConverter(
xProp, rItemPool, pRefSize, "ReferencePageSize", xParentProp)); xProp, rItemPool, pRefSize, "ReferencePageSize", xParentProp));
else else
m_aConverters.push_back( new CharacterPropertyItemConverter( xProp, rItemPool )); m_aConverters.emplace_back( new CharacterPropertyItemConverter( xProp, rItemPool ));
} }
} }
} }
...@@ -96,7 +96,7 @@ TitleItemConverter::TitleItemConverter( ...@@ -96,7 +96,7 @@ TitleItemConverter::TitleItemConverter(
const awt::Size* pRefSize ) : const awt::Size* pRefSize ) :
ItemConverter( rPropertySet, rItemPool ) ItemConverter( rPropertySet, rItemPool )
{ {
m_aConverters.push_back( new GraphicPropertyItemConverter( m_aConverters.emplace_back( new GraphicPropertyItemConverter(
rPropertySet, rItemPool, rDrawModel, rPropertySet, rItemPool, rDrawModel,
xNamedPropertyContainerFactory, xNamedPropertyContainerFactory,
GraphicObjectType::LineAndFillProperties )); GraphicObjectType::LineAndFillProperties ));
...@@ -109,7 +109,7 @@ TitleItemConverter::TitleItemConverter( ...@@ -109,7 +109,7 @@ TitleItemConverter::TitleItemConverter(
uno::Sequence< uno::Reference< chart2::XFormattedString > > aStringSeq( xTitle->getText()); uno::Sequence< uno::Reference< chart2::XFormattedString > > aStringSeq( xTitle->getText());
if( aStringSeq.getLength() > 0 ) if( aStringSeq.getLength() > 0 )
{ {
m_aConverters.push_back( m_aConverters.emplace_back(
new FormattedStringsConverter( aStringSeq, rItemPool, pRefSize, rPropertySet )); new FormattedStringsConverter( aStringSeq, rItemPool, pRefSize, rPropertySet ));
} }
} }
...@@ -117,7 +117,6 @@ TitleItemConverter::TitleItemConverter( ...@@ -117,7 +117,6 @@ TitleItemConverter::TitleItemConverter(
TitleItemConverter::~TitleItemConverter() TitleItemConverter::~TitleItemConverter()
{ {
std::for_each(m_aConverters.begin(), m_aConverters.end(), std::default_delete<ItemConverter>());
} }
void TitleItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const void TitleItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment