chart2/source/controller/inc/DataPointItemConverter.hxx | 2 +- chart2/source/controller/inc/LegendItemConverter.hxx | 2 +- chart2/source/controller/inc/MultipleItemConverter.hxx | 2 +- chart2/source/controller/inc/RegressionEquationItemConverter.hxx | 2 +- chart2/source/controller/inc/TextLabelItemConverter.hxx | 2 +- chart2/source/controller/inc/TitleItemConverter.hxx | 2 +- chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx | 9 ++++----- chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx | 5 ++--- chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx | 10 +++++----- chart2/source/controller/itemsetwrapper/MultipleItemConverter.cxx | 5 ++--- chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx | 5 ++--- chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx | 3 +-- chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx | 9 ++++----- 13 files changed, 26 insertions(+), 32 deletions(-)
New commits: commit 6d157312023513acfb999f6968ecfc76bf80cf61 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Tue Jun 12 15:03:03 2018 +0200 loplugin:useuniqueptr in chart2 *ItemConverter Change-Id: I83da56774b37b1c9c6abc4d6b1e7624db3f66de4 Reviewed-on: https://gerrit.libreoffice.org/55696 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/chart2/source/controller/inc/DataPointItemConverter.hxx b/chart2/source/controller/inc/DataPointItemConverter.hxx index 46bb8745c5ca..ea7b675f33fa 100644 --- a/chart2/source/controller/inc/DataPointItemConverter.hxx +++ b/chart2/source/controller/inc/DataPointItemConverter.hxx @@ -68,7 +68,7 @@ protected: virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override; private: - std::vector< ItemConverter * > m_aConverters; + std::vector< std::unique_ptr<ItemConverter> > m_aConverters; bool m_bDataSeries; bool m_bOverwriteLabelsForAttributedDataPointsAlso; bool m_bUseSpecialFillColor; diff --git a/chart2/source/controller/inc/LegendItemConverter.hxx b/chart2/source/controller/inc/LegendItemConverter.hxx index d039e84d34a8..231f857f16e6 100644 --- a/chart2/source/controller/inc/LegendItemConverter.hxx +++ b/chart2/source/controller/inc/LegendItemConverter.hxx @@ -55,7 +55,7 @@ protected: virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override; private: - std::vector< ItemConverter * > m_aConverters; + std::vector< std::unique_ptr<ItemConverter> > m_aConverters; }; } // namespace wrapper diff --git a/chart2/source/controller/inc/MultipleItemConverter.hxx b/chart2/source/controller/inc/MultipleItemConverter.hxx index 3abcbb05144b..698f7578e2f4 100644 --- a/chart2/source/controller/inc/MultipleItemConverter.hxx +++ b/chart2/source/controller/inc/MultipleItemConverter.hxx @@ -41,7 +41,7 @@ public: protected: MultipleItemConverter( SfxItemPool& rItemPool ); - std::vector< ItemConverter * > m_aConverters; + std::vector< std::unique_ptr<ItemConverter> > m_aConverters; }; }} diff --git a/chart2/source/controller/inc/RegressionEquationItemConverter.hxx b/chart2/source/controller/inc/RegressionEquationItemConverter.hxx index c664acc1858c..d2a80c933663 100644 --- a/chart2/source/controller/inc/RegressionEquationItemConverter.hxx +++ b/chart2/source/controller/inc/RegressionEquationItemConverter.hxx @@ -55,7 +55,7 @@ protected: virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override; private: - std::vector< ItemConverter * > m_aConverters; + std::vector< std::unique_ptr<ItemConverter> > m_aConverters; }; }} diff --git a/chart2/source/controller/inc/TextLabelItemConverter.hxx b/chart2/source/controller/inc/TextLabelItemConverter.hxx index 1cde585eeb7b..f1e227691c14 100644 --- a/chart2/source/controller/inc/TextLabelItemConverter.hxx +++ b/chart2/source/controller/inc/TextLabelItemConverter.hxx @@ -55,7 +55,7 @@ protected: virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override; private: - std::vector<ItemConverter*> maConverters; + std::vector<std::unique_ptr<ItemConverter>> maConverters; sal_Int32 mnNumberFormat; sal_Int32 mnPercentNumberFormat; css::uno::Sequence<sal_Int32> maAvailableLabelPlacements; diff --git a/chart2/source/controller/inc/TitleItemConverter.hxx b/chart2/source/controller/inc/TitleItemConverter.hxx index 7e88fe659b6f..7d28217f79fd 100644 --- a/chart2/source/controller/inc/TitleItemConverter.hxx +++ b/chart2/source/controller/inc/TitleItemConverter.hxx @@ -51,7 +51,7 @@ protected: virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override; private: - std::vector< ItemConverter * > m_aConverters; + std::vector< std::unique_ptr<ItemConverter> > m_aConverters; }; }} diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx index 9aa54f554bb9..d9642c3df9a7 100644 --- a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx @@ -215,13 +215,13 @@ DataPointItemConverter::DataPointItemConverter( m_aAvailableLabelPlacements(), m_bForbidPercentValue(true) { - m_aConverters.push_back( new GraphicPropertyItemConverter( + m_aConverters.emplace_back( new GraphicPropertyItemConverter( 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 ) { - m_aConverters.push_back( new StatisticsItemConverter( xChartModel, rPropertySet, rItemPool )); - m_aConverters.push_back( new SeriesOptionsItemConverter( xChartModel, xContext, rPropertySet, rItemPool )); + m_aConverters.emplace_back( new StatisticsItemConverter( xChartModel, rPropertySet, rItemPool )); + m_aConverters.emplace_back( new SeriesOptionsItemConverter( xChartModel, xContext, rPropertySet, rItemPool )); } uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram(xChartModel) ); @@ -236,7 +236,6 @@ DataPointItemConverter::DataPointItemConverter( DataPointItemConverter::~DataPointItemConverter() { - std::for_each(m_aConverters.begin(), m_aConverters.end(), std::default_delete<ItemConverter>()); } void DataPointItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const diff --git a/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx b/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx index 0c6bbca33d59..b9d13e0adc6d 100644 --- a/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx @@ -49,17 +49,16 @@ LegendItemConverter::LegendItemConverter( const awt::Size* pRefSize ) : ItemConverter( rPropertySet, rItemPool ) { - m_aConverters.push_back( new GraphicPropertyItemConverter( + m_aConverters.emplace_back( new GraphicPropertyItemConverter( rPropertySet, rItemPool, rDrawModel, xNamedPropertyContainerFactory, GraphicObjectType::LineAndFillProperties )); - m_aConverters.push_back( new CharacterPropertyItemConverter( + m_aConverters.emplace_back( new CharacterPropertyItemConverter( rPropertySet, rItemPool, pRefSize, "ReferencePageSize" )); } LegendItemConverter::~LegendItemConverter() { - std::for_each( m_aConverters.begin(), m_aConverters.end(), std::default_delete<ItemConverter>()); } void LegendItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const diff --git a/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx b/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx index b9e75ea51111..98dc4d56791a 100644 --- a/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx +++ b/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx @@ -51,7 +51,7 @@ AllAxisItemConverter::AllAxisItemConverter( for( sal_Int32 nA = 0; nA < aElementList.getLength(); nA++ ) { 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, uno::Reference< chart2::XChartDocument >( xChartModel, uno::UNO_QUERY ), nullptr, nullptr, pRefSize)); @@ -80,7 +80,7 @@ AllGridItemConverter::AllGridItemConverter( for( sal_Int32 nA = 0; nA < aElementList.getLength(); 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, ::chart::wrapper::GraphicObjectType::LineProperties ) ); } @@ -115,7 +115,7 @@ AllDataLabelItemConverter::AllDataLabelItemConverter( sal_Int32 nPercentNumberFormat=ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForDataLabel( xObjectProperties,uno::Reference< util::XNumberFormatsSupplier >(xChartModel, uno::UNO_QUERY)); - m_aConverters.push_back( + m_aConverters.emplace_back( new ::chart::wrapper::DataPointItemConverter( xChartModel, xContext, xObjectProperties, series, rItemPool, rDrawModel, xNamedPropertyContainerFactory, GraphicObjectType::FilledDataPoint, @@ -146,7 +146,7 @@ AllTitleItemConverter::AllTitleItemConverter( if(!xTitle.is()) continue; uno::Reference< beans::XPropertySet > xObjectProperties( xTitle, uno::UNO_QUERY); - m_aConverters.push_back( + m_aConverters.emplace_back( new ::chart::wrapper::TitleItemConverter( xObjectProperties, rItemPool, rDrawModel, xNamedPropertyContainerFactory, nullptr)); } @@ -173,7 +173,7 @@ AllSeriesStatisticsConverter::AllSeriesStatisticsConverter( for (auto const& series : aSeriesList) { 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 )); } } diff --git a/chart2/source/controller/itemsetwrapper/MultipleItemConverter.cxx b/chart2/source/controller/itemsetwrapper/MultipleItemConverter.cxx index 3ff5f0a662f4..0e0b33c151de 100644 --- a/chart2/source/controller/itemsetwrapper/MultipleItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/MultipleItemConverter.cxx @@ -33,13 +33,12 @@ MultipleItemConverter::MultipleItemConverter( SfxItemPool& rItemPool ) } MultipleItemConverter::~MultipleItemConverter() { - std::for_each( m_aConverters.begin(), m_aConverters.end(), std::default_delete<ItemConverter>()); } void MultipleItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const { - std::vector< ItemConverter* >::const_iterator aIter = m_aConverters.begin(); - const std::vector< ItemConverter* >::const_iterator aEnd = m_aConverters.end(); + auto aIter = m_aConverters.begin(); + auto aEnd = m_aConverters.end(); if( aIter != aEnd ) { (*aIter)->FillItemSet( rOutItemSet ); diff --git a/chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx b/chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx index 86a0e2c6dd69..f2abc74ad764 100644 --- a/chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx @@ -55,18 +55,17 @@ RegressionEquationItemConverter::RegressionEquationItemConverter( const awt::Size* pRefSize ) : ItemConverter( rPropertySet, rItemPool ) { - m_aConverters.push_back( new GraphicPropertyItemConverter( + m_aConverters.emplace_back( new GraphicPropertyItemConverter( rPropertySet, rItemPool, rDrawModel, xNamedPropertyContainerFactory, GraphicObjectType::LineAndFillProperties )); - m_aConverters.push_back( + m_aConverters.emplace_back( new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize")); } RegressionEquationItemConverter::~RegressionEquationItemConverter() { - std::for_each(m_aConverters.begin(), m_aConverters.end(), std::default_delete<ItemConverter>()); } void RegressionEquationItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const diff --git a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx index d4eda866e032..20cc502b2b4d 100644 --- a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx @@ -194,7 +194,7 @@ TextLabelItemConverter::TextLabelItemConverter( mbDataSeries(bDataSeries), 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<XChartType> xChartType(DiagramHelper::getChartTypeOfSeries(xDiagram, xSeries)); @@ -208,7 +208,6 @@ TextLabelItemConverter::TextLabelItemConverter( TextLabelItemConverter::~TextLabelItemConverter() { - std::for_each(maConverters.begin(), maConverters.end(), std::default_delete<ItemConverter>()); } void TextLabelItemConverter::FillItemSet( SfxItemSet& rOutItemSet ) const diff --git a/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx index 1bfdb5b215ce..7d43b1016076 100644 --- a/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx @@ -74,11 +74,11 @@ FormattedStringsConverter::FormattedStringsConverter( if( xProp.is()) { if( bHasRefSize ) - m_aConverters.push_back( + m_aConverters.emplace_back( new CharacterPropertyItemConverter( xProp, rItemPool, pRefSize, "ReferencePageSize", xParentProp)); else - m_aConverters.push_back( new CharacterPropertyItemConverter( xProp, rItemPool )); + m_aConverters.emplace_back( new CharacterPropertyItemConverter( xProp, rItemPool )); } } } @@ -96,7 +96,7 @@ TitleItemConverter::TitleItemConverter( const awt::Size* pRefSize ) : ItemConverter( rPropertySet, rItemPool ) { - m_aConverters.push_back( new GraphicPropertyItemConverter( + m_aConverters.emplace_back( new GraphicPropertyItemConverter( rPropertySet, rItemPool, rDrawModel, xNamedPropertyContainerFactory, GraphicObjectType::LineAndFillProperties )); @@ -109,7 +109,7 @@ TitleItemConverter::TitleItemConverter( uno::Sequence< uno::Reference< chart2::XFormattedString > > aStringSeq( xTitle->getText()); if( aStringSeq.getLength() > 0 ) { - m_aConverters.push_back( + m_aConverters.emplace_back( new FormattedStringsConverter( aStringSeq, rItemPool, pRefSize, rPropertySet )); } } @@ -117,7 +117,6 @@ TitleItemConverter::TitleItemConverter( TitleItemConverter::~TitleItemConverter() { - std::for_each(m_aConverters.begin(), m_aConverters.end(), std::default_delete<ItemConverter>()); } void TitleItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits