summaryrefslogtreecommitdiff
path: root/sd/source/ui
diff options
context:
space:
mode:
authorSarper Akdemir <sarper.akdemir@allotropia.de>2024-05-24 15:11:24 +0200
committerThorsten Behrens <thorsten.behrens@allotropia.de>2024-05-28 13:45:51 +0200
commitef71c6529f694a1714f15b3fb018830211253024 (patch)
tree4ddca22810593876afd7f2c20b830db574eeb324 /sd/source/ui
parent4655057fd8fdfe55855bd84daf30d4079012cefa (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> (cherry picked from commit a50b13f357ffa403542a09de0552c048d6374011) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168063 Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de> Tested-by: allotropia jenkins <jenkins@allotropia.de>
Diffstat (limited to 'sd/source/ui')
-rw-r--r--sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx30
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);
}
}