diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2021-01-22 11:55:06 +0100 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2021-01-25 15:21:46 +0100 |
commit | 2a2e1bcfbeffbed39a90ea61486f95041579c6d4 (patch) | |
tree | e397eb50a5de3b70a23926031cde22308f320ca3 | |
parent | 5864fcba2d7d285cb0f8628b0c24d0f31deb2ab0 (diff) |
tdf#139830: keep the right context for chart after view switch (impress).
Change-Id: Ida345dd884a09b88e35e0df6f9520528c910d9d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109791
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109902
-rw-r--r-- | sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx index 4811c360b4b4..2659fa475469 100644 --- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx +++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx @@ -61,10 +61,8 @@ #include <svx/svxids.hrc> #include <vcl/EnumContext.hxx> #include <svx/sidebar/ContextChangeEventMultiplexer.hxx> -#include <svx/sidebar/SelectionAnalyzer.hxx> -#include <com/sun/star/drawing/framework/XControllerManager.hpp> -#include <com/sun/star/drawing/framework/ResourceId.hpp> -#include <cppuhelper/bootstrap.hxx> +#include <sfx2/sidebar/SidebarController.hxx> +#include <sfx2/sidebar/Tools.hxx> using namespace ::sd::slidesorter; #define ShellClass_SlideSorterViewShell @@ -79,6 +77,24 @@ using ::vcl::EnumContext; namespace sd { namespace slidesorter { +namespace { + +bool inChartContext(sd::View* pView) +{ + if (!pView) + return false; + + SfxViewShell* pViewShell = pView->GetSfxViewShell(); + sfx2::sidebar::SidebarController* pSidebar = sfx2::sidebar::Tools::GetSidebarController(pViewShell); + if (pSidebar) + return pSidebar->hasChartContextCurrently(); + + return false; +} + +} // anonymous namespace + + SFX_IMPL_INTERFACE(SlideSorterViewShell, SfxShell) void SlideSorterViewShell::InitInterface_Impl() @@ -449,6 +465,17 @@ void SlideSorterViewShell::ArrangeGUIElements() void SlideSorterViewShell::Activate (bool bIsMDIActivate) { + if(inChartContext(GetView())) + { + // Avoid context changes for chart during activation / deactivation. + const bool bIsContextBroadcasterEnabled (SfxShell::SetContextBroadcasterEnabled(false)); + + ViewShell::Activate(bIsMDIActivate); + + SfxShell::SetContextBroadcasterEnabled(bIsContextBroadcasterEnabled); + return; + } + ViewShell::Activate(bIsMDIActivate); if (mbIsArrangeGUIElementsPending) ArrangeGUIElements(); |