sd: scroll the Presenter Console slide overview to the current slide

The slide overview (PresenterSlideSorter) always opened scrolled to the
top, ignoring the current slide, because UpdateLayout() resets the
scroll offset to 0 and only setCurrentPage() called ScrollSlideIntoView
(and only when the slide index changed). Opening/resizing the grid does
not change that index. Call ScrollSlideIntoView(mnCurrentSlideIndex) at
the end of UpdateLayout(), guarded by mnCurrentSlideIndex >= 0.

To reproduce the issue, with a single screen setup we can go to Slide
Show - Slide Show Settings - Presenter console: Windowed, then create 30
slides (copying and pasting a slide is the quickest way) and start the
presentation with Shift+F5 from the last slide. In the console view, we
click the Slides button from the bottom toolbar. With the multiple rows
of slides and the scrollbar appearing, we can see the issue of the view
not being pre-scrolled to the active slide.

Change-Id: I61f1a1eb10e2ec032fa385f77081c00ff6b0d08a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208056
Tested-by: Jenkins
Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
This commit is contained in:
Denis A. Altoé Falqueto
2026-07-14 11:49:03 +02:00
committed by Ilmari Lauhakangas
parent 8cfa628be8
commit 88d1c60b18
@@ -672,6 +672,9 @@ void PresenterSlideSorter::UpdateLayout()
mpLayout->SetupVisibleArea();
mpLayout->UpdateScrollBars();
if (mnCurrentSlideIndex >= 0)
ScrollSlideIntoView(mnCurrentSlideIndex);
// Tell the preview cache about some of the values.
mxPreviewCache->setPreviewSize(mpLayout->maPreviewSize);
mxPreviewCache->setVisibleRange(