diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2015-11-03 23:27:32 +0200 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2015-11-04 00:32:04 +0200 |
commit | 72e426c4c04051320f6f43542911a3e63f36bcfa (patch) | |
tree | fe11cd74351f86c63d28e4b3e0cec2d748d0a678 | |
parent | 6744951cf9b911dc1ac516b06c0363b80de36c3f (diff) |
Tweak MenuBarManager a bit for use with context menus
Change-Id: Ie28277e692d3b3286f1961e66f90b5ae59810fe7
-rw-r--r-- | framework/inc/uielement/menubarmanager.hxx | 4 | ||||
-rw-r--r-- | framework/source/uielement/generictoolbarcontroller.cxx | 2 | ||||
-rw-r--r-- | framework/source/uielement/menubarmanager.cxx | 13 |
3 files changed, 13 insertions, 6 deletions
diff --git a/framework/inc/uielement/menubarmanager.hxx b/framework/inc/uielement/menubarmanager.hxx index b7e37d2cad62..5f41fb6de573 100644 --- a/framework/inc/uielement/menubarmanager.hxx +++ b/framework/inc/uielement/menubarmanager.hxx @@ -95,7 +95,8 @@ class MenuBarManager : public css::frame::XStatusListener , const OUString& aModuleIdentifier, Menu* pMenu, bool bDelete, - bool bDeleteChildren ); + bool bDeleteChildren, + bool bHasMenuBar = true ); virtual ~MenuBarManager(); @@ -214,6 +215,7 @@ class MenuBarManager : public css::frame::XStatusListener , bool m_bRetrieveImages : 1, m_bAcceleratorCfg : 1; bool m_bModuleIdentified; + bool m_bHasMenuBar; OUString m_aMenuItemCommand; OUString m_aModuleIdentifier; Menu* m_pVCLMenu; diff --git a/framework/source/uielement/generictoolbarcontroller.cxx b/framework/source/uielement/generictoolbarcontroller.cxx index f9a89d928cc3..cfb1f8c68634 100644 --- a/framework/source/uielement/generictoolbarcontroller.cxx +++ b/framework/source/uielement/generictoolbarcontroller.cxx @@ -348,7 +348,7 @@ MenuToolbarController::createPopupWindow() throw (css::uno::RuntimeException, st Reference< XDispatchProvider > xDispatch; Reference< XURLTransformer > xURLTransformer = URLTransformer::create( m_xContext ); pMenu = new Toolbarmenu(); - m_xMenuManager.set( new MenuBarManager( m_xContext, m_xFrame, xURLTransformer, xDispatch, m_aModuleIdentifier, pMenu, true, true ) ); + m_xMenuManager.set( new MenuBarManager( m_xContext, m_xFrame, xURLTransformer, xDispatch, m_aModuleIdentifier, pMenu, true, true, false ) ); if (m_xMenuManager.is()) { MenuBarManager& rMgr = dynamic_cast<MenuBarManager&>(*m_xMenuManager.get()); diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index fb5bca7ac7f2..5c46e755428f 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -136,12 +136,13 @@ MenuBarManager::MenuBarManager( const Reference< XURLTransformer >& _xURLTransformer, const Reference< XDispatchProvider >& rDispatchProvider, const OUString& rModuleIdentifier, - Menu* pMenu, bool bDelete, bool bDeleteChildren ): + Menu* pMenu, bool bDelete, bool bDeleteChildren, bool bHasMenuBar ): OWeakObject() , m_bDisposed( false ) , m_bRetrieveImages( false ) , m_bAcceleratorCfg( false ) , m_bModuleIdentified( false ) + , m_bHasMenuBar( bHasMenuBar ) , m_aListenerContainer( m_mutex ) , m_xContext(rxContext) , m_xURLTransformer(_xURLTransformer) @@ -164,6 +165,7 @@ MenuBarManager::MenuBarManager( , m_bRetrieveImages( true ) , m_bAcceleratorCfg( false ) , m_bModuleIdentified( false ) + , m_bHasMenuBar( true ) , m_aListenerContainer( m_mutex ) , m_xContext(rxContext) , m_xURLTransformer(_xURLTransformer) @@ -392,6 +394,7 @@ throw ( RuntimeException, std::exception ) OUString aFeatureURL = Event.FeatureURL.Complete; SolarMutexGuard aSolarGuard; + if ( m_bHasMenuBar ) { vcl::MenuInvalidator::Invalidated(); } @@ -801,6 +804,7 @@ IMPL_LINK_TYPED( MenuBarManager, Activate, Menu *, pMenu, bool ) } // Try to set accelerator keys + if ( m_bHasMenuBar ) { RetrieveShortcuts( m_aMenuItemHandlerVector ); std::vector< MenuItemHandler* >::iterator p; @@ -898,7 +902,8 @@ IMPL_LINK_TYPED( MenuBarManager, Activate, Menu *, pMenu, bool ) { xMenuItemDispatch->addStatusListener( static_cast< XStatusListener* >( this ), aTargetURL ); xMenuItemDispatch->removeStatusListener( static_cast< XStatusListener* >( this ), aTargetURL ); - xMenuItemDispatch->addStatusListener( static_cast< XStatusListener* >( this ), aTargetURL ); + if ( m_bHasMenuBar ) + xMenuItemDispatch->addStatusListener( static_cast< XStatusListener* >( this ), aTargetURL ); } } else if ( !bPopupMenu ) @@ -1302,7 +1307,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF } else { - MenuBarManager* pSubMenuMgr = new MenuBarManager( m_xContext, rFrame, m_xURLTransformer,rDispatchProvider, aModuleIdentifier, pPopup, bDeleteChildren, bDeleteChildren ); + MenuBarManager* pSubMenuMgr = new MenuBarManager( m_xContext, rFrame, m_xURLTransformer,rDispatchProvider, aModuleIdentifier, pPopup, bDeleteChildren, bDeleteChildren, m_bHasMenuBar ); AddMenu(pSubMenuMgr,aItemCommand,nItemId); } } @@ -1367,7 +1372,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF } } - if ( bAccessibilityEnabled ) + if ( m_bHasMenuBar && bAccessibilityEnabled ) { RetrieveShortcuts( m_aMenuItemHandlerVector ); std::vector< MenuItemHandler* >::iterator p; |