diff options
Diffstat (limited to 'sw/source/uibase/shells/olesh.cxx')
-rw-r--r-- | sw/source/uibase/shells/olesh.cxx | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/sw/source/uibase/shells/olesh.cxx b/sw/source/uibase/shells/olesh.cxx index b8207d200c94..28e8e153eeb1 100644 --- a/sw/source/uibase/shells/olesh.cxx +++ b/sw/source/uibase/shells/olesh.cxx @@ -23,10 +23,28 @@ #include <frmsh.hxx> #include <olesh.hxx> +#include <sfx2/sidebar/SidebarController.hxx> + #define ShellClass_SwOleShell #include <sfx2/msg.hxx> #include <swslots.hxx> +using namespace css::uno; +using namespace sfx2::sidebar; + +namespace { + +bool inChartOrMathContext(const SwView& rViewShell) +{ + SidebarController* pSidebar = SidebarController::GetSidebarControllerForView(&rViewShell); + if (pSidebar) + return pSidebar->hasChartOrMathContextCurrently(); + + return false; +} + +} // anonymous namespace + SFX_IMPL_INTERFACE(SwOleShell, SwFrameShell) void SwOleShell::InitInterface_Impl() @@ -36,6 +54,36 @@ void SwOleShell::InitInterface_Impl() GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT, SfxVisibilityFlags::Invisible, ToolbarId::Ole_Toolbox); } +void SwOleShell::Activate(bool bMDI) +{ + if(!inChartOrMathContext(GetView())) + SwFrameShell::Activate(bMDI); + else + { + // Avoid context changes for chart/math during activation / deactivation. + const bool bIsContextBroadcasterEnabled (SfxShell::SetContextBroadcasterEnabled(false)); + + SwFrameShell::Activate(bMDI); + + SfxShell::SetContextBroadcasterEnabled(bIsContextBroadcasterEnabled); + } +} + +void SwOleShell::Deactivate(bool bMDI) +{ + if(!inChartOrMathContext(GetView())) + SwFrameShell::Deactivate(bMDI); + else + { + // Avoid context changes for chart/math during activation / deactivation. + const bool bIsContextBroadcasterEnabled (SfxShell::SetContextBroadcasterEnabled(false)); + + SwFrameShell::Deactivate(bMDI); + + SfxShell::SetContextBroadcasterEnabled(bIsContextBroadcasterEnabled); + } +} + SwOleShell::SwOleShell(SwView &_rView) : SwFrameShell(_rView) |