[Libreoffice-commits] core.git: 2 commits - include/sfx2 sc/source sc/uiconfig sfx2/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Oct 29 07:23:45 UTC 2018
include/sfx2/notebookbar/SfxNotebookBar.hxx | 4 +++
sc/source/ui/view/prevwsh.cxx | 15 ++++++++++++
sc/uiconfig/scalc/ui/notebookbar.ui | 3 ++
sfx2/source/notebookbar/SfxNotebookBar.cxx | 35 +++++++++++++++++++++++++++-
4 files changed, 56 insertions(+), 1 deletion(-)
New commits:
commit 81695542af1dc2cc74f16a1ce4b4dd540a64817b
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Sat Oct 27 17:47:01 2018 +0200
Commit: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Mon Oct 29 08:23:34 2018 +0100
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 at cib.de>
diff --git a/include/sfx2/notebookbar/SfxNotebookBar.hxx b/include/sfx2/notebookbar/SfxNotebookBar.hxx
index e3c397a5bd62..08633bf27352 100644
--- a/include/sfx2/notebookbar/SfxNotebookBar.hxx
+++ b/include/sfx2/notebookbar/SfxNotebookBar.hxx
@@ -11,6 +11,7 @@
#define INCLUDED_SFX2_NOTEBOOKBAR_SFXNOTEBOOKBAR_HXX
#include <sfx2/dllapi.h>
+#include <sfx2/viewfrm.hxx>
#include <vcl/notebookbar.hxx>
class SfxBindings;
@@ -43,7 +44,10 @@ public:
static void RemoveListeners(SystemWindow const * pSysWindow);
+ /** Show menu bar in all frames of current application */
static void ShowMenubar(bool bShow);
+ /** Show menu bar only in current frame */
+ static void ShowMenubar(SfxViewFrame* pViewFrame, bool bShow);
static void ToggleMenubar();
private:
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())
commit 128ecffe53394c1f045521c2efb42ea03a319f4b
Author: andreas kainz <kainz.a at gmail.com>
AuthorDate: Wed Oct 17 21:41:25 2018 +0200
Commit: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Mon Oct 29 08:23:23 2018 +0100
Notebookbar: add context-Printpreview to calc tabbed NB
Change-Id: I9b63a515c407692f5632cb5e1f391593cfd68736
Reviewed-on: https://gerrit.libreoffice.org/62433
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx
index 01ca947a8251..15074ddf2a04 100644
--- a/sc/source/ui/view/prevwsh.cxx
+++ b/sc/source/ui/view/prevwsh.cxx
@@ -69,6 +69,9 @@
#include <com/sun/star/document/XDocumentProperties.hpp>
#include <scabstdlg.hxx>
+#include <vcl/EnumContext.hxx>
+#include <vcl/notebookbar.hxx>
+
// for mouse wheel
#define MINZOOM_SLIDER 10
#define MAXZOOM_SLIDER 400
@@ -155,6 +158,15 @@ ScPreviewShell::ScPreviewShell( SfxViewFrame* pViewFrame,
{
Construct( &pViewFrame->GetWindow() );
+ SfxShell::SetContextBroadcasterEnabled(true);
+ SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context::Printpreview));
+ SfxShell::BroadcastContextForActivation(true);
+
+
+ auto& pNotebookBar = pViewFrame->GetWindow().GetSystemWindow()->GetNotebookBar();
+ if (pNotebookBar)
+ pNotebookBar->ControlListener(true);
+
if ( auto pTabViewShell = dynamic_cast<ScTabViewShell*>( pOldSh) )
{
// store view settings, show table from TabView
@@ -181,6 +193,9 @@ ScPreviewShell::~ScPreviewShell()
if (mpFrameWindow)
mpFrameWindow->SetCloseHdl(Link<SystemWindow&,void>()); // Remove close handler.
+ if (auto& pBar = GetViewFrame()->GetWindow().GetSystemWindow()->GetNotebookBar())
+ pBar->ControlListener(false);
+
// #108333#; notify Accessibility that Shell is dying and before destroy all
BroadcastAccessibility( SfxHint( SfxHintId::Dying ) );
pAccessibilityBroadcaster.reset();
diff --git a/sc/uiconfig/scalc/ui/notebookbar.ui b/sc/uiconfig/scalc/ui/notebookbar.ui
index 5f0b0d9b4802..de1c182856d8 100644
--- a/sc/uiconfig/scalc/ui/notebookbar.ui
+++ b/sc/uiconfig/scalc/ui/notebookbar.ui
@@ -12873,6 +12873,9 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="CalcNotebookbar|PrintLabel">Print</property>
+ <style>
+ <class name="context-Printpreview"/>
+ </style>
</object>
<packing>
<property name="position">12</property>
More information about the Libreoffice-commits
mailing list