summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dbaccess/source/ui/control/dbtreelistbox.cxx8
-rw-r--r--dbaccess/source/ui/inc/dbtreelistbox.hxx3
-rw-r--r--include/svtools/treelistbox.hxx3
-rw-r--r--sd/source/ui/animations/CustomAnimationList.cxx6
-rw-r--r--sd/source/ui/animations/CustomAnimationList.hxx6
-rw-r--r--sfx2/source/dialog/templdlg.cxx8
-rw-r--r--sfx2/source/inc/templdgi.hxx10
-rw-r--r--svtools/source/contnr/fileview.cxx8
-rw-r--r--svtools/source/contnr/svimpbox.cxx19
-rw-r--r--svtools/source/contnr/treelistbox.cxx2
-rw-r--r--svx/source/form/datanavi.cxx10
-rw-r--r--svx/source/inc/datanavi.hxx4
-rw-r--r--sw/source/uibase/inc/conttree.hxx6
-rw-r--r--sw/source/uibase/utlui/content.cxx4
-rw-r--r--sw/source/uibase/utlui/glbltree.cxx6
15 files changed, 62 insertions, 41 deletions
diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx
index cd213baa4a3e..8535e7bcbbfc 100644
--- a/dbaccess/source/ui/control/dbtreelistbox.cxx
+++ b/dbaccess/source/ui/control/dbtreelistbox.cxx
@@ -561,12 +561,12 @@ namespace
}
}
-PopupMenu* DBTreeListBox::CreateContextMenu()
+std::unique_ptr<PopupMenu> DBTreeListBox::CreateContextMenu()
{
::std::unique_ptr< PopupMenu > pContextMenu;
if ( !m_pContextMenuProvider )
- return pContextMenu.release();
+ return pContextMenu;
// the basic context menu
pContextMenu.reset( m_pContextMenuProvider->getContextMenu( *this ) );
@@ -577,7 +577,7 @@ PopupMenu* DBTreeListBox::CreateContextMenu()
// allow context menu interception
::cppu::OInterfaceContainerHelper* pInterceptors = m_pContextMenuProvider->getContextMenuInterceptors();
if ( !pInterceptors || !pInterceptors->getLength() )
- return pContextMenu.release();
+ return pContextMenu;
ContextMenuExecuteEvent aEvent;
aEvent.SourceWindow = VCLUnoHelper::GetInterface( this );
@@ -642,7 +642,7 @@ PopupMenu* DBTreeListBox::CreateContextMenu()
lcl_adjustMenuItemIDs( *pModifiedMenu, m_pContextMenuProvider->getCommandController() );
}
- return pContextMenu.release();
+ return pContextMenu;
}
void DBTreeListBox::ExcecuteContextMenuAction( sal_uInt16 _nSelectedPopupEntry )
diff --git a/dbaccess/source/ui/inc/dbtreelistbox.hxx b/dbaccess/source/ui/inc/dbtreelistbox.hxx
index 9e6c42b3aedc..edabc325869e 100644
--- a/dbaccess/source/ui/inc/dbtreelistbox.hxx
+++ b/dbaccess/source/ui/inc/dbtreelistbox.hxx
@@ -27,6 +27,7 @@
#include <svtools/treelistbox.hxx>
#include <vcl/timer.hxx>
+#include <memory>
#include <set>
namespace dbaui
@@ -114,7 +115,7 @@ namespace dbaui
virtual bool DoubleClickHdl() SAL_OVERRIDE;
- virtual PopupMenu* CreateContextMenu() SAL_OVERRIDE;
+ virtual std::unique_ptr<PopupMenu> CreateContextMenu() SAL_OVERRIDE;
virtual void ExcecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry ) SAL_OVERRIDE;
void SetEnterKeyHdl(const Link<DBTreeListBox*,void>& rNewHdl) {m_aEnterKeyHdl = rNewHdl;}
diff --git a/include/svtools/treelistbox.hxx b/include/svtools/treelistbox.hxx
index b64b4ad7af3b..86a75daa4483 100644
--- a/include/svtools/treelistbox.hxx
+++ b/include/svtools/treelistbox.hxx
@@ -23,6 +23,7 @@
#include <svtools/svtdllapi.h>
#include <deque>
+#include <memory>
#include <vector>
#include <vcl/ctrl.hxx>
@@ -794,7 +795,7 @@ public:
void ShowFocusRect( const SvTreeListEntry* pEntry );
void InitStartEntry();
- virtual PopupMenu* CreateContextMenu();
+ virtual std::unique_ptr<PopupMenu> CreateContextMenu();
virtual void ExcecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry );
void EnableContextMenuHandling();
diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx
index 7789f4bb7485..03be56447c41 100644
--- a/sd/source/ui/animations/CustomAnimationList.cxx
+++ b/sd/source/ui/animations/CustomAnimationList.cxx
@@ -46,6 +46,7 @@
#include "glob.hrc"
#include <algorithm>
+#include <memory>
using namespace ::com::sun::star;
using namespace ::com::sun::star::animations;
@@ -877,9 +878,10 @@ bool CustomAnimationList::DoubleClickHdl()
return false;
}
-PopupMenu* CustomAnimationList::CreateContextMenu()
+std::unique_ptr<PopupMenu> CustomAnimationList::CreateContextMenu()
{
- PopupMenu* pMenu = new PopupMenu(SdResId( RID_EFFECT_CONTEXTMENU ));
+ std::unique_ptr<PopupMenu> pMenu(
+ new PopupMenu(SdResId( RID_EFFECT_CONTEXTMENU )));
sal_Int16 nNodeType = -1;
sal_Int16 nEntries = 0;
diff --git a/sd/source/ui/animations/CustomAnimationList.hxx b/sd/source/ui/animations/CustomAnimationList.hxx
index 851ea6756d0f..72b215325bce 100644
--- a/sd/source/ui/animations/CustomAnimationList.hxx
+++ b/sd/source/ui/animations/CustomAnimationList.hxx
@@ -20,6 +20,10 @@
#ifndef INCLUDED_SD_SOURCE_UI_ANIMATIONS_CUSTOMANIMATIONLIST_HXX
#define INCLUDED_SD_SOURCE_UI_ANIMATIONS_CUSTOMANIMATIONLIST_HXX
+#include <sal/config.h>
+
+#include <memory>
+
#include <com/sun/star/drawing/XShape.hpp>
#include <svtools/treelistbox.hxx>
#include <CustomAnimationEffect.hxx>
@@ -72,7 +76,7 @@ public:
virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
- virtual PopupMenu* CreateContextMenu() SAL_OVERRIDE;
+ virtual std::unique_ptr<PopupMenu> CreateContextMenu() SAL_OVERRIDE;
virtual void ExcecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry ) SAL_OVERRIDE;
virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
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<PopupMenu> 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<PopupMenu> 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<PopupMenu> 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<PopupMenu> 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 <sal/config.h>
+
+#include <memory>
+
#include <vcl/button.hxx>
#include <vcl/toolbox.hxx>
#include <vcl/lstbox.hxx>
@@ -137,7 +141,7 @@ public:
}
void MakeExpanded_Impl(ExpandedEntries_t& rEntries) const;
- virtual PopupMenu* CreateContextMenu() SAL_OVERRIDE;
+ virtual std::unique_ptr<PopupMenu> 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<PopupMenu> 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<PopupMenu> CreateContextMenu();
};
class DropToolBox_Impl : public ToolBox, public DropTargetHelper
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;
}
diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx
index 1ad38717937d..a49e23b1dcf2 100644
--- a/svx/source/form/datanavi.cxx
+++ b/svx/source/form/datanavi.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <memory>
#include <sal/macros.h>
#include "datanavi.hxx"
@@ -217,9 +220,10 @@ namespace svxform
pTransferable->StartDrag( this, DND_ACTION_COPY );
}
- PopupMenu* DataTreeListBox::CreateContextMenu()
+ std::unique_ptr<PopupMenu> DataTreeListBox::CreateContextMenu()
{
- PopupMenu* pMenu = new PopupMenu( SVX_RES( RID_MENU_DATANAVIGATOR ) );
+ std::unique_ptr<PopupMenu> pMenu(
+ new PopupMenu( SVX_RES( RID_MENU_DATANAVIGATOR ) ));
if ( DGTInstance == m_eGroup )
pMenu->RemoveItem( pMenu->GetItemPos( m_nAddId ) );
else
@@ -240,7 +244,7 @@ namespace svxform
pMenu->SetItemText( m_nRemoveId, SVX_RESSTR( RID_STR_DATANAV_REMOVE_BINDING ) );
}
}
- m_pXFormsPage->EnableMenuItems( pMenu );
+ m_pXFormsPage->EnableMenuItems( pMenu.get() );
return pMenu;
}
diff --git a/svx/source/inc/datanavi.hxx b/svx/source/inc/datanavi.hxx
index dbb1180f6902..b5a7867de8a4 100644
--- a/svx/source/inc/datanavi.hxx
+++ b/svx/source/inc/datanavi.hxx
@@ -52,6 +52,8 @@
#include <com/sun/star/xml/dom/events/XEventTarget.hpp>
#include "datalistener.hxx"
+
+#include <memory>
#include <vector>
class FmFormShell;
@@ -131,7 +133,7 @@ namespace svxform
virtual ~DataTreeListBox();
virtual void dispose() SAL_OVERRIDE;
- virtual PopupMenu* CreateContextMenu() SAL_OVERRIDE;
+ virtual std::unique_ptr<PopupMenu> CreateContextMenu() SAL_OVERRIDE;
virtual void ExcecuteContextMenuAction( sal_uInt16 _nSelectedPopupEntry ) SAL_OVERRIDE;
virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) SAL_OVERRIDE;
virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) SAL_OVERRIDE;
diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx
index aa49b1695c69..4dd8bdca4737 100644
--- a/sw/source/uibase/inc/conttree.hxx
+++ b/sw/source/uibase/inc/conttree.hxx
@@ -25,6 +25,8 @@
#include "swcont.hxx"
#include <map>
+#include <memory>
+
#include <o3tl/enumarray.hxx>
class SwWrtShell;
@@ -142,7 +144,7 @@ protected:
void GotoContent(SwContent* pCnt);
static void SetInDrag(bool bSet) {bIsInDrag = bSet;}
- virtual PopupMenu* CreateContextMenu() SAL_OVERRIDE;
+ virtual std::unique_ptr<PopupMenu> CreateContextMenu() SAL_OVERRIDE;
virtual void ExcecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry ) SAL_OVERRIDE;
public:
@@ -305,7 +307,7 @@ protected:
static void SetShowShell(const SfxObjectShell*pSet) {pShowShell = pSet;}
DECL_STATIC_LINK_TYPED(SwGlobalTree, ShowFrameHdl, void*, void);
- virtual PopupMenu* CreateContextMenu() SAL_OVERRIDE;
+ virtual std::unique_ptr<PopupMenu> CreateContextMenu() SAL_OVERRIDE;
virtual void ExcecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry ) SAL_OVERRIDE;
public:
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 195771a9d08a..80beca936417 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -1115,9 +1115,9 @@ sal_Int8 SwContentTree::ExecuteDrop( const ExecuteDropEvent& rEvt )
// Handler for Dragging and ContextMenu
-PopupMenu* SwContentTree::CreateContextMenu()
+std::unique_ptr<PopupMenu> SwContentTree::CreateContextMenu()
{
- PopupMenu* pPop = new PopupMenu;
+ std::unique_ptr<PopupMenu> pPop(new PopupMenu);
PopupMenu* pSubPop1 = new PopupMenu;
PopupMenu* pSubPop2 = new PopupMenu;
PopupMenu* pSubPop3 = new PopupMenu;
diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx
index a92682177d3e..1cf278a958fd 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -331,14 +331,14 @@ sal_Int8 SwGlobalTree::AcceptDrop( const AcceptDropEvent& rEvt )
return nRet;
}
-PopupMenu* SwGlobalTree::CreateContextMenu()
+std::unique_ptr<PopupMenu> SwGlobalTree::CreateContextMenu()
{
- PopupMenu* pPop = 0;
+ std::unique_ptr<PopupMenu> pPop;
if(pActiveShell &&
!pActiveShell->GetView().GetDocShell()->IsReadOnly())
{
const sal_uInt16 nEnableFlags = GetEnableFlags();
- pPop = new PopupMenu;
+ pPop.reset(new PopupMenu);
PopupMenu* pSubPop1 = new PopupMenu;
PopupMenu* pSubPop2 = new PopupMenu;