Kaydet (Commit) 4b44ab2f authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in AxisItemConverter

Change-Id: Idbe3a52a62da43e86e9695a3f1519d611e63011a
Reviewed-on: https://gerrit.libreoffice.org/50698Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 91101181
...@@ -56,15 +56,15 @@ protected: ...@@ -56,15 +56,15 @@ 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;
css::uno::Reference< css::uno::Reference<
css::chart2::XAxis > m_xAxis; css::chart2::XAxis > m_xAxis;
css::uno::Reference< css::uno::Reference<
css::chart2::XChartDocument > m_xChartDoc; css::chart2::XChartDocument > m_xChartDoc;
ExplicitScaleData* m_pExplicitScale; std::unique_ptr<ExplicitScaleData> m_pExplicitScale;
ExplicitIncrementData* m_pExplicitIncrement; std::unique_ptr<ExplicitIncrementData> m_pExplicitIncrement;
}; };
}} }}
......
...@@ -80,22 +80,20 @@ AxisItemConverter::AxisItemConverter( ...@@ -80,22 +80,20 @@ AxisItemConverter::AxisItemConverter(
::chart::ExplicitIncrementData const * pIncrement /* = NULL */, ::chart::ExplicitIncrementData const * pIncrement /* = NULL */,
const awt::Size* pRefSize ) : const awt::Size* pRefSize ) :
ItemConverter( rPropertySet, rItemPool ), ItemConverter( rPropertySet, rItemPool ),
m_xChartDoc( xChartDoc ), m_xChartDoc( xChartDoc )
m_pExplicitScale( nullptr ),
m_pExplicitIncrement( nullptr )
{ {
Reference< lang::XMultiServiceFactory > xNamedPropertyContainerFactory( xChartDoc, uno::UNO_QUERY ); Reference< lang::XMultiServiceFactory > xNamedPropertyContainerFactory( xChartDoc, uno::UNO_QUERY );
if( pScale ) if( pScale )
m_pExplicitScale = new ::chart::ExplicitScaleData( *pScale ); m_pExplicitScale.reset( new ::chart::ExplicitScaleData( *pScale ) );
if( pIncrement ) 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, rPropertySet, rItemPool, rDrawModel,
xNamedPropertyContainerFactory, xNamedPropertyContainerFactory,
GraphicObjectType::LineProperties )); GraphicObjectType::LineProperties ));
m_aConverters.push_back( m_aConverters.emplace_back(
new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize")); new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize"));
m_xAxis.set( Reference< chart2::XAxis >( rPropertySet, uno::UNO_QUERY ) ); m_xAxis.set( Reference< chart2::XAxis >( rPropertySet, uno::UNO_QUERY ) );
...@@ -104,10 +102,6 @@ AxisItemConverter::AxisItemConverter( ...@@ -104,10 +102,6 @@ AxisItemConverter::AxisItemConverter(
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 void AxisItemConverter::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