framework/inc/services/layoutmanager.hxx | 1 framework/source/layoutmanager/layoutmanager.cxx | 104 ++++++++++++----------- 2 files changed, 57 insertions(+), 48 deletions(-)
New commits: commit 1195bca0342647ae974ed5a1db2b41c5eddf1d4a Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Fri Feb 15 18:36:25 2019 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Sun Feb 17 11:02:56 2019 +0100 MSForms: Extract menu creation to a separate method No functional change is intended. Change-Id: Ieb88e746b08c6a6daac14c08a206db73cbeef8a9 Reviewed-on: https://gerrit.libreoffice.org/67903 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> (cherry picked from commit 5599dfc71b4bd0a2f9130cb51a0dc8fe7eaf9fdb) Reviewed-on: https://gerrit.libreoffice.org/67919 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> diff --git a/framework/inc/services/layoutmanager.hxx b/framework/inc/services/layoutmanager.hxx index 8ef46a21de72..ed3ec629e7e7 100644 --- a/framework/inc/services/layoutmanager.hxx +++ b/framework/inc/services/layoutmanager.hxx @@ -173,6 +173,7 @@ namespace framework // menu bar + void implts_createMenuBar( const OUString& rMenuBarName ); void impl_clearUpMenuBar(); void implts_reset( bool bAttach ); void implts_updateMenuBarClose(); diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 2012ee2576bb..9560a88f3013 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -155,6 +155,57 @@ LayoutManager::~LayoutManager() delete m_pGlobalSettings; } +void LayoutManager::implts_createMenuBar(const OUString& rMenuBarName) +{ + SolarMutexClearableGuard aWriteLock; + + if (!m_bInplaceMenuSet && !m_xMenuBar.is()) + { + m_xMenuBar = implts_createElement( rMenuBarName ); + if ( m_xMenuBar.is() ) + { + SolarMutexGuard aGuard; + + SystemWindow* pSysWindow = getTopSystemWindow( m_xContainerWindow ); + if ( pSysWindow ) + { + Reference< awt::XMenuBar > xMenuBar; + + Reference< XPropertySet > xPropSet( m_xMenuBar, UNO_QUERY ); + if ( xPropSet.is() ) + { + try + { + xPropSet->getPropertyValue("XMenuBar") >>= xMenuBar; + } + catch (const beans::UnknownPropertyException&) + { + } + catch (const lang::WrappedTargetException&) + { + } + } + + if ( xMenuBar.is() ) + { + VCLXMenu* pAwtMenuBar = VCLXMenu::GetImplementation( xMenuBar ); + if ( pAwtMenuBar ) + { + MenuBar* pMenuBar = static_cast<MenuBar*>(pAwtMenuBar->GetMenu()); + if ( pMenuBar ) + { + pSysWindow->SetMenuBar(pMenuBar); + pMenuBar->SetDisplayable( m_bMenuVisible ); + implts_updateMenuBarClose(); + } + } + } + } + } + } + aWriteLock.clear(); +} + // Internal helper function void LayoutManager::impl_clearUpMenuBar() { @@ -1391,7 +1442,6 @@ void SAL_CALL LayoutManager::createElement( const OUString& aName ) SolarMutexClearableGuard aReadLock; Reference< XFrame > xFrame = m_xFrame; - bool bInPlaceMenu = m_bInplaceMenuSet; aReadLock.clear(); if ( !xFrame.is() ) @@ -1427,55 +1477,13 @@ void SAL_CALL LayoutManager::createElement( const OUString& aName ) bMustBeLayouted = m_xToolbarManager->isLayoutDirty(); } else if ( aElementType.equalsIgnoreAsciiCase("menubar") && - aElementName.equalsIgnoreAsciiCase("menubar") ) + aElementName.equalsIgnoreAsciiCase("menubar") && + implts_isFrameOrWindowTop(xFrame) ) { - // #i38743# don't create a menubar if frame isn't top - if ( !bInPlaceMenu && !m_xMenuBar.is() && implts_isFrameOrWindowTop( xFrame )) - { - m_xMenuBar = implts_createElement( aName ); - if ( m_xMenuBar.is() ) - { - SolarMutexGuard aGuard; + implts_createMenuBar( aName ); + if (m_bMenuVisible) + bNotify = true; - SystemWindow* pSysWindow = getTopSystemWindow( m_xContainerWindow ); - if ( pSysWindow ) - { - Reference< awt::XMenuBar > xMenuBar; - - Reference< XPropertySet > xPropSet( m_xMenuBar, UNO_QUERY ); - if ( xPropSet.is() ) - { - try - { - xPropSet->getPropertyValue("XMenuBar") >>= xMenuBar; - } - catch (const beans::UnknownPropertyException&) - { - } - catch (const lang::WrappedTargetException&) - { - } - } - - if ( xMenuBar.is() ) - { - VCLXMenu* pAwtMenuBar = VCLXMenu::GetImplementation( xMenuBar ); - if ( pAwtMenuBar ) - { - MenuBar* pMenuBar = static_cast<MenuBar*>(pAwtMenuBar->GetMenu()); - if ( pMenuBar ) - { - pSysWindow->SetMenuBar(pMenuBar); - pMenuBar->SetDisplayable( m_bMenuVisible ); - if ( m_bMenuVisible ) - bNotify = true; - implts_updateMenuBarClose(); - } - } - } - } - } - } aWriteLock.clear(); } else if ( aElementType.equalsIgnoreAsciiCase("statusbar") && _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits