sd/source/ui/inc/DrawViewShell.hxx                             |    3 ++-
 sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx |    1 -
 sd/source/ui/view/drviews1.cxx                                 |    9 ++++++++-
 sd/source/ui/view/viewshe2.cxx                                 |    2 +-
 4 files changed, 11 insertions(+), 4 deletions(-)

New commits:
commit 8346ab98c1f84026bcdfad714e5e690b2f9147c0
Author:     Sarper Akdemir <sarper.akde...@allotropia.de>
AuthorDate: Tue Apr 8 15:41:34 2025 +0200
Commit:     Sarper Akdemir <sarper.akde...@allotropia.de>
CommitDate: Wed Apr 9 11:48:16 2025 +0200

    sd: impress: fix scrollbar not updating on PgUp/PgDown
    
    make scrollbars update when the current slide is switched via
    hotkeys.
    which eliminates now not needed UpdateScrollBars call at
    CurrentSlideManager.
    
    Change-Id: I89db8c45edd14a871e6d9901a156609ad569984c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183854
    Tested-by: Jenkins
    Reviewed-by: Sarper Akdemir <sarper.akde...@allotropia.de>

diff --git a/sd/source/ui/inc/DrawViewShell.hxx 
b/sd/source/ui/inc/DrawViewShell.hxx
index 7d2f275753c1..1bb5b629351b 100644
--- a/sd/source/ui/inc/DrawViewShell.hxx
+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -253,7 +253,8 @@ public:
 
     void            ResetActualPage();
     void            ResetActualLayer();
-    SD_DLLPUBLIC bool SwitchPage(sal_uInt16 nPage, bool bAllowChangeFocus = 
true);
+    SD_DLLPUBLIC bool SwitchPage(sal_uInt16 nPage, bool bAllowChangeFocus = 
true,
+                                 bool bUpdateScrollbars = true);
     bool            IsSwitchPageAllowed() const;
 
     /**
diff --git a/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx 
b/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx
index 7a531a3fbff3..c274494495ec 100644
--- a/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx
@@ -200,7 +200,6 @@ void CurrentSlideManager::SetCurrentSlideAtViewShellBase 
(const SharedPageDescri
             pDrawViewShell->SwitchPage(nPageNumber);
             TabControl& rPageTabControl = pDrawViewShell->GetPageTabControl();
             
rPageTabControl.SetCurPageId(rPageTabControl.GetPageId(nPageNumber));
-            pDrawViewShell->UpdateScrollBars();
         }
     }
 }
diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx
index e77211fc3496..4739e72b7145 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -805,8 +805,12 @@ bool DrawViewShell::IsSelected(sal_uInt16 nPage)
  * bAllowChangeFocus set to false when slide is inserted before current page
  *                   and we need to only update the current page number,
  *                   do not disturb editing in that case
+ * bUpdateScrollbars set to false when the scrollbars are going to be updated 
by
+ *                   some other mechanism. (e.g. if the page switch happened as
+ *                   a result of a scroll)
  */
-bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage, bool 
bAllowChangeFocus)
+bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage, bool 
bAllowChangeFocus,
+                               bool bUpdateScrollbars)
 {
     /** Under some circumstances there are nested calls to SwitchPage() and
         may crash the application (activation of form controls when the
@@ -1162,6 +1166,9 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage, 
bool bAllowChangeFocus)
         UpdatePreview( mpActualPage );
 
         mpDrawView->AdjustMarkHdl();
+
+        if(bUpdateScrollbars)
+            UpdateScrollBars();
     }
 
     return bOK;
diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx
index 3c2e70b37184..54fa6093b3f6 100644
--- a/sd/source/ui/view/viewshe2.cxx
+++ b/sd/source/ui/view/viewshe2.cxx
@@ -269,7 +269,7 @@ void ViewShell::VirtVScrollHdl(ScrollAdaptor* pVScroll)
                        static_cast<double>(nTotalPages - 1));
 
         if (nCurPage != nNewPage)
-            static_cast<DrawViewShell*>(this)->SwitchPage(nNewPage);
+            static_cast<DrawViewShell*>(this)->SwitchPage(nNewPage, true, 
false);
 
         double fNewPageStart = nNewPage * fScrollableDistancePerPage;
         double fY = (pVScroll->GetThumbPos() / fMappingFactor) - fNewPageStart;

Reply via email to