summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorSzymon Kłos <eszkadev@gmail.com>2016-10-06 21:34:27 +0200
committerSzymon Kłos <eszkadev@gmail.com>2016-10-07 17:46:39 +0000
commit1b786fb2db9b555fd9882487f1f0375bd93f6e32 (patch)
tree29b0d54b8bc22d16b93c82afbfe4e137fa2a9239 /sfx2
parent3d5d631e5ea9dd897abd5de61a92a75ba22b040e (diff)
tdf#102776 : switching the menubar in all windows
Change-Id: I74804605ec9dd15d1e4dbea15f09709dbf9c8770 Reviewed-on: https://gerrit.libreoffice.org/29580 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Szymon Kłos <eszkadev@gmail.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/notebookbar/SfxNotebookBar.cxx48
1 files changed, 34 insertions, 14 deletions
diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx
index 182b70aee2ae..73053b8b6fdc 100644
--- a/sfx2/source/notebookbar/SfxNotebookBar.cxx
+++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx
@@ -353,29 +353,49 @@ void SfxNotebookBar::ShowMenubar(bool bShow)
{
m_bLock = true;
- if (SfxViewFrame::Current())
+ Reference<frame::XFrame> xFrame;
+ vcl::EnumContext::Application eCurrentApp = vcl::EnumContext::Application::Application_None;
+ uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
+ const Reference<frame::XModuleManager> xModuleManager = frame::ModuleManager::create( xContext );
+
+ if ( SfxViewFrame::Current() )
{
- const Reference<frame::XFrame>& xFrame = SfxViewFrame::Current()->GetFrame().GetFrameInterface();
- if (xFrame.is())
+ xFrame = SfxViewFrame::Current()->GetFrame().GetFrameInterface();
+ eCurrentApp = vcl::EnumContext::GetApplicationEnum( xModuleManager->identify( xFrame ) );
+ }
+
+ SfxViewFrame* pViewFrame = SfxViewFrame::GetFirst();
+ while( pViewFrame )
+ {
+ xFrame = pViewFrame->GetFrame().GetFrameInterface();
+ if ( xFrame.is() )
{
- const Reference<frame::XLayoutManager>& xLayoutManager =
- lcl_getLayoutManager(xFrame);
+ vcl::EnumContext::Application eApp =
+ vcl::EnumContext::GetApplicationEnum( xModuleManager->identify( xFrame ) );
- if (xLayoutManager.is())
+ if ( eApp == eCurrentApp )
{
- xLayoutManager->lock();
+ const Reference<frame::XLayoutManager>& xLayoutManager =
+ lcl_getLayoutManager( xFrame );
- if (xLayoutManager->getElement(MENUBAR_STR).is())
+ if (xLayoutManager.is())
{
- if (xLayoutManager->isElementVisible(MENUBAR_STR) && !bShow)
- xLayoutManager->hideElement(MENUBAR_STR);
- else if(!xLayoutManager->isElementVisible(MENUBAR_STR) && bShow)
- xLayoutManager->showElement(MENUBAR_STR);
- }
+ xLayoutManager->lock();
+
+ if (xLayoutManager->getElement(MENUBAR_STR).is())
+ {
+ if (xLayoutManager->isElementVisible(MENUBAR_STR) && !bShow)
+ xLayoutManager->hideElement(MENUBAR_STR);
+ else if(!xLayoutManager->isElementVisible(MENUBAR_STR) && bShow)
+ xLayoutManager->showElement(MENUBAR_STR);
+ }
- xLayoutManager->unlock();
+ xLayoutManager->unlock();
+ }
}
}
+
+ pViewFrame = SfxViewFrame::GetNext( *pViewFrame );
}
m_bLock = false;
}