From d5b87dcce119f0cd69e65873833d98ed1660f9d0 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 28 Sep 2015 13:06:39 +0200 Subject: Return std::unique_ptr from SvTreeListBox::CreateContextMenu Change-Id: I1e4c32099ec9741c0cab246eb627a2eb3b933e1a --- sfx2/source/dialog/templdlg.cxx | 8 ++++---- sfx2/source/inc/templdgi.hxx | 10 +++++++--- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 251990c9b62d..992f1be9f162 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -332,7 +332,7 @@ void SfxActionListBox::Recalc() } } -PopupMenu* SfxActionListBox::CreateContextMenu() +std::unique_ptr SfxActionListBox::CreateContextMenu() { if( !( GetSelectionCount() > 0 ) ) @@ -421,7 +421,7 @@ void StyleTreeListBox_Impl::MakeExpanded_Impl(ExpandedEntries_t& rEntries) const } } -PopupMenu* StyleTreeListBox_Impl::CreateContextMenu() +std::unique_ptr StyleTreeListBox_Impl::CreateContextMenu() { return pDialog->CreateContextMenu(); } @@ -2191,7 +2191,7 @@ void SfxCommonTemplateDialog_Impl::EnableExample_Impl(sal_uInt16 nId, bool bEnab EnableItem(nId, bEnable); } -PopupMenu* SfxCommonTemplateDialog_Impl::CreateContextMenu() +std::unique_ptr SfxCommonTemplateDialog_Impl::CreateContextMenu() { if ( bBindingUpdate ) { @@ -2199,7 +2199,7 @@ PopupMenu* SfxCommonTemplateDialog_Impl::CreateContextMenu() pBindings->Update( SID_STYLE_NEW ); bBindingUpdate = false; } - PopupMenu* pMenu = new PopupMenu( SfxResId( MN_CONTEXT_TEMPLDLG ) ); + std::unique_ptr pMenu(new PopupMenu( SfxResId( MN_CONTEXT_TEMPLDLG ) )); pMenu->SetSelectHdl( LINK( this, SfxCommonTemplateDialog_Impl, MenuSelectHdl ) ); pMenu->EnableItem( ID_EDIT, bCanEdit ); pMenu->EnableItem( ID_DELETE, bCanDel ); diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx index 040645165623..afa26b5be746 100644 --- a/sfx2/source/inc/templdgi.hxx +++ b/sfx2/source/inc/templdgi.hxx @@ -21,6 +21,10 @@ class SfxTemplateControllerItem; +#include + +#include + #include #include #include @@ -137,7 +141,7 @@ public: } void MakeExpanded_Impl(ExpandedEntries_t& rEntries) const; - virtual PopupMenu* CreateContextMenu() SAL_OVERRIDE; + virtual std::unique_ptr CreateContextMenu() SAL_OVERRIDE; }; class SfxActionListBox : public DropListBox_Impl @@ -146,7 +150,7 @@ protected: public: SfxActionListBox( SfxCommonTemplateDialog_Impl* pParent, WinBits nWinBits ); - virtual PopupMenu* CreateContextMenu() SAL_OVERRIDE; + virtual std::unique_ptr CreateContextMenu() SAL_OVERRIDE; void Recalc(); }; @@ -332,7 +336,7 @@ public: } // normally for derivates from SvTreeListBoxes, but in this case the dialog handles context menus - PopupMenu* CreateContextMenu(); + std::unique_ptr CreateContextMenu(); }; class DropToolBox_Impl : public ToolBox, public DropTargetHelper -- cgit