[Libreoffice-commits] core.git: framework/inc framework/source
Maxim Monastirsky
momonasmon at gmail.com
Tue Nov 3 14:33:28 PST 2015
framework/inc/uielement/menubarmanager.hxx | 4 +++-
framework/source/uielement/generictoolbarcontroller.cxx | 2 +-
framework/source/uielement/menubarmanager.cxx | 13 +++++++++----
3 files changed, 13 insertions(+), 6 deletions(-)
New commits:
commit 72e426c4c04051320f6f43542911a3e63f36bcfa
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Tue Nov 3 23:27:32 2015 +0200
Tweak MenuBarManager a bit for use with context menus
Change-Id: Ie28277e692d3b3286f1961e66f90b5ae59810fe7
diff --git a/framework/inc/uielement/menubarmanager.hxx b/framework/inc/uielement/menubarmanager.hxx
index b7e37d2..5f41fb6 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 f9a89d9..cfb1f8c 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 fb5bca7..5c46e75 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;
More information about the Libreoffice-commits
mailing list