sw/source/uibase/inc/olesh.hxx | 4 +++ sw/source/uibase/shells/olesh.cxx | 49 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+)
New commits: commit 4211ce171cceee978b6e85ea9accaa6726e774c4 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Fri Jan 22 11:55:25 2021 +0100 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Mon Jan 25 18:40:20 2021 +0100 tdf#139830: keep the right context for chart after view switch (writer). Change-Id: Id4829e4bf8f52e2348ebd7874c77e245b18a2bb9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109812 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109899 Tested-by: Jenkins diff --git a/sw/source/uibase/inc/olesh.hxx b/sw/source/uibase/inc/olesh.hxx index 4f21b2a0396a..a5c9eb28d051 100644 --- a/sw/source/uibase/inc/olesh.hxx +++ b/sw/source/uibase/inc/olesh.hxx @@ -30,6 +30,10 @@ private: /// SfxInterface initializer. static void InitInterface_Impl(); +protected: + virtual void Activate(bool bMDI) override; + virtual void Deactivate(bool bMDI) override; + public: SwOleShell(SwView& rView); }; diff --git a/sw/source/uibase/shells/olesh.cxx b/sw/source/uibase/shells/olesh.cxx index b8207d200c94..b823d9a1e6b4 100644 --- a/sw/source/uibase/shells/olesh.cxx +++ b/sw/source/uibase/shells/olesh.cxx @@ -23,10 +23,29 @@ #include <frmsh.hxx> #include <olesh.hxx> +#include <sfx2/sidebar/SidebarController.hxx> +#include <view.hxx> + #define ShellClass_SwOleShell #include <sfx2/msg.hxx> #include <swslots.hxx> +using namespace css::uno; +using namespace sfx2::sidebar; + +namespace { + +bool inChartContext(SwView& rViewShell) +{ + SidebarController* pSidebar = SidebarController::GetSidebarControllerForView(&rViewShell); + if (pSidebar) + return pSidebar->hasChartContextCurrently(); + + return false; +} + +} // anonymous namespace + SFX_IMPL_INTERFACE(SwOleShell, SwFrameShell) void SwOleShell::InitInterface_Impl() @@ -36,6 +55,36 @@ void SwOleShell::InitInterface_Impl() GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT, SfxVisibilityFlags::Invisible, ToolbarId::Ole_Toolbox); } +void SwOleShell::Activate(bool bMDI) +{ + if(!inChartContext(GetView())) + SwFrameShell::Activate(bMDI); + else + { + // Avoid context changes for chart during activation / deactivation. + const bool bIsContextBroadcasterEnabled (SfxShell::SetContextBroadcasterEnabled(false)); + + SwFrameShell::Activate(bMDI); + + SfxShell::SetContextBroadcasterEnabled(bIsContextBroadcasterEnabled); + } +} + +void SwOleShell::Deactivate(bool bMDI) +{ + if(!inChartContext(GetView())) + SwFrameShell::Deactivate(bMDI); + else + { + // Avoid context changes for chart during activation / deactivation. + const bool bIsContextBroadcasterEnabled (SfxShell::SetContextBroadcasterEnabled(false)); + + SwFrameShell::Deactivate(bMDI); + + SfxShell::SetContextBroadcasterEnabled(bIsContextBroadcasterEnabled); + } +} + SwOleShell::SwOleShell(SwView &_rView) : SwFrameShell(_rView) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits