diff options
author | Sarper Akdemir <sarper.akdemir@allotropia.de> | 2024-05-24 15:11:24 +0200 |
---|---|---|
committer | Sarper Akdemir <sarper.akdemir@allotropia.de> | 2024-05-24 18:03:28 +0200 |
commit | a50b13f357ffa403542a09de0552c048d6374011 (patch) | |
tree | 2273600dbe2a289f6409692d749d23fdda57666c /sd | |
parent | 8112883acf0015066f21dece7e1109dbda3e4cae (diff) |
related tdf#33603: update current page on SlideSorter view
Make SlideSorterView update the current page properly when it is the
MainViewShell.
Also fixes Notes Pane not properly updating on SlideSorter
view mode.
Change-Id: If4fed4e84951cb4a1707874b288ac46e6d5c26da
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168022
Tested-by: Jenkins
Reviewed-by: Sarper Akdemir <sarper.akdemir@allotropia.de>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx b/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx index e8fc847a4a7b..684cb2da5f7e 100644 --- a/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx @@ -28,6 +28,8 @@ #include <ViewShellBase.hxx> #include <ViewShell.hxx> #include <DrawViewShell.hxx> +#include <DrawController.hxx> +#include <drawdoc.hxx> #include <sdpage.hxx> #include <FrameView.hxx> #include <com/sun/star/beans/XPropertySet.hpp> @@ -166,7 +168,29 @@ void CurrentSlideManager::SetCurrentSlideAtViewShellBase (const SharedPageDescri OSL_ASSERT(rpDescriptor); ViewShellBase* pBase = mrSlideSorter.GetViewShellBase(); - if (pBase != nullptr) + if(!pBase) + return; + + if (mrSlideSorter.GetViewShell() && mrSlideSorter.GetViewShell()->IsMainViewShell()) + { + SdDrawDocument* pDoc = pBase->GetDocument(); + if (!pDoc) + return; + + // deselect all pages + for (sal_uInt16 i = 0; i < pDoc->GetSdPageCount(PageKind::Standard); i++) + pDoc->SetSelected(pDoc->GetSdPage(i, PageKind::Standard), false); + + // select the given page + pDoc->SetSelected(rpDescriptor->GetPage(), true); + DrawController* pDrawController = pBase->GetDrawController(); + if (!pDrawController) + return; + + pDrawController->FireSelectionChangeListener(); + pDrawController->FireSwitchCurrentPage(rpDescriptor->GetPage()); + } + else { DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>( pBase->GetMainViewShell().get()); @@ -245,9 +269,7 @@ IMPL_LINK_NOARG(CurrentSlideManager, SwitchPageCallback, Timer *, void) // it does not work always correctly (after some kinds of model // changes). Therefore, we call DrawViewShell::SwitchPage(), // too. - ViewShell* pViewShell = mrSlideSorter.GetViewShell(); - if (pViewShell==nullptr || ! pViewShell->IsMainViewShell()) - SetCurrentSlideAtViewShellBase(mpCurrentSlide); + SetCurrentSlideAtViewShellBase(mpCurrentSlide); SetCurrentSlideAtXController(mpCurrentSlide); } } |