sc/source/ui/view/prevwsh.cxx       |   13 +++++++++++++
 sc/uiconfig/scalc/ui/notebookbar.ui |    3 +++
 2 files changed, 16 insertions(+)

New commits:
commit 3f9c477929c261a8862411c00153e4c7d0d0ae7c
Author:     andreas kainz <kain...@gmail.com>
AuthorDate: Wed Oct 17 21:41:25 2018 +0200
Commit:     andreas_kainz <kain...@gmail.com>
CommitDate: Thu Oct 18 21:02:24 2018 +0200

    Notebookbar: add context-Printpreview to calc tabbed NB
    
    Change-Id: Iee6c83ae03ead7ae0b2c33f6cf364c1c3c59528f
    Reviewed-on: https://gerrit.libreoffice.org/61892
    Reviewed-by: andreas_kainz <kain...@gmail.com>
    Tested-by: andreas_kainz <kain...@gmail.com>

diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx
index 42d6700d0ab5..1ad9c412f049 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,13 @@ ScPreviewShell::ScPreviewShell( SfxViewFrame* pViewFrame,
 {
     Construct( &pViewFrame->GetWindow() );
 
+    SfxShell::SetContextBroadcasterEnabled(true);
+    
SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context::Printpreview));
+    SfxShell::BroadcastContextForActivation(true);
+
+    if (auto& pBar = 
SfxViewFrame::Current()->GetWindow().GetSystemWindow()->GetNotebookBar())
+        pBar->ControlListener(true);
+
     if ( auto pTabViewShell = dynamic_cast<ScTabViewShell*>( pOldSh) )
     {
         //  store view settings, show table from TabView
@@ -181,6 +191,9 @@ ScPreviewShell::~ScPreviewShell()
     if (mpFrameWindow)
         mpFrameWindow->SetCloseHdl(Link<SystemWindow&,void>()); // Remove 
close handler.
 
+    if (auto& pBar = 
SfxViewFrame::Current()->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 ca39249bc22f..418cb46f549c 100644
--- a/sc/uiconfig/scalc/ui/notebookbar.ui
+++ b/sc/uiconfig/scalc/ui/notebookbar.ui
@@ -12841,6 +12841,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>
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to