diff options
author | Noel Grandin <noel@peralex.com> | 2016-06-20 15:56:35 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-06-23 06:28:00 +0000 |
commit | aa0d0536a444fb26d9e570bd6bf6c1bdc3596cf3 (patch) | |
tree | 8b2a5207e77fa4054a37b33c25378c23a00af8ed /svx | |
parent | b722f3d6fc72877e8caaaae7291d5d736ddc494d (diff) |
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>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/dialog/imapwnd.cxx | 46 | ||||
-rw-r--r-- | svx/source/dialog/svxruler.cxx | 28 | ||||
-rw-r--r-- | svx/source/fmcomp/fmgridcl.cxx | 26 | ||||
-rw-r--r-- | svx/source/fmcomp/gridctrl.cxx | 14 | ||||
-rw-r--r-- | svx/source/form/datanavi.cxx | 5 | ||||
-rw-r--r-- | svx/source/form/filtnav.cxx | 17 | ||||
-rw-r--r-- | svx/source/form/fmshimp.cxx | 4 | ||||
-rw-r--r-- | svx/source/form/navigatortree.cxx | 42 | ||||
-rw-r--r-- | svx/source/gallery2/galbrws1.cxx | 18 | ||||
-rw-r--r-- | svx/source/gallery2/galbrws2.cxx | 57 | ||||
-rw-r--r-- | svx/source/inc/datanavi.hxx | 2 | ||||
-rw-r--r-- | svx/source/inc/fmshimp.hxx | 2 | ||||
-rw-r--r-- | svx/source/mnuctrls/clipboardctl.cxx | 5 | ||||
-rw-r--r-- | svx/source/mnuctrls/smarttagmenu.cxx | 9 | ||||
-rw-r--r-- | svx/source/stbctrls/pszctrl.cxx | 6 | ||||
-rw-r--r-- | svx/source/stbctrls/selctrl.cxx | 10 | ||||
-rw-r--r-- | svx/source/stbctrls/xmlsecctrl.cxx | 4 | ||||
-rw-r--r-- | svx/source/stbctrls/zoomctrl.cxx | 8 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 11 |
19 files changed, 156 insertions, 158 deletions
diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx index 6d38b347e55a..4ba77b9ba492 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 efe4de316bd3..7504522b9c01 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 55c1b3acfa46..9a1fa116638e 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 cb6b42a07a3a..e2992ee288a8 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 6db0f72e1255..281ffefa8fe8 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 7c1f1ee9924d..f48413ed54bd 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 67b5d999693d..501c39c1bd2d 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 21c95d94f02e..afe7d11d6845 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 b193f7f1fc5c..3a5e08bba459 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 63166c0debfe..0280380736da 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 c4d8a0e45e97..81b4ddff09cd 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 96ae5ca1f3fe..b89aa938a856 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 fe6a91cf922b..35561f3eda51 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 16b0f02756fb..0d8e9e73e0a4 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 85eb356fd81c..a071173bea90 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 b68dd7961884..13579ed98bd4 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 6abcfe584536..336881576b39 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 88714ebfc06a..0ab191c6ba36 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 b0c25965c2c2..3c8164c6f201 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 |