sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx | 12 ++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
New commits: commit e940f28d57d87212b2a160c9a6ac69009f35b867 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Nov 23 16:16:05 2022 +0000 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Thu Nov 24 19:27:01 2022 +0100 Resolves: tdf#145491 make sure focused page is selected after undo/redo Change-Id: I269315556624c48373815640605a93c91a4c9819 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143156 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx index 4f733dc5c9c6..8fb0493a0b98 100644 --- a/sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx @@ -121,11 +121,17 @@ void SelectionObserver::EndObservation() } aUpdateLock.Release(); - bool bSuccess = mrSlideSorter.GetController().GetFocusManager().SetFocusedPageToCurrentPage(); + FocusManager& rFocusManager = mrSlideSorter.GetController().GetFocusManager(); + bool bSuccess = rFocusManager.SetFocusedPageToCurrentPage(); // tdf#129346 nothing currently selected, select something, if possible // but (tdf#129346) only if setting focus to current page failed - if (!bSuccess && rSelector.GetPageCount() && rSelector.GetSelectedPageCount() == 0) - rSelector.SelectPage(0); + if (rSelector.GetPageCount() && rSelector.GetSelectedPageCount() == 0) + { + if (bSuccess) + rSelector.SelectPage(rFocusManager.GetFocusedPageDescriptor()); + else + rSelector.SelectPage(0); + } } } // end of namespace ::sd::slidesorter::controller