summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorKshitij Pathania <kshitijpathania@gmail.com>2018-07-02 18:48:19 +0530
committerSzymon Kłos <szymon.klos@collabora.com>2018-07-04 12:46:01 +0200
commitd05b7b32d9ecb6fcb4a268eb68cdcee09bafa6dd (patch)
treec82f797131cfbdfd8933daad0fea249b50c49ad6 /sw
parentea39c41fdf63191579d25f327db81db14862251c (diff)
Notebookbar:Context for printpreview is now working
Also the context stuff is now working well even after print preview is set Change-Id: Ia43f512394cf4d162b4019257c039aecb664df22 Reviewed-on: https://gerrit.libreoffice.org/56740 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/uibase/uiview/pview.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx
index 1138834932a1..2a83ada829e0 100644
--- a/sw/source/uibase/uiview/pview.cxx
+++ b/sw/source/uibase/uiview/pview.cxx
@@ -78,6 +78,8 @@
#include <svx/dialogs.hrc>
#include <memory>
+#include <vcl/EnumContext.hxx>
+#include <vcl/notebookbar.hxx>
using namespace ::com::sun::star;
SFX_IMPL_NAMED_VIEWFACTORY(SwPagePreview, "PrintPreview")
@@ -1157,6 +1159,13 @@ SwPagePreview::SwPagePreview(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh):
CreateScrollbar( true );
CreateScrollbar( false );
+ //notify notebookbar change in context
+ SfxShell::SetContextBroadcasterEnabled(true);
+ SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context::Printpreview));
+ SfxShell::BroadcastContextForActivation(true);
+ //removelisteners for notebookbar
+ SfxViewFrame::Current()->GetWindow().GetSystemWindow()->GetNotebookBar()->ControlListener(true);
+
SfxObjectShell* pObjShell = pViewFrame->GetObjectShell();
if ( !pOldSh )
{
@@ -1221,7 +1230,7 @@ SwPagePreview::~SwPagePreview()
delete pVShell;
m_pViewWin.disposeAndClear();
-
+ SfxViewFrame::Current()->GetWindow().GetSystemWindow()->GetNotebookBar()->ControlListener(false);
m_pScrollFill.disposeAndClear();
m_pHScrollbar.disposeAndClear();
m_pVScrollbar.disposeAndClear();