diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-04-06 16:18:13 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-04-06 16:18:41 +0100 |
commit | 95b720f6d7ba2639c06ba07c3f70aca871a45950 (patch) | |
tree | 97654e80487679996736354f9dcbb6baf62ee460 | |
parent | d02a015593fc129d55e03e2b6d4caacd4e6d3787 (diff) |
revert to fix tdf#98783 missing menubar
Change-Id: Ia322149a7ed461f528af856d9907fe4620f9e97f
-rw-r--r-- | framework/source/layoutmanager/layoutmanager.cxx | 4 | ||||
-rw-r--r-- | framework/source/uielement/menubarwrapper.cxx | 28 | ||||
-rw-r--r-- | framework/source/uifactory/menubarfactory.cxx | 11 | ||||
-rw-r--r-- | include/vcl/menu.hxx | 3 | ||||
-rw-r--r-- | vcl/inc/osx/salinst.h | 2 | ||||
-rw-r--r-- | vcl/inc/salinst.hxx | 3 | ||||
-rw-r--r-- | vcl/inc/unx/gtk/gtkinst.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/unx/gtk/gtksalmenu.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/win/salinst.h | 2 | ||||
-rw-r--r-- | vcl/osx/salmenu.cxx | 2 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/menu.cxx | 15 | ||||
-rw-r--r-- | vcl/unx/gtk/gtkinst.cxx | 19 | ||||
-rw-r--r-- | vcl/unx/gtk/gtksalmenu.cxx | 28 | ||||
-rw-r--r-- | vcl/win/window/salmenu.cxx | 2 |
15 files changed, 47 insertions, 78 deletions
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index e7bbd0fdd566..e67617016cc9 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -726,13 +726,11 @@ Reference< XUIElement > LayoutManager::implts_createElement( const OUString& aNa Reference< ui::XUIElement > xUIElement; SolarMutexGuard g; - Sequence< PropertyValue > aPropSeq( 3 ); + Sequence< PropertyValue > aPropSeq( 2 ); aPropSeq[0].Name = "Frame"; aPropSeq[0].Value <<= m_xFrame; aPropSeq[1].Name = "Persistent"; aPropSeq[1].Value <<= sal_True; - aPropSeq[2].Name = "Container"; - aPropSeq[2].Value <<= m_xContainerWindow; try { diff --git a/framework/source/uielement/menubarwrapper.cxx b/framework/source/uielement/menubarwrapper.cxx index 4cd67300060f..cc5820c8d59a 100644 --- a/framework/source/uielement/menubarwrapper.cxx +++ b/framework/source/uielement/menubarwrapper.cxx @@ -34,7 +34,6 @@ #include <comphelper/processfactory.hxx> #include <comphelper/sequence.hxx> #include <vcl/svapp.hxx> -#include "../layoutmanager/helpers.hxx" using namespace com::sun::star; using namespace com::sun::star::uno; @@ -123,20 +122,6 @@ void SAL_CALL MenuBarWrapper::initialize( const Sequence< Any >& aArguments ) th OUString aModuleIdentifier; UIConfigElementWrapperBase::initialize( aArguments ); - bool bMenuOnly( false ); - Reference< XWindow > xContainerWindow; - for ( sal_Int32 n = 0; n < aArguments.getLength(); n++ ) - { - PropertyValue aPropValue; - if ( aArguments[n] >>= aPropValue ) - { - if ( aPropValue.Name == "MenuOnly" ) - aPropValue.Value >>= bMenuOnly; - else if ( aPropValue.Name == "Container" ) - aPropValue.Value >>= xContainerWindow; - } - } - Reference< XFrame > xFrame( m_xWeakFrame ); if ( xFrame.is() && m_xConfigSource.is() ) { @@ -145,7 +130,7 @@ void SAL_CALL MenuBarWrapper::initialize( const Sequence< Any >& aArguments ) th VCLXMenuBar* pAwtMenuBar = nullptr; { SolarMutexGuard aSolarMutexGuard; - pVCLMenuBar = new MenuBar(getTopSystemWindow(xContainerWindow)); + pVCLMenuBar = new MenuBar(); } Reference< XModuleManager2 > xModuleManager = ModuleManager::create( m_xContext ); @@ -174,6 +159,17 @@ void SAL_CALL MenuBarWrapper::initialize( const Sequence< Any >& aArguments ) th { } + bool bMenuOnly( false ); + for ( sal_Int32 n = 0; n < aArguments.getLength(); n++ ) + { + PropertyValue aPropValue; + if ( aArguments[n] >>= aPropValue ) + { + if ( aPropValue.Name == "MenuOnly" ) + aPropValue.Value >>= bMenuOnly; + } + } + if ( !bMenuOnly ) { // Initialize menubar manager with our vcl menu bar. There are some situations where we only want to get the menu without any diff --git a/framework/source/uifactory/menubarfactory.cxx b/framework/source/uifactory/menubarfactory.cxx index 13025adcfff7..e9d9f79ce5ab 100644 --- a/framework/source/uifactory/menubarfactory.cxx +++ b/framework/source/uifactory/menubarfactory.cxx @@ -34,7 +34,6 @@ #include <rtl/ustrbuf.hxx> using namespace com::sun::star::uno; -using namespace com::sun::star::awt; using namespace com::sun::star::lang; using namespace com::sun::star::frame; using namespace com::sun::star::beans; @@ -75,7 +74,6 @@ void MenuBarFactory::CreateUIElement(const OUString& ResourceURL Reference< XUIConfigurationManager > xCfgMgr; Reference< XUIConfigurationManager > xConfigSource; Reference< XFrame > xFrame; - Reference< XWindow > xContainerWindow; OUString aResourceURL( ResourceURL ); bool bPersistent( true ); bool bExtraMode( false ); @@ -86,8 +84,6 @@ void MenuBarFactory::CreateUIElement(const OUString& ResourceURL Args[n].Value >>= xConfigSource; else if ( Args[n].Name == "Frame" ) Args[n].Value >>= xFrame; - else if ( Args[n].Name == "Container" ) - Args[n].Value >>= xContainerWindow; else if ( Args[n].Name == "ResourceURL" ) Args[n].Value >>= aResourceURL; else if ( Args[n].Name == "Persistent" ) @@ -133,7 +129,7 @@ void MenuBarFactory::CreateUIElement(const OUString& ResourceURL } PropertyValue aPropValue; - Sequence< Any > aPropSeq( _pExtraMode ? 6 : 5); + Sequence< Any > aPropSeq( _pExtraMode ? 5 : 4); aPropValue.Name = "Frame"; aPropValue.Value <<= xFrame; aPropSeq[0] <<= aPropValue; @@ -146,14 +142,11 @@ void MenuBarFactory::CreateUIElement(const OUString& ResourceURL aPropValue.Name = "Persistent"; aPropValue.Value <<= bPersistent; aPropSeq[3] <<= aPropValue; - aPropValue.Name = "Container"; - aPropValue.Value <<= xContainerWindow; - aPropSeq[4] <<= aPropValue; if ( _pExtraMode ) { aPropValue.Name = OUString::createFromAscii(_pExtraMode); aPropValue.Value <<= bExtraMode; - aPropSeq[5] <<= aPropValue; + aPropSeq[4] <<= aPropValue; } SolarMutexGuard aGuard; diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index e88bf463fd8c..0f4de5c00ce4 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -414,7 +414,6 @@ class VCL_DLLPUBLIC MenuBar : public Menu bool mbFloatBtnVisible : 1; bool mbHideBtnVisible : 1; bool mbDisplayable : 1; - VclPtr<SystemWindow> mxAssociatedSystemWindow; friend class Application; friend class Menu; @@ -433,7 +432,7 @@ protected: MenuBarWindow* getMenuBarWindow(); public: - MenuBar( SystemWindow* pAssociatedSystemWindow = nullptr ); + MenuBar(); MenuBar( const MenuBar& rMenu ); virtual ~MenuBar(); diff --git a/vcl/inc/osx/salinst.h b/vcl/inc/osx/salinst.h index fec12ecea07f..972ad7be8cbe 100644 --- a/vcl/inc/osx/salinst.h +++ b/vcl/inc/osx/salinst.h @@ -111,7 +111,7 @@ public: virtual SalYieldResult DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) override; virtual bool AnyInput( VclInputFlags nType ) override; - virtual SalMenu* CreateMenu( bool bMenuBar, Menu* pVCLMenu, SystemWindow* pAssociatedSystemWindow ) override; + virtual SalMenu* CreateMenu( bool bMenuBar, Menu* pVCLMenu ) override; virtual void DestroyMenu( SalMenu* ) override; virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData ) override; virtual void DestroyMenuItem( SalMenuItem* ) override; diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx index 6486ae67e04f..6502679d426a 100644 --- a/vcl/inc/salinst.hxx +++ b/vcl/inc/salinst.hxx @@ -53,7 +53,6 @@ struct SalItemParams; class SalSession; struct SystemGraphicsData; struct SystemWindowData; -class SystemWindow; class Menu; enum class VclInputFlags; enum class SalFrameStyleFlags; @@ -138,7 +137,7 @@ public: virtual bool AnyInput( VclInputFlags nType ) = 0; // menus - virtual SalMenu* CreateMenu( bool bMenuBar, Menu* pMenu, SystemWindow* pAssociatedSystemWindow ); + virtual SalMenu* CreateMenu( bool bMenuBar, Menu* pMenu ); virtual void DestroyMenu( SalMenu* pMenu); virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData ); virtual void DestroyMenuItem( SalMenuItem* pItem ); diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx index 5fec57974483..6f1f9999bc9b 100644 --- a/vcl/inc/unx/gtk/gtkinst.hxx +++ b/vcl/inc/unx/gtk/gtkinst.hxx @@ -199,7 +199,7 @@ public: virtual SalSystem* CreateSalSystem() override; virtual SalInfoPrinter* CreateInfoPrinter(SalPrinterQueueInfo* pPrinterQueueInfo, ImplJobSetup* pJobSetup) override; virtual SalPrinter* CreatePrinter( SalInfoPrinter* pInfoPrinter ) override; - virtual SalMenu* CreateMenu( bool, Menu*, SystemWindow* ) override; + virtual SalMenu* CreateMenu( bool, Menu* ) override; virtual void DestroyMenu( SalMenu* pMenu ) override; virtual SalMenuItem* CreateMenuItem( const SalItemParams* ) override; virtual void DestroyMenuItem( SalMenuItem* pItem ) override; diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx index 95789a0fa1d2..240f22f029c0 100644 --- a/vcl/inc/unx/gtk/gtksalmenu.hxx +++ b/vcl/inc/unx/gtk/gtksalmenu.hxx @@ -59,7 +59,7 @@ private: void ActivateAllSubmenus(Menu* pMenuBar); public: - GtkSalMenu(bool bMenuBar, GActionGroup* pActionGroup); + GtkSalMenu( bool bMenuBar ); virtual ~GtkSalMenu(); virtual bool VisibleMenuBar() override; // must return TRUE to actually DISPLAY native menu bars diff --git a/vcl/inc/win/salinst.h b/vcl/inc/win/salinst.h index 35d3d408fbd2..b6408ea4f322 100644 --- a/vcl/inc/win/salinst.h +++ b/vcl/inc/win/salinst.h @@ -74,7 +74,7 @@ public: virtual SalYieldResult DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong nReleased) override; virtual bool AnyInput( VclInputFlags nType ) override; - virtual SalMenu* CreateMenu( bool bMenuBar, Menu*, SystemWindow* ) override; + virtual SalMenu* CreateMenu( bool bMenuBar, Menu* ) override; virtual void DestroyMenu( SalMenu* ) override; virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData ) override; virtual void DestroyMenuItem( SalMenuItem* ) override; diff --git a/vcl/osx/salmenu.cxx b/vcl/osx/salmenu.cxx index ad6ce395a2dc..00f099105818 100644 --- a/vcl/osx/salmenu.cxx +++ b/vcl/osx/salmenu.cxx @@ -220,7 +220,7 @@ static void initAppMenu() } } -SalMenu* AquaSalInstance::CreateMenu( bool bMenuBar, Menu* pVCLMenu, SystemWindow* /*pAssociatedSystemWindow*/ ) +SalMenu* AquaSalInstance::CreateMenu( bool bMenuBar, Menu* pVCLMenu ) { initAppMenu(); diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 116c772c3324..c135cdf42294 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -65,7 +65,7 @@ SalInstance::~SalInstance() { } -SalMenu* SalInstance::CreateMenu( bool, Menu*, SystemWindow* ) +SalMenu* SalInstance::CreateMenu( bool, Menu* ) { // default: no native menus return nullptr; diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index c31887e2d013..810525ba1234 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2488,15 +2488,14 @@ MenuBarWindow* MenuBar::getMenuBarWindow() return pWin; } -MenuBar::MenuBar(SystemWindow* pAssociatedSystemWindow) +MenuBar::MenuBar() : Menu(), mbCloseBtnVisible(false), mbFloatBtnVisible(false), mbHideBtnVisible(false), - mbDisplayable(true), - mxAssociatedSystemWindow(pAssociatedSystemWindow) + mbDisplayable(true) { - mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu(true, this, mxAssociatedSystemWindow.get()); + mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu(true, this); } MenuBar::MenuBar( const MenuBar& rMenu ) @@ -2506,7 +2505,7 @@ MenuBar::MenuBar( const MenuBar& rMenu ) mbHideBtnVisible(false), mbDisplayable(true) { - mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu(true, this, mxAssociatedSystemWindow.get()); + mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu(true, this); *this = rMenu; } @@ -2780,13 +2779,13 @@ MenuFloatingWindow * PopupMenu::ImplGetFloatingWindow() const { PopupMenu::PopupMenu() : pRefAutoSubMenu(nullptr) { - mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu(false, this, nullptr); + mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu(false, this); } PopupMenu::PopupMenu( const ResId& rResId ) : pRefAutoSubMenu(nullptr) { - mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu(false, this, nullptr); + mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu(false, this); ResMgr* pMgr = rResId.GetResMgr(); if( ! pMgr ) @@ -2820,7 +2819,7 @@ PopupMenu::PopupMenu( const PopupMenu& rMenu ) : Menu(), pRefAutoSubMenu(nullptr) { - mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu(false, this, nullptr); + mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu(false, this); *this = rMenu; } diff --git a/vcl/unx/gtk/gtkinst.cxx b/vcl/unx/gtk/gtkinst.cxx index 0bdaf3ee7a9f..368cdfb2c577 100644 --- a/vcl/unx/gtk/gtkinst.cxx +++ b/vcl/unx/gtk/gtkinst.cxx @@ -32,7 +32,6 @@ #include <headless/svpvd.hxx> #include <headless/svpbmp.hxx> #include <vcl/inputtypes.hxx> -#include <vcl/syswin.hxx> #include <unx/genpspgraphics.h> #include <rtl/strbuf.hxx> #include <rtl/uri.hxx> @@ -348,24 +347,10 @@ SalBitmap* GtkInstance::CreateSalBitmap() #ifdef ENABLE_GMENU_INTEGRATION -SalMenu* GtkInstance::CreateMenu( bool bMenuBar, Menu* pVCLMenu, SystemWindow* pAssociatedSystemWindow ) +SalMenu* GtkInstance::CreateMenu( bool bMenuBar, Menu* pVCLMenu ) { EnsureInit(); - - GtkSalFrame *pFrame = pAssociatedSystemWindow ? dynamic_cast<GtkSalFrame*>(pAssociatedSystemWindow->ImplGetFrame()) - : nullptr; - - GActionGroup* pActionGroup; - if (pFrame) - { - GtkWidget* pWidget = pFrame->getWindow(); - GdkWindow* gdkWindow = gtk_widget_get_window( pWidget ); - pActionGroup = G_ACTION_GROUP( g_object_get_data( G_OBJECT( gdkWindow ), "g-lo-action-group" ) ); - } - else - pActionGroup = nullptr; - - GtkSalMenu* pSalMenu = new GtkSalMenu(bMenuBar, pActionGroup); + GtkSalMenu* pSalMenu = new GtkSalMenu( bMenuBar ); pSalMenu->SetMenu( pVCLMenu ); return pSalMenu; } diff --git a/vcl/unx/gtk/gtksalmenu.cxx b/vcl/unx/gtk/gtksalmenu.cxx index 6c904ced957e..44e555918f0a 100644 --- a/vcl/unx/gtk/gtksalmenu.cxx +++ b/vcl/unx/gtk/gtksalmenu.cxx @@ -456,26 +456,16 @@ bool GtkSalMenu::ShowNativePopupMenu(FloatingWindow* pWin, const Rectangle& rRec * GtkSalMenu */ -GtkSalMenu::GtkSalMenu( bool bMenuBar, GActionGroup *pActionGroup ) : +GtkSalMenu::GtkSalMenu( bool bMenuBar ) : mbMenuBar( bMenuBar ), mpMenuBarWidget( nullptr ), mpCloseButton( nullptr ), mpVCLMenu( nullptr ), mpParentSalMenu( nullptr ), mpFrame( nullptr ), - mpActionGroup(pActionGroup) + mpMenuModel( nullptr ), + mpActionGroup( nullptr ) { - if (bMenuBar) - mpMenuModel = G_MENU_MODEL(g_lo_menu_new()); - else - mpMenuModel = nullptr; - - GLOActionGroup* pLOActionGroup = G_LO_ACTION_GROUP( mpActionGroup ); - if (pLOActionGroup) - { - g_lo_action_group_clear(pLOActionGroup); - g_lo_action_group_set_top_menu(pLOActionGroup, static_cast<gpointer>(this)); - } } void GtkSalMenu::SetMenuModel(GMenuModel* pMenuModel) @@ -674,12 +664,22 @@ void GtkSalMenu::SetFrame(const SalFrame* pFrame) GdkWindow* gdkWindow = gtk_widget_get_window( pWidget ); GLOMenu* pMenuModel = G_LO_MENU( g_object_get_data( G_OBJECT( gdkWindow ), "g-lo-menubar" ) ); - SAL_INFO("vcl.unity", "Found menu model: " << pMenuModel); + GLOActionGroup* pActionGroup = G_LO_ACTION_GROUP( g_object_get_data( G_OBJECT( gdkWindow ), "g-lo-action-group" ) ); + SAL_INFO("vcl.unity", "Found menu model: " << pMenuModel << " and action group: " << pActionGroup); if ( pMenuModel ) { if ( g_menu_model_get_n_items( G_MENU_MODEL( pMenuModel ) ) > 0 ) g_lo_menu_remove( pMenuModel, 0 ); + + mpMenuModel = G_MENU_MODEL( g_lo_menu_new() ); + } + + if ( pActionGroup ) + { + g_lo_action_group_clear( pActionGroup ); + g_lo_action_group_set_top_menu(pActionGroup, static_cast<gpointer>(this)); + mpActionGroup = G_ACTION_GROUP( pActionGroup ); } // Generate the main menu structure. diff --git a/vcl/win/window/salmenu.cxx b/vcl/win/window/salmenu.cxx index 1f038bedbe3f..0b623e25b1b4 100644 --- a/vcl/win/window/salmenu.cxx +++ b/vcl/win/window/salmenu.cxx @@ -43,7 +43,7 @@ bool SalData::IsKnownMenuHandle( HMENU hMenu ) // WinSalInst factory methods -SalMenu* WinSalInstance::CreateMenu( bool bMenuBar, Menu*, SystemWindow* /*pAssociatedSystemWindow*/ ) +SalMenu* WinSalInstance::CreateMenu( bool bMenuBar, Menu* ) { WinSalMenu *pSalMenu = new WinSalMenu(); |