sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx | 30 ++++++++-- 1 file changed, 26 insertions(+), 4 deletions(-)
New commits: commit a50b13f357ffa403542a09de0552c048d6374011 Author: Sarper Akdemir <sarper.akde...@allotropia.de> AuthorDate: Fri May 24 15:11:24 2024 +0200 Commit: Sarper Akdemir <sarper.akde...@allotropia.de> CommitDate: Fri May 24 18:03:28 2024 +0200 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.akde...@allotropia.de> 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); } }