summaryrefslogtreecommitdiff
path: root/svtools/source
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-09-28 13:06:39 +0200
committerStephan Bergmann <sbergman@redhat.com>2015-09-28 13:07:03 +0200
commitd5b87dcce119f0cd69e65873833d98ed1660f9d0 (patch)
tree8cb637f751eef1225487f7a38fefd84b22b5d44d /svtools/source
parent94ed449247e2256d4163fb4a46b4be2c3f498d60 (diff)
Return std::unique_ptr from SvTreeListBox::CreateContextMenu
Change-Id: I1e4c32099ec9741c0cab246eb627a2eb3b933e1a
Diffstat (limited to 'svtools/source')
-rw-r--r--svtools/source/contnr/fileview.cxx8
-rw-r--r--svtools/source/contnr/svimpbox.cxx19
-rw-r--r--svtools/source/contnr/treelistbox.cxx2
3 files changed, 15 insertions, 14 deletions
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index e2b8d5b1188c..8b0e3683bfef 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -225,7 +225,7 @@ public:
DECL_LINK_TYPED(ResetQuickSearch_Impl, Timer *, void);
- virtual PopupMenu* CreateContextMenu() SAL_OVERRIDE;
+ virtual std::unique_ptr<PopupMenu> CreateContextMenu() SAL_OVERRIDE;
virtual void ExcecuteContextMenuAction( sal_uInt16 nSelectedPopentry ) SAL_OVERRIDE;
};
@@ -656,7 +656,7 @@ void ViewTabListBox_Impl::KeyInput( const KeyEvent& rKEvt )
-PopupMenu* ViewTabListBox_Impl::CreateContextMenu()
+std::unique_ptr<PopupMenu> ViewTabListBox_Impl::CreateContextMenu()
{
bool bEnableDelete = mbEnableDelete;
bool bEnableRename = mbEnableRename;
@@ -733,8 +733,8 @@ PopupMenu* ViewTabListBox_Impl::CreateContextMenu()
if ( bEnableDelete || bEnableRename )
{
- PopupMenu * pRet
- = new PopupMenu( SvtResId( RID_FILEVIEW_CONTEXTMENU ) );
+ std::unique_ptr<PopupMenu> pRet(
+ new PopupMenu( SvtResId( RID_FILEVIEW_CONTEXTMENU ) ));
pRet->EnableItem( MID_FILEVIEW_DELETE, bEnableDelete );
pRet->EnableItem( MID_FILEVIEW_RENAME, bEnableRename );
pRet->RemoveDisabledEntries( true, true );
diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx
index 35eae008cb7c..1e6f7699aae6 100644
--- a/svtools/source/contnr/svimpbox.cxx
+++ b/svtools/source/contnr/svimpbox.cxx
@@ -23,6 +23,7 @@
#include <vcl/settings.hxx>
#include <cstdlib>
+#include <memory>
#include <stack>
#include <svtools/treelistbox.hxx>
@@ -3042,16 +3043,16 @@ void SvImpLBox::Command( const CommandEvent& rCEvt )
aPopupPos = Point( 0, 0 );
}
- PopupMenu* pPopup = pView->CreateContextMenu();
-
- if( pPopup )
{
- // do action for selected entry in popup menu
- sal_uInt16 nMenuAction = pPopup->Execute( pView, aPopupPos );
- if ( nMenuAction )
- pView->ExcecuteContextMenuAction( nMenuAction );
- lcl_DeleteSubPopups(pPopup);
- delete pPopup;
+ std::unique_ptr<PopupMenu> pPopup = pView->CreateContextMenu();
+ if( pPopup.get() )
+ {
+ // do action for selected entry in popup menu
+ sal_uInt16 nMenuAction = pPopup->Execute( pView, aPopupPos );
+ if ( nMenuAction )
+ pView->ExcecuteContextMenuAction( nMenuAction );
+ lcl_DeleteSubPopups(pPopup.get());
+ }
}
if( bClickedIsFreePlace )
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index 66d3a4931e7d..56fdc2901770 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -3810,7 +3810,7 @@ void SvTreeListBox::InitStartEntry()
pImp->pStartEntry = GetModel()->First();
}
-PopupMenu* SvTreeListBox::CreateContextMenu()
+std::unique_ptr<PopupMenu> SvTreeListBox::CreateContextMenu()
{
return NULL;
}