diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-28 16:00:56 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-05 07:29:18 +0100 |
commit | 4b44ab2fdf0d71428bdec3ca4090e7968851b24d (patch) | |
tree | 12de733871db8ebd1538374a36d3f6fd3ef9aada | |
parent | 9110118117d45a6cff1c50f3bd3087f97206ff51 (diff) |
loplugin:useuniqueptr in AxisItemConverter
Change-Id: Idbe3a52a62da43e86e9695a3f1519d611e63011a
Reviewed-on: https://gerrit.libreoffice.org/50698
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | chart2/source/controller/inc/AxisItemConverter.hxx | 6 | ||||
-rw-r--r-- | chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx | 16 |
2 files changed, 8 insertions, 14 deletions
diff --git a/chart2/source/controller/inc/AxisItemConverter.hxx b/chart2/source/controller/inc/AxisItemConverter.hxx index ad742691ada5..3a82e54124af 100644 --- a/chart2/source/controller/inc/AxisItemConverter.hxx +++ b/chart2/source/controller/inc/AxisItemConverter.hxx @@ -56,15 +56,15 @@ 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; css::uno::Reference< css::chart2::XAxis > m_xAxis; css::uno::Reference< css::chart2::XChartDocument > m_xChartDoc; - ExplicitScaleData* m_pExplicitScale; - ExplicitIncrementData* m_pExplicitIncrement; + std::unique_ptr<ExplicitScaleData> m_pExplicitScale; + std::unique_ptr<ExplicitIncrementData> m_pExplicitIncrement; }; }} diff --git a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx index 6b59fcb5394f..b0ba96674cf9 100644 --- a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx @@ -80,22 +80,20 @@ AxisItemConverter::AxisItemConverter( ::chart::ExplicitIncrementData const * pIncrement /* = NULL */, const awt::Size* pRefSize ) : ItemConverter( rPropertySet, rItemPool ), - m_xChartDoc( xChartDoc ), - m_pExplicitScale( nullptr ), - m_pExplicitIncrement( nullptr ) + m_xChartDoc( xChartDoc ) { Reference< lang::XMultiServiceFactory > xNamedPropertyContainerFactory( xChartDoc, uno::UNO_QUERY ); if( pScale ) - m_pExplicitScale = new ::chart::ExplicitScaleData( *pScale ); + m_pExplicitScale.reset( new ::chart::ExplicitScaleData( *pScale ) ); if( pIncrement ) - m_pExplicitIncrement = new ::chart::ExplicitIncrementData( *pIncrement ); + m_pExplicitIncrement.reset( new ::chart::ExplicitIncrementData( *pIncrement ) ); - m_aConverters.push_back( new GraphicPropertyItemConverter( + m_aConverters.emplace_back( new GraphicPropertyItemConverter( rPropertySet, rItemPool, rDrawModel, xNamedPropertyContainerFactory, GraphicObjectType::LineProperties )); - m_aConverters.push_back( + m_aConverters.emplace_back( new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize")); m_xAxis.set( Reference< chart2::XAxis >( rPropertySet, uno::UNO_QUERY ) ); @@ -104,10 +102,6 @@ AxisItemConverter::AxisItemConverter( AxisItemConverter::~AxisItemConverter() { - delete m_pExplicitScale; - delete m_pExplicitIncrement; - - std::for_each(m_aConverters.begin(), m_aConverters.end(), std::default_delete<ItemConverter>()); } void AxisItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const |