diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2016-01-20 14:39:22 +0200 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2016-01-20 17:44:00 +0200 |
commit | ad236a3e1b456531ea758c2a3c5075860d823109 (patch) | |
tree | 9e0b12e26e85c06a25c14368845429b34fc8b21c | |
parent | c5a1278fa2bcc193a82d78ee408ea7a913420675 (diff) |
i#107205 Remove SfxDispatcher::Popup and SfxPopupMenuManager::Popup
Change-Id: I1a8bee75a2dbfb039ec32faf001b75b26ea1f3fe
-rw-r--r-- | include/sfx2/dispatch.hxx | 2 | ||||
-rw-r--r-- | include/sfx2/mnumgr.hxx | 11 | ||||
-rw-r--r-- | sfx2/source/control/dispatch.cxx | 24 | ||||
-rw-r--r-- | sfx2/source/menu/mnumgr.cxx | 56 |
4 files changed, 0 insertions, 93 deletions
diff --git a/include/sfx2/dispatch.hxx b/include/sfx2/dispatch.hxx index c6bc45870736..47be2d7aaf0e 100644 --- a/include/sfx2/dispatch.hxx +++ b/include/sfx2/dispatch.hxx @@ -154,8 +154,6 @@ public: SfxShell* GetShell(sal_uInt16 nIdx) const; SfxViewFrame* GetFrame() const; SfxModule* GetModule() const; - // caller has to clean up the Manager on his own - static SfxPopupMenuManager* Popup( sal_uInt16 nConfigId, vcl::Window *pWin, const Point *pPos ); void ExecutePopup( const ResId &rId, vcl::Window *pWin = nullptr, const Point *pPos = nullptr ); void ExecutePopup( const OUString &rResName, vcl::Window *pWin = nullptr, const Point *pPos = nullptr ); diff --git a/include/sfx2/mnumgr.hxx b/include/sfx2/mnumgr.hxx index 7682fc624464..a1607b9bcfa6 100644 --- a/include/sfx2/mnumgr.hxx +++ b/include/sfx2/mnumgr.hxx @@ -68,12 +68,6 @@ class SAL_DLLPUBLIC_EXPORT SfxPopupMenuManager : public SfxMenuManager { private: Menu* pSVMenu; - - // when #i107205 gets fixed this one should be superfluous. - // But right now we want to avoid the memory leak that would otherwise occur, - // if we don't delete the pointer that got created in SfxPopupMenuManager::Popup - static PopupMenu * pStaticThesSubMenu; - SfxPopupMenuManager( const SfxPopupMenuManager& ) = delete; SfxPopupMenuManager& operator=( const SfxPopupMenuManager& ) = delete; @@ -81,11 +75,6 @@ public: SfxPopupMenuManager( PopupMenu*, SfxBindings& ); ~SfxPopupMenuManager(); static void ExecutePopup( const ResId&, SfxViewFrame* pViewFrame, const Point& rPoint, vcl::Window* pWindow ); - // @deprecated!! - // Don't use this method any longer. The whole class will be removed in the future. - // Changing code which relies on Popup would need much more effort. - static SfxPopupMenuManager* Popup( const ResId& rResId, SfxViewFrame* pFrame,const Point& rPoint, vcl::Window* pWindow ); - void Execute( const Point& rPos, vcl::Window *pWindow ); void RemoveDisabledEntries(); diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 12444ef21559..a4d73d5415d2 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -1849,30 +1849,6 @@ bool SfxDispatcher::_FillState(const SfxSlotServer& rSvr, SfxItemSet& rState, return false; } -SfxPopupMenuManager* SfxDispatcher::Popup( sal_uInt16 nConfigId, vcl::Window *pWin, const Point *pPos ) -{ - SfxDispatcher &rDisp = *SfxGetpApp()->GetDispatcher_Impl(); - sal_uInt16 nShLevel = 0; - SfxShell *pSh; - - if ( rDisp.xImp->bQuiet ) - { - nConfigId = 0; - nShLevel = rDisp.xImp->aStack.size(); - } - - vcl::Window *pWindow = pWin ? pWin : rDisp.xImp->pFrame->GetFrame().GetWorkWindow_Impl()->GetWindow(); - for ( pSh = rDisp.GetShell(nShLevel); pSh; ++nShLevel, pSh = rDisp.GetShell(nShLevel) ) - { - const ResId& rResId = pSh->GetInterface()->GetPopupMenuResId(); - if ( ( nConfigId == 0 && rResId.GetId() ) || ( nConfigId != 0 && rResId.GetId() == nConfigId ) ) - { - return SfxPopupMenuManager::Popup( rResId, rDisp.GetFrame(), pPos ? *pPos : pWindow->GetPointerPosPixel(), pWindow ); - } - } - return nullptr; -} - void SfxDispatcher::ExecutePopup( vcl::Window *pWin, const Point *pPos ) { SfxDispatcher &rDisp = *SfxGetpApp()->GetDispatcher_Impl(); diff --git a/sfx2/source/menu/mnumgr.cxx b/sfx2/source/menu/mnumgr.cxx index 31a304d47c23..ef2d375eb4e2 100644 --- a/sfx2/source/menu/mnumgr.cxx +++ b/sfx2/source/menu/mnumgr.cxx @@ -64,9 +64,6 @@ #include <sfx2/objface.hxx> #include "thessubmenu.hxx" -// static member initialization -PopupMenu * SfxPopupMenuManager::pStaticThesSubMenu = nullptr; - using namespace com::sun::star; void TryToHideDisabledEntries_Impl( Menu* pMenu ) @@ -254,7 +251,6 @@ void SfxPopupMenuManager::RemoveDisabledEntries() void SfxPopupMenuManager::Execute( const Point& rPos, vcl::Window* pWindow ) { static_cast<PopupMenu*>( GetMenu()->GetSVMenu() )->Execute( pWindow, rPos ); - delete pStaticThesSubMenu; pStaticThesSubMenu = nullptr; } @@ -274,58 +270,6 @@ SfxPopupMenuManager::SfxPopupMenuManager( PopupMenu* pMenuArg, SfxBindings& rBin { } -SfxPopupMenuManager* SfxPopupMenuManager::Popup( const ResId& rResId, SfxViewFrame* pFrame,const Point& rPoint, vcl::Window* pWindow ) -{ - PopupMenu *pSVMenu = new PopupMenu( rResId ); - sal_uInt16 n, nCount = pSVMenu->GetItemCount(); - for ( n=0; n<nCount; n++ ) - { - sal_uInt16 nId = pSVMenu->GetItemId( n ); - if ( nId == SID_COPY || nId == SID_CUT || nId == SID_PASTE ) - break; - } - - PopupMenu* pThesSubMenu = InsertThesaurusSubmenu_Impl( &pFrame->GetBindings(), pSVMenu ); - // #i107205# (see comment in header file) - pStaticThesSubMenu = pThesSubMenu; - - if ( n == nCount ) - { - PopupMenu aPop( SfxResId( MN_CLIPBOARDFUNCS ) ); - nCount = aPop.GetItemCount(); - for ( n=0; n<nCount; n++ ) - { - sal_uInt16 nId = aPop.GetItemId( n ); - pSVMenu->InsertItem( nId, aPop.GetItemText( nId ), aPop.GetItemBits( nId ), OString(), n ); - pSVMenu->SetHelpId( nId, aPop.GetHelpId( nId )); - } - pSVMenu->InsertSeparator( OString(), n ); - } - - InsertVerbs_Impl( &pFrame->GetBindings(), pFrame->GetViewShell()->GetVerbs(), pSVMenu ); - Menu* pMenu = nullptr; - css::ui::ContextMenuExecuteEvent aEvent; - aEvent.SourceWindow = VCLUnoHelper::GetInterface( pWindow ); - aEvent.ExecutePosition.X = rPoint.X(); - aEvent.ExecutePosition.Y = rPoint.Y(); - OUString sDummyMenuName; - if ( pFrame->GetViewShell()->TryContextMenuInterception( *pSVMenu, sDummyMenuName, pMenu, aEvent ) ) - { - if ( pMenu ) - { - delete pSVMenu; - pSVMenu = static_cast<PopupMenu*>( pMenu ); - } - - SfxPopupMenuManager* aMgr = new SfxPopupMenuManager( pSVMenu, pFrame->GetBindings()); - aMgr->RemoveDisabledEntries(); - return aMgr; - } - - return nullptr; -} - - void SfxPopupMenuManager::ExecutePopup( const ResId& rResId, SfxViewFrame* pFrame, const Point& rPoint, vcl::Window* pWindow ) { PopupMenu *pSVMenu = new PopupMenu( rResId ); |