chart2/source/controller/dialogs/dlg_ObjectProperties.cxx | 14 ++++------- chart2/source/controller/inc/dlg_ObjectProperties.hxx | 7 ++--- chart2/source/controller/main/ChartController_Properties.cxx | 7 ++--- cui/source/dialogs/cuifmsearch.cxx | 12 +++------ cui/source/inc/cuifmsearch.hxx | 4 +-- 5 files changed, 19 insertions(+), 25 deletions(-)
New commits: commit 8cfe63155d49f70ffe3bdb1675c9d41485b41b1e Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Mon Jun 4 16:57:12 2018 +0200 loplugin:useuniqueptr in FmSearchDialog Change-Id: Icf2a8f2b334b1a0b9a7028fb1718710dd67c7a81 Reviewed-on: https://gerrit.libreoffice.org/55533 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/cui/source/dialogs/cuifmsearch.cxx b/cui/source/dialogs/cuifmsearch.cxx index 3766fd9781b5..6195662e4300 100644 --- a/cui/source/dialogs/cuifmsearch.cxx +++ b/cui/source/dialogs/cuifmsearch.cxx @@ -142,8 +142,8 @@ FmSearchDialog::FmSearchDialog(vcl::Window* pParent, const OUString& sInitialTex m_plbForm->Hide(); } - m_pSearchEngine = new FmSearchEngine( - ::comphelper::getProcessComponentContext(), fmscInitial.xCursor, fmscInitial.strUsedFields, fmscInitial.arrFields ); + m_pSearchEngine.reset( new FmSearchEngine( + ::comphelper::getProcessComponentContext(), fmscInitial.xCursor, fmscInitial.strUsedFields, fmscInitial.arrFields ) ); initCommon( fmscInitial.xCursor ); if ( !fmscInitial.sFieldDisplayNames.isEmpty() ) @@ -168,11 +168,9 @@ void FmSearchDialog::dispose() SaveParams(); - delete m_pConfig; - m_pConfig = nullptr; + m_pConfig.reset(); - delete m_pSearchEngine; - m_pSearchEngine = nullptr; + m_pSearchEngine.reset(); m_prbSearchForText.clear(); m_prbSearchForNull.clear(); @@ -258,7 +256,7 @@ void FmSearchDialog::Init(const OUString& strVisibleFields, const OUString& sIni } - m_pConfig = new FmSearchConfigItem; + m_pConfig.reset( new FmSearchConfigItem ); LoadParams(); m_pcmbSearchText->SetText(sInitialText); diff --git a/cui/source/inc/cuifmsearch.hxx b/cui/source/inc/cuifmsearch.hxx index 7256fe68f4c9..e137885de3c4 100644 --- a/cui/source/inc/cuifmsearch.hxx +++ b/cui/source/inc/cuifmsearch.hxx @@ -85,12 +85,12 @@ class FmSearchDialog final : public ModalDialog /// memorize the currently selected field for every context std::vector<OUString> m_arrContextFields; - FmSearchEngine* m_pSearchEngine; + std::unique_ptr<FmSearchEngine> m_pSearchEngine; Timer m_aDelayedPaint; // see EnableSearchUI - ::svxform::FmSearchConfigItem* m_pConfig; + std::unique_ptr<::svxform::FmSearchConfigItem> m_pConfig; public: /** This can search in different sets of fields. There is a number of contexts; their names are in strContexts (separated by ';'), the user can choose one of them. commit 9dce48ad2a25602d6cebc97827e33de3df9ddd65 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Mon Jun 4 16:37:48 2018 +0200 loplugin:useuniqueptr in SchAttribTabDlg Change-Id: I98b1a790fda68404cf13f21dbfb5b4493c849700 Reviewed-on: https://gerrit.libreoffice.org/55532 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> 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() ) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits