tdf#97527 - vcl: reference-count Menu
some places are marked with "dodgy"- need to check those to see
what is going on, because they are leaving dangling pointers behind
in the Menu class
Change-Id: I41d5c7c0fec2f70ce9e3ffdc48cd03d26c0a869b
Reviewed-on: https://gerrit.libreoffice.org/26516
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
diff --git a/accessibility/inc/standard/accessiblemenubasecomponent.hxx b/accessibility/inc/standard/accessiblemenubasecomponent.hxx
index 167c957..9b01b60 100644
--- a/accessibility/inc/standard/accessiblemenubasecomponent.hxx
+++ b/accessibility/inc/standard/accessiblemenubasecomponent.hxx
@@ -26,6 +26,7 @@
#include <comphelper/accessiblecomponenthelper.hxx>
#include <cppuhelper/implbase2.hxx>
#include <tools/link.hxx>
#include <vcl/vclptr.hxx>
#include <vector>
@@ -59,7 +60,7 @@ protected:
typedef ::std::vector< css::uno::Reference< css::accessibility::XAccessible > > AccessibleChildren;
AccessibleChildren m_aAccessibleChildren;
Menu* m_pMenu;
VclPtr<Menu> m_pMenu;
bool m_bEnabled;
bool m_bFocused;
diff --git a/accessibility/inc/standard/accessiblemenuitemcomponent.hxx b/accessibility/inc/standard/accessiblemenuitemcomponent.hxx
index 84d0cc2..8abeb8a 100644
--- a/accessibility/inc/standard/accessiblemenuitemcomponent.hxx
+++ b/accessibility/inc/standard/accessiblemenuitemcomponent.hxx
@@ -31,7 +31,7 @@ class OAccessibleMenuItemComponent : public OAccessibleMenuBaseComponent
friend class OAccessibleMenuBaseComponent;
protected:
Menu* m_pParent;
VclPtr<Menu> m_pParent;
sal_uInt16 m_nItemPos;
OUString m_sAccessibleName;
OUString m_sItemText;
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index d1159c8..b33e9bd 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -1479,9 +1479,9 @@ void BreakPointWindow::Command( const CommandEvent& rCEvt )
if ( pBrk )
{
// test if break point is enabled...
PopupMenu aBrkPropMenu( IDEResId( RID_POPUP_BRKPROPS ) );
aBrkPropMenu.CheckItem( RID_ACTIV, pBrk->bEnabled );
switch ( aBrkPropMenu.Execute( this, aPos ) )
ScopedVclPtrInstance<PopupMenu> aBrkPropMenu( IDEResId( RID_POPUP_BRKPROPS ) );
aBrkPropMenu->CheckItem( RID_ACTIV, pBrk->bEnabled );
switch ( aBrkPropMenu->Execute( this, aPos ) )
{
case RID_ACTIV:
{
@@ -1502,8 +1502,8 @@ void BreakPointWindow::Command( const CommandEvent& rCEvt )
}
else
{
PopupMenu aBrkListMenu( IDEResId( RID_POPUP_BRKDLG ) );
switch ( aBrkListMenu.Execute( this, aPos ) )
ScopedVclPtrInstance<PopupMenu> aBrkListMenu( IDEResId( RID_POPUP_BRKDLG ) );
switch ( aBrkListMenu->Execute( this, aPos ) )
{
case RID_BRKDLG:
{
diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx
index 1aefb75..88c1e9d 100644
--- a/basctl/source/basicide/bastypes.cxx
+++ b/basctl/source/basicide/bastypes.cxx
@@ -480,19 +480,19 @@ void TabBar::Command( const CommandEvent& rCEvt )
::TabBar::MouseButtonDown( aMouseEvent ); // base class
}
PopupMenu aPopup( IDEResId( RID_POPUP_TABBAR ) );
ScopedVclPtrInstance<PopupMenu> aPopup( IDEResId( RID_POPUP_TABBAR ) );
if ( GetPageCount() == 0 )
{
aPopup.EnableItem(SID_BASICIDE_DELETECURRENT, false);
aPopup.EnableItem(SID_BASICIDE_RENAMECURRENT, false);
aPopup.EnableItem(SID_BASICIDE_HIDECURPAGE, false);
aPopup->EnableItem(SID_BASICIDE_DELETECURRENT, false);
aPopup->EnableItem(SID_BASICIDE_RENAMECURRENT, false);
aPopup->EnableItem(SID_BASICIDE_HIDECURPAGE, false);
}
if ( StarBASIC::IsRunning() )
{
aPopup.EnableItem(SID_BASICIDE_DELETECURRENT, false);
aPopup.EnableItem(SID_BASICIDE_RENAMECURRENT, false);
aPopup.EnableItem(SID_BASICIDE_MODULEDLG, false);
aPopup->EnableItem(SID_BASICIDE_DELETECURRENT, false);
aPopup->EnableItem(SID_BASICIDE_RENAMECURRENT, false);
aPopup->EnableItem(SID_BASICIDE_MODULEDLG, false);
}
if (Shell* pShell = GetShell())
@@ -504,10 +504,10 @@ void TabBar::Command( const CommandEvent& rCEvt )
if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) ||
( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) ) )
{
aPopup.EnableItem(aPopup.GetItemId( 0 ), false);
aPopup.EnableItem(SID_BASICIDE_DELETECURRENT, false);
aPopup.EnableItem(SID_BASICIDE_RENAMECURRENT, false);
aPopup.RemoveDisabledEntries();
aPopup->EnableItem(aPopup->GetItemId( 0 ), false);
aPopup->EnableItem(SID_BASICIDE_DELETECURRENT, false);
aPopup->EnableItem(SID_BASICIDE_RENAMECURRENT, false);
aPopup->RemoveDisabledEntries();
}
if ( aDocument.isInVBAMode() )
{
@@ -523,8 +523,8 @@ void TabBar::Command( const CommandEvent& rCEvt )
SbModule* pActiveModule = pBasic->FindModule( it->second->GetName() );
if( pActiveModule && ( pActiveModule->GetModuleType() == script::ModuleType::DOCUMENT ) )
{
aPopup.EnableItem(SID_BASICIDE_DELETECURRENT, false);
aPopup.EnableItem(SID_BASICIDE_RENAMECURRENT, false);
aPopup->EnableItem(SID_BASICIDE_DELETECURRENT, false);
aPopup->EnableItem(SID_BASICIDE_RENAMECURRENT, false);
}
}
}
@@ -532,7 +532,7 @@ void TabBar::Command( const CommandEvent& rCEvt )
}
}
if (SfxDispatcher* pDispatcher = GetDispatcher())
pDispatcher->Execute(aPopup.Execute(this, aPos));
pDispatcher->Execute(aPopup->Execute(this, aPos));
}
}
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index f3e1b62..1b08c29 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -3134,7 +3134,7 @@ SvxToolbarConfigPage::SvxToolbarConfigPage(vcl::Window *pParent, const SfxItemSe
m_pMoveDownButton->Enable();
m_pMoveUpButton->Enable();
PopupMenu* pMenu = new PopupMenu( CUI_RES( MODIFY_TOOLBAR ) );
VclPtrInstance<PopupMenu> pMenu( CUI_RES( MODIFY_TOOLBAR ) );
pMenu->SetMenuFlags(
pMenu->GetMenuFlags() | MenuFlags::AlwaysShowDisabledEntries );
@@ -3142,8 +3142,7 @@ SvxToolbarConfigPage::SvxToolbarConfigPage(vcl::Window *pParent, const SfxItemSe
m_pModifyTopLevelButton->SetSelectHdl(
LINK( this, SvxToolbarConfigPage, ToolbarSelectHdl ) );
PopupMenu* pEntry = new PopupMenu(
CUI_RES( MODIFY_TOOLBAR_CONTENT ) );
VclPtrInstance<PopupMenu> pEntry( CUI_RES( MODIFY_TOOLBAR_CONTENT ) );
pEntry->SetMenuFlags(
pEntry->GetMenuFlags() | MenuFlags::AlwaysShowDisabledEntries );
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 5c5eed2..4eafff9 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -1239,7 +1239,7 @@ SvxNumOptionsTabPage::SvxNumOptionsTabPage(vcl::Window* pParent,
pBitmapMenu->SetHighlightHdl(LINK(this, SvxNumOptionsTabPage, PopupActivateHdl_Impl));
m_nGalleryId = pBitmapMenu->GetItemId("gallery");
assert(m_nGalleryId != MENU_ITEM_NOTFOUND);
PopupMenu* pPopup = new PopupMenu;
VclPtrInstance<PopupMenu> pPopup;
pBitmapMenu->SetPopupMenu(m_nGalleryId, pPopup);
eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE));
@@ -1258,7 +1258,8 @@ void SvxNumOptionsTabPage::dispose()
{
if (m_pBitmapMB)
{
delete m_pBitmapMB->GetPopupMenu()->GetPopupMenu(m_nGalleryId);
VclPtr<PopupMenu> p = m_pBitmapMB->GetPopupMenu()->GetPopupMenu(m_nGalleryId);
p.disposeAndClear(); // NoelG: dodgy, this leaves a dangling pointer
}
delete pActNum;
pActNum = nullptr;
diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx
index 4c12af0..ca323ab 100644
--- a/cui/source/tabpages/tpline.cxx
+++ b/cui/source/tabpages/tpline.cxx
@@ -229,10 +229,14 @@ void SvxLineTabPage::dispose()
// Symbols on a line (e.g. StarCharts), dtor new!
if (m_pSymbolMB)
{
delete m_pSymbolMB->GetPopupMenu()->GetPopupMenu( MN_GALLERY );
VclPtr<PopupMenu> p = m_pSymbolMB->GetPopupMenu()->GetPopupMenu( MN_GALLERY );
p.disposeAndClear(); // NoelG: dodgy, this leaves a dangling pointer
if(m_pSymbolList)
delete m_pSymbolMB->GetPopupMenu()->GetPopupMenu( MN_SYMBOLS );
{
VclPtr<PopupMenu> p2 = m_pSymbolMB->GetPopupMenu()->GetPopupMenu( MN_SYMBOLS );
p2.disposeAndClear(); // NoelG: dodgy, this leaves a dangling pointer
}
m_pSymbolMB = nullptr;
}
@@ -290,7 +294,7 @@ void SvxLineTabPage::InitSymbols(MenuButton* pButton)
// Get gallery entries
GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, m_aGrfNames);
PopupMenu* pPopup = new PopupMenu;
VclPtrInstance<PopupMenu> pPopup;
sal_uInt32 i = 0;
m_nNumMenuGalleryItems = m_aGrfNames.size();
for(std::vector<OUString>::iterator it = m_aGrfNames.begin(); it != m_aGrfNames.end(); ++it, ++i)
@@ -363,7 +367,7 @@ void SvxLineTabPage::InitSymbols(MenuButton* pButton)
pView->hideMarkHandles();
pView->ShowSdrPage(pPage);
PopupMenu* pPopup = new PopupMenu;
VclPtrInstance<PopupMenu> pPopup;
// Generate invisible square to give all symbols a
// bitmap size, which is independent from specific glyph
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index c7850b2..b6d7c75 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -2331,9 +2331,9 @@ bool OApplicationController::interceptUserInput( const NotifyEvent& _rEvent )
return OGenericUnoController::interceptUserInput( _rEvent );
}
PopupMenu* OApplicationController::getContextMenu( Control& /*_rControl*/ ) const
VclPtr<PopupMenu> OApplicationController::getContextMenu( Control& /*_rControl*/ ) const
{
return new PopupMenu( ModuleRes( RID_MENU_APP_EDIT ) );
return VclPtr<PopupMenu>::Create( ModuleRes( RID_MENU_APP_EDIT ) );
}
IController& OApplicationController::getCommandController()
diff --git a/dbaccess/source/ui/app/AppController.hxx b/dbaccess/source/ui/app/AppController.hxx
index dec7e2f..2fe7d7e 100644
--- a/dbaccess/source/ui/app/AppController.hxx
+++ b/dbaccess/source/ui/app/AppController.hxx
@@ -532,7 +532,7 @@ namespace dbaui
virtual sal_Int8 executeDrop( const ExecuteDropEvent& _rEvt ) override;
// IContextMenuProvider
virtual PopupMenu* getContextMenu( Control& _rControl ) const override;
virtual VclPtr<PopupMenu> getContextMenu( Control& _rControl ) const override;
virtual IController& getCommandController() override;
virtual ::comphelper::OInterfaceContainerHelper2*
getContextMenuInterceptors() override;
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index fb4564f..e8c9f37 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
@@ -187,13 +187,11 @@ OAppDetailPageHelper::OAppDetailPageHelper(vcl::Window* _pParent,OAppBorderWindo
,m_aBorder(VclPtr<Window>::Create(this,WB_BORDER | WB_READONLY))
,m_aPreview(VclPtr<OPreviewWindow>::Create(m_aBorder.get()))
,m_aDocumentInfo(VclPtr< ::svtools::ODocumentInfoPreview>::Create(m_aBorder.get(), WB_LEFT | WB_VSCROLL | WB_READONLY) )
,m_aMenu( VclPtr<PopupMenu>::Create( ModuleRes( RID_MENU_APP_PREVIEW ) ) )
,m_ePreviewMode(_ePreviewMode)
{
m_aBorder->SetBorderStyle(WindowBorderStyle::MONO);
m_aMenu.reset(new PopupMenu( ModuleRes( RID_MENU_APP_PREVIEW ) ));
m_aTBPreview->SetOutStyle(TOOLBOX_STYLE_FLAT);
m_aTBPreview->InsertItem(SID_DB_APP_DISABLE_PREVIEW,m_aMenu->GetItemText(SID_DB_APP_DISABLE_PREVIEW),ToolBoxItemBits::LEFT|ToolBoxItemBits::DROPDOWN|ToolBoxItemBits::AUTOSIZE|ToolBoxItemBits::RADIOCHECK);
m_aTBPreview->SetHelpId(HID_APP_VIEW_PREVIEW_CB);
@@ -242,7 +240,7 @@ void OAppDetailPageHelper::dispose()
rpBox.disposeAndClear();
}
}
m_aMenu.reset();
m_aMenu.disposeAndClear();
m_pTablePreview.disposeAndClear();
m_aDocumentInfo.disposeAndClear();
m_aPreview.disposeAndClear();
@@ -1153,7 +1151,7 @@ IMPL_LINK_NOARG_TYPED(OAppDetailPageHelper, OnDropdownClickHdl, ToolBox*, void)
m_aTBPreview->Update();
// execute the menu
std::unique_ptr<PopupMenu> aMenu(new PopupMenu( ModuleRes( RID_MENU_APP_PREVIEW ) ));
ScopedVclPtrInstance<PopupMenu> aMenu( ModuleRes( RID_MENU_APP_PREVIEW ) );
const sal_uInt16 pActions[] = { SID_DB_APP_DISABLE_PREVIEW
, SID_DB_APP_VIEW_DOC_PREVIEW
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.hxx b/dbaccess/source/ui/app/AppDetailPageHelper.hxx
index 819a521..8f0d799 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.hxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.hxx
@@ -86,7 +86,7 @@ namespace dbaui
VclPtr< ::svtools::ODocumentInfoPreview>
m_aDocumentInfo;
VclPtr<vcl::Window> m_pTablePreview;
::std::unique_ptr<PopupMenu> m_aMenu;
ScopedVclPtr<PopupMenu> m_aMenu;
PreviewMode m_ePreviewMode;
css::uno::Reference < css::frame::XFrame2 >
m_xFrame;
diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx
index 226eaae..695a223 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -650,7 +650,7 @@ void SbaGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rM
bool bColAttrs = (nColId != (sal_uInt16)-1) && (nColId != 0);
if ( bColAttrs && !bDBIsReadOnly)
{
PopupMenu aNewItems(ModuleRes(RID_SBA_GRID_COLCTXMENU));
ScopedVclPtrInstance<PopupMenu> aNewItems(ModuleRes(RID_SBA_GRID_COLCTXMENU));
sal_uInt16 nPos = 0;
sal_uInt16 nModelPos = static_cast<SbaGridControl*>(GetParent())->GetModelColumnPos(nColId);
Reference< XPropertySet > xField = static_cast<SbaGridControl*>(GetParent())->getField(nModelPos);
@@ -669,14 +669,14 @@ void SbaGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rM
case DataType::REF:
break;
default:
rMenu.InsertItem(ID_BROWSER_COLATTRSET, aNewItems.GetItemText(ID_BROWSER_COLATTRSET), MenuItemBits::NONE, OString(), nPos++);
rMenu.SetHelpId(ID_BROWSER_COLATTRSET, aNewItems.GetHelpId(ID_BROWSER_COLATTRSET));
rMenu.InsertItem(ID_BROWSER_COLATTRSET, aNewItems->GetItemText(ID_BROWSER_COLATTRSET), MenuItemBits::NONE, OString(), nPos++);
rMenu.SetHelpId(ID_BROWSER_COLATTRSET, aNewItems->GetHelpId(ID_BROWSER_COLATTRSET));
rMenu.InsertSeparator(OString(), nPos++);
}
}
rMenu.InsertItem(ID_BROWSER_COLWIDTH, aNewItems.GetItemText(ID_BROWSER_COLWIDTH), MenuItemBits::NONE, OString(), nPos++);
rMenu.SetHelpId(ID_BROWSER_COLWIDTH, aNewItems.GetHelpId(ID_BROWSER_COLWIDTH));
rMenu.InsertItem(ID_BROWSER_COLWIDTH, aNewItems->GetItemText(ID_BROWSER_COLWIDTH), MenuItemBits::NONE, OString(), nPos++);
rMenu.SetHelpId(ID_BROWSER_COLWIDTH, aNewItems->GetHelpId(ID_BROWSER_COLWIDTH));
rMenu.InsertSeparator(OString(), nPos++);
}
}
@@ -751,23 +751,23 @@ void SbaGridControl::PreExecuteRowContextMenu(sal_uInt16 nRow, PopupMenu& rMenu)
{
FmGridControl::PreExecuteRowContextMenu(nRow, rMenu);
PopupMenu aNewItems(ModuleRes(RID_SBA_GRID_ROWCTXMENU));
ScopedVclPtrInstance<PopupMenu> aNewItems(ModuleRes(RID_SBA_GRID_ROWCTXMENU));
sal_uInt16 nPos = 0;
if (!IsReadOnlyDB())
{
rMenu.InsertItem(ID_BROWSER_TABLEATTR, aNewItems.GetItemText(ID_BROWSER_TABLEATTR), MenuItemBits::NONE, OString(), nPos++);
rMenu.SetHelpId(ID_BROWSER_TABLEATTR, aNewItems.GetHelpId(ID_BROWSER_TABLEATTR));
rMenu.InsertItem(ID_BROWSER_TABLEATTR, aNewItems->GetItemText(ID_BROWSER_TABLEATTR), MenuItemBits::NONE, OString(), nPos++);
rMenu.SetHelpId(ID_BROWSER_TABLEATTR, aNewItems->GetHelpId(ID_BROWSER_TABLEATTR));
rMenu.InsertItem(ID_BROWSER_ROWHEIGHT, aNewItems.GetItemText(ID_BROWSER_ROWHEIGHT), MenuItemBits::NONE, OString(), nPos++);
rMenu.SetHelpId(ID_BROWSER_ROWHEIGHT, aNewItems.GetHelpId(ID_BROWSER_ROWHEIGHT));
rMenu.InsertItem(ID_BROWSER_ROWHEIGHT, aNewItems->GetItemText(ID_BROWSER_ROWHEIGHT), MenuItemBits::NONE, OString(), nPos++);
rMenu.SetHelpId(ID_BROWSER_ROWHEIGHT, aNewItems->GetHelpId(ID_BROWSER_ROWHEIGHT));
rMenu.InsertSeparator(OString(), nPos++);
}
if ( GetSelectRowCount() > 0 )
{
rMenu.InsertItem(ID_BROWSER_COPY, aNewItems.GetItemText(SID_COPY), MenuItemBits::NONE, OString(), nPos++);
rMenu.SetHelpId(ID_BROWSER_COPY, aNewItems.GetHelpId(SID_COPY));
rMenu.InsertItem(ID_BROWSER_COPY, aNewItems->GetItemText(SID_COPY), MenuItemBits::NONE, OString(), nPos++);
rMenu.SetHelpId(ID_BROWSER_COPY, aNewItems->GetHelpId(SID_COPY));
rMenu.InsertSeparator(OString(), nPos++);
}
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index f41c7e0..bae2bbf 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -3473,14 +3473,14 @@ bool SbaTableQueryBrowser::requestQuickHelp( const SvTreeListEntry* _pEntry, OUS
return false;
}
PopupMenu* SbaTableQueryBrowser::getContextMenu( Control& _rControl ) const
VclPtr<PopupMenu> SbaTableQueryBrowser::getContextMenu( Control& _rControl ) const
{
OSL_PRECOND( &m_pTreeView->getListBox() == &_rControl,
"SbaTableQueryBrowser::getContextMenu: where does this come from?" );
if ( &m_pTreeView->getListBox() != &_rControl )
return nullptr;
return new PopupMenu( ModuleRes( MENU_BROWSER_DEFAULTCONTEXT ) );
return VclPtr<PopupMenu>::Create( ModuleRes( MENU_BROWSER_DEFAULTCONTEXT ) );
}
IController& SbaTableQueryBrowser::getCommandController()
diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx
index 5fefdad..d212bd2 100644
--- a/dbaccess/source/ui/control/dbtreelistbox.cxx
+++ b/dbaccess/source/ui/control/dbtreelistbox.cxx
@@ -551,9 +551,9 @@ namespace
}
}
std::unique_ptr<PopupMenu> DBTreeListBox::CreateContextMenu()
VclPtr<PopupMenu> DBTreeListBox::CreateContextMenu()
{
::std::unique_ptr< PopupMenu > pContextMenu;
VclPtr< PopupMenu > pContextMenu;
if ( !m_pContextMenuProvider )
return pContextMenu;
@@ -621,7 +621,7 @@ std::unique_ptr<PopupMenu> DBTreeListBox::CreateContextMenu()
if ( bModifiedMenu )
{
// the interceptor(s) modified the menu description => create a new PopupMenu
PopupMenu* pModifiedMenu = new PopupMenu;
VclPtrInstance<PopupMenu> pModifiedMenu;
::framework::ActionTriggerHelper::CreateMenuFromActionTriggerContainer(
pModifiedMenu, aEvent.ActionTriggerContainer );
aEvent.ActionTriggerContainer.clear();
diff --git a/dbaccess/source/ui/control/toolboxcontroller.cxx b/dbaccess/source/ui/control/toolboxcontroller.cxx
index 2f8816e..2208de1 100644
--- a/dbaccess/source/ui/control/toolboxcontroller.cxx
+++ b/dbaccess/source/ui/control/toolboxcontroller.cxx
@@ -159,7 +159,7 @@ namespace dbaui
aFind->second = Event.IsEnabled;
if ( m_aCommandURL == aFind->first && !Event.IsEnabled )
{
::std::unique_ptr<PopupMenu> pMenu = getMenu();
ScopedVclPtr<PopupMenu> pMenu(getMenu());
sal_uInt16 nCount = pMenu->GetItemCount();
for (sal_uInt16 i = 0; i < nCount; ++i)
{
@@ -177,12 +177,12 @@ namespace dbaui
}
}
}
::std::unique_ptr<PopupMenu> OToolboxController::getMenu()
VclPtr<PopupMenu> OToolboxController::getMenu()
{
::std::unique_ptr<PopupMenu> pMenu;
VclPtr<PopupMenu> pMenu;
if ( m_aStates.size() > 2 )
{
pMenu.reset( new PopupMenu( ModuleRes( RID_MENU_APP_NEW ) ) );
pMenu = VclPtr<PopupMenu>::Create( ModuleRes( RID_MENU_APP_NEW ) );
try
{
@@ -217,7 +217,7 @@ namespace dbaui
}
else
{
pMenu.reset( new PopupMenu( ModuleRes( RID_MENU_REFRESH_DATA ) ) );
pMenu = VclPtr<PopupMenu>::Create( ModuleRes( RID_MENU_REFRESH_DATA ) );
}
return pMenu;
}
@@ -229,7 +229,7 @@ namespace dbaui
::osl::MutexGuard aGuard(m_aMutex);
VclPtr< ToolBox > pToolBox = static_cast<ToolBox*>(VCLUnoHelper::GetWindow(getParent()).get());
::std::unique_ptr<PopupMenu> pMenu = getMenu();
ScopedVclPtr<PopupMenu> pMenu(getMenu());
sal_uInt16 nSelected = pMenu->Execute(pToolBox, pToolBox->GetItemRect( m_nToolBoxId ),PopupMenuFlags::ExecuteDown);
// "cleanup" the toolbox state
diff --git a/dbaccess/source/ui/inc/callbacks.hxx b/dbaccess/source/ui/inc/callbacks.hxx
index 9c2a579..c9e98ea 100644
--- a/dbaccess/source/ui/inc/callbacks.hxx
+++ b/dbaccess/source/ui/inc/callbacks.hxx
@@ -22,6 +22,7 @@
#include <sot/exchange.hxx>
#include <sot/formats.hxx>
#include <vcl/vclptr.hxx>
#include <com/sun/star/container/XContainer.hpp>
class SvTreeListEntry;
@@ -74,7 +75,7 @@ namespace dbaui
The control itself will, using the controller provided by getCommandController,
disable menu entries as needed.
*/
virtual PopupMenu* getContextMenu( Control& _rControl ) const = 0;
virtual VclPtr<PopupMenu> getContextMenu( Control& _rControl ) const = 0;
/** returns the controller which is responsible for providing states of certain features,
and executing them.
diff --git a/dbaccess/source/ui/inc/dbtreelistbox.hxx b/dbaccess/source/ui/inc/dbtreelistbox.hxx
index 21723a7..9a7413a 100644
--- a/dbaccess/source/ui/inc/dbtreelistbox.hxx
+++ b/dbaccess/source/ui/inc/dbtreelistbox.hxx
@@ -111,7 +111,7 @@ namespace dbaui
virtual bool DoubleClickHdl() override;
virtual std::unique_ptr<PopupMenu> CreateContextMenu() override;
virtual VclPtr<PopupMenu> CreateContextMenu() override;
virtual void ExecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry ) override;
void SetEnterKeyHdl(const Link<DBTreeListBox*,void>& rNewHdl) {m_aEnterKeyHdl = rNewHdl;}
diff --git a/dbaccess/source/ui/inc/toolboxcontroller.hxx b/dbaccess/source/ui/inc/toolboxcontroller.hxx
index 3e76fc2..05fba56 100644
--- a/dbaccess/source/ui/inc/toolboxcontroller.hxx
+++ b/dbaccess/source/ui/inc/toolboxcontroller.hxx
@@ -22,6 +22,7 @@
#include <svtools/toolboxcontroller.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/implbase1.hxx>
#include <vcl/vclptr.hxx>
#include "apitools.hxx"
#include "moduledbu.hxx"
@@ -41,7 +42,7 @@ namespace dbaui
TCommandState m_aStates;
sal_uInt16 m_nToolBoxId;
::std::unique_ptr<PopupMenu> getMenu();
VclPtr<PopupMenu> getMenu();
public:
OToolboxController(const css::uno::Reference< css::uno::XComponentContext >& _rxORB);
diff --git a/dbaccess/source/ui/inc/unodatbr.hxx b/dbaccess/source/ui/inc/unodatbr.hxx
index 02673fb..68b7acc 100644
--- a/dbaccess/source/ui/inc/unodatbr.hxx
+++ b/dbaccess/source/ui/inc/unodatbr.hxx
@@ -230,12 +230,11 @@ namespace dbaui
virtual sal_Int8 executeDrop( const ExecuteDropEvent& _rEvt ) override;
// IContextMenuProvider
virtual PopupMenu* getContextMenu( Control& _rControl ) const override;
virtual IController& getCommandController() override;
virtual VclPtr<PopupMenu> getContextMenu( Control& _rControl ) const override;
virtual IController& getCommandController() override;
virtual ::comphelper::OInterfaceContainerHelper2*
getContextMenuInterceptors() override;
virtual css::uno::Any
getCurrentSelection( Control& _rControl ) const override;
getContextMenuInterceptors() override;
virtual css::uno::Any getCurrentSelection( Control& _rControl ) const override;
virtual void impl_initialize() override;
diff --git a/dbaccess/source/ui/misc/WTypeSelect.cxx b/dbaccess/source/ui/misc/WTypeSelect.cxx
index 4b85643..b2b839d 100644
--- a/dbaccess/source/ui/misc/WTypeSelect.cxx
+++ b/dbaccess/source/ui/misc/WTypeSelect.cxx
@@ -423,7 +423,7 @@ bool OWizTypeSelectList::PreNotify( NotifyEvent& rEvt )
if (pComEvt->IsMouseEvent())
ptWhere = pComEvt->GetMousePosPixel();
PopupMenu aContextMenu(ModuleRes(RID_SBA_RTF_PKEYPOPUP));
ScopedVclPtrInstance<PopupMenu> aContextMenu(ModuleRes(RID_SBA_RTF_PKEYPOPUP));
// Should primary key checkbox be checked?
const sal_Int32 nCount = GetEntryCount();
bool bCheckOk = false;
@@ -443,9 +443,9 @@ bool OWizTypeSelectList::PreNotify( NotifyEvent& rEvt )
}
if (bCheckOk)
aContextMenu.CheckItem( SID_TABLEDESIGN_TABED_PRIMARYKEY );
aContextMenu->CheckItem( SID_TABLEDESIGN_TABED_PRIMARYKEY );
switch( aContextMenu.Execute( this, ptWhere ) )
switch( aContextMenu->Execute( this, ptWhere ) )
{
case SID_TABLEDESIGN_TABED_PRIMARYKEY:
{
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index d12eca7..1ea84c3 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -1128,8 +1128,8 @@ bool OJoinTableView::IsAddAllowed()
void OJoinTableView::executePopup(const Point& _aPos, VclPtr<OTableConnection>& rSelConnection)
{
PopupMenu aContextMenu( ModuleRes( RID_MENU_JOINVIEW_CONNECTION ) );
switch (aContextMenu.Execute(this, _aPos))
ScopedVclPtrInstance<PopupMenu> aContextMenu( ModuleRes( RID_MENU_JOINVIEW_CONNECTION ) );
switch (aContextMenu->Execute(this, _aPos))
{
case SID_DELETE:
RemoveConnection(rSelConnection, true);
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index cff9469..e9d14ebfd 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -1951,8 +1951,8 @@ void OSelectionBrowseBox::Command(const CommandEvent& rEvt)
if (!static_cast<OQueryController&>(getDesignView()->getController()).isReadOnly())
{
PopupMenu aContextMenu( ModuleRes( RID_QUERYCOLPOPUPMENU ) );
switch (aContextMenu.Execute(this, aMenuPos))
ScopedVclPtrInstance<PopupMenu> aContextMenu( ModuleRes( RID_QUERYCOLPOPUPMENU ) );
switch (aContextMenu->Execute(this, aMenuPos))
{
case SID_DELETE:
RemoveField(nColId);
@@ -1968,13 +1968,13 @@ void OSelectionBrowseBox::Command(const CommandEvent& rEvt)
{
if (!static_cast<OQueryController&>(getDesignView()->getController()).isReadOnly())
{
PopupMenu aContextMenu(ModuleRes(RID_QUERYFUNCTION_POPUPMENU));
aContextMenu.CheckItem( ID_QUERY_FUNCTION, m_bVisibleRow[BROW_FUNCTION_ROW]);
aContextMenu.CheckItem( ID_QUERY_TABLENAME, m_bVisibleRow[BROW_TABLE_ROW]);
aContextMenu.CheckItem( ID_QUERY_ALIASNAME, m_bVisibleRow[BROW_COLUMNALIAS_ROW]);
aContextMenu.CheckItem( ID_QUERY_DISTINCT, static_cast<OQueryController&>(getDesignView()->getController()).isDistinct());
ScopedVclPtrInstance<PopupMenu> aContextMenu(ModuleRes(RID_QUERYFUNCTION_POPUPMENU));
aContextMenu->CheckItem( ID_QUERY_FUNCTION, m_bVisibleRow[BROW_FUNCTION_ROW]);
aContextMenu->CheckItem( ID_QUERY_TABLENAME, m_bVisibleRow[BROW_TABLE_ROW]);
aContextMenu->CheckItem( ID_QUERY_ALIASNAME, m_bVisibleRow[BROW_COLUMNALIAS_ROW]);
aContextMenu->CheckItem( ID_QUERY_DISTINCT, static_cast<OQueryController&>(getDesignView()->getController()).isDistinct());
switch (aContextMenu.Execute(this, aMenuPos))
switch (aContextMenu->Execute(this, aMenuPos))
{
case ID_QUERY_FUNCTION:
SetRowVisible(BROW_FUNCTION_ROW, !IsRowVisible(BROW_FUNCTION_ROW));
diff --git a/dbaccess/source/ui/querydesign/TableWindow.cxx b/dbaccess/source/ui/querydesign/TableWindow.cxx
index 10d3fd4e..b699f0d 100644
--- a/dbaccess/source/ui/querydesign/TableWindow.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindow.cxx
@@ -603,8 +603,8 @@ void OTableWindow::Command(const CommandEvent& rEvt)
ptWhere = m_xTitle->GetPosPixel();
}
PopupMenu aContextMenu(ModuleRes(RID_MENU_JOINVIEW_TABLE));
switch (aContextMenu.Execute(this, ptWhere))
ScopedVclPtrInstance<PopupMenu> aContextMenu(ModuleRes(RID_MENU_JOINVIEW_TABLE));
switch (aContextMenu->Execute(this, ptWhere))
{
case SID_DELETE:
Remove();
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index 04da703..7a39f55d 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -1361,10 +1361,10 @@ void OTableEditorCtrl::Command(const CommandEvent& rEvt)
if ( !IsColumnSelected( nColId ) )
SelectColumnId( nColId );
PopupMenu aContextMenu( ModuleRes( RID_QUERYCOLPOPUPMENU ) );
aContextMenu.EnableItem( SID_DELETE, false );
aContextMenu.RemoveDisabledEntries(true, true);
switch ( aContextMenu.Execute( this, aMenuPos ) )
ScopedVclPtrInstance<PopupMenu> aContextMenu( ModuleRes( RID_QUERYCOLPOPUPMENU ) );
aContextMenu->EnableItem( SID_DELETE, false );
aContextMenu->RemoveDisabledEntries(true, true);
switch ( aContextMenu->Execute( this, aMenuPos ) )
{
case ID_BROWSER_COLWIDTH:
adjustBrowseBoxColumnWidth( this, nColId );
@@ -1375,18 +1375,18 @@ void OTableEditorCtrl::Command(const CommandEvent& rEvt)
}
else
{
PopupMenu aContextMenu(ModuleRes(RID_TABLEDESIGNROWPOPUPMENU));
ScopedVclPtrInstance<PopupMenu> aContextMenu(ModuleRes(RID_TABLEDESIGNROWPOPUPMENU));
aContextMenu.EnableItem( SID_CUT, IsCutAllowed(nRow) );
aContextMenu.EnableItem( SID_COPY, IsCopyAllowed(nRow) );
aContextMenu.EnableItem( SID_PASTE, IsPasteAllowed(nRow) );
aContextMenu.EnableItem( SID_DELETE, IsDeleteAllowed(nRow) );
aContextMenu.EnableItem( SID_TABLEDESIGN_TABED_PRIMARYKEY, IsPrimaryKeyAllowed(nRow) );
aContextMenu.EnableItem( SID_TABLEDESIGN_INSERTROWS, IsInsertNewAllowed(nRow) );
aContextMenu.CheckItem( SID_TABLEDESIGN_TABED_PRIMARYKEY, IsRowSelected(GetCurRow()) && IsPrimaryKey() );
aContextMenu->EnableItem( SID_CUT, IsCutAllowed(nRow) );
aContextMenu->EnableItem( SID_COPY, IsCopyAllowed(nRow) );
aContextMenu->EnableItem( SID_PASTE, IsPasteAllowed(nRow) );
aContextMenu->EnableItem( SID_DELETE, IsDeleteAllowed(nRow) );
aContextMenu->EnableItem( SID_TABLEDESIGN_TABED_PRIMARYKEY, IsPrimaryKeyAllowed(nRow) );
aContextMenu->EnableItem( SID_TABLEDESIGN_INSERTROWS, IsInsertNewAllowed(nRow) );
aContextMenu->CheckItem( SID_TABLEDESIGN_TABED_PRIMARYKEY, IsRowSelected(GetCurRow()) && IsPrimaryKey() );
// remove all the disable entries
aContextMenu.RemoveDisabledEntries(true, true);
aContextMenu->RemoveDisabledEntries(true, true);
if( SetDataPtr(m_nDataPos) )
pDescrWin->SaveData( pActRow->GetActFieldDescr() );
@@ -1394,7 +1394,7 @@ void OTableEditorCtrl::Command(const CommandEvent& rEvt)
// All actions which change the number of rows must be run asynchronously
// otherwise there may be problems between the Context menu and the Browser
m_nDataPos = GetCurRow();
switch (aContextMenu.Execute(this, aMenuPos))
switch (aContextMenu->Execute(this, aMenuPos))
{
case SID_CUT:
cut();
diff --git a/dbaccess/source/ui/tabledesign/TableDesignControl.cxx b/dbaccess/source/ui/tabledesign/TableDesignControl.cxx
index 77f0650..668edcd 100644
--- a/dbaccess/source/ui/tabledesign/TableDesignControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TableDesignControl.cxx
@@ -107,13 +107,13 @@ void OTableRowView::Command(const CommandEvent& rEvt)
if ( nColId == HANDLE_ID )
{
PopupMenu aContextMenu(ModuleRes(RID_TABLEDESIGNROWPOPUPMENU));
ScopedVclPtrInstance<PopupMenu> aContextMenu(ModuleRes(RID_TABLEDESIGNROWPOPUPMENU));
long nSelectRowCount = GetSelectRowCount();
aContextMenu.EnableItem( SID_CUT, nSelectRowCount != 0);
aContextMenu.EnableItem( SID_COPY, nSelectRowCount != 0);
aContextMenu.EnableItem( SID_PASTE, m_bClipboardFilled );
aContextMenu.EnableItem( SID_DELETE, false );
switch (aContextMenu.Execute(this, rEvt.GetMousePosPixel()))
aContextMenu->EnableItem( SID_CUT, nSelectRowCount != 0);
aContextMenu->EnableItem( SID_COPY, nSelectRowCount != 0);
aContextMenu->EnableItem( SID_PASTE, m_bClipboardFilled );
aContextMenu->EnableItem( SID_DELETE, false );
switch (aContextMenu->Execute(this, rEvt.GetMousePosPixel()))
{
case SID_CUT:
cut();
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
index a4a5867..b14650a 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
@@ -359,10 +359,10 @@ MENU_COMMAND ExtBoxWithBtns_Impl::ShowPopupMenu( const Point & rPos, const long
if ( nPos >= (long) getItemCount() )
return CMD_NONE;
PopupMenu aPopup;
ScopedVclPtrInstance<PopupMenu> aPopup;
#if ENABLE_EXTENSION_UPDATE
aPopup.InsertItem( CMD_UPDATE, DialogHelper::getResourceString( RID_CTX_ITEM_CHECK_UPDATE ) );
aPopup->InsertItem( CMD_UPDATE, DialogHelper::getResourceString( RID_CTX_ITEM_CHECK_UPDATE ) );
#endif
if ( ! GetEntryData( nPos )->m_bLocked )
@@ -370,17 +370,17 @@ MENU_COMMAND ExtBoxWithBtns_Impl::ShowPopupMenu( const Point & rPos, const long
if ( GetEntryData( nPos )->m_bUser )
{
if ( GetEntryData( nPos )->m_eState == REGISTERED )
aPopup.InsertItem( CMD_DISABLE, DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) );
aPopup->InsertItem( CMD_DISABLE, DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) );
else if ( GetEntryData( nPos )->m_eState != NOT_AVAILABLE )
aPopup.InsertItem( CMD_ENABLE, DialogHelper::getResourceString( RID_CTX_ITEM_ENABLE ) );
aPopup->InsertItem( CMD_ENABLE, DialogHelper::getResourceString( RID_CTX_ITEM_ENABLE ) );
}
aPopup.InsertItem( CMD_REMOVE, DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) );
aPopup->InsertItem( CMD_REMOVE, DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) );
}
if ( !GetEntryData( nPos )->m_sLicenseText.isEmpty() )
aPopup.InsertItem( CMD_SHOW_LICENSE, DialogHelper::getResourceString( RID_STR_SHOW_LICENSE_CMD ) );
aPopup->InsertItem( CMD_SHOW_LICENSE, DialogHelper::getResourceString( RID_STR_SHOW_LICENSE_CMD ) );
return (MENU_COMMAND) aPopup.Execute( this, rPos );
return (MENU_COMMAND) aPopup->Execute( this, rPos );
}
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
index 624a64d..5354816 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
@@ -654,17 +654,17 @@ void UpdateDialog::CheckListBox::handlePopupMenu( const Point &rPos )
if ( ( p->m_eKind == ENABLED_UPDATE ) || ( p->m_eKind == DISABLED_UPDATE ) )
{
PopupMenu aPopup;
ScopedVclPtrInstance<PopupMenu> aPopup;
if ( p->m_bIgnored )
aPopup.InsertItem( CMD_ENABLE_UPDATE, m_enableUpdate );
aPopup->InsertItem( CMD_ENABLE_UPDATE, m_enableUpdate );
else
{
aPopup.InsertItem( CMD_IGNORE_UPDATE, m_ignoreUpdate );
aPopup.InsertItem( CMD_IGNORE_ALL_UPDATES, m_ignoreAllUpdates );
aPopup->InsertItem( CMD_IGNORE_UPDATE, m_ignoreUpdate );
aPopup->InsertItem( CMD_IGNORE_ALL_UPDATES, m_ignoreAllUpdates );
}
sal_uInt16 aCmd = aPopup.Execute( this, rPos );
sal_uInt16 aCmd = aPopup->Execute( this, rPos );
if ( ( aCmd == CMD_IGNORE_UPDATE ) || ( aCmd == CMD_IGNORE_ALL_UPDATES ) )
{
p->m_bIgnored = true;
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 84dba19..0cd9e6f 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -765,9 +765,9 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
ESelection aOldSel = GetSelection();
if ( xSpeller.is() && pImpEditView->IsWrongSpelledWord( aPaM, true ) )
{
PopupMenu aPopupMenu( EditResId( RID_MENU_SPELL ) );
PopupMenu *pAutoMenu = aPopupMenu.GetPopupMenu( MN_AUTOCORR );
PopupMenu *pInsertMenu = aPopupMenu.GetPopupMenu( MN_INSERT ); // add word to user-dictionaries
ScopedVclPtrInstance<PopupMenu> aPopupMenu( EditResId( RID_MENU_SPELL ) );
PopupMenu *pAutoMenu = aPopupMenu->GetPopupMenu( MN_AUTOCORR );
PopupMenu *pInsertMenu = aPopupMenu->GetPopupMenu( MN_INSERT ); // add word to user-dictionaries
pInsertMenu->SetMenuFlags( MenuFlags::NoAutoMnemonics ); //! necessary to retrieve the correct dictionary names later
EditPaM aPaM2( aPaM );
@@ -824,24 +824,24 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
if (nGuessLangPara == LANGUAGE_NONE)
nGuessLangPara = nGuessLangWord;
aPopupMenu.InsertSeparator();
aPopupMenu->InsertSeparator();
OUString aTmpWord( SvtLanguageTable::GetLanguageString( nGuessLangWord ) );
OUString aTmpPara( SvtLanguageTable::GetLanguageString( nGuessLangPara ) );
OUString aWordStr( EE_RESSTR( RID_STR_WORD ) );
aWordStr = aWordStr.replaceFirst( "%x", aTmpWord );
OUString aParaStr( EE_RESSTR( RID_STR_PARAGRAPH ) );
aParaStr = aParaStr.replaceFirst( "%x", aTmpPara );
aPopupMenu.InsertItem( MN_WORDLANGUAGE, aWordStr );
aPopupMenu.SetHelpId( MN_WORDLANGUAGE, HID_EDITENG_SPELLER_WORDLANGUAGE );
aPopupMenu.InsertItem( MN_PARALANGUAGE, aParaStr );
aPopupMenu.SetHelpId( MN_PARALANGUAGE, HID_EDITENG_SPELLER_PARALANGUAGE );
aPopupMenu->InsertItem( MN_WORDLANGUAGE, aWordStr );
aPopupMenu->SetHelpId( MN_WORDLANGUAGE, HID_EDITENG_SPELLER_WORDLANGUAGE );
aPopupMenu->InsertItem( MN_PARALANGUAGE, aParaStr );
aPopupMenu->SetHelpId( MN_PARALANGUAGE, HID_EDITENG_SPELLER_PARALANGUAGE );
}
// ## Create mnemonics here
if ( Application::IsAutoMnemonicEnabled() )
{
aPopupMenu.CreateAutoMnemonics();
aPopupMenu.SetMenuFlags( aPopupMenu.GetMenuFlags() | MenuFlags::NoAutoMnemonics );
aPopupMenu->CreateAutoMnemonics();
aPopupMenu->SetMenuFlags( aPopupMenu->GetMenuFlags() | MenuFlags::NoAutoMnemonics );
}
// Replace suggestions...
@@ -855,13 +855,13 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
for ( sal_uInt16 nW = 0; nW < nWords; nW++ )
{
OUString aAlternate( pAlt[nW] );
aPopupMenu.InsertItem( MN_ALTSTART+nW, aAlternate, MenuItemBits::NONE, OString(), nW );
aPopupMenu->InsertItem( MN_ALTSTART+nW, aAlternate, MenuItemBits::NONE, OString(), nW );
pAutoMenu->InsertItem( MN_AUTOSTART+nW, aAlternate, MenuItemBits::NONE, OString(), nW );
}
aPopupMenu.InsertSeparator(OString(), nWords);
aPopupMenu->InsertSeparator(OString(), nWords);
}
else
aPopupMenu.RemoveItem( MN_AUTOCORR ); // delete?
aPopupMenu->RemoveItem( MN_AUTOCORR ); // delete?
SvtLinguConfig aCfg;
@@ -915,18 +915,18 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
}
}
if ( pInsertMenu->GetItemCount() != 1)
aPopupMenu.EnableItem( MN_INSERT_SINGLE, false );
aPopupMenu->EnableItem( MN_INSERT_SINGLE, false );
if ( pInsertMenu->GetItemCount() < 2 )
aPopupMenu.EnableItem( MN_INSERT, false );
aPopupMenu->EnableItem( MN_INSERT, false );
aPopupMenu.RemoveDisabledEntries( true, true );
aPopupMenu->RemoveDisabledEntries( true, true );
Rectangle aTempRect = pImpEditView->pEditEngine->pImpEditEngine->PaMtoEditCursor( aPaM, GETCRSR_TXTONLY );
Point aScreenPos = pImpEditView->GetWindowPos( aTempRect.TopLeft() );
aScreenPos = pImpEditView->GetWindow()->OutputToScreenPixel( aScreenPos );
aTempRect = pImpEditView->GetWindow()->LogicToPixel( Rectangle(aScreenPos, aTempRect.GetSize() ));
sal_uInt16 nId = aPopupMenu.Execute( pImpEditView->GetWindow(), aTempRect, PopupMenuFlags::NoMouseUpClose );
sal_uInt16 nId = aPopupMenu->Execute( pImpEditView->GetWindow(), aTempRect, PopupMenuFlags::NoMouseUpClose );
if ( nId == MN_IGNORE )
{
OUString aWord = pImpEditView->SpellIgnoreWord();
diff --git a/extensions/source/bibliography/toolbar.cxx b/extensions/source/bibliography/toolbar.cxx
index 3cf37e48..65e4010 100644
--- a/extensions/source/bibliography/toolbar.cxx
+++ b/extensions/source/bibliography/toolbar.cxx
@@ -383,21 +383,21 @@ void BibToolBar::Click()
void BibToolBar::ClearFilterMenu()
{
aPopupMenu.Clear();
pPopupMenu->Clear();
nMenuId=0;
}
sal_uInt16 BibToolBar::InsertFilterItem(const OUString& aMenuEntry)
{
nMenuId++;
aPopupMenu.InsertItem(nMenuId,aMenuEntry);
pPopupMenu->InsertItem(nMenuId,aMenuEntry);
return nMenuId;
}
void BibToolBar::SelectFilterItem(sal_uInt16 nId)
{
aPopupMenu.CheckItem(nId);
pPopupMenu->CheckItem(nId);
nSelMenuItem=nId;
aQueryField = MnemonicGenerator::EraseAllMnemonicChars( aPopupMenu.GetItemText(nId) );
aQueryField = MnemonicGenerator::EraseAllMnemonicChars( pPopupMenu->GetItemText(nId) );
}
void BibToolBar::EnableSourceList(bool bFlag)
@@ -490,15 +490,15 @@ IMPL_LINK_NOARG_TYPED( BibToolBar, MenuHdl, ToolBox*, void)
EndSelection(); // vor SetDropMode (SetDropMode ruft SetItemImage)
SetItemDown(nTBC_BT_AUTOFILTER, true);
nId = aPopupMenu.Execute(this, GetItemRect(nTBC_BT_AUTOFILTER));
nId = pPopupMenu->Execute(this, GetItemRect(nTBC_BT_AUTOFILTER));
if(nId>0)
{
aPopupMenu.CheckItem(nSelMenuItem,false);
aPopupMenu.CheckItem(nId);
pPopupMenu->CheckItem(nSelMenuItem,false);
pPopupMenu->CheckItem(nId);
nSelMenuItem=nId;
aQueryField = MnemonicGenerator::EraseAllMnemonicChars( aPopupMenu.GetItemText(nId) );
aQueryField = MnemonicGenerator::EraseAllMnemonicChars( pPopupMenu->GetItemText(nId) );
Sequence<PropertyValue> aPropVal(2);
PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray());
pPropertyVal[0].Name = "QueryText";
diff --git a/extensions/source/bibliography/toolbar.hxx b/extensions/source/bibliography/toolbar.hxx
index 9743e28..97f189c 100644
--- a/extensions/source/bibliography/toolbar.hxx
+++ b/extensions/source/bibliography/toolbar.hxx
@@ -116,7 +116,7 @@ class BibToolBar: public ToolBox
VclPtr<ListBox> aLBSource;
VclPtr<FixedText> aFtQuery;
VclPtr<Edit> aEdQuery;
PopupMenu aPopupMenu;
ScopedVclPtr<PopupMenu> pPopupMenu;
sal_uInt16 nMenuId;
sal_uInt16 nSelMenuItem;
OUString aQueryField;
diff --git a/extensions/source/update/ui/updatecheckui.cxx b/extensions/source/update/ui/updatecheckui.cxx
index f8f9e9f..25f5655 100644
--- a/extensions/source/update/ui/updatecheckui.cxx
+++ b/extensions/source/update/ui/updatecheckui.cxx
@@ -126,7 +126,7 @@ class UpdateCheckUI : public ::cppu::WeakImplHelper
Image maBubbleImage;
VclPtr<BubbleWindow> mpBubbleWin;
VclPtr<SystemWindow> mpIconSysWin;
MenuBar* mpIconMBar;
VclPtr<MenuBar> mpIconMBar;
ResMgr* mpUpdResMgr;
ResMgr* mpSfxResMgr;
Idle maWaitIdle;
diff --git a/fpicker/source/office/RemoteFilesDialog.hxx b/fpicker/source/office/RemoteFilesDialog.hxx
index a2a7d16..84ba1e7 100644
--- a/fpicker/source/office/RemoteFilesDialog.hxx
+++ b/fpicker/source/office/RemoteFilesDialog.hxx
@@ -162,7 +162,7 @@ private:
VclPtr< FileViewContainer > m_pContainer;
VclPtr< ListBox > m_pFilter_lb;
VclPtr< AutocompleteEdit > m_pName_ed;
PopupMenu* m_pAddMenu;
VclPtr<PopupMenu> m_pAddMenu;
ImageList m_aImages;
diff --git a/fpicker/source/office/iodlgimp.cxx b/fpicker/source/office/iodlgimp.cxx
index 7aaa3d0..9cee811 100644
--- a/fpicker/source/office/iodlgimp.cxx
+++ b/fpicker/source/office/iodlgimp.cxx
@@ -91,7 +91,7 @@ SvtFileDialogFilter_Impl::~SvtFileDialogFilter_Impl()
SvtFileDialogURLSelector::SvtFileDialogURLSelector( vcl::Window* _pParent, SvtFileDialog* _pDlg, WinBits nBits, sal_uInt16 _nButtonId )
:MenuButton ( _pParent, nBits )
,m_pDlg ( _pDlg )
,m_pMenu ( new PopupMenu )
,m_pMenu ( VclPtr<PopupMenu>::Create() )
{
SetStyle( GetStyle() | WB_NOPOINTERFOCUS | WB_RECTSTYLE | WB_SMALLSTYLE );
SetModeImage( _pDlg->GetButtonImage( _nButtonId ) );
@@ -107,7 +107,7 @@ SvtFileDialogURLSelector::~SvtFileDialogURLSelector()
void SvtFileDialogURLSelector::dispose()
{
delete m_pMenu;
m_pMenu.disposeAndClear();
m_pDlg.clear();
MenuButton::dispose();
}
diff --git a/fpicker/source/office/iodlgimp.hxx b/fpicker/source/office/iodlgimp.hxx
index 1726a39..7ad9443 100644
--- a/fpicker/source/office/iodlgimp.hxx
+++ b/fpicker/source/office/iodlgimp.hxx
@@ -84,7 +84,7 @@ public:
virtual void dispose() override;
private:
VclPtr<SvtFileDialog> m_pDlg;
PopupMenu* m_pMenu;
VclPtr<PopupMenu> m_pMenu;
protected:
inline SvtFileDialog* GetDialogParent() { return m_pDlg; }
diff --git a/framework/inc/classes/rootactiontriggercontainer.hxx b/framework/inc/classes/rootactiontriggercontainer.hxx
index bc0fa2b..53d009c 100644
--- a/framework/inc/classes/rootactiontriggercontainer.hxx
+++ b/framework/inc/classes/rootactiontriggercontainer.hxx
@@ -106,7 +106,7 @@ class FWE_DLLPUBLIC RootActionTriggerContainer : public PropertySetContainer,
bool m_bContainerCreated;
bool m_bContainerChanged;
bool m_bInContainerCreation;
const Menu* m_pMenu;
VclPtr<const Menu> m_pMenu;
const OUString* m_pMenuIdentifier;
};
diff --git a/framework/inc/uielement/generictoolbarcontroller.hxx b/framework/inc/uielement/generictoolbarcontroller.hxx
index 805a232..69f57f7 100644
--- a/framework/inc/uielement/generictoolbarcontroller.hxx
+++ b/framework/inc/uielement/generictoolbarcontroller.hxx
@@ -70,7 +70,7 @@ class GenericToolbarController : public svt::ToolboxController
class MenuToolbarController : public GenericToolbarController
{
css::uno::Reference< css::container::XIndexAccess > m_xMenuDesc;
PopupMenu* pMenu;
VclPtr<PopupMenu> pMenu;
css::uno::Reference< css::lang::XComponent > m_xMenuManager;
OUString m_aModuleIdentifier;
public:
diff --git a/framework/inc/uielement/menubarmanager.hxx b/framework/inc/uielement/menubarmanager.hxx
index 0405df3..8e30d5d 100644
--- a/framework/inc/uielement/menubarmanager.hxx
+++ b/framework/inc/uielement/menubarmanager.hxx
@@ -215,7 +215,7 @@ class MenuBarManager : public css::frame::XStatusListener ,
bool m_bHasMenuBar;
OUString m_aMenuItemCommand;
OUString m_aModuleIdentifier;
Menu* m_pVCLMenu;
VclPtr<Menu> m_pVCLMenu;
css::uno::Reference< css::frame::XFrame > m_xFrame;
css::uno::Reference< css::container::XNameAccess > m_xUICommandLabels;
css::uno::Reference< css::frame::XUIControllerFactory > m_xPopupMenuControllerFactory;
diff --git a/framework/inc/uielement/menubarmerger.hxx b/framework/inc/uielement/menubarmerger.hxx
index 354c0fd..1cced99 100644
--- a/framework/inc/uielement/menubarmerger.hxx
+++ b/framework/inc/uielement/menubarmerger.hxx
@@ -51,7 +51,7 @@ enum RPResultInfo
struct ReferencePathInfo
{
Menu* pPopupMenu;
VclPtr<Menu> pPopupMenu;
sal_uInt16 nPos;
sal_Int32 nLevel;
RPResultInfo eResult;
diff --git a/framework/source/fwe/classes/addonmenu.cxx b/framework/source/fwe/classes/addonmenu.cxx
index f69ae27..2e20b30 100644
--- a/framework/source/fwe/classes/addonmenu.cxx
+++ b/framework/source/fwe/classes/addonmenu.cxx
@@ -53,14 +53,12 @@ AddonMenu::AddonMenu( const css::uno::Reference< css::frame::XFrame >& rFrame )
AddonMenu::~AddonMenu()
{
for ( sal_uInt16 i = 0; i < GetItemCount(); i++ )
{
if ( GetItemType( i ) != MenuItemType::SEPARATOR )
{
sal_uInt16 nId = GetItemId( i );
delete GetPopupMenu( nId );
}
}
disposeOnce();
}
void AddonMenu::dispose()
{
PopupMenu::dispose();
}
// Check if command URL string has the unique prefix to identify addon popup menus
@@ -101,36 +99,35 @@ bool AddonMenuManager::HasAddonMenuElements()
}
// Factory method to create different Add-On menu types
PopupMenu* AddonMenuManager::CreatePopupMenuType( MenuType eMenuType, const Reference< XFrame >& rFrame )
VclPtr<PopupMenu> AddonMenuManager::CreatePopupMenuType( MenuType eMenuType, const Reference< XFrame >& rFrame )
{
if ( eMenuType == ADDON_MENU )
return new AddonMenu( rFrame );
return VclPtr<AddonMenu>::Create( rFrame );
else if ( eMenuType == ADDON_POPUPMENU )
return new AddonPopupMenu( rFrame );
return VclPtr<AddonPopupMenu>::Create( rFrame );
else
return nullptr;
}
// Create the Add-Ons menu
AddonMenu* AddonMenuManager::CreateAddonMenu( const Reference< XFrame >& rFrame,
VclPtr<AddonMenu> AddonMenuManager::CreateAddonMenu( const Reference< XFrame >& rFrame,
const Reference< XComponentContext >& rContext )
{
AddonsOptions aOptions;
AddonMenu* pAddonMenu = nullptr;
sal_uInt16 nUniqueMenuId = ADDONMENU_ITEMID_START;
AddonsOptions aOptions;
VclPtr<AddonMenu> pAddonMenu;
sal_uInt16 nUniqueMenuId = ADDONMENU_ITEMID_START;
const Sequence< Sequence< PropertyValue > >& rAddonMenuEntries = aOptions.GetAddonsMenu();
if ( rAddonMenuEntries.getLength() > 0 )
{
pAddonMenu = static_cast<AddonMenu *>(AddonMenuManager::CreatePopupMenuType( ADDON_MENU, rFrame ));
pAddonMenu = static_cast<AddonMenu *>(AddonMenuManager::CreatePopupMenuType( ADDON_MENU, rFrame ).get());
::rtl::OUString aModuleIdentifier = GetModuleIdentifier( rContext, rFrame );
AddonMenuManager::BuildMenu( pAddonMenu, ADDON_MENU, MENU_APPEND, nUniqueMenuId, rAddonMenuEntries, rFrame, aModuleIdentifier );
// Don't return an empty Add-On menu
if ( pAddonMenu->GetItemCount() == 0 )
{
delete pAddonMenu;
pAddonMenu = nullptr;
pAddonMenu.disposeAndClear();
}
}
@@ -243,7 +240,7 @@ void AddonMenuManager::MergeAddonPopupMenus( const Reference< XFrame >& rFrame,
AddonMenuManager::IsCorrectContext( aModuleIdentifier, aContext ))
{
sal_uInt16 nId = nUniqueMenuId++;
AddonPopupMenu* pAddonPopupMenu = static_cast<AddonPopupMenu *>(AddonMenuManager::CreatePopupMenuType( ADDON_POPUPMENU, rFrame ));
VclPtr<AddonPopupMenu> pAddonPopupMenu = static_cast<AddonPopupMenu *>(AddonMenuManager::CreatePopupMenuType( ADDON_POPUPMENU, rFrame ).get());
AddonMenuManager::BuildMenu( pAddonPopupMenu, ADDON_MENU, MENU_APPEND, nUniqueMenuId, aAddonSubMenu, rFrame, aModuleIdentifier );
@@ -257,7 +254,7 @@ void AddonMenuManager::MergeAddonPopupMenus( const Reference< XFrame >& rFrame,
pMergeMenuBar->SetItemCommand( nId, aURL );
}
else
delete pAddonPopupMenu;
pAddonPopupMenu.disposeAndClear();
}
}
}
@@ -296,7 +293,7 @@ void AddonMenuManager::BuildMenu( PopupMenu* pCurrent
bInsertSeparator = true;
else
{
PopupMenu* pSubMenu = nullptr;
VclPtr<PopupMenu> pSubMenu;
if ( aAddonSubMenu.getLength() > 0 )
{
pSubMenu = AddonMenuManager::CreatePopupMenuType( nSubMenuType, rFrame );
@@ -305,8 +302,7 @@ void AddonMenuManager::BuildMenu( PopupMenu* pCurrent
// Don't create a menu item for an empty sub menu
if ( pSubMenu->GetItemCount() == 0 )
{
delete pSubMenu;
pSubMenu = nullptr;
pSubMenu.disposeAndClear();
continue;
}
}
diff --git a/framework/source/fwe/helper/actiontriggerhelper.cxx b/framework/source/fwe/helper/actiontriggerhelper.cxx
index 3749606..33a171b 100644
--- a/framework/source/fwe/helper/actiontriggerhelper.cxx
+++ b/framework/source/fwe/helper/actiontriggerhelper.cxx
@@ -208,7 +208,7 @@ void InsertSubMenuItems( Menu* pSubMenu, sal_uInt16& nItemId, const Reference< X
if ( xSubContainer.is() )
{
PopupMenu* pNewSubMenu = new PopupMenu;
VclPtr<PopupMenu> pNewSubMenu = VclPtr<PopupMenu>::Create();
// Sub menu (recursive call CreateSubMenu )
InsertSubMenuItems( pNewSubMenu, nItemId, xSubContainer );
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index 3dfab06..7d65c33 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -208,7 +208,7 @@ void LayoutManager::impl_clearUpMenuBar()
}
// reset inplace menubar manager
Menu *pMenuBar = nullptr;
VclPtr<Menu> pMenuBar;
if (m_pInplaceMenuBar)
{
pMenuBar = m_pInplaceMenuBar->GetMenuBar();
@@ -219,7 +219,7 @@ void LayoutManager::impl_clearUpMenuBar()
m_xInplaceMenuBar->dispose();
m_xInplaceMenuBar.clear();
}
delete pMenuBar;
pMenuBar.disposeAndClear();
Reference< XComponent > xComp( m_xMenuBar, UNO_QUERY );
if ( xComp.is() )
@@ -1150,7 +1150,7 @@ throw (uno::RuntimeException, std::exception)
SolarMutexGuard aGuard;
// Reset old inplace menubar!
Menu *pOldMenuBar = nullptr;
VclPtr<Menu> pOldMenuBar;
if (m_pInplaceMenuBar)
{
pOldMenuBar = m_pInplaceMenuBar->GetMenuBar();
@@ -1161,7 +1161,7 @@ throw (uno::RuntimeException, std::exception)
m_xInplaceMenuBar->dispose();
m_xInplaceMenuBar.clear();
}
delete pOldMenuBar;
pOldMenuBar.disposeAndClear();
m_bInplaceMenuSet = false;
@@ -1170,7 +1170,7 @@ throw (uno::RuntimeException, std::exception)
OUString aModuleIdentifier;
Reference< XDispatchProvider > xDispatchProvider;
MenuBar* pMenuBar = new MenuBar;
VclPtr<MenuBar> pMenuBar = VclPtr<MenuBar>::Create();
m_pInplaceMenuBar = new MenuBarManager( m_xContext, m_xFrame, m_xURLTransformer, xDispatchProvider, aModuleIdentifier, pMenuBar, true, true );
m_pInplaceMenuBar->SetItemContainer( xMergedMenuBar );
@@ -1210,7 +1210,7 @@ throw (uno::RuntimeException)
}
// Remove inplace menu bar
Menu *pMenuBar = nullptr;
VclPtr<Menu> pMenuBar;
if (m_pInplaceMenuBar)
{
pMenuBar = m_pInplaceMenuBar->GetMenuBar();
@@ -1221,7 +1221,7 @@ throw (uno::RuntimeException)
m_xInplaceMenuBar->dispose();
m_xInplaceMenuBar.clear();
}
delete pMenuBar;
pMenuBar.disposeAndClear();
}
void SAL_CALL LayoutManager::attachFrame( const Reference< XFrame >& xFrame )
@@ -2830,7 +2830,7 @@ throw( RuntimeException, std::exception )
implts_destroyElements();
impl_clearUpMenuBar();
m_xMenuBar.clear();
Menu *pMenuBar = nullptr;
VclPtr<Menu> pMenuBar;
if (m_pInplaceMenuBar)
{
pMenuBar = m_pInplaceMenuBar->GetMenuBar();
@@ -2841,7 +2841,7 @@ throw( RuntimeException, std::exception )
m_xInplaceMenuBar->dispose();
m_xInplaceMenuBar.clear();
}
delete pMenuBar;
pMenuBar.disposeAndClear();
m_xContainerWindow.clear();
m_xContainerTopWindow.clear();
@@ -2894,7 +2894,7 @@ throw( RuntimeException, std::exception )
}
impl_clearUpMenuBar();
m_xMenuBar.clear();
Menu *pMenuBar = nullptr;
VclPtr<Menu> pMenuBar;
if (m_pInplaceMenuBar)
{
pMenuBar = m_pInplaceMenuBar->GetMenuBar();
@@ -2905,7 +2905,7 @@ throw( RuntimeException, std::exception )
m_xInplaceMenuBar->dispose();
m_xInplaceMenuBar.clear();
}
delete pMenuBar;
pMenuBar.disposeAndClear();
m_xContainerWindow.clear();
m_xContainerTopWindow.clear();
}
diff --git a/framework/source/uielement/controlmenucontroller.cxx b/framework/source/uielement/controlmenucontroller.cxx
index 00e91ac..f9852ac 100644
--- a/framework/source/uielement/controlmenucontroller.cxx
+++ b/framework/source/uielement/controlmenucontroller.cxx
@@ -233,8 +233,8 @@ private:
void updateImagesPopupMenu( PopupMenu* pPopupMenu );
void fillPopupMenu( uno::Reference< awt::XPopupMenu >& rPopupMenu );
bool m_bShowMenuImages : 1;
PopupMenu* m_pResPopupMenu;
bool m_bShowMenuImages : 1;
VclPtr<PopupMenu> m_pResPopupMenu;
UrlToDispatchMap m_aURLToDispatchMap;
};
@@ -300,7 +300,7 @@ void SAL_CALL ControlMenuController::disposing( const EventObject& ) throw ( Run
if ( m_xPopupMenu.is() )
m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(static_cast<OWeakObject *>(this), UNO_QUERY ));
m_xPopupMenu.clear();
delete m_pResPopupMenu;
m_pResPopupMenu.disposeAndClear();
}
// XStatusListener
@@ -398,7 +398,7 @@ void ControlMenuController::impl_setPopupMenu()
aResId.SetRT( RSC_MENU );
if ( pResMgr->IsAvailable( aResId ))
{
m_pResPopupMenu = new PopupMenu( aResId );
m_pResPopupMenu = VclPtr<PopupMenu>::Create( aResId );
updateImagesPopupMenu( m_pResPopupMenu );
}
}
diff --git a/framework/source/uielement/generictoolbarcontroller.cxx b/framework/source/uielement/generictoolbarcontroller.cxx
index 620462b..46fd4e0 100644
--- a/framework/source/uielement/generictoolbarcontroller.cxx
+++ b/framework/source/uielement/generictoolbarcontroller.cxx
@@ -305,10 +305,8 @@ MenuToolbarController::~MenuToolbarController()
catch( const Exception& ) {}
if ( pMenu )
{
delete pMenu;
pMenu = nullptr;
pMenu.disposeAndClear();
}
}
class Toolbarmenu : public ::PopupMenu
@@ -316,6 +314,7 @@ class Toolbarmenu : public ::PopupMenu
public:
Toolbarmenu();
virtual ~Toolbarmenu();
virtual void dispose() override;
};
Toolbarmenu::Toolbarmenu()
@@ -325,7 +324,13 @@ Toolbarmenu::Toolbarmenu()
Toolbarmenu::~Toolbarmenu()
{
disposeOnce();
}
void Toolbarmenu::dispose()
{
SAL_INFO("fwk.uielement", "destructing Toolbarmenu " << this);
::PopupMenu::dispose();
}
void SAL_CALL MenuToolbarController::click() throw (RuntimeException, std::exception)
@@ -340,7 +345,7 @@ MenuToolbarController::createPopupWindow() throw (css::uno::RuntimeException, st
{
Reference< XDispatchProvider > xDispatch;
Reference< XURLTransformer > xURLTransformer = URLTransformer::create( m_xContext );
pMenu = new Toolbarmenu();
pMenu = VclPtr<Toolbarmenu>::Create();
m_xMenuManager.set( new MenuBarManager( m_xContext, m_xFrame, xURLTransformer, xDispatch, m_aModuleIdentifier, pMenu, true, true, false ) );
if (m_xMenuManager.is())
{
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 3007e8a44..3f1d1c2 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -250,8 +250,7 @@ void MenuBarManager::Destroy()
if ( m_bDeleteMenu )
{
delete m_pVCLMenu;
m_pVCLMenu = nullptr;
m_pVCLMenu.disposeAndClear();
}
}
}
@@ -1190,7 +1189,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
Reference< XDispatch > xDispatch;
Reference< XStatusListener > xStatusListener;
PopupMenu* pPopup = pMenu->GetPopupMenu( nItemId );
VclPtr<PopupMenu> pPopup = pMenu->GetPopupMenu( nItemId );
bool bItemShowMenuImages = m_bShowMenuImages;
// overwrite the show icons on menu option?
if (!bItemShowMenuImages)
@@ -1223,7 +1222,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
pItemHandler->xPopupMenu.set( static_cast<OWeakObject *>(pVCLXPopupMenu), UNO_QUERY );
pItemHandler->aMenuItemURL = aItemCommand;
m_aMenuItemHandlerVector.push_back( pItemHandler );
delete pPopup;
pPopup.disposeAndClear();
if ( bAccessibilityEnabled )
{
@@ -1258,7 +1257,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
AddonMenuManager::HasAddonMenuElements() )
{
// Create addon popup menu if there exist elements and this is the tools popup menu
AddonMenu* pSubMenu = AddonMenuManager::CreateAddonMenu(rFrame, m_xContext);
VclPtr<AddonMenu> pSubMenu = AddonMenuManager::CreateAddonMenu(rFrame, m_xContext);
if ( pSubMenu && ( pSubMenu->GetItemCount() > 0 ))
{
sal_uInt16 nCount = 0;
@@ -1275,12 +1274,12 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
pPopup->SetItemCommand( ITEMID_ADDONLIST, aNewItemCommand );
}
else
delete pSubMenu;
pSubMenu.disposeAndClear();
}
if ( nItemId == ITEMID_ADDONLIST )
{
AddonMenu* pSubMenu = dynamic_cast< AddonMenu* >( pPopup );
AddonMenu* pSubMenu = dynamic_cast< AddonMenu* >( pPopup.get() );
if ( pSubMenu )
{
MenuBarManager* pSubMenuManager = new MenuBarManager( m_xContext, m_xFrame, m_xURLTransformer,pSubMenu, true, false, false );
@@ -1672,7 +1671,7 @@ void MenuBarManager::FillMenu(
if ( xIndexContainer.is() )
{
PopupMenu* pNewPopupMenu = new PopupMenu;
VclPtr<PopupMenu> pNewPopupMenu = VclPtr<PopupMenu>::Create();
pMenu->SetPopupMenu( nId, pNewPopupMenu );
if ( xDispatchProvider.is() )
diff --git a/framework/source/uielement/menubarmerger.cxx b/framework/source/uielement/menubarmerger.cxx
index 47514143..8adb19f 100644
--- a/framework/source/uielement/menubarmerger.cxx
+++ b/framework/source/uielement/menubarmerger.cxx
@@ -180,7 +180,7 @@ bool MenuBarMerger::CreateSubMenu(
pSubMenu->SetItemCommand( nItemId, rMenuItem.aURL );
if ( !rMenuItem.aSubMenu.empty() )
{
PopupMenu* pPopupMenu = new PopupMenu();
VclPtr<PopupMenu> pPopupMenu = VclPtr<PopupMenu>::Create();
pSubMenu->SetPopupMenu( nItemId, pPopupMenu );
++nItemId;
@@ -221,7 +221,7 @@ bool MenuBarMerger::MergeMenuItems(
pMenu->SetItemCommand( nItemId, rMenuItem.aURL );
if ( !rMenuItem.aSubMenu.empty() )
{
PopupMenu* pSubMenu = new PopupMenu();
VclPtr<PopupMenu> pSubMenu = VclPtr<PopupMenu>::Create();
pMenu->SetPopupMenu( nItemId, pSubMenu );
++nItemId;
@@ -352,7 +352,7 @@ bool MenuBarMerger::ProcessFallbackOperation(
const OUString aCmd( rReferencePath[nLevel] );
sal_uInt16 nInsPos( MENU_APPEND );
PopupMenu* pPopupMenu( new PopupMenu );
VclPtr<PopupMenu> pPopupMenu = VclPtr<PopupMenu>::Create();
if ( bFirstLevel && ( aRefPathInfo.eResult == RP_MENUITEM_INSTEAD_OF_POPUPMENU_FOUND ))
{
diff --git a/framework/source/uielement/menubarwrapper.cxx b/framework/source/uielement/menubarwrapper.cxx
index 1d20272..d420fa1 100644
--- a/framework/source/uielement/menubarwrapper.cxx
+++ b/framework/source/uielement/menubarwrapper.cxx
@@ -126,11 +126,11 @@ void SAL_CALL MenuBarWrapper::initialize( const Sequence< Any >& aArguments ) th
if ( xFrame.is() && m_xConfigSource.is() )
{
// Create VCL menubar which will be filled with settings data
MenuBar* pVCLMenuBar = nullptr;
VclPtr<MenuBar> pVCLMenuBar;
VCLXMenuBar* pAwtMenuBar = nullptr;
{
SolarMutexGuard aSolarMutexGuard;
pVCLMenuBar = new MenuBar();
pVCLMenuBar = VclPtr<MenuBar>::Create();
}
Reference< XModuleManager2 > xModuleManager = ModuleManager::create( m_xContext );
diff --git a/framework/source/uielement/togglebuttontoolbarcontroller.cxx b/framework/source/uielement/togglebuttontoolbarcontroller.cxx
index 5dd73a6..4e726c1 100644
--- a/framework/source/uielement/togglebuttontoolbarcontroller.cxx
+++ b/framework/source/uielement/togglebuttontoolbarcontroller.cxx
@@ -102,21 +102,21 @@ throw (css::uno::RuntimeException, std::exception)
( m_eStyle == STYLE_TOGGLE_DROPDOWNBUTTON ))
{
// create popup menu
::PopupMenu aPopup;
ScopedVclPtrInstance<::PopupMenu> aPopup;
const sal_uInt32 nCount = m_aDropdownMenuList.size();
for ( sal_uInt32 i = 0; i < nCount; i++ )
{
OUString aLabel( m_aDropdownMenuList[i] );
aPopup.InsertItem( sal_uInt16( i+1 ), aLabel );
aPopup->InsertItem( sal_uInt16( i+1 ), aLabel );
if ( aLabel == m_aCurrentSelection )
aPopup.CheckItem( sal_uInt16( i+1 ) );
aPopup->CheckItem( sal_uInt16( i+1 ) );
else
aPopup.CheckItem( sal_uInt16( i+1 ), false );
aPopup->CheckItem( sal_uInt16( i+1 ), false );
}
m_pToolbar->SetItemDown( m_nID, true );
aPopup.SetSelectHdl( LINK( this, ToggleButtonToolbarController, MenuSelectHdl ));
aPopup.Execute( m_pToolbar, m_pToolbar->GetItemRect( m_nID ));
aPopup->SetSelectHdl( LINK( this, ToggleButtonToolbarController, MenuSelectHdl ));
aPopup->Execute( m_pToolbar, m_pToolbar->GetItemRect( m_nID ));
m_pToolbar->SetItemDown( m_nID, false );
}
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index 7521384..68a3e00 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -1326,12 +1326,11 @@ void ToolBarManager::ImplClearPopupMenu( ToolBox *pToolBar )
// remove config entries from menu, so we have a clean menu to start with
// remove submenu first
::PopupMenu* pItemMenu = pMenu->GetPopupMenu( 1 );
VclPtr<::PopupMenu> pItemMenu = pMenu->GetPopupMenu( 1 );
if( pItemMenu )
{
pItemMenu->Clear();
delete pItemMenu;
pItemMenu = nullptr;
pItemMenu.disposeAndClear();
pMenu->SetPopupMenu( 1, pItemMenu );
}
@@ -1412,12 +1411,12 @@ bool ToolBarManager::MenuItemAllowed( sal_uInt16 ) const
// popup menu for quick customization
bool bHideDisabledEntries = !SvtMenuOptions().IsEntryHidingEnabled();
::PopupMenu aQuickCustomizationMenu( FwkResId( POPUPMENU_TOOLBAR_QUICKCUSTOMIZATION ));
ScopedVclPtrInstance<::PopupMenu> aQuickCustomizationMenu( FwkResId( POPUPMENU_TOOLBAR_QUICKCUSTOMIZATION ));
if ( m_pToolBar->IsCustomize() )
{
sal_uInt16 nPos( 0 );
::PopupMenu* pVisibleItemsPopupMenu( aQuickCustomizationMenu.GetPopupMenu( 1 ));
::PopupMenu* pVisibleItemsPopupMenu( aQuickCustomizationMenu->GetPopupMenu( 1 ));
bool bIsFloating( false );
@@ -1427,25 +1426,25 @@ bool ToolBarManager::MenuItemAllowed( sal_uInt16 ) const
if ( !bIsFloating )
{
aQuickCustomizationMenu.EnableItem( MENUITEM_TOOLBAR_DOCKTOOLBAR, false );
aQuickCustomizationMenu.EnableItem( MENUITEM_TOOLBAR_DOCKALLTOOLBAR, false );
aQuickCustomizationMenu->EnableItem( MENUITEM_TOOLBAR_DOCKTOOLBAR, false );
aQuickCustomizationMenu->EnableItem( MENUITEM_TOOLBAR_DOCKALLTOOLBAR, false );
Reference< XDockableWindow > xDockable( VCLUnoHelper::GetInterface( m_pToolBar ), UNO_QUERY );
if( xDockable.is() )
aQuickCustomizationMenu.CheckItem( MENUITEM_TOOLBAR_LOCKTOOLBARPOSITION, xDockable->isLocked() );
aQuickCustomizationMenu->CheckItem( MENUITEM_TOOLBAR_LOCKTOOLBARPOSITION, xDockable->isLocked() );
}
else
aQuickCustomizationMenu.EnableItem( MENUITEM_TOOLBAR_LOCKTOOLBARPOSITION, false );
aQuickCustomizationMenu->EnableItem( MENUITEM_TOOLBAR_LOCKTOOLBARPOSITION, false );
if ( SvtMiscOptions().DisableUICustomization() )
{
aQuickCustomizationMenu.EnableItem( MENUITEM_TOOLBAR_VISIBLEBUTTON, false );
aQuickCustomizationMenu.EnableItem( MENUITEM_TOOLBAR_CUSTOMIZETOOLBAR, false );
aQuickCustomizationMenu.EnableItem( MENUITEM_TOOLBAR_LOCKTOOLBARPOSITION, false );
aQuickCustomizationMenu->EnableItem( MENUITEM_TOOLBAR_VISIBLEBUTTON, false );
aQuickCustomizationMenu->EnableItem( MENUITEM_TOOLBAR_CUSTOMIZETOOLBAR, false );
aQuickCustomizationMenu->EnableItem( MENUITEM_TOOLBAR_LOCKTOOLBARPOSITION, false );
}
// Disable menu item CLOSE if the toolbar has no closer
if( !(pToolBar->GetFloatStyle() & WB_CLOSEABLE) )
aQuickCustomizationMenu.EnableItem(MENUITEM_TOOLBAR_CLOSE, false);
aQuickCustomizationMenu->EnableItem(MENUITEM_TOOLBAR_CLOSE, false);
// Temporary stores a Command --> Url map to update contextual menu with the
// correct icons. The popup icons are by default the same as those in the
@@ -1486,9 +1485,9 @@ bool ToolBarManager::MenuItemAllowed( sal_uInt16 ) const
}
else
{
sal_uInt16 nPos = aQuickCustomizationMenu.GetItemPos( MENUITEM_TOOLBAR_CUSTOMIZETOOLBAR );
sal_uInt16 nPos = aQuickCustomizationMenu->GetItemPos( MENUITEM_TOOLBAR_CUSTOMIZETOOLBAR );
if ( nPos != MENU_ITEM_NOTFOUND )
aQuickCustomizationMenu.RemoveItem( nPos );
aQuickCustomizationMenu->RemoveItem( nPos );
}
// copy all menu items 'Visible buttons, Customize toolbar, Dock toolbar,
@@ -1497,21 +1496,21 @@ bool ToolBarManager::MenuItemAllowed( sal_uInt16 ) const
pMenu->InsertSeparator();
sal_uInt16 i;
for( i=0; i< aQuickCustomizationMenu.GetItemCount(); i++)
for( i=0; i< aQuickCustomizationMenu->GetItemCount(); i++)
{
sal_uInt16 nId = aQuickCustomizationMenu.GetItemId( i );
sal_uInt16 nId = aQuickCustomizationMenu->GetItemId( i );
if ( MenuItemAllowed( nId ))
pMenu->CopyItem( aQuickCustomizationMenu, i );
pMenu->CopyItem( *aQuickCustomizationMenu.get(), i );
}
// set submenu to toolbar menu
if( aQuickCustomizationMenu.GetPopupMenu( 1 ) )
if( aQuickCustomizationMenu->GetPopupMenu( 1 ) )
{
// create an own submenu to avoid auto-delete when resource menu is deleted
::PopupMenu *pItemMenu = new ::PopupMenu();
VclPtr<::PopupMenu> pItemMenu = VclPtr<::PopupMenu>::Create();
for( i=0; i< aQuickCustomizationMenu.GetPopupMenu( 1 )->GetItemCount(); i++)
pItemMenu->CopyItem( *aQuickCustomizationMenu.GetPopupMenu( 1 ), i );
for( i=0; i< aQuickCustomizationMenu->GetPopupMenu( 1 )->GetItemCount(); i++)
pItemMenu->CopyItem( *aQuickCustomizationMenu->GetPopupMenu( 1 ), i );
pMenu->SetPopupMenu( 1, pItemMenu );
}
diff --git a/include/framework/addonmenu.hxx b/include/framework/addonmenu.hxx
index b909d61..fec0de7 100644
--- a/include/framework/addonmenu.hxx
+++ b/include/framework/addonmenu.hxx
@@ -39,6 +39,7 @@ class FWE_DLLPUBLIC AddonMenu : public PopupMenu
public:
AddonMenu( const css::uno::Reference< css::frame::XFrame >& rFrame );
virtual ~AddonMenu();
virtual void dispose() override;
protected:
css::uno::Reference< css::frame::XFrame > m_xFrame;
@@ -62,6 +63,7 @@ class FWE_DLLPUBLIC AddonPopupMenu : public AddonMenu
OUString m_aCommandURL;
friend class AddonMenuManager;
friend class ::VclPtr<AddonPopupMenu>;
};
class FWE_DLLPUBLIC AddonMenuManager
@@ -81,10 +83,10 @@ class FWE_DLLPUBLIC AddonMenuManager
static bool IsCorrectContext(const OUString& rModuleIdentifier, const OUString& rContext);
// Factory method to create different Add-On menu types
static PopupMenu* CreatePopupMenuType( MenuType eMenuType, const css::uno::Reference< css::frame::XFrame >& rFrame );
static VclPtr<PopupMenu> CreatePopupMenuType( MenuType eMenuType, const css::uno::Reference< css::frame::XFrame >& rFrame );
// Create the Add-Ons menu
static AddonMenu* CreateAddonMenu( const css::uno::Reference< css::frame::XFrame >& rFrame,
static VclPtr<AddonMenu> CreateAddonMenu( const css::uno::Reference< css::frame::XFrame >& rFrame,
const css::uno::Reference< css::uno::XComponentContext >& rContext );
// Merge the Add-Ons help menu items into the given menu bar at a defined pos
diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx
index 7634272..cbed84e 100644
--- a/include/sfx2/sidebar/SidebarController.hxx
+++ b/include/sfx2/sidebar/SidebarController.hxx
@@ -237,7 +237,7 @@ private:
void ShowPopupMenu (
const Rectangle& rButtonBox,
const ::std::vector<TabBar::DeckMenuData>& rMenuData) const;
std::shared_ptr<PopupMenu> CreatePopupMenu (
VclPtr<PopupMenu> CreatePopupMenu (
const ::std::vector<TabBar::DeckMenuData>& rMenuData) const;
DECL_LINK_TYPED(OnMenuItemSelected, Menu*, bool);
void BroadcastPropertyChange();
diff --git a/include/sfx2/templatedlg.hxx b/include/sfx2/templatedlg.hxx
index 3b7f2b9..eeec07c 100644
--- a/include/sfx2/templatedlg.hxx
+++ b/include/sfx2/templatedlg.hxx
@@ -155,9 +155,9 @@ protected:
VclPtr<TemplateAbstractView> mpCurView;
VclPtr<TemplateLocalView> mpLocalView;
VclPtr<TemplateRemoteView> mpRemoteView;
PopupMenu *mpActionMenu;
PopupMenu *mpRepositoryMenu;
PopupMenu *mpTemplateDefaultMenu;
VclPtr<PopupMenu> mpActionMenu;
VclPtr<PopupMenu> mpRepositoryMenu;
VclPtr<PopupMenu> mpTemplateDefaultMenu;
std::set<const ThumbnailViewItem*,selection_cmp_fn> maSelTemplates;
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index b46b092..fba08dfea 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -282,7 +282,7 @@ public:
css::uno::Reference< css::frame::XController >
GetController();
bool TryContextMenuInterception( Menu& rIn, const OUString& rMenuIdentifier, Menu*& rpOut, css::ui::ContextMenuExecuteEvent aEvent );
bool TryContextMenuInterception( Menu& rIn, const OUString& rMenuIdentifier, VclPtr<Menu>& rpOut, css::ui::ContextMenuExecuteEvent aEvent );
bool TryContextMenuInterception( Menu& rMenu, const OUString& rMenuIdentifier, css::ui::ContextMenuExecuteEvent aEvent );
void ExecPrint( const css::uno::Sequence < css::beans::PropertyValue >&, bool, bool );
diff --git a/include/svtools/treelistbox.hxx b/include/svtools/treelistbox.hxx
index 88d39df..9421703 100644
--- a/include/svtools/treelistbox.hxx
+++ b/include/svtools/treelistbox.hxx
@@ -775,7 +775,7 @@ public:
void ShowFocusRect( const SvTreeListEntry* pEntry );
void InitStartEntry();
virtual std::unique_ptr<PopupMenu> CreateContextMenu();
virtual VclPtr<PopupMenu> CreateContextMenu();
virtual void ExecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry );
void EnableContextMenuHandling();
diff --git a/include/svx/clipboardctl.hxx b/include/svx/clipboardctl.hxx
index f244d32..931b3d2 100644
--- a/include/svx/clipboardctl.hxx
+++ b/include/svx/clipboardctl.hxx
@@ -33,7 +33,7 @@ class SvxClipboardFormatItem;
class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxClipBoardControl : public SfxToolBoxControl
{
SfxPoolItem* pClipboardFmtItem;
PopupMenu* pPopup;
VclPtr<PopupMenu> pPopup;
bool bDisabled;
void DelPopup();
diff --git a/include/toolkit/awt/vclxmenu.hxx b/include/toolkit/awt/vclxmenu.hxx
index d092692..e042e01 100644
--- a/include/toolkit/awt/vclxmenu.hxx
+++ b/include/toolkit/awt/vclxmenu.hxx
@@ -33,6 +33,7 @@
#include <osl/mutex.hxx>
#include <tools/link.hxx>
#include <vcl/vclptr.hxx>
#include <vector>
@@ -59,7 +60,7 @@ class TOOLKIT_DLLPUBLIC VCLXMenu : public css::awt::XMenuBar,
{
private:
::osl::Mutex maMutex;
Menu* mpMenu;
VclPtr<Menu> mpMenu;
MenuListenerMultiplexer maMenuListeners;
PopupMenuRefList maPopupMenuRefs;
diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx
index 928e512..8c50fee 100644
--- a/include/vcl/builder.hxx
+++ b/include/vcl/builder.hxx
@@ -156,12 +156,9 @@ private:
struct MenuAndId
{
OString m_sID;
PopupMenu *m_pMenu;
MenuAndId(const OString &rId, PopupMenu *pMenu)
: m_sID(rId)
, m_pMenu(pMenu)
{
}
VclPtr<PopupMenu> m_pMenu;
MenuAndId(const OString &rId, PopupMenu *pMenu);
~MenuAndId();
};
std::vector<MenuAndId> m_aMenus;
diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx
index 357dc6a..4c9424c 100644
--- a/include/vcl/edit.hxx
+++ b/include/vcl/edit.hxx
@@ -265,8 +265,7 @@ public:
static void SetGetSpecialCharsFunction( FncGetSpecialChars fn );
static FncGetSpecialChars GetGetSpecialCharsFunction();
static PopupMenu* CreatePopupMenu();
static void DeletePopupMenu( PopupMenu* pMenu );
static VclPtr<PopupMenu> CreatePopupMenu();
virtual OUString GetSurroundingText() const override;
virtual Selection GetSurroundingTextSelection() const override;
diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index c4fa65b..81bb0c5c 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -28,6 +28,7 @@
#include <vcl/dllapi.h>
#include <vcl/bitmapex.hxx>
#include <vcl/keycod.hxx>
#include <vcl/vclreferencebase.hxx>
#include <vcl/vclevent.hxx>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/uno/Reference.hxx>
@@ -104,7 +105,7 @@ namespace o3tl
struct ImplMenuDelData
{
ImplMenuDelData* mpNext;
const Menu* mpMenu;
VclPtr<const Menu> mpMenu;
explicit ImplMenuDelData( const Menu* );
~ImplMenuDelData();
@@ -121,7 +122,7 @@ struct MenuLogo
typedef void (*MenuUserDataReleaseFunction)(sal_uLong);
class VCL_DLLPUBLIC Menu : public Resource
class VCL_DLLPUBLIC Menu : public Resource, public VclReferenceBase
{
friend class MenuBar;
friend class MenuBarWindow;
@@ -134,7 +135,7 @@ private:
ImplMenuDelData* mpFirstDel;
MenuItemList* pItemList; // Liste mit den MenuItems
MenuLogo* pLogo;
Menu* pStartedFrom;
VclPtr<Menu> pStartedFrom;
VclPtr<vcl::Window> pWindow;
Link<Menu*, bool> aActivateHdl; // Active-Handler
@@ -230,6 +231,7 @@ protected:
public:
virtual ~Menu();
virtual void dispose() override;
void Activate();
void Deactivate();
@@ -432,6 +434,7 @@ public:
MenuBar();
MenuBar( const MenuBar& rMenu );
virtual ~MenuBar();
virtual void dispose() override;
MenuBar& operator =( const MenuBar& rMenu );
@@ -467,7 +470,7 @@ public:
{
sal_uInt16 nId; // Id of the button
bool bHighlight; // highlight on/off
MenuBar* pMenuBar; // menubar the button belongs to
VclPtr<MenuBar> pMenuBar; // menubar the button belongs to
};
// add an arbitrary button to the menubar (will appear next to closer)
// passed link will be call with a MenuBarButtonCallbackArg on press
@@ -498,7 +501,7 @@ class VCL_DLLPUBLIC PopupMenu : public Menu
friend struct MenuItemData;
private:
Menu** pRefAutoSubMenu; // keeps track if a pointer to this Menu is stored in the MenuItemData
VclPtr<Menu>* pRefAutoSubMenu; // keeps track if a pointer to this Menu is stored in the MenuItemData
SAL_DLLPRIVATE MenuFloatingWindow * ImplGetFloatingWindow() const;
@@ -513,6 +516,7 @@ public:
PopupMenu( const PopupMenu& rMenu );
explicit PopupMenu( const ResId& );
virtual ~PopupMenu();
virtual void dispose() override;
virtual bool IsMenuBar() const override { return false; }
diff --git a/include/vcl/menubtn.hxx b/include/vcl/menubtn.hxx
index 5f791cb..8d8438f 100644
--- a/include/vcl/menubtn.hxx
+++ b/include/vcl/menubtn.hxx
@@ -36,8 +36,8 @@ private:
friend class VclBuilder;
Timer* mpMenuTimer;
PopupMenu* mpOwnMenu;
PopupMenu* mpMenu;
VclPtr<PopupMenu> mpOwnMenu;
VclPtr<PopupMenu> mpMenu;
sal_uInt16 mnCurItemId;
sal_uInt16 mnMenuMode;
Link<MenuButton*,void> maActivateHdl;
diff --git a/include/vcl/syswin.hxx b/include/vcl/syswin.hxx
index fd09ad9..cbd2a9c 100644
--- a/include/vcl/syswin.hxx
+++ b/include/vcl/syswin.hxx
@@ -151,7 +151,7 @@ class VCL_DLLPUBLIC SystemWindow
class ImplData;
private:
MenuBar* mpMenuBar;
VclPtr<MenuBar> mpMenuBar;
Size maOrgSize;
Size maRollUpOutSize;
Size maMinOutSize;
diff --git a/include/vcl/vclevent.hxx b/include/vcl/vclevent.hxx
index 83bcd57..b376054 100644
--- a/include/vcl/vclevent.hxx
+++ b/include/vcl/vclevent.hxx
@@ -222,14 +222,14 @@ public:
class VCL_DLLPUBLIC VclMenuEvent : public VclSimpleEvent
{
private:
Menu* pMenu;
VclPtr<Menu> pMenu;
sal_uInt16 mnPos;
public:
VclMenuEvent( Menu* pM, sal_uLong n, sal_uInt16 nPos ) : VclSimpleEvent(n) { pMenu = pM; mnPos = nPos; }
virtual ~VclMenuEvent() {}
VclMenuEvent( Menu* pM, sal_uLong n, sal_uInt16 nPos );
virtual ~VclMenuEvent();
Menu* GetMenu() const { return pMenu; }
Menu* GetMenu() const;
sal_uInt16 GetItemPos() const { return mnPos; }
};
diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx
index 83b28b2..fdd00a7 100644
--- a/reportdesign/source/ui/dlg/GroupsSorting.cxx
+++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx
@@ -717,7 +717,7 @@ void OFieldExpressionControl::Command(const CommandEvent& rEvt)
if ( nColId == HANDLE_ID )
{
PopupMenu aContextMenu(ModuleRes(RID_GROUPSROWPOPUPMENU));
ScopedVclPtrInstance<PopupMenu> aContextMenu(ModuleRes(RID_GROUPSROWPOPUPMENU));
bool bEnable = false;
long nIndex = FirstSelectedRow();
while( nIndex >= 0 && !bEnable )
@@ -726,8 +726,8 @@ void OFieldExpressionControl::Command(const CommandEvent& rEvt)
bEnable = true;
nIndex = NextSelectedRow();
}
aContextMenu.EnableItem( SID_DELETE, IsDeleteAllowed() && bEnable );
switch (aContextMenu.Execute(this, rEvt.GetMousePosPixel()))
aContextMenu->EnableItem( SID_DELETE, IsDeleteAllowed() && bEnable );
switch (aContextMenu->Execute(this, rEvt.GetMousePosPixel()))
{
case SID_CUT:
cut();
diff --git a/reportdesign/source/ui/dlg/Navigator.cxx b/reportdesign/source/ui/dlg/Navigator.cxx
index 0413884..da0e0fa 100644
--- a/reportdesign/source/ui/dlg/Navigator.cxx
+++ b/reportdesign/source/ui/dlg/Navigator.cxx
@@ -306,27 +306,27 @@ void NavigatorTree::Command( const CommandEvent& rEvt )
uno::Reference< report::XGroup> xGroup(pData->getContent(),uno::UNO_QUERY);
bool bDeleteAllowed = m_rController.isEditable() && (xGroup.is() ||
uno::Reference< report::XFunction>(pData->getContent(),uno::UNO_QUERY).is());
PopupMenu aContextMenu( ModuleRes( RID_MENU_NAVIGATOR ) );
ScopedVclPtrInstance<PopupMenu> aContextMenu( ModuleRes( RID_MENU_NAVIGATOR ) );
sal_uInt16 nCount = aContextMenu.GetItemCount();
sal_uInt16 nCount = aContextMenu->GetItemCount();
for (sal_uInt16 i = 0; i < nCount; ++i)
{
if ( MenuItemType::SEPARATOR != aContextMenu.GetItemType(i))
if ( MenuItemType::SEPARATOR != aContextMenu->GetItemType(i))
{
sal_uInt16 nId = aContextMenu.GetItemId(i);
sal_uInt16 nId = aContextMenu->GetItemId(i);
aContextMenu.CheckItem(nId,m_rController.isCommandChecked(nId));
aContextMenu->CheckItem(nId,m_rController.isCommandChecked(nId));
bool bEnabled = m_rController.isCommandEnabled(nId);
if ( nId == SID_RPT_NEW_FUNCTION )
aContextMenu.EnableItem(nId,m_rController.isEditable() && (xSupplier.is() || xFunctions.is()) );
aContextMenu->EnableItem(nId,m_rController.isEditable() && (xSupplier.is() || xFunctions.is()) );
// special condition, check for function and group
else if ( nId == SID_DELETE )
aContextMenu.EnableItem(SID_DELETE,bDeleteAllowed);
aContextMenu->EnableItem(SID_DELETE,bDeleteAllowed);
else
aContextMenu.EnableItem(nId,bEnabled);
aContextMenu->EnableItem(nId,bEnabled);
}
}
sal_uInt16 nId = aContextMenu.Execute(this, aWhere);
sal_uInt16 nId = aContextMenu->Execute(this, aWhere);
if ( nId )
{
uno::Sequence< beans::PropertyValue> aArgs;
diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx
index 4566566..ce723b9 100644
--- a/reportdesign/source/ui/report/ReportSection.cxx
+++ b/reportdesign/source/ui/report/ReportSection.cxx
@@ -477,14 +477,14 @@ void OReportSection::Command( const CommandEvent& _rCEvt )
{
OReportController& rController = m_pParent->getViewsWindow()->getView()->getReportView()->getController();
uno::Reference<frame::XFrame> xFrame = rController.getFrame();
PopupMenu aContextMenu( ModuleRes( RID_MENU_REPORT ) );
ScopedVclPtrInstance<PopupMenu> aContextMenu( ModuleRes( RID_MENU_REPORT ) );
uno::Reference< report::XReportDefinition> xReportDefinition = getSection()->getReportDefinition();
lcl_insertMenuItemImages(aContextMenu,rController,xReportDefinition,xFrame);
lcl_insertMenuItemImages(*aContextMenu.get(),rController,xReportDefinition,xFrame);
Point aPos = _rCEvt.GetMousePosPixel();
m_pView->EndAction();
const sal_uInt16 nId = aContextMenu.Execute(this, aPos);
const sal_uInt16 nId = aContextMenu->Execute(this, aPos);
if ( nId )
{
uno::Sequence< beans::PropertyValue> aArgs;
diff --git a/sc/source/ui/dbgui/csvgrid.cxx b/sc/source/ui/dbgui/csvgrid.cxx
index e2a8ec2..850453b 100644
--- a/sc/source/ui/dbgui/csvgrid.cxx
+++ b/sc/source/ui/dbgui/csvgrid.cxx
@@ -78,7 +78,7 @@ ScCsvGrid::ScCsvGrid( ScCsvControl& rParent ) :
mpEditEngine->SetRefMapMode( MapMode( MAP_PIXEL ) );
maEdEngSize = mpEditEngine->GetPaperSize();
maPopup.SetMenuFlags( maPopup.GetMenuFlags() | MenuFlags::NoAutoMnemonics );
mpPopup->SetMenuFlags( mpPopup->GetMenuFlags() | MenuFlags::NoAutoMnemonics );
EnableRTL( false ); // RTL
InitFonts();
@@ -505,12 +505,12 @@ void ScCsvGrid::SetTypeNames( const std::vector<OUString>& rTypeNames )
maTypeNames = rTypeNames;
Repaint( true );
maPopup.Clear();
mpPopup->Clear();
sal_uInt32 nCount = maTypeNames.size();
sal_uInt32 nIx;
sal_uInt16 nItemId;
for( nIx = 0, nItemId = 1; nIx < nCount; ++nIx, ++nItemId )
maPopup.InsertItem( nItemId, maTypeNames[ nIx ] );
mpPopup->InsertItem( nItemId, maTypeNames[ nIx ] );
::std::for_each( maColStates.begin(), maColStates.end(), Func_SetType( CSV_TYPE_DEFAULT ) );
}
@@ -582,9 +582,9 @@ void ScCsvGrid::ScrollVertRel( ScMoveMode eDir )
void ScCsvGrid::ExecutePopup( const Point& rPos )
{
sal_uInt16 nItemId = maPopup.Execute( this, rPos );
sal_uInt16 nItemId = mpPopup->Execute( this, rPos );
if( nItemId ) // 0 = cancelled
Execute( CSVCMD_SETCOLUMNTYPE, maPopup.GetItemPos( nItemId ) );
Execute( CSVCMD_SETCOLUMNTYPE, mpPopup->GetItemPos( nItemId ) );
}
// selection handling ---------------------------------------------------------
diff --git a/sc/source/ui/inc/csvgrid.hxx b/sc/source/ui/inc/csvgrid.hxx
index 772ef36..63e2013 100644
--- a/sc/source/ui/inc/csvgrid.hxx
+++ b/sc/source/ui/inc/csvgrid.hxx
@@ -62,7 +62,7 @@ private:
VclPtr<VirtualDevice> mpBackgrDev; /// Grid background, headers, cell texts.
VclPtr<VirtualDevice> mpGridDev; /// Data grid with selection and cursor.
PopupMenu maPopup; /// Popup menu for column types.
VclPtr<PopupMenu> mpPopup; /// Popup menu for column types.
::svtools::ColorConfig* mpColorConfig; /// Application color configuration.
Color maBackColor; /// Cell background color.
diff --git a/sc/source/ui/inc/tphfedit.hxx b/sc/source/ui/inc/tphfedit.hxx
index fcb829f..31c331c 100644
--- a/sc/source/ui/inc/tphfedit.hxx
+++ b/sc/source/ui/inc/tphfedit.hxx
@@ -104,7 +104,7 @@ class SC_DLLPUBLIC ScExtIButton : public ImageButton
private:
Idle aIdle;
PopupMenu* pPopupMenu;
VclPtr<PopupMenu> pPopupMenu;
Link<ScExtIButton&,void> aMLink;
sal_uInt16 nSelected;
OString aSelectedIdent;
@@ -122,6 +122,8 @@ protected:
public:
ScExtIButton(vcl::Window* pParent, WinBits nBits );
virtual ~ScExtIButton();
virtual void dispose() override;
void SetPopupMenu(PopupMenu* pPopUp);
diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx
index 407bd39..3121b36 100644
--- a/sc/source/ui/miscdlgs/acredlin.cxx
+++ b/sc/source/ui/miscdlgs/acredlin.cxx
@@ -1676,9 +1676,9 @@ IMPL_LINK_NOARG_TYPED(ScAcceptChgDlg, CommandHdl, SvSimpleTable*, void)
if(aCEvt.GetCommand()==CommandEventId::ContextMenu)
{
ScPopupMenu aPopup(ScResId(RID_POPUP_CHANGES));
ScopedVclPtrInstance<ScPopupMenu> aPopup(ScResId(RID_POPUP_CHANGES));
aPopup.SetMenuFlags(MenuFlags::HideDisabledEntries);
aPopup->SetMenuFlags(MenuFlags::HideDisabledEntries);
SvTreeListEntry* pEntry=pTheView->GetCurEntry();
if(pEntry!=nullptr)
@@ -1687,7 +1687,7 @@ IMPL_LINK_NOARG_TYPED(ScAcceptChgDlg, CommandHdl, SvSimpleTable*, void)
}
else
{
aPopup.Deactivate();
aPopup->Deactivate();
}
sal_uInt16 nSortedCol= pTheView->GetSortedCol();
@@ -1696,15 +1696,15 @@ IMPL_LINK_NOARG_TYPED(ScAcceptChgDlg, CommandHdl, SvSimpleTable*, void)
{
sal_uInt16 nItemId=nSortedCol+SC_SUB_SORT+1;
aPopup.CheckItem(nItemId);
aPopup->CheckItem(nItemId);
PopupMenu *pSubMenu = aPopup.GetPopupMenu(SC_SUB_SORT);
PopupMenu *pSubMenu = aPopup->GetPopupMenu(SC_SUB_SORT);
if (pSubMenu)
pSubMenu->CheckItem(nItemId);
}
aPopup.EnableItem(SC_CHANGES_COMMENT,false);
aPopup->EnableItem(SC_CHANGES_COMMENT,false);
if(pDoc->IsDocEditable() && pEntry!=nullptr)
{
@@ -1714,11 +1714,11 @@ IMPL_LINK_NOARG_TYPED(ScAcceptChgDlg, CommandHdl, SvSimpleTable*, void)
ScChangeAction* pScChangeAction=
static_cast<ScChangeAction*>(pEntryData->pData);
if(pScChangeAction!=nullptr && !pTheView->GetParent(pEntry))
aPopup.EnableItem(SC_CHANGES_COMMENT);
aPopup->EnableItem(SC_CHANGES_COMMENT);
}
}
sal_uInt16 nCommand=aPopup.Execute( this, GetPointerPosPixel() );
sal_uInt16 nCommand = aPopup->Execute( this, GetPointerPosPixel() );
if(nCommand)
{
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index 7e7a043..1817750 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -579,16 +579,16 @@ void ScContentTree::Command( const CommandEvent& rCEvt )
{
// Drag-Drop Modus
PopupMenu aPop;
ScPopupMenu aDropMenu( ScResId( RID_POPUP_DROPMODE ) );
aDropMenu.CheckItem( RID_DROPMODE_URL + pParentWindow->GetDropMode() );
aPop.InsertItem( 1, pParentWindow->GetStrDragMode() );
aPop.SetPopupMenu( 1, &aDropMenu );
ScopedVclPtrInstance<PopupMenu> aPop;
ScopedVclPtrInstance<ScPopupMenu> aDropMenu( ScResId( RID_POPUP_DROPMODE ) );
aDropMenu->CheckItem( RID_DROPMODE_URL + pParentWindow->GetDropMode() );
aPop->InsertItem( 1, pParentWindow->GetStrDragMode() );
aPop->SetPopupMenu( 1, aDropMenu.get() );
// angezeigtes Dokument
ScPopupMenu aDocMenu;
aDocMenu.SetMenuFlags( aDocMenu.GetMenuFlags() | MenuFlags::NoAutoMnemonics );
ScopedVclPtrInstance<ScPopupMenu> aDocMenu;
aDocMenu->SetMenuFlags( aDocMenu->GetMenuFlags() | MenuFlags::NoAutoMnemonics );
sal_uInt16 i=0;
sal_uInt16 nPos=0;
// geladene Dokumente
@@ -604,14 +604,14 @@ void ScContentTree::Command( const CommandEvent& rCEvt )
aEntry += pParentWindow->aStrActive;
else
aEntry += pParentWindow->aStrNotActive;
aDocMenu.InsertItem( ++i, aEntry );
aDocMenu->InsertItem( ++i, aEntry );
if ( !bHiddenDoc && aName == aManualDoc )
nPos = i;
}
pSh = SfxObjectShell::GetNext( *pSh );
}
// "aktives Fenster"
aDocMenu.InsertItem( ++i, pParentWindow->aStrActiveWin );
aDocMenu->InsertItem( ++i, pParentWindow->aStrActiveWin );
if (!bHiddenDoc && aManualDoc.isEmpty())
nPos = i;
// verstecktes Dokument
@@ -619,28 +619,28 @@ void ScContentTree::Command( const CommandEvent& rCEvt )
{
OUString aEntry = aHiddenTitle;
aEntry += pParentWindow->aStrHidden;
aDocMenu.InsertItem( ++i, aEntry );
aDocMenu->InsertItem( ++i, aEntry );
if (bHiddenDoc)
nPos = i;
}
aDocMenu.CheckItem( nPos );
aPop.InsertItem( 2, pParentWindow->GetStrDisplay() );
aPop.SetPopupMenu( 2, &aDocMenu );
aDocMenu->CheckItem( nPos );
aPop->InsertItem( 2, pParentWindow->GetStrDisplay() );
aPop->SetPopupMenu( 2, aDocMenu.get() );
// ausfuehren
aPop.Execute( this, rCEvt.GetMousePosPixel() );
aPop->Execute( this, rCEvt.GetMousePosPixel() );
if ( aDropMenu.WasHit() ) // Drag-Drop Modus
if ( aDropMenu->WasHit() ) // Drag-Drop Modus
{
sal_uInt16 nId = aDropMenu.GetSelected();
sal_uInt16 nId = aDropMenu->GetSelected();
if ( nId >= RID_DROPMODE_URL && nId <= RID_DROPMODE_COPY )
pParentWindow->SetDropMode( nId - RID_DROPMODE_URL );
}
else if ( aDocMenu.WasHit() ) // angezeigtes Dokument
else if ( aDocMenu->WasHit() ) // angezeigtes Dokument
{
sal_uInt16 nId = aDocMenu.GetSelected();
OUString aName = aDocMenu.GetItemText(nId);
sal_uInt16 nId = aDocMenu->GetSelected();
OUString aName = aDocMenu->GetItemText(nId);
SelectDoc( aName );
}
}
diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx
index 12c81b7..ba592c6 100644
--- a/sc/source/ui/navipi/navipi.cxx
+++ b/sc/source/ui/navipi/navipi.cxx
@@ -390,10 +390,10 @@ IMPL_LINK_NOARG_TYPED(CommandToolBox, ToolBoxDropdownClickHdl, ToolBox *, void)
if ( GetCurItemId() == IID_DROPMODE )
{
ScPopupMenu aPop( ScResId( RID_POPUP_DROPMODE ) );
aPop.CheckItem( RID_DROPMODE_URL + rDlg.GetDropMode() );
aPop.Execute( this, GetItemRect(IID_DROPMODE), PopupMenuFlags::ExecuteDown );
sal_uInt16 nId = aPop.GetSelected();
ScopedVclPtrInstance<ScPopupMenu> aPop( ScResId( RID_POPUP_DROPMODE ) );
aPop->CheckItem( RID_DROPMODE_URL + rDlg.GetDropMode() );
aPop->Execute( this, GetItemRect(IID_DROPMODE), PopupMenuFlags::ExecuteDown );
sal_uInt16 nId = aPop->GetSelected();
EndSelection(); // bevore SetDropMode (SetDropMode calls SetItemImage)
diff --git a/sc/source/ui/navipi/scenwnd.cxx b/sc/source/ui/navipi/scenwnd.cxx
index eaa620a..88347cb 100644
--- a/sc/source/ui/navipi/scenwnd.cxx
+++ b/sc/source/ui/navipi/scenwnd.cxx
@@ -135,11 +135,11 @@ bool ScScenarioListBox::Notify( NotifyEvent& rNEvt )
{
if( !pEntry->mbProtected )
{
ScPopupMenu aPopup( ScResId( RID_POPUP_NAVIPI_SCENARIO ) );
aPopup.Execute( this, pCEvt->GetMousePosPixel() );
if (aPopup.WasHit())
ScopedVclPtrInstance<ScPopupMenu> aPopup( ScResId( RID_POPUP_NAVIPI_SCENARIO ) );
aPopup->Execute( this, pCEvt->GetMousePosPixel() );
if (aPopup->WasHit())
{
switch( aPopup.GetSelected() )
switch( aPopup->GetSelected() )
{
case RID_NAVIPI_SCENARIO_DELETE:
DeleteScenario();
diff --git a/sc/source/ui/pagedlg/tphfedit.cxx b/sc/source/ui/pagedlg/tphfedit.cxx
index f9eaeac..cb63352 100644
--- a/sc/source/ui/pagedlg/tphfedit.cxx
+++ b/sc/source/ui/pagedlg/tphfedit.cxx
@@ -345,6 +345,17 @@ ScExtIButton::ScExtIButton(vcl::Window* pParent, WinBits nBits )
SetDropDown(PushButtonDropdownStyle::Toolbox);
}
ScExtIButton::~ScExtIButton()
{
disposeOnce();
}
void ScExtIButton::dispose()
{
pPopupMenu.clear();
ImageButton::dispose();
}
VCL_BUILDER_FACTORY_ARGS(ScExtIButton, 0 /* WB_BORDER|WB_TABSTOP */)
void ScExtIButton::SetPopupMenu(PopupMenu* pPopUp)
diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx
index 6fa034c..0f7e430 100644
--- a/sc/source/ui/view/tabcont.cxx
+++ b/sc/source/ui/view/tabcont.cxx
@@ -86,7 +86,7 @@ ScTabControl::ScTabControl( vcl::Window* pParent, ScViewData* pData )
IMPL_LINK_TYPED(ScTabControl, ShowPageList, const CommandEvent &, rEvent, void)
{
PopupMenu aPopup;
ScopedVclPtrInstance<PopupMenu> aPopup;
sal_uInt16 nCurPageId = GetCurPageId();
@@ -100,14 +100,14 @@ IMPL_LINK_TYPED(ScTabControl, ShowPageList, const CommandEvent &, rEvent, void)
if (pDoc->GetName(i, aString))
{
sal_uInt16 nId = static_cast<sal_uInt16>(i)+1;
aPopup.InsertItem(nId, aString, MenuItemBits::CHECKABLE);
aPopup->InsertItem(nId, aString, MenuItemBits::CHECKABLE);
if (nId == nCurPageId)
aPopup.CheckItem(nId);
aPopup->CheckItem(nId);
}
}
}
sal_uInt16 nItemId = aPopup.Execute( this, rEvent.GetMousePosPixel() );
sal_uInt16 nItemId = aPopup->Execute( this, rEvent.GetMousePosPixel() );
SwitchToPageId(nItemId);
}
diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx
index 21f6115..434ef38 100644
--- a/sd/source/ui/animations/CustomAnimationDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationDialog.cxx
@@ -352,9 +352,9 @@ public:
void SetMenuSelectHdl( const Link<MenuButton *, void>& rLink ) { mpDropdownButton->SetSelectHdl( rLink ); }
private:
VclPtr<Edit> mpSubControl;
VclPtr<Edit> mpSubControl;
VclPtr<MenuButton> mpDropdownButton;
PopupMenu* mpMenu;
VclPtr<PopupMenu> mpMenu;
};
DropdownMenuBox::DropdownMenuBox( vcl::Window* pParent, Edit* pSubControl, PopupMenu* pMenu )
@@ -380,7 +380,7 @@ void DropdownMenuBox::dispose()
{
SetSubEdit(nullptr);
mpDropdownButton.disposeAndClear();
delete mpMenu;
mpMenu.disposeAndClear();
mpSubControl.disposeAndClear();
Edit::dispose();
}
@@ -436,7 +436,7 @@ public:
private:
DECL_LINK_TYPED( EditModifyHdl, Edit&, void );
VclPtr<DropdownMenuBox> mpControl;
PopupMenu* mpMenu;
VclPtr<PopupMenu> mpMenu;
VclPtr<MetricField> mpMetric;
Link<LinkParamNone*,void> maModifyHdl;
};
@@ -449,7 +449,7 @@ CharHeightPropertyBox::CharHeightPropertyBox( sal_Int32 nControlType, vcl::Windo
mpMetric->SetMin( 0 );
mpMetric->SetMax( 1000 );
mpMenu = new PopupMenu(SdResId( RID_CUSTOMANIMATION_FONTSIZE_POPUP ) );
mpMenu = VclPtr<PopupMenu>::Create(SdResId( RID_CUSTOMANIMATION_FONTSIZE_POPUP ) );
mpControl = VclPtr<DropdownMenuBox>::Create( pParent, mpMetric, mpMenu );
mpControl->SetMenuSelectHdl( LINK( this, CharHeightPropertyBox, implMenuSelectHdl ));
mpControl->SetModifyHdl( LINK( this, CharHeightPropertyBox, EditModifyHdl ) );
@@ -521,7 +521,7 @@ public:
private:
VclPtr<DropdownMenuBox> mpControl;
PopupMenu* mpMenu;
VclPtr<PopupMenu> mpMenu;
VclPtr<MetricField> mpMetric;
Link<LinkParamNone*,void> maModifyHdl;
};
@@ -535,7 +535,7 @@ TransparencyPropertyBox::TransparencyPropertyBox( sal_Int32 nControlType, vcl::W
mpMetric->SetMin( 0 );
mpMetric->SetMax( 100 );
mpMenu = new PopupMenu();
mpMenu = VclPtr<PopupMenu>::Create();
for( sal_Int32 i = 25; i < 101; i += 25 )
{
OUString aStr(unicode::formatPercent(i,
@@ -621,7 +621,7 @@ public:
private:
VclPtr<DropdownMenuBox> mpControl;
PopupMenu* mpMenu;
VclPtr<PopupMenu> mpMenu;
VclPtr<MetricField> mpMetric;
Link<LinkParamNone*,void> maModifyHdl;
};
@@ -636,7 +636,7 @@ RotationPropertyBox::RotationPropertyBox( sal_Int32 nControlType, vcl::Window* p
mpMetric->SetMin( -10000 );
mpMetric->SetMax( 10000 );
mpMenu = new PopupMenu(SdResId( RID_CUSTOMANIMATION_ROTATION_POPUP ) );
mpMenu = VclPtr<PopupMenu>::Create(SdResId( RID_CUSTOMANIMATION_ROTATION_POPUP ) );
mpControl = VclPtr<DropdownMenuBox>::Create( pParent, mpMetric, mpMenu );
mpControl->SetMenuSelectHdl( LINK( this, RotationPropertyBox, implMenuSelectHdl ));
mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_ROTATIONPROPERTYBOX );
@@ -742,7 +742,7 @@ public:
private:
VclPtr<DropdownMenuBox> mpControl;
PopupMenu* mpMenu;
VclPtr<PopupMenu> mpMenu;
VclPtr<MetricField> mpMetric;
Link<LinkParamNone*,void> maModifyHdl;
int mnDirection;
@@ -757,7 +757,7 @@ ScalePropertyBox::ScalePropertyBox( sal_Int32 nControlType, vcl::Window* pParent
mpMetric->SetMin( 0 );
mpMetric->SetMax( 10000 );
mpMenu = new PopupMenu(SdResId( RID_CUSTOMANIMATION_SCALE_POPUP ) );
mpMenu = VclPtr<PopupMenu>::Create(SdResId( RID_CUSTOMANIMATION_SCALE_POPUP ) );
mpControl = VclPtr<DropdownMenuBox>::Create( pParent, mpMetric, mpMenu );
mpControl->SetMenuSelectHdl( LINK( this, ScalePropertyBox, implMenuSelectHdl ));
mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_SCALEPROPERTYBOX );
@@ -900,7 +900,7 @@ public:
private:
VclPtr<DropdownMenuBox> mpControl;
PopupMenu* mpMenu;
VclPtr<PopupMenu> mpMenu;
VclPtr<Edit> mpEdit;
Link<LinkParamNone*,void> maModifyHdl;
@@ -916,7 +916,7 @@ FontStylePropertyBox::FontStylePropertyBox( sal_Int32 nControlType, vcl::Window*
mpEdit.set( VclPtr<Edit>::Create( pParent, WB_TABSTOP|WB_IGNORETAB|WB_NOBORDER|WB_READONLY) );
mpEdit->SetText( SD_RESSTR(STR_CUSTOMANIMATION_SAMPLE) );
mpMenu = new PopupMenu(SdResId( RID_CUSTOMANIMATION_FONTSTYLE_POPUP ) );
mpMenu = VclPtr<PopupMenu>::Create(SdResId( RID_CUSTOMANIMATION_FONTSTYLE_POPUP ) );
mpControl = VclPtr<DropdownMenuBox>::Create( pParent, mpEdit, mpMenu );
mpControl->SetMenuSelectHdl( LINK( this, FontStylePropertyBox, implMenuSelectHdl ));
mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_FONTSTYLEPROPERTYBOX );
diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx
index e6a63fa..b5875dd 100644
--- a/sd/source/ui/animations/CustomAnimationList.cxx
+++ b/sd/source/ui/animations/CustomAnimationList.cxx
@@ -906,10 +906,9 @@ bool CustomAnimationList::DoubleClickHdl()
return false;
}
std::unique_ptr<PopupMenu> CustomAnimationList::CreateContextMenu()
VclPtr<PopupMenu> CustomAnimationList::CreateContextMenu()
{
std::unique_ptr<PopupMenu> pMenu(
new PopupMenu(SdResId( RID_EFFECT_CONTEXTMENU )));
VclPtrInstance<PopupMenu> pMenu(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 dcbbf6b..260668b 100644
--- a/sd/source/ui/animations/CustomAnimationList.hxx
+++ b/sd/source/ui/animations/CustomAnimationList.hxx
@@ -76,7 +76,7 @@ public:
virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) override;
virtual std::unique_ptr<PopupMenu> CreateContextMenu() override;
virtual VclPtr<PopupMenu> CreateContextMenu() override;
virtual void ExecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry ) override;
virtual void KeyInput( const KeyEvent& rKEvt ) override;
diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx
index 03f4925..a8faea0 100644
--- a/sd/source/ui/annotations/annotationmanager.cxx
+++ b/sd/source/ui/annotations/annotationmanager.cxx
@@ -915,7 +915,7 @@ void AnnotationManagerImpl::ExecuteAnnotationContextMenu( const Reference< XAnno
if( bReadOnly && !pAnnotationWindow )
return;
std::unique_ptr< PopupMenu > pMenu( new PopupMenu( SdResId( pAnnotationWindow ? RID_ANNOTATION_CONTEXTMENU : RID_ANNOTATION_TAG_CONTEXTMENU ) ) );
ScopedVclPtrInstance<PopupMenu> pMenu( SdResId( pAnnotationWindow ? RID_ANNOTATION_CONTEXTMENU : RID_ANNOTATION_TAG_CONTEXTMENU ) );
SvtUserOptions aUserOptions;
OUString sCurrentAuthor( aUserOptions.GetFullName() );
diff --git a/sd/source/ui/app/tmplctrl.cxx b/sd/source/ui/app/tmplctrl.cxx
index 78066ac..c44eb1b 100644
--- a/sd/source/ui/app/tmplctrl.cxx
+++ b/sd/source/ui/app/tmplctrl.cxx
@@ -104,7 +104,7 @@ void SdTemplateControl::Command( const CommandEvent& rCEvt )
if( !pDoc )
return;
SdTemplatePopup_Impl aPop;
ScopedVclPtrInstance<SdTemplatePopup_Impl> aPop;
{
const sal_uInt16 nMasterCount = pDoc->GetMasterSdPageCount(PK_STANDARD);
@@ -113,11 +113,11 @@ void SdTemplateControl::Command( const CommandEvent& rCEvt )
{
SdPage* pMaster = pDoc->GetMasterSdPage(nPage, PK_STANDARD);
if( pMaster )
aPop.InsertItem( ++nCount, pMaster->GetName() );
aPop->InsertItem( ++nCount, pMaster->GetName() );
}
aPop.Execute( &GetStatusBar(), rCEvt.GetMousePosPixel());
aPop->Execute( &GetStatusBar(), rCEvt.GetMousePosPixel());
sal_uInt16 nCurrId = aPop.GetCurId()-1;
sal_uInt16 nCurrId = aPop->GetCurId()-1;
if( nCurrId < nMasterCount )
{
SdPage* pMaster = pDoc->GetMasterSdPage(nCurrId, PK_STANDARD);
diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx
index e6b5e52..5480154 100644
--- a/sd/source/ui/dlg/navigatr.cxx
+++ b/sd/source/ui/dlg/navigatr.cxx
@@ -294,7 +294,7 @@ IMPL_LINK_TYPED( SdNavigatorWin, DropdownClickToolBoxHdl, ToolBox*, pBox, void )
case TBI_DRAGTYPE:
{
// Popup menu is created depending if the document is saved or not
PopupMenu *pMenu = new PopupMenu;
ScopedVclPtrInstance<PopupMenu> pMenu;
static const char* aHIDs[] =
{
@@ -331,13 +331,12 @@ IMPL_LINK_TYPED( SdNavigatorWin, DropdownClickToolBoxHdl, ToolBox*, pBox, void )
pMenu->Execute( this, maToolbox->GetItemRect( nId ), PopupMenuFlags::ExecuteDown );
pBox->EndSelection();
delete pMenu;
}
break;
case TBI_SHAPE_FILTER:
{
PopupMenu *pMenu = new PopupMenu;
ScopedVclPtrInstance<PopupMenu> pMenu;
pMenu->InsertItem(
nShowNamedShapesFilter,
@@ -354,7 +353,6 @@ IMPL_LINK_TYPED( SdNavigatorWin, DropdownClickToolBoxHdl, ToolBox*, pBox, void )
pMenu->Execute( this, maToolbox->GetItemRect( nId ), PopupMenuFlags::ExecuteDown );
pBox->EndSelection();
delete pMenu;
}
break;
}
diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx
index f9ba5cf6..df4767b 100644
--- a/sd/source/ui/sidebar/LayoutMenu.cxx
+++ b/sd/source/ui/sidebar/LayoutMenu.cxx
@@ -611,7 +611,7 @@ void LayoutMenu::Command (const CommandEvent& rEvent)
}
// Setup the menu.
std::shared_ptr<PopupMenu> pMenu (new PopupMenu(SdResId(RID_TASKPANE_LAYOUTMENU_POPUP)));
ScopedVclPtrInstance<PopupMenu> pMenu(SdResId(RID_TASKPANE_LAYOUTMENU_POPUP));
FloatingWindow* pMenuWindow = dynamic_cast<FloatingWindow*>(pMenu->GetWindow());
if (pMenuWindow != nullptr)
pMenuWindow->SetPopupModeFlags(
diff --git a/sd/source/ui/sidebar/MasterPagesSelector.cxx b/sd/source/ui/sidebar/MasterPagesSelector.cxx
index 88491e0..f04d113 100644
--- a/sd/source/ui/sidebar/MasterPagesSelector.cxx
+++ b/sd/source/ui/sidebar/MasterPagesSelector.cxx
@@ -221,7 +221,7 @@ void MasterPagesSelector::Command (const CommandEvent& rEvent)
}
// Setup the menu.
std::unique_ptr<PopupMenu> pMenu (new PopupMenu(GetContextMenuResId()));
ScopedVclPtrInstance<PopupMenu> pMenu(GetContextMenuResId());
FloatingWindow* pMenuWindow = dynamic_cast<FloatingWindow*>(pMenu->GetWindow());
if (pMenuWindow != nullptr)
pMenuWindow->SetPopupModeFlags(
diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx
index 2b031ea..ade2ef6 100644
--- a/sd/source/ui/slideshow/slideshowimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -1985,7 +1985,7 @@ IMPL_LINK_NOARG_TYPED(SlideshowImpl, ContextMenuHdl, void*, void)
if( !mbWasPaused )
pause();
PopupMenu* pMenu = new PopupMenu( SdResId( RID_SLIDESHOW_CONTEXTMENU ) );
VclPtrInstance<PopupMenu> pMenu( SdResId( RID_SLIDESHOW_CONTEXTMENU ) );
// Adding button to display if in Pen mode
pMenu->CheckItem( CM_PEN_MODE, mbUsePen);
@@ -2098,7 +2098,7 @@ IMPL_LINK_NOARG_TYPED(SlideshowImpl, ContextMenuHdl, void*, void)
pMenu->SetSelectHdl( LINK( this, SlideshowImpl, ContextMenuSelectHdl ) );
pMenu->Execute( mpShowWindow, maPopupMousePos );
delete pMenu;
pMenu.disposeAndClear();
if( mxView.is() )
mxView->ignoreNextMouseReleased();
diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx
index 5396310..fc23608 100644
--- a/sd/source/ui/view/drviews4.cxx
+++ b/sd/source/ui/view/drviews4.cxx
@@ -556,15 +556,15 @@ void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin)
//fdo#44998 if the outliner has captured the mouse events release the lock
//so the SdFieldPopup can get them
pOLV->ReleaseMouse();
SdFieldPopup aFieldPopup( pFldItem->GetField(), eLanguage );
ScopedVclPtrInstance<SdFieldPopup> aFieldPopup( pFldItem->GetField(), eLanguage );
if ( rCEvt.IsMouseEvent() )
aMPos = rCEvt.GetMousePosPixel();
else
aMPos = Point( 20, 20 );
aFieldPopup.Execute( pWin, aMPos );
aFieldPopup->Execute( pWin, aMPos );
std::unique_ptr<SvxFieldData> pField(aFieldPopup.GetField());
std::unique_ptr<SvxFieldData> pField(aFieldPopup->GetField());
if( pField )
{
SvxFieldItem aFieldItem( *pField, EE_FEATURE_FIELD );
@@ -876,7 +876,7 @@ void DrawViewShell::ShowSnapLineContextMenu (
const Point& rMouseLocation)
{
const SdrHelpLine& rHelpLine (rPageView.GetHelpLines()[nSnapLineIndex]);
std::unique_ptr<PopupMenu> pMenu (new PopupMenu ());
ScopedVclPtrInstance<PopupMenu> pMenu;
if (rHelpLine.GetKind() == SDRHELPLINE_POINT)
{
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index 9c85b16..69d360b 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -1249,8 +1249,8 @@ bool BookmarksBox_Impl::Notify( NotifyEvent& rNEvt )
const CommandEvent* pCEvt = rNEvt.GetCommandEvent();
if ( pCEvt->GetCommand() == CommandEventId::ContextMenu )
{
PopupMenu aMenu( SfxResId( MENU_HELP_BOOKMARKS ) );
sal_uInt16 nId = aMenu.Execute( this, pCEvt->GetMousePosPixel() );
ScopedVclPtrInstance<PopupMenu> aMenu( SfxResId( MENU_HELP_BOOKMARKS ) );
sal_uInt16 nId = aMenu->Execute( this, pCEvt->GetMousePosPixel() );
if ( nId != MENU_ITEM_NOTFOUND )
DoAction( nId );
bRet = true;
@@ -2339,50 +2339,50 @@ bool SfxHelpTextWindow_Impl::PreNotify( NotifyEvent& rNEvt )
else
aPos = Point( pTextWin->GetPosPixel().X() + 20, 20 );
aPos.Y() += pTextWin->GetPosPixel().Y();
PopupMenu aMenu;
ScopedVclPtrInstance<PopupMenu> aMenu;
if ( bIsIndexOn )
aMenu.InsertItem( TBI_INDEX, aIndexOffText, Image( SfxResId( IMG_HELP_TOOLBOX_INDEX_OFF ) ) );
aMenu->InsertItem( TBI_INDEX, aIndexOffText, Image( SfxResId( IMG_HELP_TOOLBOX_INDEX_OFF ) ) );
else
aMenu.InsertItem( TBI_INDEX, aIndexOnText, Image( SfxResId( IMG_HELP_TOOLBOX_INDEX_ON ) ) );
aMenu->InsertItem( TBI_INDEX, aIndexOnText, Image( SfxResId( IMG_HELP_TOOLBOX_INDEX_ON ) ) );
aMenu.SetHelpId( TBI_INDEX, HID_HELP_TOOLBOXITEM_INDEX );
aMenu.InsertSeparator();
aMenu.InsertItem( TBI_BACKWARD,
aMenu->SetHelpId( TBI_INDEX, HID_HELP_TOOLBOXITEM_INDEX );
aMenu->InsertSeparator();
aMenu->InsertItem( TBI_BACKWARD,
SfxResId( STR_HELP_BUTTON_PREV ).toString(),
Image( SfxResId( IMG_HELP_TOOLBOX_PREV ) )
);
aMenu.SetHelpId( TBI_BACKWARD, HID_HELP_TOOLBOXITEM_BACKWARD );
aMenu.EnableItem( TBI_BACKWARD, pHelpWin->HasHistoryPredecessor() );
aMenu.InsertItem( TBI_FORWARD,
aMenu->SetHelpId( TBI_BACKWARD, HID_HELP_TOOLBOXITEM_BACKWARD );
aMenu->EnableItem( TBI_BACKWARD, pHelpWin->HasHistoryPredecessor() );
aMenu->InsertItem( TBI_FORWARD,
SfxResId( STR_HELP_BUTTON_NEXT ).toString(),
Image( SfxResId( IMG_HELP_TOOLBOX_NEXT ) )
);
aMenu.SetHelpId( TBI_FORWARD, HID_HELP_TOOLBOXITEM_FORWARD );
aMenu.EnableItem( TBI_FORWARD, pHelpWin->HasHistorySuccessor() );
aMenu.InsertItem( TBI_START,
aMenu->SetHelpId( TBI_FORWARD, HID_HELP_TOOLBOXITEM_FORWARD );
aMenu->EnableItem( TBI_FORWARD, pHelpWin->HasHistorySuccessor() );
aMenu->InsertItem( TBI_START,
SfxResId( STR_HELP_BUTTON_START ).toString(),
Image( SfxResId( IMG_HELP_TOOLBOX_START ) )
);
aMenu.SetHelpId( TBI_START, HID_HELP_TOOLBOXITEM_START );
aMenu.InsertSeparator();
aMenu.InsertItem( TBI_PRINT,
aMenu->SetHelpId( TBI_START, HID_HELP_TOOLBOXITEM_START );
aMenu->InsertSeparator();
aMenu->InsertItem( TBI_PRINT,
SfxResId( STR_HELP_BUTTON_PRINT ).toString(),
Image( SfxResId( IMG_HELP_TOOLBOX_PRINT ) )
);
aMenu.SetHelpId( TBI_PRINT, HID_HELP_TOOLBOXITEM_PRINT );
aMenu.InsertItem( TBI_BOOKMARKS,
aMenu->SetHelpId( TBI_PRINT, HID_HELP_TOOLBOXITEM_PRINT );
aMenu->InsertItem( TBI_BOOKMARKS,
SfxResId( STR_HELP_BUTTON_ADDBOOKMARK ).toString(),
Image( SfxResId( IMG_HELP_TOOLBOX_BOOKMARKS ) )
);
aMenu.SetHelpId( TBI_BOOKMARKS, HID_HELP_TOOLBOXITEM_BOOKMARKS );
aMenu.InsertItem( TBI_SEARCHDIALOG,
aMenu->SetHelpId( TBI_BOOKMARKS, HID_HELP_TOOLBOXITEM_BOOKMARKS );
aMenu->InsertItem( TBI_SEARCHDIALOG,
SfxResId( STR_HELP_BUTTON_SEARCHDIALOG ).toString(),
Image( SfxResId( IMG_HELP_TOOLBOX_SEARCHDIALOG ) )
);
aMenu.SetHelpId( TBI_SEARCHDIALOG, HID_HELP_TOOLBOXITEM_SEARCHDIALOG );
aMenu.InsertSeparator();
aMenu.InsertItem( TBI_SELECTIONMODE, SfxResId( STR_HELP_MENU_TEXT_SELECTION_MODE ).toString() );
aMenu.SetHelpId( TBI_SELECTIONMODE, HID_HELP_TEXT_SELECTION_MODE );
aMenu->SetHelpId( TBI_SEARCHDIALOG, HID_HELP_TOOLBOXITEM_SEARCHDIALOG );
aMenu->InsertSeparator();
aMenu->InsertItem( TBI_SELECTIONMODE, SfxResId( STR_HELP_MENU_TEXT_SELECTION_MODE ).toString() );
aMenu->SetHelpId( TBI_SELECTIONMODE, HID_HELP_TEXT_SELECTION_MODE );
URL aURL;
aURL.Complete = ".uno:SelectTextMode";
Reference< util::XURLTransformer > xTrans( util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) );
@@ -2396,26 +2396,26 @@ bool SfxHelpTextWindow_Impl::PreNotify( NotifyEvent& rNEvt )
FeatureStateEvent rEvent = pStateListener->GetStateEvent();
bool bCheck = false;
rEvent.State >>= bCheck;
aMenu.CheckItem(TBI_SELECTIONMODE, bCheck);
aMenu->CheckItem(TBI_SELECTIONMODE, bCheck);
}
aMenu.InsertSeparator();
aMenu.InsertItem( TBI_COPY,
aMenu->InsertSeparator();
aMenu->InsertItem( TBI_COPY,
SfxResId(STR_HELP_MENU_TEXT_COPY).toString(),
Image( SfxResId( IMG_HELP_TOOLBOX_COPY ) )
);
aMenu.SetHelpId( TBI_COPY, ".uno:Copy" );
aMenu.EnableItem( TBI_COPY, HasSelection() );
aMenu->SetHelpId( TBI_COPY, ".uno:Copy" );
aMenu->EnableItem( TBI_COPY, HasSelection() );
if ( bIsDebug )
{
aMenu.InsertSeparator();
aMenu.InsertItem( TBI_SOURCEVIEW, SfxResId(STR_HELP_BUTTON_SOURCEVIEW).toString() );
aMenu->InsertSeparator();
aMenu->InsertItem( TBI_SOURCEVIEW, SfxResId(STR_HELP_BUTTON_SOURCEVIEW).toString() );
}
if( ! SvtMenuOptions().IsEntryHidingEnabled() )
aMenu.SetMenuFlags( aMenu.GetMenuFlags() | MenuFlags::HideDisabledEntries );
aMenu->SetMenuFlags( aMenu->GetMenuFlags() | MenuFlags::HideDisabledEntries );
sal_uInt16 nId = aMenu.Execute( this, aPos );
sal_uInt16 nId = aMenu->Execute( this, aPos );
pHelpWin->DoAction( nId );
bDone = true;
}
diff --git a/sfx2/source/control/templatedefaultview.cxx b/sfx2/source/control/templatedefaultview.cxx
index 789ef16..8ac3609 100644
--- a/sfx2/source/control/templatedefaultview.cxx
+++ b/sfx2/source/control/templatedefaultview.cxx
@@ -64,7 +64,7 @@ void TemplateDefaultView::KeyInput( const KeyEvent& rKEvt )
void TemplateDefaultView::createContextMenu()
{
std::unique_ptr<PopupMenu> pItemMenu(new PopupMenu);
ScopedVclPtrInstance<PopupMenu> pItemMenu;
pItemMenu->InsertItem(MNI_OPEN,SfxResId(STR_OPEN).toString());
pItemMenu->InsertItem(MNI_EDIT,SfxResId(STR_EDIT_TEMPLATE).toString());
deselectItems();
diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx
index 605011e..0ecd166 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -182,7 +182,7 @@ TemplateContainerItem* TemplateLocalView::getRegion(OUString const & rName)
void TemplateLocalView::createContextMenu(const bool bIsDefault)
{
std::unique_ptr<PopupMenu> pItemMenu(new PopupMenu);
ScopedVclPtrInstance<PopupMenu> pItemMenu;
pItemMenu->InsertItem(MNI_OPEN,SfxResId(STR_OPEN).toString());
pItemMenu->InsertItem(MNI_EDIT,SfxResId(STR_EDIT_TEMPLATE).toString());
diff --git a/sfx2/source/control/templatesearchview.cxx b/sfx2/source/control/templatesearchview.cxx
index 20da15c..3967204 100644
--- a/sfx2/source/control/templatesearchview.cxx
+++ b/sfx2/source/control/templatesearchview.cxx
@@ -126,7 +126,7 @@ void TemplateSearchView::Command( const CommandEvent& rCEvt )
void TemplateSearchView::createContextMenu( const bool bIsDefault)
{
std::unique_ptr<PopupMenu> pItemMenu(new PopupMenu);
ScopedVclPtrInstance<PopupMenu> pItemMenu;
pItemMenu->InsertItem(MNI_OPEN,SfxResId(STR_OPEN).toString());
pItemMenu->InsertItem(MNI_EDIT,SfxResId(STR_EDIT_TEMPLATE).toString());
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index fe83011..58c16e4 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -328,7 +328,7 @@ void SfxActionListBox::Recalc()
}
}
std::unique_ptr<PopupMenu> SfxActionListBox::CreateContextMenu()
VclPtr<PopupMenu> SfxActionListBox::CreateContextMenu()
{
if( !( GetSelectionCount() > 0 ) )
@@ -412,7 +412,7 @@ void StyleTreeListBox_Impl::MakeExpanded_Impl(ExpandedEntries_t& rEntries) const
}
}
std::unique_ptr<PopupMenu> StyleTreeListBox_Impl::CreateContextMenu()
VclPtr<PopupMenu> StyleTreeListBox_Impl::CreateContextMenu()
{
return pDialog->CreateContextMenu();
}
@@ -2156,7 +2156,7 @@ void SfxCommonTemplateDialog_Impl::EnableExample_Impl(sal_uInt16 nId, bool bEnab
EnableItem(nId, bEnable);
}
std::unique_ptr<PopupMenu> SfxCommonTemplateDialog_Impl::CreateContextMenu()
VclPtr<PopupMenu> SfxCommonTemplateDialog_Impl::CreateContextMenu()
{
if ( bBindingUpdate )
{
@@ -2164,7 +2164,7 @@ std::unique_ptr<PopupMenu> SfxCommonTemplateDialog_Impl::CreateContextMenu()
pBindings->Update( SID_STYLE_NEW );
bBindingUpdate = false;
}
std::unique_ptr<PopupMenu> pMenu(new PopupMenu( SfxResId( MN_CONTEXT_TEMPLDLG ) ));
VclPtr<PopupMenu> pMenu = VclPtr<PopupMenu>::Create( SfxResId( MN_CONTEXT_TEMPLDLG ) );
pMenu->SetSelectHdl( LINK( this, SfxCommonTemplateDialog_Impl, MenuSelectHdl ) );
pMenu->EnableItem( ID_EDIT, bCanEdit );
pMenu->EnableItem( ID_DELETE, bCanDel );
@@ -2474,7 +2474,7 @@ IMPL_LINK_TYPED( SfxTemplateDialog_Impl, ToolBoxRClick, ToolBox *, pBox, void )
ToolBoxItemBits::DROPDOWN == (pBox->GetItemBits(nEntry)&ToolBoxItemBits::DROPDOWN))
{
//create a popup menu in Writer
std::unique_ptr<PopupMenu> pMenu(new PopupMenu);
ScopedVclPtrInstance<PopupMenu> pMenu;
uno::Reference< container::XNameAccess > xNameAccess(
frame::theUICommandDescription::get(
::comphelper::getProcessComponentContext()) );
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 9d6b8de..42b7dfe 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -180,7 +180,7 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg(vcl::Window *parent)
get(mpCBXHideDlg, "hidedialogcb");
// Create popup menus
mpActionMenu = new PopupMenu;
mpActionMenu = VclPtr<PopupMenu>::Create();
mpActionMenu->InsertItem(MNI_ACTION_NEW_FOLDER,
SfxResId(STR_CATEGORY_NEW).toString(),
Image(SfxResId(IMG_ACTION_REFRESH)));
@@ -195,10 +195,10 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg(vcl::Window *parent)
mpActionMenu->InsertItem(MNI_ACTION_DEFAULT,SfxResId(STR_ACTION_DEFAULT).toString());
mpActionMenu->SetSelectHdl(LINK(this,SfxTemplateManagerDlg,MenuSelectHdl));
mpRepositoryMenu = new PopupMenu;
mpRepositoryMenu = VclPtr<PopupMenu>::Create();
mpRepositoryMenu->SetSelectHdl(LINK(this,SfxTemplateManagerDlg,RepositoryMenuSelectHdl));
mpTemplateDefaultMenu = new PopupMenu;
mpTemplateDefaultMenu = VclPtr<PopupMenu>::Create();
mpTemplateDefaultMenu->SetSelectHdl(LINK(this,SfxTemplateManagerDlg,DefaultTemplateMenuSelectHdl));
mpActionMenu->SetPopupMenu(MNI_ACTION_DEFAULT,mpTemplateDefaultMenu);
diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx
index b8a08d3..13e36c5 100644
--- a/sfx2/source/inc/templdgi.hxx
+++ b/sfx2/source/inc/templdgi.hxx
@@ -131,7 +131,7 @@ public:
}
void MakeExpanded_Impl(ExpandedEntries_t& rEntries) const;
virtual std::unique_ptr<PopupMenu> CreateContextMenu() override;
virtual VclPtr<PopupMenu> CreateContextMenu() override;
};
class SfxActionListBox : public DropListBox_Impl
@@ -140,7 +140,7 @@ protected:
public:
SfxActionListBox( SfxCommonTemplateDialog_Impl* pParent, WinBits nWinBits );
virtual std::unique_ptr<PopupMenu> CreateContextMenu() override;
virtual VclPtr<PopupMenu> CreateContextMenu() override;
void Recalc();
};
@@ -325,7 +325,7 @@ public:
}
// normally for derivates from SvTreeListBoxes, but in this case the dialog handles context menus
std::unique_ptr<PopupMenu> CreateContextMenu();
VclPtr<PopupMenu> CreateContextMenu();
};
class DropToolBox_Impl : public ToolBox, public DropTargetHelper
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 1dc3ffb..43d8884 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -926,7 +926,7 @@ void SidebarController::ShowPopupMenu (
const Rectangle& rButtonBox,
const ::std::vector<TabBar::DeckMenuData>& rMenuData) const
{
std::shared_ptr<PopupMenu> pMenu = CreatePopupMenu(rMenuData);
VclPtr<PopupMenu> pMenu = CreatePopupMenu(rMenuData);
pMenu->SetSelectHdl(LINK(const_cast<SidebarController*>(this), SidebarController, OnMenuItemSelected));
// pass toolbox button rect so the menu can stay open on button up
@@ -935,11 +935,11 @@ void SidebarController::ShowPopupMenu (
pMenu->Execute(mpParentWindow, aBox, PopupMenuFlags::ExecuteDown);
}
std::shared_ptr<PopupMenu> SidebarController::CreatePopupMenu (
VclPtr<PopupMenu> SidebarController::CreatePopupMenu (
const ::std::vector<TabBar::DeckMenuData>& rMenuData) const
{
// Create the top level popup menu.
std::shared_ptr<PopupMenu> pMenu (new PopupMenu());
VclPtrInstance<PopupMenu> pMenu;
FloatingWindow* pMenuWindow = dynamic_cast<FloatingWindow*>(pMenu->GetWindow());
if (pMenuWindow != nullptr)
{
@@ -947,7 +947,7 @@ std::shared_ptr<PopupMenu> SidebarController::CreatePopupMenu (
}
// Create sub menu for customization (hiding of deck tabs.)
PopupMenu* pCustomizationMenu = new PopupMenu();
VclPtr<PopupMenu> pCustomizationMenu = VclPtr<PopupMenu>::Create();
SidebarResource aLocalResource;
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index f787d00..fc23ebb 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -1774,7 +1774,7 @@ void Change( Menu* pMenu, SfxViewShell* pView )
}
bool SfxViewShell::TryContextMenuInterception( Menu& rIn, const OUString& rMenuIdentifier, Menu*& rpOut, ui::ContextMenuExecuteEvent aEvent )
bool SfxViewShell::TryContextMenuInterception( Menu& rIn, const OUString& rMenuIdentifier, VclPtr<Menu>& rpOut, ui::ContextMenuExecuteEvent aEvent )
{
rpOut = nullptr;
bool bModified = false;
@@ -1829,7 +1829,7 @@ bool SfxViewShell::TryContextMenuInterception( Menu& rIn, const OUString& rMenuI
if ( bModified )
{
// container was modified, create a new window out of it
rpOut = new PopupMenu;
rpOut = VclPtr<PopupMenu>::Create();
::framework::ActionTriggerHelper::CreateMenuFromActionTriggerContainer( rpOut, aEvent.ActionTriggerContainer );
Change( rpOut, this );
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index ba9fda4..bf1af9a 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -340,10 +340,10 @@ void SmEditWindow::Command(const CommandEvent& rCEvt)
GetParent()->ToTop();
Point aPoint = rCEvt.GetMousePosPixel();
std::unique_ptr<PopupMenu> xPopupMenu(new PopupMenu(SmResId(RID_COMMANDMENU)));
VclPtr<PopupMenu> xPopupMenu = VclPtr<PopupMenu>::Create(SmResId(RID_COMMANDMENU));
// added for replaceability of context menus
Menu* pMenu = nullptr;
VclPtr<Menu> pMenu;
css::ui::ContextMenuExecuteEvent aEvent;
aEvent.SourceWindow = VCLUnoHelper::GetInterface( this );
aEvent.ExecutePosition.X = aPoint.X();
@@ -353,7 +353,8 @@ void SmEditWindow::Command(const CommandEvent& rCEvt)
{
if ( pMenu )
{
xPopupMenu.reset(static_cast<PopupMenu*>(pMenu));
xPopupMenu.disposeAndClear();
xPopupMenu = static_cast<PopupMenu*>(pMenu.get());
}
}
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index d287cea..433652b 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -205,7 +205,7 @@ public:
DECL_LINK_TYPED(ResetQuickSearch_Impl, Timer *, void);
virtual std::unique_ptr<PopupMenu> CreateContextMenu() override;
virtual VclPtr<PopupMenu> CreateContextMenu() override;
virtual void ExecuteContextMenuAction( sal_uInt16 nSelectedPopentry ) override;
};
@@ -627,7 +627,7 @@ void ViewTabListBox_Impl::KeyInput( const KeyEvent& rKEvt )
}
std::unique_ptr<PopupMenu> ViewTabListBox_Impl::CreateContextMenu()
VclPtr<PopupMenu> ViewTabListBox_Impl::CreateContextMenu()
{
bool bEnableDelete = mbEnableDelete;
bool bEnableRename = mbEnableRename;
@@ -700,8 +700,7 @@ std::unique_ptr<PopupMenu> ViewTabListBox_Impl::CreateContextMenu()
if ( bEnableDelete || bEnableRename )
{
std::unique_ptr<PopupMenu> pRet(
new PopupMenu( SvtResId( RID_FILEVIEW_CONTEXTMENU ) ));
VclPtrInstance<PopupMenu> pRet(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 20e218b..5a19237 100644
--- a/svtools/source/contnr/svimpbox.cxx
+++ b/svtools/source/contnr/svimpbox.cxx
@@ -2917,11 +2917,13 @@ static void lcl_DeleteSubPopups(PopupMenu* pPopup)
{
for(sal_uInt16 i = 0; i < pPopup->GetItemCount(); i++)
{
PopupMenu* pSubPopup = pPopup->GetPopupMenu( pPopup->GetItemId( i ));
VclPtr<PopupMenu> pSubPopup = pPopup->GetPopupMenu( pPopup->GetItemId( i ));
if(pSubPopup)
{
lcl_DeleteSubPopups(pSubPopup);
delete pSubPopup;
// NoelG: this looks very dodgy to me, we are attempting to delete this, but we leave a dangling pointer
// in the PopupMenu class?
pSubPopup.disposeAndClear();
}
}
}
@@ -3017,8 +3019,8 @@ void SvImpLBox::Command( const CommandEvent& rCEvt )
}
{
std::unique_ptr<PopupMenu> pPopup = pView->CreateContextMenu();
if( pPopup.get() )
VclPtr<PopupMenu> pPopup = pView->CreateContextMenu();
if( pPopup )
{
// do action for selected entry in popup menu
sal_uInt16 nMenuAction = pPopup->Execute( pView, aPopupPos );
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index abc8d35..4a4f48f 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -3724,7 +3724,7 @@ void SvTreeListBox::InitStartEntry()
pImpl->pStartEntry = GetModel()->First();
}
std::unique_ptr<PopupMenu> SvTreeListBox::CreateContextMenu()
VclPtr<PopupMenu> SvTreeListBox::CreateContextMenu()
{
return nullptr;
}
diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx
index c04650c..4ce2033 100644
--- a/svtools/source/control/calendar.cxx
+++ b/svtools/source/control/calendar.cxx
@@ -1161,8 +1161,8 @@ void Calendar::ImplShowMenu( const Point& rPos, const Date& rDate )
EndSelection();
Date aOldFirstDate = GetFirstMonth();
PopupMenu aPopupMenu;
PopupMenu* pYearPopupMenus[MENU_YEAR_COUNT];
ScopedVclPtrInstance<PopupMenu> aPopupMenu;
VclPtr<PopupMenu> pYearPopupMenus[MENU_YEAR_COUNT];
sal_uInt16 nMonthOff;
sal_uInt16 nCurItemId;
sal_uInt16 nYear = rDate.GetYear()-1;
@@ -1179,26 +1179,26 @@ void Calendar::ImplShowMenu( const Point& rPos, const Date& rDate )
// construct menu (include years with different months)
for ( i = 0; i < MENU_YEAR_COUNT; i++ )
{
pYearPopupMenus[i] = new PopupMenu;
pYearPopupMenus[i] = VclPtr<PopupMenu>::Create();
for ( j = 1; j <= 12; j++ )
pYearPopupMenus[i]->InsertItem( nYearIdCount+j,
maCalendarWrapper.getDisplayName(
i18n::CalendarDisplayIndex::MONTH, j-1, 1));
aPopupMenu.InsertItem( 10+i, OUString::number( nYear+i ) );
aPopupMenu.SetPopupMenu( 10+i, pYearPopupMenus[i] );
aPopupMenu->InsertItem( 10+i, OUString::number( nYear+i ) );
aPopupMenu->SetPopupMenu( 10+i, pYearPopupMenus[i] );
nYearIdCount += 1000;
}
mbMenuDown = true;
nCurItemId = aPopupMenu.Execute( this, rPos );
nCurItemId = aPopupMenu->Execute( this, rPos );
mbMenuDown = false;
// destroy menu
aPopupMenu.SetPopupMenu( 2, nullptr );
aPopupMenu->SetPopupMenu( 2, nullptr );
for ( i = 0; i < MENU_YEAR_COUNT; i++ )
{
aPopupMenu.SetPopupMenu( 10+i, nullptr );
delete pYearPopupMenus[i];
aPopupMenu->SetPopupMenu( 10+i, nullptr );
pYearPopupMenus[i].disposeAndClear();
}
if ( nCurItemId )
diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx
index 6d38b34..4ba77b9 100644
--- a/svx/source/dialog/imapwnd.cxx
+++ b/svx/source/dialog/imapwnd.cxx
@@ -471,23 +471,23 @@ void IMapWindow::Command(const CommandEvent& rCEvt)
if ( rCEvt.GetCommand() == CommandEventId::ContextMenu )
{
PopupMenu aMenu( SVX_RES( RID_SVXMN_IMAP ) );
ScopedVclPtrInstance<PopupMenu> aMenu( SVX_RES( RID_SVXMN_IMAP ) );
const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
const size_t nMarked = rMarkList.GetMarkCount();
aMenu.EnableItem( MN_URL, false );
aMenu.EnableItem( MN_ACTIVATE, false );
aMenu.EnableItem( MN_MACRO, false );
aMenu.EnableItem( MN_MARK_ALL, pModel->GetPage( 0 )->GetObjCount() != pView->GetMarkedObjectCount() );
aMenu->EnableItem( MN_URL, false );
aMenu->EnableItem( MN_ACTIVATE, false );
aMenu->EnableItem( MN_MACRO, false );
aMenu->EnableItem( MN_MARK_ALL, pModel->GetPage( 0 )->GetObjCount() != pView->GetMarkedObjectCount() );
if ( !nMarked )
{
aMenu.EnableItem( MN_POSITION, false );
aMenu.EnableItem( MN_FRAME_TO_TOP, false );
aMenu.EnableItem( MN_MOREFRONT, false );
aMenu.EnableItem( MN_MOREBACK, false );
aMenu.EnableItem( MN_FRAME_TO_BOTTOM, false );
aMenu.EnableItem( MN_DELETE1, false );
aMenu->EnableItem( MN_POSITION, false );
aMenu->EnableItem( MN_FRAME_TO_TOP, false );
aMenu->EnableItem( MN_MOREFRONT, false );
aMenu->EnableItem( MN_MOREBACK, false );
aMenu->EnableItem( MN_FRAME_TO_BOTTOM, false );
aMenu->EnableItem( MN_DELETE1, false );
}
else
{
@@ -495,22 +495,22 @@ void IMapWindow::Command(const CommandEvent& rCEvt)
{
SdrObject* pSdrObj = GetSelectedSdrObject();
aMenu.EnableItem( MN_URL );
aMenu.EnableItem( MN_ACTIVATE );
aMenu.EnableItem( MN_MACRO );
aMenu.CheckItem( MN_ACTIVATE, GetIMapObj( pSdrObj )->IsActive() );
aMenu->EnableItem( MN_URL );
aMenu->EnableItem( MN_ACTIVATE );
aMenu->EnableItem( MN_MACRO );
aMenu->CheckItem( MN_ACTIVATE, GetIMapObj( pSdrObj )->IsActive() );
}
aMenu.EnableItem( MN_POSITION );
aMenu.EnableItem( MN_FRAME_TO_TOP );
aMenu.EnableItem( MN_MOREFRONT );
aMenu.EnableItem( MN_MOREBACK );
aMenu.EnableItem( MN_FRAME_TO_BOTTOM );
aMenu.EnableItem( MN_DELETE1 );
aMenu->EnableItem( MN_POSITION );
aMenu->EnableItem( MN_FRAME_TO_TOP );
aMenu->EnableItem( MN_MOREFRONT );
aMenu->EnableItem( MN_MOREBACK );
aMenu->EnableItem( MN_FRAME_TO_BOTTOM );
aMenu->EnableItem( MN_DELETE1 );
}
aMenu.SetSelectHdl( LINK( this, IMapWindow, MenuSelectHdl ) );
aMenu.Execute( this, rCEvt.GetMousePosPixel() );
aMenu->SetSelectHdl( LINK( this, IMapWindow, MenuSelectHdl ) );
aMenu->Execute( this, rCEvt.GetMousePosPixel() );
}
else
Window::Command(rCEvt);
diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx
index efe4de3..7504522 100644
--- a/svx/source/dialog/svxruler.cxx
+++ b/svx/source/dialog/svxruler.cxx
@@ -3387,8 +3387,8 @@ void SvxRuler::Command( const CommandEvent& rCommandEvent )
GetType( rCommandEvent.GetMousePosPixel(), &mxRulerImpl->nIdx ) &&
mpTabs[mxRulerImpl->nIdx + TAB_GAP].nStyle < RULER_TAB_DEFAULT )
{
PopupMenu aMenu;
aMenu.SetSelectHdl(LINK(this, SvxRuler, TabMenuSelect));
ScopedVclPtrInstance<PopupMenu> aMenu;
aMenu->SetSelectHdl(LINK(this, SvxRuler, TabMenuSelect));
ScopedVclPtrInstance< VirtualDevice > pDev;
const Size aSz(ruler_tab_svx.width + 2, ruler_tab_svx.height + 2);
pDev->SetOutputSize(aSz);
@@ -3401,26 +3401,26 @@ void SvxRuler::Command( const CommandEvent& rCommandEvent )
sal_uInt16 nStyle = bRTL ? i|RULER_TAB_RTL : i;
nStyle |= static_cast<sal_uInt16>(bHorz ? WB_HORZ : WB_VERT);
DrawTab(*pDev, aFillColor, aPt, nStyle);
aMenu.InsertItem(i + 1,
aMenu->InsertItem(i + 1,
ResId(RID_SVXSTR_RULER_START + i, DIALOG_MGR()).toString(),
Image(pDev->GetBitmap(Point(), aSz), Color(COL_WHITE)));
aMenu.CheckItem(i + 1, i == mpTabs[mxRulerImpl->nIdx + TAB_GAP].nStyle);
aMenu->CheckItem(i + 1, i == mpTabs[mxRulerImpl->nIdx + TAB_GAP].nStyle);
pDev->SetOutputSize(aSz); // delete device
}
aMenu.Execute( this, rCommandEvent.GetMousePosPixel() );
aMenu->Execute( this, rCommandEvent.GetMousePosPixel() );
}
else
{
PopupMenu aMenu(ResId(RID_SVXMN_RULER, DIALOG_MGR()));
aMenu.SetSelectHdl(LINK(this, SvxRuler, MenuSelect));
ScopedVclPtrInstance<PopupMenu> aMenu(ResId(RID_SVXMN_RULER, DIALOG_MGR()));
aMenu->SetSelectHdl(LINK(this, SvxRuler, MenuSelect));
FieldUnit eUnit = GetUnit();
const sal_uInt16 nCount = aMenu.GetItemCount();
const sal_uInt16 nCount = aMenu->GetItemCount();
bool bReduceMetric = bool(nFlags & SvxRulerSupportFlags::REDUCED_METRIC);
for ( sal_uInt16 i = nCount; i; --i )
{
const sal_uInt16 nId = aMenu.GetItemId(i - 1);
aMenu.CheckItem(nId, nId == (sal_uInt16)eUnit);
const sal_uInt16 nId = aMenu->GetItemId(i - 1);
aMenu->CheckItem(nId, nId == (sal_uInt16)eUnit);
if( bReduceMetric )
{
if ( nId == FUNIT_M ||
@@ -3428,19 +3428,19 @@ void SvxRuler::Command( const CommandEvent& rCommandEvent )
nId == FUNIT_FOOT ||
nId == FUNIT_MILE )
{
aMenu.RemoveItem(i - 1);
aMenu->RemoveItem(i - 1);
}
else if (( nId == FUNIT_CHAR ) && !bHorz )
{
aMenu.RemoveItem(i - 1);
aMenu->RemoveItem(i - 1);
}
else if (( nId == FUNIT_LINE ) && bHorz )
{
aMenu.RemoveItem(i - 1);
aMenu->RemoveItem(i - 1);
}
}
}
aMenu.Execute( this, rCommandEvent.GetMousePosPixel() );
aMenu->Execute( this, rCommandEvent.GetMousePosPixel() );
}
}
else
diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx
index 55c1b3a..9a1fa11 100644
--- a/svx/source/fmcomp/fmgridcl.cxx
+++ b/svx/source/fmcomp/fmgridcl.cxx
@@ -496,12 +496,12 @@ IMPL_LINK_NOARG_TYPED( FmGridHeader, OnAsyncExecuteDrop, void*, void )
{
ImageList aImageList( SVX_RES(RID_SVXIMGLIST_FMEXPL) );
PopupMenu aInsertMenu(SVX_RES(RID_SVXMNU_COLS));
PopupMenu aTypeMenu;
PopupMenu* pMenu = aInsertMenu.GetPopupMenu(SID_FM_INSERTCOL);
ScopedVclPtrInstance<PopupMenu> aInsertMenu(SVX_RES(RID_SVXMNU_COLS));
ScopedVclPtrInstance<PopupMenu> aTypeMenu;
PopupMenu* pMenu = aInsertMenu->GetPopupMenu(SID_FM_INSERTCOL);
for (std::vector<sal_uInt16>::const_iterator iter = aPossibleTypes.begin(); iter != aPossibleTypes.end(); ++iter)
SetMenuItem(aImageList, *iter, pMenu, aTypeMenu, true, 0);
nPreferredType = aTypeMenu.Execute(this, m_pImpl->aDropPosPixel);
SetMenuItem(aImageList, *iter, pMenu, *aTypeMenu.get(), true, 0);
nPreferredType = aTypeMenu->Execute(this, m_pImpl->aDropPosPixel);
}
bDateNTimeCol = nPreferredType == SID_FM_TWOFIELDS_DATE_N_TIME;
@@ -657,7 +657,7 @@ void FmGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rMe
bool bMarked = nColId && static_cast<FmGridControl*>(GetParent())->isColumnMarked(nColId);
ImageList aImageList( SVX_RES(RID_SVXIMGLIST_FMEXPL) );
PopupMenu* pControlMenu = new PopupMenu;
VclPtrInstance<PopupMenu> pControlMenu;
PopupMenu* pMenu = rMenu.GetPopupMenu(SID_FM_INSERTCOL);
if (pMenu)
@@ -782,8 +782,8 @@ void FmGridHeader::PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMe
sal_uInt16 nPos = GetModelColumnPos(nColId);
// remove and delete the menu we inserted in PreExecuteColumnContextMenu
PopupMenu* pControlMenu = rMenu.GetPopupMenu(SID_FM_CHANGECOL);
delete pControlMenu;
VclPtr<PopupMenu> pControlMenu = rMenu.GetPopupMenu(SID_FM_CHANGECOL);
pControlMenu.disposeAndClear(); // NoelG: dodgy, this leaves a dangling pointer
OUString aFieldType;
bool bReplace = false;
@@ -983,17 +983,17 @@ void FmGridHeader::triggerColumnContextMenu( const ::Point& _rPreferredPos )
sal_uInt16 nColId = GetItemId( _rPreferredPos );
// the menu
PopupMenu aContextMenu( SVX_RES( RID_SVXMNU_COLS ) );
ScopedVclPtrInstance<PopupMenu> aContextMenu( SVX_RES( RID_SVXMNU_COLS ) );
// let derivees modify the menu
PreExecuteColumnContextMenu( nColId, aContextMenu );
aContextMenu.RemoveDisabledEntries( true, true );
PreExecuteColumnContextMenu( nColId, *aContextMenu );
aContextMenu->RemoveDisabledEntries( true, true );
// execute the menu
sal_uInt16 nResult = aContextMenu.Execute( this, _rPreferredPos );
sal_uInt16 nResult = aContextMenu->Execute( this, _rPreferredPos );
// let derivees handle the result
PostExecuteColumnContextMenu( nColId, aContextMenu, nResult );
PostExecuteColumnContextMenu( nColId, *aContextMenu, nResult );
}
void FmGridHeader::Command(const CommandEvent& rEvt)
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index cb6b42a..e2992ee 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -2827,11 +2827,11 @@ void DbGridControl::copyCellText(sal_Int32 _nRow, sal_uInt16 _nColId)
void DbGridControl::executeRowContextMenu( long _nRow, const Point& _rPreferredPos )
{
PopupMenu aContextMenu( SVX_RES( RID_SVXMNU_ROWS ) );
ScopedVclPtrInstance<PopupMenu> aContextMenu( SVX_RES( RID_SVXMNU_ROWS ) );
PreExecuteRowContextMenu( (sal_uInt16)_nRow, aContextMenu );
aContextMenu.RemoveDisabledEntries( true, true );
PostExecuteRowContextMenu( (sal_uInt16)_nRow, aContextMenu, aContextMenu.Execute( this, _rPreferredPos ) );
PreExecuteRowContextMenu( (sal_uInt16)_nRow, *aContextMenu.get() );
aContextMenu->RemoveDisabledEntries( true, true );
PostExecuteRowContextMenu( (sal_uInt16)_nRow, *aContextMenu.get(), aContextMenu->Execute( this, _rPreferredPos ) );
// TODO: why this weird cast to sal_uInt16? What if we really have more than 65535 lines?
// -> change this to sal_uInt32
@@ -2872,9 +2872,9 @@ void DbGridControl::Command(const CommandEvent& rEvt)
}
else if (canCopyCellText(nRow, nColId))
{
PopupMenu aContextMenu(SVX_RES(RID_SVXMNU_CELL));
aContextMenu.RemoveDisabledEntries(true, true);
switch (aContextMenu.Execute(this, rEvt.GetMousePosPixel()))
ScopedVclPtrInstance<PopupMenu> aContextMenu(SVX_RES(RID_SVXMNU_CELL));
aContextMenu->RemoveDisabledEntries(true, true);
switch (aContextMenu->Execute(this, rEvt.GetMousePosPixel()))
{
case SID_COPY:
copyCellText(nRow, nColId);
diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx
index 6db0f72..281ffef 100644
--- a/svx/source/form/datanavi.cxx
+++ b/svx/source/form/datanavi.cxx
@@ -220,10 +220,9 @@ namespace svxform
pTransferable->StartDrag( this, DND_ACTION_COPY );
}
std::unique_ptr<PopupMenu> DataTreeListBox::CreateContextMenu()
VclPtr<PopupMenu> DataTreeListBox::CreateContextMenu()
{
std::unique_ptr<PopupMenu> pMenu(
new PopupMenu( SVX_RES( RID_MENU_DATANAVIGATOR ) ));
VclPtrInstance<PopupMenu> pMenu( SVX_RES( RID_MENU_DATANAVIGATOR ) );
if ( DGTInstance == m_eGroup )
pMenu->RemoveItem( pMenu->GetItemPos( m_nAddId ) );
else
diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx
index 7c1f1ee..f48413e 100644
--- a/svx/source/form/filtnav.cxx
+++ b/svx/source/form/filtnav.cxx
@@ -1629,24 +1629,21 @@ void FmFilterNavigator::Command( const CommandEvent& rEvt )
aSelectList.clear();
}
PopupMenu aContextMenu(SVX_RES(RID_FM_FILTER_MENU));
ScopedVclPtrInstance<PopupMenu> aContextMenu(SVX_RES(RID_FM_FILTER_MENU));
// every condition could be deleted except the first one if its the only one
aContextMenu.EnableItem( SID_FM_DELETE, !aSelectList.empty() );
aContextMenu->EnableItem( SID_FM_DELETE, !aSelectList.empty() );
bool bEdit = dynamic_cast<FmFilterItem*>( static_cast<FmFilterData*>(pClicked->GetUserData()) ) != nullptr &&
IsSelected(pClicked) && GetSelectionCount() == 1;
aContextMenu.EnableItem( SID_FM_FILTER_EDIT,
bEdit );
aContextMenu.EnableItem( SID_FM_FILTER_IS_NULL,
bEdit );
aContextMenu.EnableItem( SID_FM_FILTER_IS_NOT_NULL,
bEdit );
aContextMenu->EnableItem( SID_FM_FILTER_EDIT, bEdit );
aContextMenu->EnableItem( SID_FM_FILTER_IS_NULL, bEdit );
aContextMenu->EnableItem( SID_FM_FILTER_IS_NOT_NULL, bEdit );
aContextMenu.RemoveDisabledEntries(true, true);
sal_uInt16 nSlotId = aContextMenu.Execute( this, aWhere );
aContextMenu->RemoveDisabledEntries(true, true);
sal_uInt16 nSlotId = aContextMenu->Execute( this, aWhere );
switch( nSlotId )
{
case SID_FM_FILTER_EDIT:
diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index 67b5d99..501c39c 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -1040,10 +1040,10 @@ void FmXFormShell::ForceUpdateSelection()
}
PopupMenu* FmXFormShell::GetConversionMenu()
VclPtr<PopupMenu> FmXFormShell::GetConversionMenu()
{
PopupMenu* pNewMenu = new PopupMenu(SVX_RES( RID_FMSHELL_CONVERSIONMENU ));
VclPtrInstance<PopupMenu> pNewMenu(SVX_RES( RID_FMSHELL_CONVERSIONMENU ));
ImageList aImageList( SVX_RES( RID_SVXIMGLIST_FMEXPL) );
for ( size_t i = 0; i < SAL_N_ELEMENTS(nConvertSlots); ++i )
diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx
index 21c95d94..afe7d11 100644
--- a/svx/source/form/navigatortree.cxx
+++ b/svx/source/form/navigatortree.cxx
@@ -360,11 +360,11 @@ namespace svxform
FmFormModel* pFormModel = pFormShell ? pFormShell->GetFormModel() : nullptr;
if( pFormShell && pFormModel )
{
PopupMenu aContextMenu(SVX_RES(RID_FMEXPLORER_POPUPMENU));
PopupMenu* pSubMenuNew = aContextMenu.GetPopupMenu( SID_FM_NEW );
ScopedVclPtrInstance<PopupMenu> aContextMenu(SVX_RES(RID_FMEXPLORER_POPUPMENU));
PopupMenu* pSubMenuNew = aContextMenu->GetPopupMenu( SID_FM_NEW );
// menu 'New' only exists, if only the root or only one form is selected
aContextMenu.EnableItem( SID_FM_NEW, bSingleSelection && (m_nFormsSelected || m_bRootSelected) );
aContextMenu->EnableItem( SID_FM_NEW, bSingleSelection && (m_nFormsSelected || m_bRootSelected) );
// 'New'\'Form' under the same terms
pSubMenuNew->EnableItem( SID_FM_NEW_FORM, bSingleSelection && (m_nFormsSelected || m_bRootSelected) );
@@ -375,62 +375,62 @@ namespace svxform
pSubMenuNew->EnableItem( SID_FM_NEW_HIDDEN, bSingleSelection && m_nFormsSelected );
// 'Delete': everything which is not root can be removed
aContextMenu.EnableItem( SID_FM_DELETE, !m_bRootSelected );
aContextMenu->EnableItem( SID_FM_DELETE, !m_bRootSelected );
// 'Cut', 'Copy' and 'Paste'
aContextMenu.EnableItem( SID_CUT, !m_bRootSelected && implAllowExchange( DND_ACTION_MOVE ) );
aContextMenu.EnableItem( SID_COPY, !m_bRootSelected && implAllowExchange( DND_ACTION_COPY ) );
aContextMenu.EnableItem( SID_PASTE, implAcceptPaste( ) );
aContextMenu->EnableItem( SID_CUT, !m_bRootSelected && implAllowExchange( DND_ACTION_MOVE ) );
aContextMenu->EnableItem( SID_COPY, !m_bRootSelected && implAllowExchange( DND_ACTION_COPY ) );
aContextMenu->EnableItem( SID_PASTE, implAcceptPaste( ) );
// TabDialog, if exactly one form
aContextMenu.EnableItem( SID_FM_TAB_DIALOG, bSingleSelection && m_nFormsSelected );
aContextMenu->EnableItem( SID_FM_TAB_DIALOG, bSingleSelection && m_nFormsSelected );
// in XML forms, we don't allow for the properties of a form
// #i36484#
if ( pFormShell->GetImpl()->isEnhancedForm() && !m_nControlsSelected )
aContextMenu.RemoveItem( aContextMenu.GetItemPos( SID_FM_SHOW_PROPERTY_BROWSER ) );
aContextMenu->RemoveItem( aContextMenu->GetItemPos( SID_FM_SHOW_PROPERTY_BROWSER ) );
// if the property browser is already open, we don't allow for the properties, too
if( pFormShell->GetImpl()->IsPropBrwOpen() )
aContextMenu.RemoveItem( aContextMenu.GetItemPos( SID_FM_SHOW_PROPERTY_BROWSER ) );
aContextMenu->RemoveItem( aContextMenu->GetItemPos( SID_FM_SHOW_PROPERTY_BROWSER ) );
// and finally, if there's a mixed selection of forms and controls, disable the entry, too
else
aContextMenu.EnableItem( SID_FM_SHOW_PROPERTY_BROWSER,
aContextMenu->EnableItem( SID_FM_SHOW_PROPERTY_BROWSER,
(m_nControlsSelected && !m_nFormsSelected) || (!m_nControlsSelected && m_nFormsSelected) );
// rename, if one element and no root
aContextMenu.EnableItem( SID_FM_RENAME_OBJECT, bSingleSelection && !m_bRootSelected );
aContextMenu->EnableItem( SID_FM_RENAME_OBJECT, bSingleSelection && !m_bRootSelected );
// Readonly-entry is only for root
aContextMenu.EnableItem( SID_FM_OPEN_READONLY, m_bRootSelected );
aContextMenu->EnableItem( SID_FM_OPEN_READONLY, m_bRootSelected );
// the same for automatic control focus
aContextMenu.EnableItem( SID_FM_AUTOCONTROLFOCUS, m_bRootSelected );
aContextMenu->EnableItem( SID_FM_AUTOCONTROLFOCUS, m_bRootSelected );
// ConvertTo-Slots are enabled, if one control is selected
// the corresponding slot is disabled
if (!m_bRootSelected && !m_nFormsSelected && (m_nControlsSelected == 1))
{
aContextMenu.SetPopupMenu( SID_FM_CHANGECONTROLTYPE, FmXFormShell::GetConversionMenu() );
aContextMenu->SetPopupMenu( SID_FM_CHANGECONTROLTYPE, FmXFormShell::GetConversionMenu() );
#if OSL_DEBUG_LEVEL > 0
FmControlData* pCurrent = static_cast<FmControlData*>((*m_arrCurrentSelection.begin())->GetUserData());
OSL_ENSURE( pFormShell->GetImpl()->isSolelySelected( pCurrent->GetFormComponent() ),
"NavigatorTree::Command: inconsistency between the navigator selection, and the selection as the shell knows it!" );
#endif
pFormShell->GetImpl()->checkControlConversionSlotsForCurrentSelection( *aContextMenu.GetPopupMenu( SID_FM_CHANGECONTROLTYPE ) );
pFormShell->GetImpl()->checkControlConversionSlotsForCurrentSelection( *aContextMenu->GetPopupMenu( SID_FM_CHANGECONTROLTYPE ) );
}
else
aContextMenu.EnableItem( SID_FM_CHANGECONTROLTYPE, false );
aContextMenu->EnableItem( SID_FM_CHANGECONTROLTYPE, false );
// remove all disabled entries
aContextMenu.RemoveDisabledEntries(true, true);
aContextMenu->RemoveDisabledEntries(true, true);
// set OpenReadOnly
aContextMenu.CheckItem( SID_FM_OPEN_READONLY, pFormModel->GetOpenInDesignMode() );
aContextMenu.CheckItem( SID_FM_AUTOCONTROLFOCUS, pFormModel->GetAutoControlFocus() );
aContextMenu->CheckItem( SID_FM_OPEN_READONLY, pFormModel->GetOpenInDesignMode() );
aContextMenu->CheckItem( SID_FM_AUTOCONTROLFOCUS, pFormModel->GetAutoControlFocus() );
sal_uInt16 nSlotId = aContextMenu.Execute( this, ptWhere );
sal_uInt16 nSlotId = aContextMenu->Execute( this, ptWhere );
switch( nSlotId )
{
case SID_FM_NEW_FORM:
diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx
index b193f7f..3a5e08b 100644
--- a/svx/source/gallery2/galbrws1.cxx
+++ b/svx/source/gallery2/galbrws1.cxx
@@ -581,15 +581,15 @@ IMPL_LINK_NOARG_TYPED(GalleryBrowser1, ShowContextMenuHdl, void*, void)
if( !aExecVector.empty() )
{
PopupMenu aMenu( GAL_RES( RID_SVXMN_GALLERY1 ) );
ScopedVclPtrInstance<PopupMenu> aMenu( GAL_RES( RID_SVXMN_GALLERY1 ) );
aMenu.EnableItem( MN_ACTUALIZE, ::std::find( aExecVector.begin(), aExecVector.end(), MN_ACTUALIZE ) != aExecVector.end() );
aMenu.EnableItem( MN_RENAME, ::std::find( aExecVector.begin(), aExecVector.end(), MN_RENAME ) != aExecVector.end() );
aMenu.EnableItem( MN_DELETE, ::std::find( aExecVector.begin(), aExecVector.end(), MN_DELETE ) != aExecVector.end() );
aMenu.EnableItem( MN_ASSIGN_ID, ::std::find( aExecVector.begin(), aExecVector.end(), MN_ASSIGN_ID ) != aExecVector.end() );
aMenu.EnableItem( MN_PROPERTIES, ::std::find( aExecVector.begin(), aExecVector.end(), MN_PROPERTIES ) != aExecVector.end() );
aMenu.SetSelectHdl( LINK( this, GalleryBrowser1, PopupMenuHdl ) );
aMenu.RemoveDisabledEntries();
aMenu->EnableItem( MN_ACTUALIZE, ::std::find( aExecVector.begin(), aExecVector.end(), MN_ACTUALIZE ) != aExecVector.end() );
aMenu->EnableItem( MN_RENAME, ::std::find( aExecVector.begin(), aExecVector.end(), MN_RENAME ) != aExecVector.end() );
aMenu->EnableItem( MN_DELETE, ::std::find( aExecVector.begin(), aExecVector.end(), MN_DELETE ) != aExecVector.end() );
aMenu->EnableItem( MN_ASSIGN_ID, ::std::find( aExecVector.begin(), aExecVector.end(), MN_ASSIGN_ID ) != aExecVector.end() );
aMenu->EnableItem( MN_PROPERTIES, ::std::find( aExecVector.begin(), aExecVector.end(), MN_PROPERTIES ) != aExecVector.end() );
aMenu->SetSelectHdl( LINK( this, GalleryBrowser1, PopupMenuHdl ) );
aMenu->RemoveDisabledEntries();
const Rectangle aThemesRect( mpThemes->GetPosPixel(), mpThemes->GetOutputSizePixel() );
Point aSelPos( mpThemes->GetBoundingRectangle( mpThemes->GetSelectEntryPos() ).Center() );
@@ -597,7 +597,7 @@ IMPL_LINK_NOARG_TYPED(GalleryBrowser1, ShowContextMenuHdl, void*, void)
aSelPos.X() = std::max( std::min( aSelPos.X(), aThemesRect.Right() ), aThemesRect.Left() );
aSelPos.Y() = std::max( std::min( aSelPos.Y(), aThemesRect.Bottom() ), aThemesRect.Top() );
aMenu.Execute( this, aSelPos );
aMenu->Execute( this, aSelPos );
}
}
diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx
index 63166c0..0280380 100644
--- a/svx/source/gallery2/galbrws2.cxx
+++ b/svx/source/gallery2/galbrws2.cxx
@@ -112,8 +112,8 @@ private:
const GalleryTheme* mpTheme;
sal_uIntPtr mnObjectPos;
bool mbPreview;
PopupMenu maPopupMenu;
PopupMenu maBackgroundPopup;
ScopedVclPtr<PopupMenu> mpPopupMenu;
ScopedVclPtr<PopupMenu> mpBackgroundPopup;
VclPtr<GalleryBrowser2> mpBrowser;
typedef std::map< int, CommandInfo > CommandInfoMap;
@@ -146,8 +146,7 @@ GalleryThemePopup::GalleryThemePopup(
: mpTheme( pTheme )
, mnObjectPos( nObjectPos )
, mbPreview( bPreview )
, maPopupMenu( GAL_RES( RID_SVXMN_GALLERY2 ) )
, maBackgroundPopup()
, mpPopupMenu( VclPtr<PopupMenu>::Create(GAL_RES( RID_SVXMN_GALLERY2 )) )
, mpBrowser( pBrowser )
{
@@ -182,19 +181,19 @@ throw ( css::uno::RuntimeException, std::exception )
{
if ( !rEvent.IsEnabled )
{
maPopupMenu.EnableItem( MN_ADD, false );
mpPopupMenu->EnableItem( MN_ADD, false );
}
}
else if ( rURL == CMD_SID_GALLERY_BG_BRUSH )
{
maBackgroundPopup.Clear();
mpBackgroundPopup->Clear();
if ( rEvent.IsEnabled )
{
OUString sItem;
css::uno::Sequence< OUString > sItems;
if ( ( rEvent.State >>= sItem ) && sItem.getLength() )
{
maBackgroundPopup.InsertItem( 1, sItem );
mpBackgroundPopup->InsertItem( 1, sItem );
}
else if ( ( rEvent.State >>= sItems ) && sItems.getLength() )
{
@@ -202,7 +201,7 @@ throw ( css::uno::RuntimeException, std::exception )
const OUString *pEnd = pStr + sItems.getLength();
for ( sal_uInt16 nId = 1; pStr != pEnd; pStr++, nId++ )
{
maBackgroundPopup.InsertItem( nId, *pStr );
mpBackgroundPopup->InsertItem( nId, *pStr );
}
}
}
@@ -242,33 +241,33 @@ void GalleryThemePopup::ExecutePopup( vcl::Window *pWindow, const ::Point &aPos
const_cast< GalleryTheme* >( mpTheme )->GetURL( mnObjectPos, aURL );
const bool bValidURL = ( aURL.GetProtocol() != INetProtocol::NotValid );
maPopupMenu.EnableItem( MN_ADD, bValidURL && SGA_OBJ_SOUND != eObjKind );
mpPopupMenu->EnableItem( MN_ADD, bValidURL && SGA_OBJ_SOUND != eObjKind );
maPopupMenu.EnableItem( MN_PREVIEW, bValidURL );
mpPopupMenu->EnableItem( MN_PREVIEW, bValidURL );
maPopupMenu.CheckItem( MN_PREVIEW, mbPreview );
mpPopupMenu->CheckItem( MN_PREVIEW, mbPreview );
if( mpTheme->IsReadOnly() || !mpTheme->GetObjectCount() )
{
maPopupMenu.EnableItem( MN_DELETE, false );
maPopupMenu.EnableItem( MN_TITLE, false );
mpPopupMenu->EnableItem( MN_DELETE, false );
mpPopupMenu->EnableItem( MN_TITLE, false );
if( mpTheme->IsReadOnly() )
maPopupMenu.EnableItem( MN_PASTECLIPBOARD, false );
mpPopupMenu->EnableItem( MN_PASTECLIPBOARD, false );
if( !mpTheme->GetObjectCount() )
maPopupMenu.EnableItem( MN_COPYCLIPBOARD, false );
mpPopupMenu->EnableItem( MN_COPYCLIPBOARD, false );
}
else
{
maPopupMenu.EnableItem( MN_DELETE, !mbPreview );
maPopupMenu.EnableItem( MN_TITLE );
maPopupMenu.EnableItem( MN_COPYCLIPBOARD );
maPopupMenu.EnableItem( MN_PASTECLIPBOARD );
mpPopupMenu->EnableItem( MN_DELETE, !mbPreview );
mpPopupMenu->EnableItem( MN_TITLE );
mpPopupMenu->EnableItem( MN_COPYCLIPBOARD );
mpPopupMenu->EnableItem( MN_PASTECLIPBOARD );
}
maPopupMenu.EnableItem( MN_COPYCLIPBOARD, false );
maPopupMenu.EnableItem( MN_PASTECLIPBOARD, false );
mpPopupMenu->EnableItem( MN_COPYCLIPBOARD, false );
mpPopupMenu->EnableItem( MN_PASTECLIPBOARD, false );
// update status
css::uno::Reference< css::frame::XDispatchProvider> xDispatchProvider(
@@ -303,19 +302,19 @@ void GalleryThemePopup::ExecutePopup( vcl::Window *pWindow, const ::Point &aPos
{}
}
if( !maBackgroundPopup.GetItemCount() || ( eObjKind == SGA_OBJ_SVDRAW ) || ( eObjKind == SGA_OBJ_SOUND ) )
maPopupMenu.EnableItem( MN_BACKGROUND, false );
if( !mpBackgroundPopup->GetItemCount() || ( eObjKind == SGA_OBJ_SVDRAW ) || ( eObjKind == SGA_OBJ_SOUND ) )
mpPopupMenu->EnableItem( MN_BACKGROUND, false );
else
{
maPopupMenu.EnableItem( MN_BACKGROUND );
maPopupMenu.SetPopupMenu( MN_BACKGROUND, &maBackgroundPopup );
maBackgroundPopup.SetSelectHdl( LINK( this, GalleryThemePopup, BackgroundMenuSelectHdl ) );
mpPopupMenu->EnableItem( MN_BACKGROUND );
mpPopupMenu->SetPopupMenu( MN_BACKGROUND, mpBackgroundPopup );
mpBackgroundPopup->SetSelectHdl( LINK( this, GalleryThemePopup, BackgroundMenuSelectHdl ) );
}
maPopupMenu.RemoveDisabledEntries();
mpPopupMenu->RemoveDisabledEntries();
maPopupMenu.SetSelectHdl( LINK( this, GalleryThemePopup, MenuSelectHdl ) );
maPopupMenu.Execute( pWindow, aPos );
mpPopupMenu->SetSelectHdl( LINK( this, GalleryThemePopup, MenuSelectHdl ) );
mpPopupMenu->Execute( pWindow, aPos );
}
IMPL_LINK_TYPED( GalleryThemePopup, MenuSelectHdl, Menu*, pMenu, bool )
diff --git a/svx/source/inc/datanavi.hxx b/svx/source/inc/datanavi.hxx
index c4d8a0e..81b4ddff 100644
--- a/svx/source/inc/datanavi.hxx
+++ b/svx/source/inc/datanavi.hxx
@@ -119,7 +119,7 @@ namespace svxform
virtual ~DataTreeListBox();
virtual void dispose() override;
virtual std::unique_ptr<PopupMenu> CreateContextMenu() override;
virtual VclPtr<PopupMenu> CreateContextMenu() override;
virtual void ExecuteContextMenuAction( sal_uInt16 _nSelectedPopupEntry ) override;
virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
diff --git a/svx/source/inc/fmshimp.hxx b/svx/source/inc/fmshimp.hxx
index 96ae5ca..b89aa93 100644
--- a/svx/source/inc/fmshimp.hxx
+++ b/svx/source/inc/fmshimp.hxx
@@ -420,7 +420,7 @@ public:
SAL_DLLPRIVATE void startFiltering();
SAL_DLLPRIVATE void stopFiltering(bool bSave);
SAL_DLLPRIVATE static PopupMenu* GetConversionMenu();
SAL_DLLPRIVATE static VclPtr<PopupMenu> GetConversionMenu();
// ein Menue, das alle ControlConversion-Eintraege enthaelt
/// checks whether a given control conversion slot can be applied to the current selection
diff --git a/svx/source/mnuctrls/clipboardctl.cxx b/svx/source/mnuctrls/clipboardctl.cxx
index fe6a91c..35561f3 100644
--- a/svx/source/mnuctrls/clipboardctl.cxx
+++ b/svx/source/mnuctrls/clipboardctl.cxx
@@ -68,7 +68,7 @@ VclPtr<SfxPopupWindow> SvxClipBoardControl::CreatePopupWindow()
if (pPopup)
pPopup->Clear();
else
pPopup = new PopupMenu;
pPopup = VclPtr<PopupMenu>::Create();
sal_uInt16 nCount = pFmtItem->Count();
for (sal_uInt16 i = 0; i < nCount; ++i)
@@ -134,8 +134,7 @@ void SvxClipBoardControl::DelPopup()
{
if(pPopup)
{
delete pPopup;
pPopup = nullptr;
pPopup.disposeAndClear();
}
}
diff --git a/svx/source/mnuctrls/smarttagmenu.cxx b/svx/source/mnuctrls/smarttagmenu.cxx
index 16b0f02..0d8e9e7 100644
--- a/svx/source/mnuctrls/smarttagmenu.cxx
+++ b/svx/source/mnuctrls/smarttagmenu.cxx
@@ -50,7 +50,7 @@ private:
sal_uInt32 nActionID ) : m_xAction( xAction ), m_xSmartTagProperties( xSmartTagProperties ), m_nActionID( nActionID ) {}
};
std::vector< InvokeAction > m_aInvokeActions;
std::vector< std::unique_ptr< PopupMenu > > m_aSubMenus;
std::vector< VclPtr< PopupMenu > > m_aSubMenus;
std::unique_ptr< const SvxSmartTagItem > m_pSmartTagItem;
};
@@ -61,6 +61,8 @@ SmartTagMenuController::SmartTagMenuController( const css::uno::Reference< css::
SmartTagMenuController::~SmartTagMenuController()
{
for (auto& i : m_aSubMenus)
i.disposeAndClear();
}
void SmartTagMenuController::statusChanged( const css::frame::FeatureStateEvent& rEvent )
@@ -151,8 +153,9 @@ void SmartTagMenuController::FillMenu()
if ( 1 < rActionComponentsSequence.getLength() )
{
pVCLMenu->InsertItem( nMenuId, aSmartTagCaption );
pSubMenu = new PopupMenu;
m_aSubMenus.push_back( std::unique_ptr< PopupMenu >( pSubMenu ) );
VclPtrInstance<PopupMenu> pMenu;
pSubMenu = pMenu;
m_aSubMenus.push_back( pMenu );
pVCLMenu->SetPopupMenu( nMenuId++, pSubMenu );
}
pSubMenu->SetSelectHdl( LINK( this, SmartTagMenuController, MenuSelect ) );
diff --git a/svx/source/stbctrls/pszctrl.cxx b/svx/source/stbctrls/pszctrl.cxx
index 85eb356..a071173 100644
--- a/svx/source/stbctrls/pszctrl.cxx
+++ b/svx/source/stbctrls/pszctrl.cxx
@@ -317,10 +317,10 @@ void SvxPosSizeStatusBarControl::Command( const CommandEvent& rCEvt )
sal_uInt32 nSelect = pImpl->nFunctionSet;
if (!nSelect)
nSelect = ( 1 << PSZ_FUNC_NONE );
FunctionPopup_Impl aMenu( nSelect );
if ( aMenu.Execute( &GetStatusBar(), rCEvt.GetMousePosPixel() ) )
ScopedVclPtrInstance<FunctionPopup_Impl> aMenu( nSelect );
if ( aMenu->Execute( &GetStatusBar(), rCEvt.GetMousePosPixel() ) )
{
nSelect = aMenu.GetSelected();
nSelect = aMenu->GetSelected();
if (nSelect)
{
if (nSelect == (1 << PSZ_FUNC_NONE))
diff --git a/svx/source/stbctrls/selctrl.cxx b/svx/source/stbctrls/selctrl.cxx
index b68dd79..13579ed 100644
--- a/svx/source/stbctrls/selctrl.cxx
+++ b/svx/source/stbctrls/selctrl.cxx
@@ -98,20 +98,20 @@ void SvxSelectionModeControl::StateChanged( sal_uInt16, SfxItemState eState,
const SfxUInt16Item* pItem = static_cast<const SfxUInt16Item*>(pState);
mnState = pItem->GetValue();
SelectionTypePopup aPop( mnState );
GetStatusBar().SetQuickHelpText( GetId(), aPop.GetItemText( state_to_id( mnState ) ) );
ScopedVclPtrInstance<SelectionTypePopup> aPop( mnState );
GetStatusBar().SetQuickHelpText( GetId(), aPop->GetItemText( state_to_id( mnState ) ) );
}
}
bool SvxSelectionModeControl::MouseButtonDown( const MouseEvent& rEvt )
{
SelectionTypePopup aPop( mnState );
ScopedVclPtrInstance<SelectionTypePopup> aPop( mnState );
StatusBar& rStatusbar = GetStatusBar();
if ( aPop.Execute( &rStatusbar, rEvt.GetPosPixel() ) )
if ( aPop->Execute( &rStatusbar, rEvt.GetPosPixel() ) )
{
sal_uInt16 nNewState = id_to_state( aPop.GetCurItemId() );
sal_uInt16 nNewState = id_to_state( aPop->GetCurItemId() );
if ( nNewState != mnState )
{
mnState = nNewState;
diff --git a/svx/source/stbctrls/xmlsecctrl.cxx b/svx/source/stbctrls/xmlsecctrl.cxx
index 6abcfe5..3368815 100644
--- a/svx/source/stbctrls/xmlsecctrl.cxx
+++ b/svx/source/stbctrls/xmlsecctrl.cxx
@@ -118,8 +118,8 @@ void XmlSecStatusBarControl::Command( const CommandEvent& rCEvt )
{
if( rCEvt.GetCommand() == CommandEventId::ContextMenu )
{
PopupMenu aPopupMenu( ResId( RID_SVXMNU_XMLSECSTATBAR, DIALOG_MGR() ) );
if( aPopupMenu.Execute( &GetStatusBar(), rCEvt.GetMousePosPixel() ) )
ScopedVclPtrInstance<PopupMenu> aPopupMenu( ResId( RID_SVXMNU_XMLSECSTATBAR, DIALOG_MGR() ) );
if( aPopupMenu->Execute( &GetStatusBar(), rCEvt.GetMousePosPixel() ) )
{
css::uno::Any a;
SfxUInt16Item aState( GetSlotId(), 0 );
diff --git a/svx/source/stbctrls/zoomctrl.cxx b/svx/source/stbctrls/zoomctrl.cxx
index 88714eb..0ab191c 100644
--- a/svx/source/stbctrls/zoomctrl.cxx
+++ b/svx/source/stbctrls/zoomctrl.cxx
@@ -142,15 +142,15 @@ void SvxZoomStatusBarControl::Command( const CommandEvent& rCEvt )
{
if ( CommandEventId::ContextMenu == rCEvt.GetCommand() && bool(nValueSet) )
{
ZoomPopup_Impl aPop( nZoom, nValueSet );
ScopedVclPtrInstance<ZoomPopup_Impl> aPop( nZoom, nValueSet );
StatusBar& rStatusbar = GetStatusBar();
if ( aPop.Execute( &rStatusbar, rCEvt.GetMousePosPixel() ) && ( nZoom != aPop.GetZoom() || !nZoom ) )
if ( aPop->Execute( &rStatusbar, rCEvt.GetMousePosPixel() ) && ( nZoom != aPop->GetZoom() || !nZoom ) )
{
nZoom = aPop.GetZoom();
nZoom = aPop->GetZoom();
SvxZoomItem aZoom( SvxZoomType::PERCENT, nZoom, GetId() );
switch( aPop.GetCurId() )
switch( aPop->GetCurId() )
{
case ZOOM_OPTIMAL: aZoom.SetType( SvxZoomType::OPTIMAL ); break;
case ZOOM_PAGE_WIDTH: aZoom.SetType( SvxZoomType::PAGEWIDTH ); break;
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index b0c2596..3c8164c 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -27,6 +27,7 @@
#include <vcl/toolbox.hxx>
#include <vcl/bitmapaccess.hxx>
#include <vcl/menubtn.hxx>
#include <vcl/vclptr.hxx>
#include <svtools/valueset.hxx>
#include <svtools/ctrlbox.hxx>
#include <svl/style.hxx>
@@ -162,7 +163,7 @@ private:
OUString sDefaultStyle;
bool bInSpecialMode;
VclPtr<MenuButton> m_pButtons[MAX_STYLES_ENTRIES];
PopupMenu m_aMenu;
ScopedVclPtr<PopupMenu> m_pMenu;
void ReleaseFocus();
static Color TestColorsVisible(const Color &FontCol, const Color &BackCol);
@@ -353,9 +354,9 @@ SvxStyleBox_Impl::SvxStyleBox_Impl(vcl::Window* pParent,
, aClearFormatKey( rClearFormatKey )
, aMoreKey( rMoreKey )
, bInSpecialMode( bInSpec )
, m_aMenu ( SVX_RES( RID_SVX_STYLE_MENU ) )
, m_pMenu( VclPtr<PopupMenu>::Create(SVX_RES( RID_SVX_STYLE_MENU )) )
{
m_aMenu.SetSelectHdl( LINK( this, SvxStyleBox_Impl, MenuSelectHdl ) );
m_pMenu->SetSelectHdl( LINK( this, SvxStyleBox_Impl, MenuSelectHdl ) );
for(VclPtr<MenuButton> & rpButton : m_pButtons)
rpButton = nullptr;
aLogicalSize = PixelToLogic( GetSizePixel(), MAP_APPFONT );
@@ -785,7 +786,7 @@ void SvxStyleBox_Impl::SetupEntry(vcl::RenderContext& rRenderContext, vcl::Windo
{
m_pButtons[nId] = VclPtr<MenuButton>::Create(pParent, WB_FLATBUTTON | WB_NOPOINTERFOCUS);
m_pButtons[nId]->SetSizePixel(Size(BUTTON_WIDTH, rRect.GetHeight()));
m_pButtons[nId]->SetPopupMenu(&m_aMenu);
m_pButtons[nId]->SetPopupMenu(m_pMenu);
}
m_pButtons[nId]->SetPosPixel(Point(rRect.GetWidth() - BUTTON_WIDTH, rRect.getY()));
m_pButtons[nId]->Show();
@@ -3139,4 +3140,4 @@ void SvxCurrencyToolBoxControl::GetCurrencySymbols( std::vector<OUString>& rList
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx
index 7296528..9d556ed 100644
--- a/sw/inc/AnnotationWin.hxx
+++ b/sw/inc/AnnotationWin.hxx
@@ -63,8 +63,8 @@ class SwAnnotationWin : public sw::sidebarwindows::SwSidebarWin
sal_uInt32 CountFollowing();
SwFormatField* mpFormatField;
SwPostItField* mpField;
PopupMenu* mpButtonPopup;
SwPostItField* mpField;
VclPtr<PopupMenu> mpButtonPopup;
};
diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx
index 6a1f493..57182c1 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -573,12 +573,12 @@ DECLARE_ODFIMPORT_TEST(testSpellmenuRedline, "spellmenu-redline.odt")
SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
OUString aParaText;
uno::Reference<linguistic2::XSpellAlternatives> xAlt;
SwSpellPopup aPopup(pWrtShell, xAlt, aParaText);
ScopedVclPtrInstance<SwSpellPopup> aPopup(pWrtShell, xAlt, aParaText);
// Make sure that if we show the spellcheck popup menu (for the current
// document, which contains redlines), then the last two entries will be
// always 'go to next/previous change'.
CPPUNIT_ASSERT_EQUAL(sal_uInt16(FN_REDLINE_NEXT_CHANGE), aPopup.GetItemId(aPopup.GetItemCount() - 2));
CPPUNIT_ASSERT_EQUAL(sal_uInt16(FN_REDLINE_PREV_CHANGE), aPopup.GetItemId(aPopup.GetItemCount() - 1));
CPPUNIT_ASSERT_EQUAL(sal_uInt16(FN_REDLINE_NEXT_CHANGE), aPopup->GetItemId(aPopup->GetItemCount() - 2));
CPPUNIT_ASSERT_EQUAL(sal_uInt16(FN_REDLINE_PREV_CHANGE), aPopup->GetItemId(aPopup->GetItemCount() - 1));
}
DECLARE_ODFIMPORT_TEST(testAnnotationFormatting, "annotation-formatting.odt")
diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx
index 17bc48e..8d9bff9 100644
--- a/sw/source/uibase/docvw/AnnotationWin.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin.cxx
@@ -79,7 +79,7 @@ SwAnnotationWin::~SwAnnotationWin()
void SwAnnotationWin::dispose()
{
delete mpButtonPopup;
mpButtonPopup.disposeAndClear();
sw::sidebarwindows::SwSidebarWin::dispose();
}
@@ -220,7 +220,7 @@ sal_uInt32 SwAnnotationWin::CountFollowing()
VclPtr<MenuButton> SwAnnotationWin::CreateMenuButton()
{
mpButtonPopup = new PopupMenu(SW_RES(MN_ANNOTATION_BUTTON));
mpButtonPopup = VclPtr<PopupMenu>::Create(SW_RES(MN_ANNOTATION_BUTTON));
OUString aText = mpButtonPopup->GetItemText( FN_DELETE_NOTE_AUTHOR );
SwRewriter aRewriter;
aRewriter.AddRule(UndoArg1,GetAuthor());
diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx b/sw/source/uibase/docvw/HeaderFooterWin.cxx
index b2c33e0..b170140 100644
--- a/sw/source/uibase/docvw/HeaderFooterWin.cxx
+++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx
@@ -144,7 +144,7 @@ SwHeaderFooterWin::SwHeaderFooterWin( SwEditWin* pEditWin, const SwFrame *pFrame
m_pLine->SetZOrder(this, ZOrderFlags::Before);
// Create and set the PopupMenu
m_pPopupMenu = new PopupMenu(SW_RES(MN_HEADERFOOTER_BUTTON));
m_pPopupMenu = VclPtr<PopupMenu>::Create(SW_RES(MN_HEADERFOOTER_BUTTON));
// Rewrite the menu entries' text
if (m_bIsHeader)
@@ -171,7 +171,7 @@ SwHeaderFooterWin::~SwHeaderFooterWin( )
void SwHeaderFooterWin::dispose()
{
delete m_pPopupMenu;
m_pPopupMenu.disposeAndClear();
m_pLine.disposeAndClear();
SwFrameMenuButtonBase::dispose();
}
diff --git a/sw/source/uibase/docvw/PageBreakWin.cxx b/sw/source/uibase/docvw/PageBreakWin.cxx
index 2070b4c..c556a7b 100644
--- a/sw/source/uibase/docvw/PageBreakWin.cxx
+++ b/sw/source/uibase/docvw/PageBreakWin.cxx
@@ -108,7 +108,7 @@ SwPageBreakWin::SwPageBreakWin( SwEditWin* pEditWin, const SwFrame *pFrame ) :
m_pLine = VclPtr<SwBreakDashedLine>::Create( GetEditWin(), &SwViewOption::GetPageBreakColor, this );
// Create the popup menu
m_pPopupMenu = new PopupMenu( SW_RES( MN_PAGEBREAK_BUTTON ) );
m_pPopupMenu = VclPtr<PopupMenu>::Create( SW_RES( MN_PAGEBREAK_BUTTON ) );
m_pPopupMenu->SetDeactivateHdl( LINK( this, SwPageBreakWin, HideHandler ) );
SetPopupMenu( m_pPopupMenu );
@@ -127,8 +127,7 @@ void SwPageBreakWin::dispose()
m_aFadeTimer.Stop();
m_pLine.disposeAndClear();
delete m_pPopupMenu;
m_pPopupMenu = nullptr;
m_pPopupMenu.disposeAndClear();
delete m_pMousePt;
m_pMousePt = nullptr;
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index b184da1..fedbd8b 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -5325,20 +5325,20 @@ void SwEditWin::Command( const CommandEvent& rCEvt )
if ( m_rView.GetDocShell()->IsReadOnly() )
{
std::unique_ptr<SwReadOnlyPopup> pROPopup(new SwReadOnlyPopup( aDocPos, m_rView ));
ScopedVclPtrInstance<SwReadOnlyPopup> pROPopup( aDocPos, m_rView );
ui::ContextMenuExecuteEvent aEvent;
aEvent.SourceWindow = VCLUnoHelper::GetInterface( this );
aEvent.ExecutePosition.X = aPixPos.X();
aEvent.ExecutePosition.Y = aPixPos.Y();
Menu* pMenu = nullptr;
VclPtr<Menu> pMenu;
OUString sMenuName("private:resource/ReadonlyContextMenu");
if( GetView().TryContextMenuInterception( *pROPopup, sMenuName, pMenu, aEvent ) )
{
if ( pMenu )
{
sal_uInt16 nExecId = static_cast<PopupMenu*>(pMenu)->Execute(this, aPixPos);
if( !::ExecuteMenuCommand( *static_cast<PopupMenu*>(pMenu), *m_rView.GetViewFrame(), nExecId ))
sal_uInt16 nExecId = static_cast<PopupMenu*>(pMenu.get())->Execute(this, aPixPos);
if( !::ExecuteMenuCommand( *static_cast<PopupMenu*>(pMenu.get()), *m_rView.GetViewFrame(), nExecId ))
pROPopup->Execute(this, nExecId);
}
else
diff --git a/sw/source/uibase/docvw/romenu.cxx b/sw/source/uibase/docvw/romenu.cxx
index 3aef486..d8ebac8 100644
--- a/sw/source/uibase/docvw/romenu.cxx
+++ b/sw/source/uibase/docvw/romenu.cxx
@@ -53,8 +53,14 @@ using namespace ::sfx2;
SwReadOnlyPopup::~SwReadOnlyPopup()
{
disposeOnce();
}
void SwReadOnlyPopup::dispose()
{
delete pImageMap;
delete pTargetURL;
PopupMenu::dispose();
}
void SwReadOnlyPopup::Check( sal_uInt16 nMID, sal_uInt16 nSID, SfxDispatcher &rDis )
diff --git a/sw/source/uibase/docvw/romenu.hxx b/sw/source/uibase/docvw/romenu.hxx
index 07241c8..985cb67 100644
--- a/sw/source/uibase/docvw/romenu.hxx
+++ b/sw/source/uibase/docvw/romenu.hxx
@@ -52,6 +52,7 @@ class SwReadOnlyPopup : public PopupMenu
public:
SwReadOnlyPopup( const Point &rDPos, SwView &rV );
virtual ~SwReadOnlyPopup();
virtual void dispose() override;
void Execute( vcl::Window* pWin, const Point &rPPos );
void Execute( vcl::Window* pWin, sal_uInt16 nId );
diff --git a/sw/source/uibase/inc/HeaderFooterWin.hxx b/sw/source/uibase/inc/HeaderFooterWin.hxx
index ec0980b..d98a032 100644
--- a/sw/source/uibase/inc/HeaderFooterWin.hxx
+++ b/sw/source/uibase/inc/HeaderFooterWin.hxx
@@ -22,7 +22,7 @@ class SwHeaderFooterWin : public SwFrameMenuButtonBase
{
OUString m_sLabel;
bool m_bIsHeader;
PopupMenu* m_pPopupMenu;
VclPtr<PopupMenu> m_pPopupMenu;
VclPtr<vcl::Window> m_pLine;
bool m_bIsAppearing;
int m_nFadeRate;
diff --git a/sw/source/uibase/inc/PageBreakWin.hxx b/sw/source/uibase/inc/PageBreakWin.hxx
index 6ee987f..c5bbfc519 100644
--- a/sw/source/uibase/inc/PageBreakWin.hxx
+++ b/sw/source/uibase/inc/PageBreakWin.hxx
@@ -22,7 +22,7 @@ class SwPageFrame;
*/
class SwPageBreakWin : public SwFrameMenuButtonBase
{
PopupMenu* m_pPopupMenu;
VclPtr<PopupMenu> m_pPopupMenu;
VclPtr<vcl::Window> m_pLine;
bool m_bIsAppearing;
int m_nFadeRate;
diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx
index e496137b..27b5469 100644
--- a/sw/source/uibase/inc/conttree.hxx
+++ b/sw/source/uibase/inc/conttree.hxx
@@ -152,7 +152,7 @@ protected:
void GotoContent(SwContent* pCnt);
static void SetInDrag(bool bSet) {bIsInDrag = bSet;}
virtual std::unique_ptr<PopupMenu> CreateContextMenu() override;
virtual VclPtr<PopupMenu> CreateContextMenu() override;
virtual void ExecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry ) override;
public:
@@ -326,7 +326,7 @@ protected:
static void SetShowShell(const SfxObjectShell*pSet) {pShowShell = pSet;}
DECL_STATIC_LINK_TYPED(SwGlobalTree, ShowFrameHdl, void*, void);
virtual std::unique_ptr<PopupMenu> CreateContextMenu() override;
virtual VclPtr<PopupMenu> CreateContextMenu() override;
virtual void ExecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry ) override;
public:
diff --git a/sw/source/uibase/inc/inputwin.hxx b/sw/source/uibase/inc/inputwin.hxx
index 78531cb..666a6ae 100644
--- a/sw/source/uibase/inc/inputwin.hxx
+++ b/sw/source/uibase/inc/inputwin.hxx
@@ -49,8 +49,8 @@ friend class InputEdit;
VclPtr<Edit> aPos;
VclPtr<InputEdit> aEdit;
PopupMenu aPopMenu;
SwFieldMgr* pMgr;
ScopedVclPtrInstance<PopupMenu> aPopMenu;
SwFieldMgr* pMgr;
SwWrtShell* pWrtShell;
SwView* pView;
OUString aAktTableName, sOldFormula;
diff --git a/sw/source/uibase/inc/redlndlg.hxx b/sw/source/uibase/inc/redlndlg.hxx
index ccf1522..c661ae2 100644
--- a/sw/source/uibase/inc/redlndlg.hxx
+++ b/sw/source/uibase/inc/redlndlg.hxx
@@ -66,7 +66,7 @@ class SW_DLLPUBLIC SwRedlineAcceptDlg
SwRedlineDataChildArr m_RedlineChildren;
SwRedlineDataParentSortArr m_aUsedSeqNo;
VclPtr<SvxAcceptChgCtr> m_aTabPagesCTRL;
PopupMenu m_aPopup;
ScopedVclPtrInstance<PopupMenu> m_aPopup;
Timer m_aDeselectTimer;
Timer m_aSelectTimer;
OUString m_sInserted;
diff --git a/sw/source/uibase/inc/workctrl.hxx b/sw/source/uibase/inc/workctrl.hxx
index 20b2314..a90c936 100644
--- a/sw/source/uibase/inc/workctrl.hxx
+++ b/sw/source/uibase/inc/workctrl.hxx
@@ -54,7 +54,7 @@ class SwView;
class SwTbxAutoTextCtrl : public SfxToolBoxControl
{
PopupMenu* pPopup;
VclPtr<PopupMenu> pPopup;
void DelPopup();
public:
diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx
index 48e3423..eca8ac5 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -1041,19 +1041,19 @@ IMPL_LINK_NOARG_TYPED(SwRedlineAcceptDlg, CommandHdl, SvSimpleTable*, void)
}
}
m_aPopup.EnableItem( MN_EDIT_COMMENT, pEntry && pRed &&
m_aPopup->EnableItem( MN_EDIT_COMMENT, pEntry && pRed &&
!m_pTable->GetParent(pEntry) &&
!m_pTable->NextSelected(pEntry)
//JP 27.9.2001: make no sense if we handle readonly sections
// && pRed->HasReadonlySel()
);
m_aPopup.EnableItem( MN_SUB_SORT, m_pTable->First() != nullptr );
m_aPopup->EnableItem( MN_SUB_SORT, m_pTable->First() != nullptr );
sal_uInt16 nColumn = m_pTable->GetSortedCol();
if (nColumn == 0xffff)
nColumn = 4;
PopupMenu *pSubMenu = m_aPopup.GetPopupMenu(MN_SUB_SORT);
PopupMenu *pSubMenu = m_aPopup->GetPopupMenu(MN_SUB_SORT);
if (pSubMenu)
{
for (sal_uInt16 i = MN_SORT_ACTION; i < MN_SORT_ACTION + 5; i++)
@@ -1062,7 +1062,7 @@ IMPL_LINK_NOARG_TYPED(SwRedlineAcceptDlg, CommandHdl, SvSimpleTable*, void)
pSubMenu->CheckItem(nColumn + MN_SORT_ACTION);
}
sal_uInt16 nRet = m_aPopup.Execute(m_pTable, aCEvt.GetMousePosPixel());
sal_uInt16 nRet = m_aPopup->Execute(m_pTable, aCEvt.GetMousePosPixel());
switch( nRet )
{
diff --git a/sw/source/uibase/ribbar/inputwin.cxx b/sw/source/uibase/ribbar/inputwin.cxx
index 90df573..84acdb1 100644
--- a/sw/source/uibase/ribbar/inputwin.cxx
+++ b/sw/source/uibase/ribbar/inputwin.cxx
@@ -124,7 +124,7 @@ SwInputWindow::SwInputWindow(vcl::Window* pParent, SfxDispatcher* pDispatcher)
aPos->SetPosSizePixel( aPosPos, aPosSize );
aEdit->SetPosSizePixel( aEditPos, aEditSize );
aPopMenu.SetSelectHdl(LINK( this, SwInputWindow, MenuHdl ));
aPopMenu->SetSelectHdl(LINK( this, SwInputWindow, MenuHdl ));
}
SwInputWindow::~SwInputWindow()
@@ -350,7 +350,7 @@ IMPL_LINK_NOARG_TYPED(SwInputWindow, DropdownClickHdl, ToolBox *, void)
{
case FN_FORMULA_CALC :
{
aPopMenu.Execute( this, GetItemRect( FN_FORMULA_CALC ), PopupMenuFlags::NoMouseUpClose );
aPopMenu->Execute( this, GetItemRect( FN_FORMULA_CALC ), PopupMenuFlags::NoMouseUpClose );
break;
default:
break;
diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx
index 710b5c7..ad20752 100644
--- a/sw/source/uibase/ribbar/workctrl.cxx
+++ b/sw/source/uibase/ribbar/workctrl.cxx
@@ -86,7 +86,7 @@ VclPtr<SfxPopupWindow> SwTbxAutoTextCtrl::CreatePopupWindow()
{
Link<Menu*,bool> aLnk = LINK(this, SwTbxAutoTextCtrl, PopupHdl);
pPopup = new PopupMenu;
pPopup = VclPtr<PopupMenu>::Create();
SwGlossaryList* pGlossaryList = ::GetGlossaryList();
const size_t nGroupCount = pGlossaryList->GetGroupCount();
for(size_t i = 1; i <= nGroupCount; ++i)
@@ -98,7 +98,7 @@ VclPtr<SfxPopupWindow> SwTbxAutoTextCtrl::CreatePopupWindow()
sal_uInt16 nIndex = static_cast<sal_uInt16>(100*i);
// but insert without extension
pPopup->InsertItem( i, sTitle);
PopupMenu* pSub = new PopupMenu;
PopupMenu* pSub = VclPtr<PopupMenu>::Create();
pSub->SetSelectHdl(aLnk);
pPopup->SetPopupMenu(i, pSub);
for(sal_uInt16 j = 0; j < nBlockCount; j++)
@@ -164,11 +164,10 @@ void SwTbxAutoTextCtrl::DelPopup()
{
for( sal_uInt16 i = 0; i < pPopup->GetItemCount(); i ++ )
{
PopupMenu* pSubPopup = pPopup->GetPopupMenu(pPopup->GetItemId(i));
delete pSubPopup;
VclPtr<PopupMenu> pSubPopup = pPopup->GetPopupMenu(pPopup->GetItemId(i));
pSubPopup.disposeAndClear(); // NoelG: dodgy, this leaves a dangling pointer
}
delete pPopup;
pPopup = nullptr;
pPopup.disposeAndClear();
}
}
diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx
index 905ceca..094377c 100644
--- a/sw/source/uibase/uiview/viewling.cxx
+++ b/sw/source/uibase/uiview/viewling.cxx
@@ -703,22 +703,22 @@ bool SwView::ExecSpellPopup(const Point& rPt)
bRet = true;
m_pWrtShell->SttSelect();
std::unique_ptr< SwSpellPopup > pPopup;
ScopedVclPtr< SwSpellPopup > pPopup;
if (bUseGrammarContext)
{
sal_Int32 nPos = aPoint.nContent.GetIndex();
(void) nPos;
pPopup.reset(new SwSpellPopup( m_pWrtShell, aGrammarCheckRes, nErrorInResult, aSuggestions, aParaText ));
pPopup = VclPtr<SwSpellPopup>::Create( m_pWrtShell, aGrammarCheckRes, nErrorInResult, aSuggestions, aParaText ).get();
}
else
pPopup.reset(new SwSpellPopup( m_pWrtShell, xAlt, aParaText ));
pPopup = VclPtr<SwSpellPopup>::Create( m_pWrtShell, xAlt, aParaText ).get();
ui::ContextMenuExecuteEvent aEvent;
const Point aPixPos = GetEditWin().LogicToPixel( rPt );
aEvent.SourceWindow = VCLUnoHelper::GetInterface( m_pEditWin );
aEvent.ExecutePosition.X = aPixPos.X();
aEvent.ExecutePosition.Y = aPixPos.Y();
Menu* pMenu = nullptr;
VclPtr<Menu> pMenu;
OUString sMenuName = bUseGrammarContext ?
OUString("private:resource/GrammarContextMenu") : OUString("private:resource/SpellContextMenu");
@@ -729,8 +729,8 @@ bool SwView::ExecSpellPopup(const Point& rPt)
//! 'custom made' menu... *sigh* (code copied from sfx2 and framework)
if ( pMenu )
{
const sal_uInt16 nId = static_cast<PopupMenu*>(pMenu)->Execute(m_pEditWin, aPixPos);
OUString aCommand = static_cast<PopupMenu*>(pMenu)->GetItemCommand(nId);
const sal_uInt16 nId = static_cast<PopupMenu*>(pMenu.get())->Execute(m_pEditWin, aPixPos);
OUString aCommand = static_cast<PopupMenu*>(pMenu.get())->GetItemCommand(nId);
if (aCommand.isEmpty() )
{
if(!ExecuteMenuCommand(dynamic_cast<PopupMenu&>(*pMenu), *GetViewFrame(), nId ))
diff --git a/sw/source/uibase/utlui/bookctrl.cxx b/sw/source/uibase/utlui/bookctrl.cxx
index 408181c..41f0641 100644
--- a/sw/source/uibase/utlui/bookctrl.cxx
+++ b/sw/source/uibase/utlui/bookctrl.cxx
@@ -101,7 +101,7 @@ void SwBookmarkControl::Command( const CommandEvent& rCEvt )
if ( rCEvt.GetCommand() == CommandEventId::ContextMenu &&
!GetStatusBar().GetItemText( GetId() ).isEmpty() )
{
BookmarkPopup_Impl aPop;
ScopedVclPtrInstance<BookmarkPopup_Impl> aPop;
SwWrtShell* pWrtShell = ::GetActiveWrtShell();
if( pWrtShell && pWrtShell->getIDocumentMarkAccess()->getAllMarksCount() > 0 )
{
@@ -115,13 +115,13 @@ void SwBookmarkControl::Command( const CommandEvent& rCEvt )
{
if(IDocumentMarkAccess::MarkType::BOOKMARK == IDocumentMarkAccess::GetType(**ppBookmark))
{
aPop.InsertItem( nPopupId, ppBookmark->get()->GetName() );
aPop->InsertItem( nPopupId, ppBookmark->get()->GetName() );
aBookmarkIdx[nPopupId] = static_cast<sal_uInt16>(ppBookmark - ppBookmarkStart);
nPopupId++;
}
}
aPop.Execute( &GetStatusBar(), rCEvt.GetMousePosPixel());
sal_uInt16 nCurrId = aPop.GetCurId();
aPop->Execute( &GetStatusBar(), rCEvt.GetMousePosPixel());
sal_uInt16 nCurrId = aPop->GetCurId();
if( nCurrId != USHRT_MAX)
{
SfxUInt16Item aBookmark( FN_STAT_BOOKMARK, aBookmarkIdx[nCurrId] );
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 85a65f4..fa3c723 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -1096,13 +1096,13 @@ sal_Int8 SwContentTree::ExecuteDrop( const ExecuteDropEvent& rEvt )
// Handler for Dragging and ContextMenu
std::unique_ptr<PopupMenu> SwContentTree::CreateContextMenu()
VclPtr<PopupMenu> SwContentTree::CreateContextMenu()
{
std::unique_ptr<PopupMenu> pPop(new PopupMenu);
PopupMenu* pSubPop1 = new PopupMenu;
PopupMenu* pSubPop2 = new PopupMenu;
PopupMenu* pSubPop3 = new PopupMenu;
PopupMenu* pSubPop4 = new PopupMenu; // Edit
VclPtrInstance<PopupMenu> pPop;
VclPtrInstance<PopupMenu> pSubPop1;
VclPtrInstance<PopupMenu> pSubPop2;
VclPtrInstance<PopupMenu> pSubPop3;
VclPtrInstance<PopupMenu> pSubPop4; // Edit
for(int i = 1; i <= MAXLEVEL; ++i)
{
diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx
index 9aaee86..e8e4799 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -330,16 +330,16 @@ sal_Int8 SwGlobalTree::AcceptDrop( const AcceptDropEvent& rEvt )
return nRet;
}
std::unique_ptr<PopupMenu> SwGlobalTree::CreateContextMenu()
VclPtr<PopupMenu> SwGlobalTree::CreateContextMenu()
{
std::unique_ptr<PopupMenu> pPop;
VclPtr<PopupMenu> pPop;
if(pActiveShell &&
!pActiveShell->GetView().GetDocShell()->IsReadOnly())
{
const sal_uInt16 nEnableFlags = GetEnableFlags();
pPop.reset(new PopupMenu);
PopupMenu* pSubPop1 = new PopupMenu;
PopupMenu* pSubPop2 = new PopupMenu;
pPop = VclPtr<PopupMenu>::Create();
VclPtrInstance<PopupMenu> pSubPop1;
VclPtrInstance<PopupMenu> pSubPop2;
for (sal_uInt16 i = CTX_UPDATE_SEL; i <= CTX_UPDATE_ALL; i++)
{
@@ -394,7 +394,7 @@ void SwGlobalTree::TbxMenuHdl(sal_uInt16 nTbxId, ToolBox* pBox)
const sal_uInt16 nEnableFlags = GetEnableFlags();
if(FN_GLOBAL_OPEN == nTbxId)
{
std::unique_ptr<PopupMenu> pMenu(new PopupMenu);
ScopedVclPtrInstance<PopupMenu> pMenu;
for (sal_uInt16 i = CTX_INSERT_ANY_INDEX; i <= CTX_INSERT_TEXT; i++)
{
pMenu->InsertItem( i, aContextStrings[STR_INDEX - STR_GLOBAL_CONTEXT_FIRST - CTX_INSERT_ANY_INDEX + i] );
@@ -406,13 +406,13 @@ void SwGlobalTree::TbxMenuHdl(sal_uInt16 nTbxId, ToolBox* pBox)
pMenu->EnableItem(CTX_INSERT_NEW_FILE, 0 != (nEnableFlags & ENABLE_INSERT_FILE));
pMenu->SetSelectHdl(LINK(this, SwGlobalTree, PopupHdl));
pMenu->Execute(pBox, pBox->GetItemRect(nTbxId));
pMenu.reset();
pMenu.disposeAndClear();
pBox->EndSelection();
pBox->Invalidate();
}
else if(FN_GLOBAL_UPDATE == nTbxId)
{
std::unique_ptr<PopupMenu> pMenu(new PopupMenu);
ScopedVclPtrInstance<PopupMenu> pMenu;
for (sal_uInt16 i = CTX_UPDATE_SEL; i <= CTX_UPDATE_ALL; i++)
{
pMenu->InsertItem( i, aContextStrings[STR_UPDATE_SEL - STR_GLOBAL_CONTEXT_FIRST - CTX_UPDATE_SEL+ i] );
@@ -421,7 +421,7 @@ void SwGlobalTree::TbxMenuHdl(sal_uInt16 nTbxId, ToolBox* pBox)
pMenu->EnableItem(CTX_UPDATE_SEL, 0 != (nEnableFlags & ENABLE_UPDATE_SEL));
pMenu->SetSelectHdl(LINK(this, SwGlobalTree, PopupHdl));
pMenu->Execute(pBox, pBox->GetItemRect(nTbxId));
pMenu.reset();
pMenu.disposeAndClear();
pBox->EndSelection();
pBox->Invalidate();
}
diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx
index f87e656..2d66ac1 100644
--- a/sw/source/uibase/utlui/navipi.cxx
+++ b/sw/source/uibase/utlui/navipi.cxx
@@ -380,7 +380,7 @@ IMPL_LINK_TYPED( SwNavigationPI, ToolBoxDropdownClickHdl, ToolBox*, pBox, void )
HID_NAVI_DRAG_LINK,
HID_NAVI_DRAG_COPY,
};
std::unique_ptr<PopupMenu> pMenu(new PopupMenu);
ScopedVclPtrInstance<PopupMenu> pMenu;
for (sal_uInt16 i = 0; i <= static_cast<sal_uInt16>(RegionMode::EMBEDDED); i++)
{
pMenu->InsertItem( i + 1, m_aContextArr[i] );
@@ -394,13 +394,13 @@ IMPL_LINK_TYPED( SwNavigationPI, ToolBoxDropdownClickHdl, ToolBox*, pBox, void )
PopupMenuFlags::ExecuteDown );
pBox->SetItemDown( nCurrItemId, false );
pBox->EndSelection();
pMenu.reset();
pMenu.disposeAndClear();
pBox->Invalidate();
}
break;
case FN_OUTLINE_LEVEL:
{
std::unique_ptr<PopupMenu> pMenu(new PopupMenu);
ScopedVclPtrInstance<PopupMenu> pMenu;
for (sal_uInt16 i = 101; i <= 100 + MAXLEVEL; i++)
{
pMenu->InsertItem( i, OUString::number(i - 100) );
@@ -413,7 +413,7 @@ IMPL_LINK_TYPED( SwNavigationPI, ToolBoxDropdownClickHdl, ToolBox*, pBox, void )
pBox->GetItemRect(FN_OUTLINE_LEVEL),
PopupMenuFlags::ExecuteDown );
pBox->SetItemDown( nCurrItemId, false );
pMenu.reset();
pMenu.disposeAndClear();
pBox->EndSelection();
pBox->Invalidate();
}
diff --git a/sw/source/uibase/utlui/tmplctrl.cxx b/sw/source/uibase/utlui/tmplctrl.cxx
index 6790276..f5f2e56 100644
--- a/sw/source/uibase/utlui/tmplctrl.cxx
+++ b/sw/source/uibase/utlui/tmplctrl.cxx
@@ -93,7 +93,7 @@ void SwTemplateControl::Command( const CommandEvent& rCEvt )
if ( rCEvt.GetCommand() == CommandEventId::ContextMenu &&
!GetStatusBar().GetItemText( GetId() ).isEmpty() )
{
SwTemplatePopup_Impl aPop;
ScopedVclPtrInstance<SwTemplatePopup_Impl> aPop;
{
SwView* pView = ::GetActiveView();
SwWrtShell* pWrtShell;
@@ -111,12 +111,12 @@ void SwTemplateControl::Command( const CommandEvent& rCEvt )
SfxStyleSheetBase* pStyle = pPool->First();
while( pStyle )
{
aPop.InsertItem( ++nCount, pStyle->GetName() );
aPop->InsertItem( ++nCount, pStyle->GetName() );
pStyle = pPool->Next();
}
aPop.Execute( &GetStatusBar(), rCEvt.GetMousePosPixel());
const sal_uInt16 nCurrId = aPop.GetCurId();
aPop->Execute( &GetStatusBar(), rCEvt.GetMousePosPixel());
const sal_uInt16 nCurrId = aPop->GetCurId();
if( nCurrId != USHRT_MAX)
{
// looks a bit awkward, but another way is not possible
diff --git a/sw/source/uibase/utlui/unotools.cxx b/sw/source/uibase/utlui/unotools.cxx
index 5a43806..a4346b6 100644
--- a/sw/source/uibase/utlui/unotools.cxx
+++ b/sw/source/uibase/utlui/unotools.cxx
@@ -448,18 +448,18 @@ static const sal_Int16 nZoomValues[] =
void SwOneExampleFrame::CreatePopup(const Point& rPt)
{
PopupMenu aPop;
PopupMenu aSubPop1;
ScopedVclPtrInstance<PopupMenu> aPop;
ScopedVclPtrInstance<PopupMenu> aSubPop1;
ResStringArray& rArr = aMenuRes.GetMenuArray();
aPop.InsertItem(ITEM_UP, rArr.GetString(rArr.FindIndex(ST_MENU_UP )));
aPop.InsertItem(ITEM_DOWN, rArr.GetString(rArr.FindIndex(ST_MENU_DOWN )));
aPop->InsertItem(ITEM_UP, rArr.GetString(rArr.FindIndex(ST_MENU_UP )));
aPop->InsertItem(ITEM_DOWN, rArr.GetString(rArr.FindIndex(ST_MENU_DOWN )));
Link<Menu*,bool> aSelLk = LINK(this, SwOneExampleFrame, PopupHdl );
aPop.SetSelectHdl(aSelLk);
aPop->SetSelectHdl(aSelLk);
if(EX_SHOW_ONLINE_LAYOUT == nStyleFlags)
{
aPop.InsertItem(ITEM_ZOOM, rArr.GetString(rArr.FindIndex(ST_MENU_ZOOM )));
aPop->InsertItem(ITEM_ZOOM, rArr.GetString(rArr.FindIndex(ST_MENU_ZOOM )));
uno::Reference< view::XViewSettingsSupplier > xSettings(_xController, uno::UNO_QUERY);
uno::Reference< beans::XPropertySet > xViewProps = xSettings->getViewSettings();
@@ -472,15 +472,14 @@ void SwOneExampleFrame::CreatePopup(const Point& rPt)
{
OUString sTemp = unicode::formatPercent(nZoomValues[i],
Application::GetSettings().GetUILanguageTag());
aSubPop1.InsertItem( ITEM_ZOOM + i + 1, sTemp);
aSubPop1->InsertItem( ITEM_ZOOM + i + 1, sTemp);
if(nZoom == nZoomValues[i])
aSubPop1.CheckItem(ITEM_ZOOM + i + 1);
aSubPop1->CheckItem(ITEM_ZOOM + i + 1);
}
aPop.SetPopupMenu( ITEM_ZOOM, &aSubPop1 );
aSubPop1.SetSelectHdl(aSelLk);
aPop->SetPopupMenu( ITEM_ZOOM, aSubPop1.get() );
aSubPop1->SetSelectHdl(aSelLk);
}
aPop.Execute( aTopWindow.get(), rPt );
aPop->Execute( aTopWindow.get(), rPt );
}
IMPL_LINK_TYPED(SwOneExampleFrame, PopupHdl, Menu*, pMenu, bool )
diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx
index 8c2598e..827e0df 100644
--- a/toolkit/source/awt/vclxmenu.cxx
+++ b/toolkit/source/awt/vclxmenu.cxx
@@ -56,7 +56,7 @@ VCLXMenu::~VCLXMenu()
if ( mpMenu )
{
mpMenu->RemoveEventListener( LINK( this, VCLXMenu, MenuEventListener ) );
delete mpMenu;
mpMenu.disposeAndClear();
}
}
@@ -70,9 +70,9 @@ void VCLXMenu::ImplCreateMenu( bool bPopup )
DBG_ASSERT( !mpMenu, "CreateMenu: Menu exists!" );
if ( bPopup )
mpMenu = new PopupMenu;
mpMenu = VclPtr<PopupMenu>::Create();
else
mpMenu = new MenuBar;
mpMenu = VclPtr<MenuBar>::Create();
mpMenu->AddEventListener( LINK( this, VCLXMenu, MenuEventListener ) );
}
@@ -526,7 +526,7 @@ throw(css::uno::RuntimeException, std::exception)
sal_Int16 nRet = 0;
if ( mpMenu && IsPopupMenu() )
{
nRet = static_cast<PopupMenu*>(mpMenu)->Execute( VCLUnoHelper::GetWindow( rxWindowPeer ),
nRet = static_cast<PopupMenu*>(mpMenu.get())->Execute( VCLUnoHelper::GetWindow( rxWindowPeer ),
VCLRectangle( rPos ),
static_cast<PopupMenuFlags>(nFlags) | PopupMenuFlags::NoMouseUpClose );
}
@@ -726,7 +726,7 @@ throw (css::uno::RuntimeException, std::exception)
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if ( mpMenu && IsPopupMenu() )
static_cast<PopupMenu*>( mpMenu )->EndExecute();
static_cast<PopupMenu*>( mpMenu.get() )->EndExecute();
}
diff --git a/vcl/inc/salmenu.hxx b/vcl/inc/salmenu.hxx
index a792356..ed7296a 100644
--- a/vcl/inc/salmenu.hxx
+++ b/vcl/inc/salmenu.hxx
@@ -32,7 +32,7 @@ struct SalItemParams
sal_uInt16 nId; // item Id
MenuItemType eType; // MenuItem-Type
MenuItemBits nBits; // MenuItem-Bits
Menu* pMenu; // Pointer to Menu
VclPtr<Menu> pMenu; // Pointer to Menu
OUString aText; // Menu-Text
Image aImage; // Image
};
diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index c1cb3e1..67d422a 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -116,7 +116,7 @@ struct ImplSVAppData
OUString* mpDisplayName; // Application Display Name
OUString* mpToolkitName; // Toolkit Name
Help* mpHelp; // Application help
PopupMenu* mpActivePopupMenu; // Actives Popup-Menu (in Execute)
VclPtr<PopupMenu> mpActivePopupMenu; // Actives Popup-Menu (in Execute)
ImplIdleMgr* mpIdleMgr; // Idle-Manager
VclPtr<ImplWheelWindow> mpWheelWindow; // WheelWindow
ImplHotKey* mpFirstHotKey; // HotKey-Verwaltung
diff --git a/vcl/inc/toolbox.h b/vcl/inc/toolbox.h
index 9104f49..c3bf697 100644
--- a/vcl/inc/toolbox.h
+++ b/vcl/inc/toolbox.h
@@ -132,7 +132,7 @@ struct ImplToolBoxPrivateData
ToolBoxButtonSize meButtonSize;
// the optional custom menu
PopupMenu* mpMenu;
VclPtr<PopupMenu> mpMenu;
ToolBoxMenuType maMenuType;
ImplSVEvent * mnEventId;
diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx
index 74f03dd..7cd93dd 100644
--- a/vcl/inc/unx/gtk/gtksalmenu.hxx
+++ b/vcl/inc/unx/gtk/gtksalmenu.hxx
@@ -51,7 +51,7 @@ private:
GtkWidget* mpMenuBarContainerWidget;
GtkWidget* mpMenuBarWidget;
GtkWidget* mpCloseButton;
Menu* mpVCLMenu;
VclPtr<Menu> mpVCLMenu;
GtkSalMenu* mpParentSalMenu;
GtkSalFrame* mpFrame;
diff --git a/vcl/source/app/vclevent.cxx b/vcl/source/app/vclevent.cxx
index 4786fd6..a7ec949 100644
--- a/vcl/source/app/vclevent.cxx
+++ b/vcl/source/app/vclevent.cxx
@@ -19,6 +19,7 @@
#include <vcl/vclevent.hxx>
#include <vcl/window.hxx>
#include <vcl/menu.hxx>
#include "svdata.hxx"
#include "vcleventlisteners.hxx"
@@ -90,4 +91,17 @@ VclWindowEvent::VclWindowEvent( vcl::Window* pWin, sal_uLong n, void* pDat ) : V
VclWindowEvent::~VclWindowEvent() {}
VclMenuEvent::VclMenuEvent( Menu* pM, sal_uLong n, sal_uInt16 nPos )
: VclSimpleEvent(n), pMenu(pM), mnPos(nPos)
{}
VclMenuEvent::~VclMenuEvent()
{}
Menu* VclMenuEvent::GetMenu() const
{
return pMenu;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index dcadb57..f1bb069 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -1976,7 +1976,7 @@ void Edit::Command( const CommandEvent& rCEvt )
{
if ( rCEvt.GetCommand() == CommandEventId::ContextMenu )
{
PopupMenu* pPopup = Edit::CreatePopupMenu();
VclPtr<PopupMenu> pPopup = Edit::CreatePopupMenu();
if ( !maSelection.Len() )
{
@@ -2036,7 +2036,7 @@ void Edit::Command( const CommandEvent& rCEvt )
aPos = Point( aSize.Width()/2, aSize.Height()/2 );
}
sal_uInt16 n = pPopup->Execute( this, aPos );
Edit::DeletePopupMenu( pPopup );
pPopup.disposeAndClear();
SetSelection( aSaveSel );
switch ( n )
{
@@ -2827,13 +2827,13 @@ FncGetSpecialChars Edit::GetGetSpecialCharsFunction()
return pImplFncGetSpecialChars;
}
PopupMenu* Edit::CreatePopupMenu()
VclPtr<PopupMenu> Edit::CreatePopupMenu()
{
ResMgr* pResMgr = ImplGetResMgr();
if( ! pResMgr )
return new PopupMenu();
return VclPtr<PopupMenu>::Create();
PopupMenu* pPopup = new PopupMenu( ResId( SV_RESID_MENU_EDIT, *pResMgr ) );
VclPtrInstance<PopupMenu> pPopup( ResId( SV_RESID_MENU_EDIT, *pResMgr ) );
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
if ( rStyleSettings.GetHideDisabledMenuItems() )
pPopup->SetMenuFlags( MenuFlags::HideDisabledEntries );
@@ -2852,11 +2852,6 @@ PopupMenu* Edit::CreatePopupMenu()
return pPopup;
}
void Edit::DeletePopupMenu( PopupMenu* pMenu )
{
delete pMenu;
}
// css::datatransfer::dnd::XDragGestureListener
void Edit::dragGestureRecognized( const css::datatransfer::dnd::DragGestureEvent& rDGE ) throw (css::uno::RuntimeException, std::exception)
{
diff --git a/vcl/source/control/menubtn.cxx b/vcl/source/control/menubtn.cxx
index 4b687ad..702d720 100644
--- a/vcl/source/control/menubtn.cxx
+++ b/vcl/source/control/menubtn.cxx
@@ -88,7 +88,7 @@ MenuButton::~MenuButton()
void MenuButton::dispose()
{
delete mpMenuTimer;
delete mpOwnMenu;
mpOwnMenu.disposeAndClear();
PushButton::dispose();
}
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index 903d3bb..5fb6ddf 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -1451,17 +1451,17 @@ void TabControl::Command( const CommandEvent& rCEvt )
if ( bMenu )
{
PopupMenu aMenu;
ScopedVclPtrInstance<PopupMenu> aMenu;
for( std::vector< ImplTabItem >::iterator it = mpTabCtrlData->maItemList.begin();
it != mpTabCtrlData->maItemList.end(); ++it )
{
aMenu.InsertItem( it->mnId, it->maText, MenuItemBits::CHECKABLE | MenuItemBits::RADIOCHECK );
aMenu->InsertItem( it->mnId, it->maText, MenuItemBits::CHECKABLE | MenuItemBits::RADIOCHECK );
if ( it->mnId == mnCurPageId )
aMenu.CheckItem( it->mnId );
aMenu.SetHelpId( it->mnId, it->maHelpId );
aMenu->CheckItem( it->mnId );
aMenu->SetHelpId( it->mnId, it->maHelpId );
}
sal_uInt16 nId = aMenu.Execute( this, aMenuPos );
sal_uInt16 nId = aMenu->Execute( this, aMenuPos );
if ( nId && (nId != mnCurPageId) )
SelectTabPage( nId );
return;
diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx
index cf224ce..f131479 100644
--- a/vcl/source/edit/vclmedit.cxx
+++ b/vcl/source/edit/vclmedit.cxx
@@ -818,7 +818,7 @@ void TextWindow::Command( const CommandEvent& rCEvt )
{
if ( rCEvt.GetCommand() == CommandEventId::ContextMenu )
{
PopupMenu* pPopup = Edit::CreatePopupMenu();
VclPtr<PopupMenu> pPopup = Edit::CreatePopupMenu();
if ( !mpExtTextView->HasSelection() )
{
pPopup->EnableItem( SV_MENU_EDIT_CUT, false );
@@ -857,7 +857,7 @@ void TextWindow::Command( const CommandEvent& rCEvt )
}
// pPopup->RemoveDisabledEntries();
sal_uInt16 n = pPopup->Execute( this, aPos );
Edit::DeletePopupMenu( pPopup );
pPopup.disposeAndClear();
switch ( n )
{
case SV_MENU_EDIT_UNDO: mpExtTextView->Undo();
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index ef1ae30..fc8069e 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -531,7 +531,7 @@ void VclBuilder::disposeBuilder()
for (std::vector<MenuAndId>::reverse_iterator aI = m_aMenus.rbegin(),
aEnd = m_aMenus.rend(); aI != aEnd; ++aI)
{
delete aI->m_pMenu;
aI->m_pMenu.disposeAndClear();
}
m_aMenus.clear();
m_pParent.clear();
@@ -2435,7 +2435,7 @@ std::vector<OString> VclBuilder::handleItems(xmlreader::XmlReader &reader, const
void VclBuilder::handleMenu(xmlreader::XmlReader &reader, const OString &rID)
{
PopupMenu *pCurrentMenu = new PopupMenu;
VclPtr<PopupMenu> pCurrentMenu = VclPtr<PopupMenu>::Create();
int nLevel = 1;
@@ -3459,4 +3459,11 @@ VclBuilder::ParserState::ParserState()
: m_nLastToolbarId(0)
{}
VclBuilder::MenuAndId::MenuAndId(const OString &rId, PopupMenu *pMenu)
: m_sID(rId)
, m_pMenu(pMenu)
{};
VclBuilder::MenuAndId::~MenuAndId() {}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 2a69969..c5e32f61 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -137,6 +137,11 @@ Menu::Menu()
Menu::~Menu()
{
disposeOnce();
}
void Menu::dispose()
{
ImplCallEventListeners( VCLEVENT_OBJECT_DYING, ITEMPOS_INVALID );
// at the window free the reference to the accessible component
@@ -144,8 +149,8 @@ Menu::~Menu()
if ( pWindow )
{
MenuFloatingWindow* pFloat = static_cast<MenuFloatingWindow*>(pWindow.get());
if( pFloat->pMenu == this )
pFloat->pMenu = nullptr;
if( pFloat->pMenu.get() == this )
pFloat->pMenu.clear();
pWindow->SetAccessible( css::uno::Reference< css::accessibility::XAccessible >() );
}
@@ -176,6 +181,8 @@ Menu::~Menu()
// Native-support: destroy SalMenu
ImplSetSalMenu( nullptr );
VclReferenceBase::dispose();
}
void Menu::CreateAutoMnemonics()
@@ -503,7 +510,7 @@ void Menu::InsertItem( const ResId& rResId )
MenuItemData* pData = GetItemList()->GetData( nItemId );
if ( pData )
{
PopupMenu* pSubMenu = new PopupMenu( ResId( static_cast<RSHEADER_TYPE*>(GetClassRes()), *pMgr ) );
VclPtr<PopupMenu> pSubMenu = VclPtr<PopupMenu>::Create( ResId( static_cast<RSHEADER_TYPE*>(GetClassRes()), *pMgr ) );
pData->pAutoSubMenu = pSubMenu;
// #111060# keep track of this pointer, may be it will be deleted from outside
pSubMenu->pRefAutoSubMenu = &pData->pAutoSubMenu;
@@ -628,7 +635,7 @@ void ImplCopyItem( Menu* pThis, const Menu& rMenu, sal_uInt16 nPos, sal_uInt16 n
// create auto-copy
if ( nMode == 1 )
{
PopupMenu* pNewMenu = new PopupMenu( *pSubMenu );
VclPtr<PopupMenu> pNewMenu = VclPtr<PopupMenu>::Create( *pSubMenu );
pThis->SetPopupMenu( nId, pNewMenu );
}
else
@@ -792,7 +799,7 @@ void Menu::SetPopupMenu( sal_uInt16 nItemId, PopupMenu* pMenu )
return;
// same menu, nothing to do
if ( static_cast<PopupMenu*>(pData->pSubMenu) == pMenu )
if ( static_cast<PopupMenu*>(pData->pSubMenu.get()) == pMenu )
return;
// data exchange
@@ -819,7 +826,7 @@ PopupMenu* Menu::GetPopupMenu( sal_uInt16 nItemId ) const
MenuItemData* pData = pItemList->GetData( nItemId );
if ( pData )
return static_cast<PopupMenu*>(pData->pSubMenu);
return static_cast<PopupMenu*>(pData->pSubMenu.get());
else
return nullptr;
}
@@ -2433,7 +2440,13 @@ MenuBar::MenuBar( const MenuBar& rMenu )
MenuBar::~MenuBar()
{
disposeOnce();
}
void MenuBar::dispose()
{
ImplDestroy( this, true );
Menu::dispose();
}
void MenuBar::ClosePopup(Menu *pMenu)
@@ -2758,8 +2771,14 @@ PopupMenu::PopupMenu( const PopupMenu& rMenu )
PopupMenu::~PopupMenu()
{
disposeOnce();
}
void PopupMenu::dispose()
{
if( pRefAutoSubMenu && *pRefAutoSubMenu == this )
*pRefAutoSubMenu = nullptr; // #111060# avoid second delete in ~MenuItemData
Menu::dispose();
}
void PopupMenu::ClosePopup(Menu* pMenu)
@@ -3169,7 +3188,7 @@ ImplMenuDelData::ImplMenuDelData( const Menu* pMenu )
ImplMenuDelData::~ImplMenuDelData()
{
if( mpMenu )
const_cast< Menu* >( mpMenu )->ImplRemoveDel( *this );
const_cast< Menu* >( mpMenu.get() )->ImplRemoveDel( *this );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx
index 8f2ca5e..bec7b35 100644
--- a/vcl/source/window/menubarwindow.cxx
+++ b/vcl/source/window/menubarwindow.cxx
@@ -230,7 +230,7 @@ IMPL_LINK_NOARG_TYPED(MenuBarWindow, CloseHdl, ToolBox *, void)
// #i106052# call close hdl asynchronously to ease handler implementation
// this avoids still being in the handler while the DecoToolBox already
// gets destroyed
Application::PostUserEvent(static_cast<MenuBar*>(pMenu)->GetCloseButtonClickHdl());
Application::PostUserEvent(static_cast<MenuBar*>(pMenu.get())->GetCloseButtonClickHdl());
}
else
{
@@ -240,7 +240,7 @@ IMPL_LINK_NOARG_TYPED(MenuBarWindow, CloseHdl, ToolBox *, void)
MenuBar::MenuBarButtonCallbackArg aArg;
aArg.nId = it->first;
aArg.bHighlight = (aCloseBtn->GetHighlightItemId() == it->first);
aArg.pMenuBar = dynamic_cast<MenuBar*>(pMenu);
aArg.pMenuBar = dynamic_cast<MenuBar*>(pMenu.get());
it->second.m_aSelectLink.Call( aArg );
}
}
@@ -254,7 +254,7 @@ IMPL_LINK_TYPED( MenuBarWindow, ToolboxEventHdl, VclWindowEvent&, rEvent, void )
MenuBar::MenuBarButtonCallbackArg aArg;
aArg.nId = 0xffff;
aArg.bHighlight = (rEvent.GetId() == VCLEVENT_TOOLBOX_HIGHLIGHT);
aArg.pMenuBar = dynamic_cast<MenuBar*>(pMenu);
aArg.pMenuBar = dynamic_cast<MenuBar*>(pMenu.get());
if( rEvent.GetId() == VCLEVENT_TOOLBOX_HIGHLIGHT )
aArg.nId = aCloseBtn->GetHighlightItemId();
else if( rEvent.GetId() == VCLEVENT_TOOLBOX_HIGHLIGHTOFF )
@@ -293,7 +293,7 @@ void MenuBarWindow::ImplCreatePopup( bool bPreSelectFirst )
if ( pItemData->bEnabled && pItemData->pSubMenu && ( nHighlightedItem != ITEMPOS_INVALID ) &&
( pItemData->pSubMenu != pActivePopup ) )
{
pActivePopup = static_cast<PopupMenu*>(pItemData->pSubMenu);
pActivePopup = static_cast<PopupMenu*>(pItemData->pSubMenu.get());
long nX = 0;
MenuItemData* pData = nullptr;
for ( sal_uLong n = 0; n < nHighlightedItem; n++ )
@@ -982,7 +982,7 @@ void MenuBarWindow::LayoutChanged()
// depending on the native implementation or the displayable flag
// the menubar windows is suppressed (ie, height=0)
if (!static_cast<MenuBar*>(pMenu)->IsDisplayable() ||
if (!static_cast<MenuBar*>(pMenu.get())->IsDisplayable() ||
(pMenu->ImplGetSalMenu() && pMenu->ImplGetSalMenu()->VisibleMenuBar()))
{
nHeight = 0;
@@ -1170,7 +1170,7 @@ bool MenuBarWindow::HandleMenuButtonEvent( sal_uInt16 i_nButtonId )
MenuBar::MenuBarButtonCallbackArg aArg;
aArg.nId = it->first;
aArg.bHighlight = true;
aArg.pMenuBar = dynamic_cast<MenuBar*>(pMenu);
aArg.pMenuBar = dynamic_cast<MenuBar*>(pMenu.get());
return it->second.m_aSelectLink.Call( aArg );
}
return false;
diff --git a/vcl/source/window/menubarwindow.hxx b/vcl/source/window/menubarwindow.hxx
index 069db13..3f1f40f 100644
--- a/vcl/source/window/menubarwindow.hxx
+++ b/vcl/source/window/menubarwindow.hxx
@@ -71,8 +71,8 @@ private:
AddButtonEntry() : m_nId( 0 ) {}
};
Menu* pMenu;
PopupMenu* pActivePopup;
VclPtr<Menu> pMenu;
VclPtr<PopupMenu> pActivePopup;
sal_uInt16 nHighlightedItem;
sal_uInt16 nRolloveredItem;
VclPtr<vcl::Window> xSaveFocusId;
diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx
index 9324051..21337ac 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -313,7 +313,7 @@ IMPL_LINK_TYPED( MenuFloatingWindow, HighlightChanged, Timer*, pTimer, void )
}
if ( pItemData->bEnabled && pItemData->pSubMenu && pItemData->pSubMenu->GetItemCount() && ( pItemData->pSubMenu != pActivePopup ) )
{
pActivePopup = static_cast<PopupMenu*>(pItemData->pSubMenu);
pActivePopup = static_cast<PopupMenu*>(pItemData->pSubMenu.get());
long nY = nScrollerHeight+ImplGetStartY();
MenuItemData* pData = nullptr;
for ( sal_uLong n = 0; n < nHighlightedItem; n++ )
@@ -390,7 +390,7 @@ void MenuFloatingWindow::Execute()
{
ImplSVData* pSVData = ImplGetSVData();
pSVData->maAppData.mpActivePopupMenu = static_cast<PopupMenu*>(pMenu);
pSVData->maAppData.mpActivePopupMenu = static_cast<PopupMenu*>(pMenu.get());
bInExecute = true;
// bCallingSelect = false;
@@ -467,7 +467,7 @@ void MenuFloatingWindow::EndExecute()
while (pWin && !pWin->bInExecute &&
pWin->pMenu->pStartedFrom && !pWin->pMenu->pStartedFrom->IsMenuBar())
{
pWin = static_cast<PopupMenu*>(pWin->pMenu->pStartedFrom)->ImplGetFloatingWindow();
pWin = static_cast<PopupMenu*>(pWin->pMenu->pStartedFrom.get())->ImplGetFloatingWindow();
}
if ( pWin )
pCleanUpFrom = pWin;
@@ -618,7 +618,7 @@ void MenuFloatingWindow::ImplScroll( bool bUp )
long nHeight = GetOutputSizePixel().Height();
sal_uInt16 nLastVisible;
static_cast<PopupMenu*>(pMenu)->ImplCalcVisEntries( nHeight, nFirstEntry, &nLastVisible );
static_cast<PopupMenu*>(pMenu.get())->ImplCalcVisEntries( nHeight, nFirstEntry, &nLastVisible );
if ( pMenu->ImplGetNextVisible( nLastVisible ) == ITEMPOS_INVALID )
{
bScrollDown = false;
@@ -957,11 +957,11 @@ void MenuFloatingWindow::ImplCursorUpDown( bool bUp, bool bHomeEnd )
Size aOutSz = GetOutputSizePixel();
sal_uInt16 nLastVisible;
static_cast<PopupMenu*>(pMenu)->ImplCalcVisEntries( aOutSz.Height(), nFirstEntry, &nLastVisible );
static_cast<PopupMenu*>(pMenu.get())->ImplCalcVisEntries( aOutSz.Height(), nFirstEntry, &nLastVisible );
while ( n > nLastVisible )
{
ImplScroll( false );
static_cast<PopupMenu*>(pMenu)->ImplCalcVisEntries( aOutSz.Height(), nFirstEntry, &nLastVisible );
static_cast<PopupMenu*>(pMenu.get())->ImplCalcVisEntries( aOutSz.Height(), nFirstEntry, &nLastVisible );
}
}
ChangeHighlightItem( n, false );
@@ -1010,7 +1010,7 @@ void MenuFloatingWindow::KeyInput( const KeyEvent& rKEvent )
else
{
StopExecute();
PopupMenu* pPopupMenu = static_cast<PopupMenu*>(pMenu->pStartedFrom);
PopupMenu* pPopupMenu = static_cast<PopupMenu*>(pMenu->pStartedFrom.get());
MenuFloatingWindow* pFloat = pPopupMenu->ImplGetFloatingWindow();
pFloat->GrabFocus();
pFloat->KillActivePopup();
@@ -1030,7 +1030,7 @@ void MenuFloatingWindow::KeyInput( const KeyEvent& rKEvent )
}
else
{
MenuFloatingWindow* pFloat = static_cast<PopupMenu*>(pMenu->pStartedFrom)->ImplGetFloatingWindow();
MenuFloatingWindow* pFloat = static_cast<PopupMenu*>(pMenu->pStartedFrom.get())->ImplGetFloatingWindow();
pFloat->GrabFocus();
pFloat->KillActivePopup();
sal_uInt16 highlightItem = pFloat->GetHighlightedItem();
diff --git a/vcl/source/window/menufloatingwindow.hxx b/vcl/source/window/menufloatingwindow.hxx
index 8791293..ce157e5 100644
--- a/vcl/source/window/menufloatingwindow.hxx
+++ b/vcl/source/window/menufloatingwindow.hxx
@@ -33,11 +33,11 @@
class MenuFloatingWindow : public FloatingWindow, public MenuWindow
{
friend void Menu::ImplFillLayoutData() const;
friend Menu::~Menu();
friend void Menu::dispose();
private:
Menu* pMenu;
PopupMenu* pActivePopup;
VclPtr<Menu> pMenu;
VclPtr<PopupMenu> pActivePopup;
Timer aHighlightChangedTimer;
Timer aSubmenuCloseTimer;
Timer aScrollTimer;
diff --git a/vcl/source/window/menuitemlist.cxx b/vcl/source/window/menuitemlist.cxx
index a1c1fa2..954615a 100644
--- a/vcl/source/window/menuitemlist.cxx
+++ b/vcl/source/window/menuitemlist.cxx
@@ -36,9 +36,8 @@ MenuItemData::~MenuItemData()
aUserValueReleaseFunc(nUserValue);
if( pAutoSubMenu )
{
static_cast<PopupMenu*>(pAutoSubMenu)->pRefAutoSubMenu = nullptr;
delete pAutoSubMenu;
pAutoSubMenu = nullptr;
static_cast<PopupMenu*>(pAutoSubMenu.get())->pRefAutoSubMenu = nullptr;
pAutoSubMenu.disposeAndClear();
}
if( pSalMenuItem )
ImplGetSVData()->mpDefInst->DestroyMenuItem( pSalMenuItem );
diff --git a/vcl/source/window/menuitemlist.hxx b/vcl/source/window/menuitemlist.hxx
index ce5ba36..89befc1 100644
--- a/vcl/source/window/menuitemlist.hxx
+++ b/vcl/source/window/menuitemlist.hxx
@@ -33,8 +33,8 @@ struct MenuItemData
sal_uInt16 nId; // SV Id
MenuItemType eType; // MenuItem-Type
MenuItemBits nBits; // MenuItem-Bits
Menu* pSubMenu; // Pointer to SubMenu
Menu* pAutoSubMenu; // Pointer to SubMenu from Resource
VclPtr<Menu> pSubMenu; // Pointer to SubMenu
VclPtr<Menu> pAutoSubMenu; // Pointer to SubMenu from Resource
OUString aText; // Menu-Text
OUString aHelpText; // Help-String
OUString aTipHelpText; // TipHelp-String (eg, expanded filenames)
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 6265289..e6d3af2 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -49,7 +49,7 @@ ImplToolBoxPrivateData::ImplToolBoxPrivateData() :
m_pLayoutData( nullptr )
{
meButtonSize = TOOLBOX_BUTTONSIZE_DONTCARE;
mpMenu = new PopupMenu();
mpMenu = VclPtr<PopupMenu>::Create();
mnEventId = nullptr;
maMenuType = ToolBoxMenuType::NONE;
@@ -73,7 +73,7 @@ ImplToolBoxPrivateData::ImplToolBoxPrivateData() :
ImplToolBoxPrivateData::~ImplToolBoxPrivateData()
{
delete m_pLayoutData;
delete mpMenu;
mpMenu.disposeAndClear();
}
void ImplToolItem::init(sal_uInt16 nItemId, ToolBoxItemBits nItemBits,
diff --git a/vcl/unx/generic/app/i18n_status.cxx b/vcl/unx/generic/app/i18n_status.cxx
index 6ed22df..ffd7b76 100644
--- a/vcl/unx/generic/app/i18n_status.cxx
+++ b/vcl/unx/generic/app/i18n_status.cxx
@@ -299,7 +299,7 @@ namespace vcl {
class IIIMPStatusWindow : public StatusWindow
{
VclPtr<MenuButton> m_aStatusBtn;
PopupMenu m_aMenu;
ScopedVclPtrInstance<PopupMenu> m_aMenu;
SalFrame* m_pResetFocus;
bool m_bShow;
bool m_bOn;
@@ -338,13 +338,13 @@ IIIMPStatusWindow::IIIMPStatusWindow( SalFrame* pParent, bool bOn ) :
layout();
m_aStatusBtn->SetSelectHdl( LINK( this, IIIMPStatusWindow, SelectHdl ) );
m_aStatusBtn->SetPopupMenu( &m_aMenu );
m_aStatusBtn->SetPopupMenu( m_aMenu.get() );
m_aStatusBtn->Show();
const ::std::vector< I18NStatus::ChoiceData >& rChoices( I18NStatus::get().getChoices() );
int i = 1;
for( ::std::vector< I18NStatus::ChoiceData >::const_iterator it = rChoices.begin(); it != rChoices.end(); ++it, i++ )
m_aMenu.InsertItem( i, it->aString );
m_aMenu->InsertItem( i, it->aString );
if( pParent )
{
diff --git a/vcl/unx/gtk/gtksalmenu.cxx b/vcl/unx/gtk/gtksalmenu.cxx
index a08917a..c9974ef 100644
--- a/vcl/unx/gtk/gtksalmenu.cxx
+++ b/vcl/unx/gtk/gtksalmenu.cxx
@@ -538,7 +538,7 @@ void GtkSalMenu::ShowCloseButton(bool bShow)
{
#if GTK_CHECK_VERSION(3,0,0)
assert(mbMenuBar);
MenuBar *pVclMenuBar = static_cast<MenuBar*>(mpVCLMenu);
MenuBar *pVclMenuBar = static_cast<MenuBar*>(mpVCLMenu.get());
if (!bShow)
{
if (mpCloseButton)
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index 1c95e32..da9a4f1 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -1812,8 +1812,8 @@ public:
class DemoWidgets : public WorkWindow
{
MenuBar *mpBar;
PopupMenu *mpPopup;
VclPtr<MenuBar> mpBar;
VclPtr<PopupMenu> mpPopup;
VclPtr<VclBox> mpBox;
VclPtr<ToolBox> mpToolbox;
@@ -1867,9 +1867,9 @@ public:
mpGLButton->Show();
mpHBox->Show();
mpBar = new MenuBar();
mpBar = VclPtr<MenuBar>::Create();
mpBar->InsertItem(0,"File");
mpPopup = new PopupMenu();
mpPopup = VclPtr<PopupMenu>::Create();
mpPopup->InsertItem(0,"Item");
mpBar->SetPopupMenu(0, mpPopup);
SetMenuBar(mpBar);
@@ -1886,8 +1886,8 @@ public:
mpToolbox.disposeAndClear();
mpButton.disposeAndClear();
mpBox.disposeAndClear();
delete mpPopup;
delete mpBar;
mpPopup.disposeAndClear();
mpBar.disposeAndClear();
WorkWindow::dispose();
}
virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle&) override