diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-04 16:37:48 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-11 08:27:50 +0200 |
commit | 9dce48ad2a25602d6cebc97827e33de3df9ddd65 (patch) | |
tree | 772566f941df9977ed30771c34a81032e9dfe674 /chart2 | |
parent | 949aecad9a6341d4994a716c22191c682e91bce7 (diff) |
loplugin:useuniqueptr in SchAttribTabDlg
Change-Id: I98b1a790fda68404cf13f21dbfb5b4493c849700
Reviewed-on: https://gerrit.libreoffice.org/55532
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2')
3 files changed, 12 insertions, 16 deletions
diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx index f4a511aa52fd..f6abe9722a82 100644 --- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx +++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx @@ -306,11 +306,11 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel const sal_uInt16 nNoArrowNoShadowDlg = 1101; -void SchAttribTabDlg::setSymbolInformation( SfxItemSet* pSymbolShapeProperties, - Graphic* pAutoSymbolGraphic ) +void SchAttribTabDlg::setSymbolInformation( std::unique_ptr<SfxItemSet> pSymbolShapeProperties, + std::unique_ptr<Graphic> pAutoSymbolGraphic ) { - m_pSymbolShapeProperties = pSymbolShapeProperties; - m_pAutoSymbolGraphic = pAutoSymbolGraphic; + m_pSymbolShapeProperties = std::move(pSymbolShapeProperties); + m_pAutoSymbolGraphic = std::move(pAutoSymbolGraphic); } void SchAttribTabDlg::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth ) @@ -484,10 +484,8 @@ SchAttribTabDlg::~SchAttribTabDlg() void SchAttribTabDlg::dispose() { - delete m_pSymbolShapeProperties; - m_pSymbolShapeProperties = nullptr; - delete m_pAutoSymbolGraphic; - m_pAutoSymbolGraphic = nullptr; + m_pSymbolShapeProperties.reset(); + m_pAutoSymbolGraphic.reset(); SfxTabDialog::dispose(); } diff --git a/chart2/source/controller/inc/dlg_ObjectProperties.hxx b/chart2/source/controller/inc/dlg_ObjectProperties.hxx index bfc1c9e09961..97bb032a02c7 100644 --- a/chart2/source/controller/inc/dlg_ObjectProperties.hxx +++ b/chart2/source/controller/inc/dlg_ObjectProperties.hxx @@ -112,8 +112,8 @@ private: const ViewElementListProvider* const m_pViewElementListProvider; SvNumberFormatter* m_pNumberFormatter; - SfxItemSet* m_pSymbolShapeProperties; - Graphic* m_pAutoSymbolGraphic; + std::unique_ptr<SfxItemSet> m_pSymbolShapeProperties; + std::unique_ptr<Graphic> m_pAutoSymbolGraphic; double m_fAxisMinorStepWidthForErrorBarDecimals; bool m_bOKPressed; @@ -133,8 +133,7 @@ public: //pSymbolShapeProperties: Properties to be set on the symbollist shapes //pAutoSymbolGraphic: Graphic to be shown if AutoSymbol gets selected - //this class takes ownership over both parameter - void setSymbolInformation( SfxItemSet* pSymbolShapeProperties, Graphic* pAutoSymbolGraphic ); + void setSymbolInformation( std::unique_ptr<SfxItemSet> pSymbolShapeProperties, std::unique_ptr<Graphic> pAutoSymbolGraphic ); void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth ); diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx index bcbe8d303930..e157064a7ab7 100644 --- a/chart2/source/controller/main/ChartController_Properties.cxx +++ b/chart2/source/controller/main/ChartController_Properties.cxx @@ -763,7 +763,6 @@ bool ChartController::executeDlg_ObjectProperties_withoutUndoGuard( if(aDialogParameter.HasSymbolProperties()) { - SfxItemSet* pSymbolShapeProperties=nullptr; uno::Reference< beans::XPropertySet > xObjectProperties = ObjectIdentifier::getObjectPropertySet( rObjectCID, getModel() ); wrapper::DataPointItemConverter aSymbolItemConverter( getModel(), m_xCC @@ -773,13 +772,13 @@ bool ChartController::executeDlg_ObjectProperties_withoutUndoGuard( , uno::Reference< lang::XMultiServiceFactory >( getModel(), uno::UNO_QUERY ) , wrapper::GraphicObjectType::FilledDataPoint ); - pSymbolShapeProperties = new SfxItemSet( aSymbolItemConverter.CreateEmptyItemSet() ); + std::unique_ptr<SfxItemSet> pSymbolShapeProperties(new SfxItemSet( aSymbolItemConverter.CreateEmptyItemSet() )); aSymbolItemConverter.FillItemSet( *pSymbolShapeProperties ); sal_Int32 const nStandardSymbol=0;//@todo get from somewhere - Graphic* pAutoSymbolGraphic = new Graphic( aViewElementListProvider.GetSymbolGraphic( nStandardSymbol, pSymbolShapeProperties ) ); + std::unique_ptr<Graphic> pAutoSymbolGraphic(new Graphic( aViewElementListProvider.GetSymbolGraphic( nStandardSymbol, pSymbolShapeProperties.get() ) )); // note: the dialog takes the ownership of pSymbolShapeProperties and pAutoSymbolGraphic - aDlg->setSymbolInformation( pSymbolShapeProperties, pAutoSymbolGraphic ); + aDlg->setSymbolInformation( std::move(pSymbolShapeProperties), std::move(pAutoSymbolGraphic) ); } if( aDialogParameter.HasStatisticProperties() ) { |