diff options
-rw-r--r-- | sc/source/ui/view/prevwsh.cxx | 15 | ||||
-rw-r--r-- | sc/uiconfig/scalc/ui/notebookbar.ui | 3 |
2 files changed, 18 insertions, 0 deletions
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> |