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.stahl@allotropia.de>
diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx
index 4f733dc..8fb0493 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