summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2018-10-27 17:47:01 +0200
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2018-10-29 08:23:34 +0100
commit81695542af1dc2cc74f16a1ce4b4dd540a64817b (patch)
treee2f181f2aee4087ce1527ff50518ca12e4fafd8b /sfx2
parent128ecffe53394c1f045521c2efb42ea03a319f4b (diff)
tdf#120874 Don't show menubar in other windows when one is closed
Change-Id: Id0b1af277bd7ec367525663ec6d478d67cde0a40 Reviewed-on: https://gerrit.libreoffice.org/62431 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/notebookbar/SfxNotebookBar.cxx35
1 files changed, 34 insertions, 1 deletions
diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx
index ee19f6f2bcc4..953bacf4bfe8 100644
--- a/sfx2/source/notebookbar/SfxNotebookBar.cxx
+++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx
@@ -179,7 +179,8 @@ void SfxNotebookBar::CloseMethod(SystemWindow* pSysWindow)
RemoveListeners(pSysWindow);
if(pSysWindow->GetNotebookBar())
pSysWindow->CloseNotebookBar();
- SfxNotebookBar::ShowMenubar(true);
+ if (SfxViewFrame::Current())
+ SfxNotebookBar::ShowMenubar(SfxViewFrame::Current(), true);
}
}
@@ -423,6 +424,38 @@ void SfxNotebookBar::ShowMenubar(bool bShow)
}
}
+void SfxNotebookBar::ShowMenubar(SfxViewFrame* pViewFrame, bool bShow)
+{
+ if (m_bLock)
+ return;
+
+ m_bLock = true;
+
+ uno::Reference<uno::XComponentContext> xContext = comphelper::getProcessComponentContext();
+ const Reference<frame::XModuleManager> xModuleManager = frame::ModuleManager::create(xContext);
+
+ Reference<frame::XFrame> xFrame = pViewFrame->GetFrame().GetFrameInterface();
+ if (xFrame.is())
+ {
+ const Reference<frame::XLayoutManager>& xLayoutManager = lcl_getLayoutManager(xFrame);
+ if (xLayoutManager.is())
+ {
+ 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();
+ }
+ }
+ m_bLock = false;
+}
+
void SfxNotebookBar::ToggleMenubar()
{
if (SfxViewFrame::Current())