From d57c9d81aab1e02d257738a82bddeca78db46da8 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 13 Jun 2017 11:19:58 +0200 Subject: Use unique_ptr for SvxHpLinkDlg::mpItemSet Change-Id: I6ad2669afe3853196bb1fce9c7c81af640831116 --- cui/source/dialogs/cuihyperdlg.cxx | 10 ++++++---- cui/source/inc/cuihyperdlg.hxx | 6 +++++- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'cui') diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx index 09810b34b8b5..eb8e9515b759 100644 --- a/cui/source/dialogs/cuihyperdlg.cxx +++ b/cui/source/dialogs/cuihyperdlg.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include + +#include #include #include #include "cuihyperdlg.hxx" @@ -115,13 +118,13 @@ SvxHpLinkDlg::SvxHpLinkDlg (vcl::Window* pParent, SfxBindings* pBindings) GetCancelButton().SetText ( CuiResId(RID_SVXSTR_HYPDLG_CLOSEBUT) ); // create itemset for tabpages - mpItemSet = new SfxItemSet( SfxGetpApp()->GetPool(), SID_HYPERLINK_GETLINK, + mpItemSet = o3tl::make_unique( SfxGetpApp()->GetPool(), SID_HYPERLINK_GETLINK, SID_HYPERLINK_SETLINK ); SvxHyperlinkItem aItem(SID_HYPERLINK_GETLINK); mpItemSet->Put(aItem); - SetInputSet (mpItemSet); + SetInputSet (mpItemSet.get()); //loop through the pages and get their max bounds and lock that down ShowPage(RID_SVXPAGE_HYPERLINK_NEWDOCUMENT); @@ -165,8 +168,7 @@ void SvxHpLinkDlg::dispose() SvtViewOptions aViewOpt( EViewType::TabDialog, OUString::number(SID_HYPERLINK_DIALOG) ); aViewOpt.Delete(); - delete mpItemSet; - mpItemSet = nullptr; + mpItemSet.reset(); maCtrl.dispose(); diff --git a/cui/source/inc/cuihyperdlg.hxx b/cui/source/inc/cuihyperdlg.hxx index 19feaf2aaeac..897d30a09aed 100644 --- a/cui/source/inc/cuihyperdlg.hxx +++ b/cui/source/inc/cuihyperdlg.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_CUI_SOURCE_INC_CUIHYPERDLG_HXX #define INCLUDED_CUI_SOURCE_INC_CUIHYPERDLG_HXX +#include + +#include + #include #include #include @@ -62,7 +66,7 @@ class SvxHpLinkDlg : public IconChoiceDialog private: SvxHlinkCtrl maCtrl; ///< Controller SfxBindings* mpBindings; - SfxItemSet* mpItemSet; + std::unique_ptr mpItemSet; bool mbGrabFocus : 1; bool mbReadOnly : 1; -- cgit