sd/qa/unit/uiimpress.cxx | 2 +- sd/source/ui/view/Outliner.cxx | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-)
New commits: commit 5f4ebedcd010f8248d9eea93bd36142a64820fe5 Author: Justin Luth <justin_l...@sil.org> AuthorDate: Fri Jan 21 11:08:46 2022 +0200 Commit: Justin Luth <jl...@mail.com> CommitDate: Sat Feb 5 20:02:39 2022 +0100 tdf#123658 sd search: restart search start on slide change When the user switches between slides and then re-starts a search, they expect that the search will begin on the current slide. This fixes a somewhat 5.2 regression. Before that time, the first search attempt failed, but the second attempt started at the current slide. After 5.2 fixed the first-attempt-failure, the starting position was "the slide after the last find". This patch resets the starting position to the current slide, which I saw was done in every case by DetectChange(). I thought about moving all this logic into DetectChange, but it doesn't make much sense to affect a spell-checking dialog run by moving around in the slides, so just keep the logic here. I submitted the unit test in a PRIOR patch. The basic search was failing on WIN/MAC platforms and so I wanted to confirm that this was NOT my fault. Indeed, on those OSes the testing fails, so I just run it under Linux where it works fine. Change-Id: I4d1af3049bb2c0a59ec46f005c4b1773aefffb6d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129204 Tested-by: Jenkins Reviewed-by: Justin Luth <jl...@mail.com> diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx index fcaa970cc929..0c3930457776 100644 --- a/sd/qa/unit/uiimpress.cxx +++ b/sd/qa/unit/uiimpress.cxx @@ -869,7 +869,7 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf123658_SearchAfterSlideChange) lcl_search("of"); // Instead of finding this on the 1st page (or on the 2nd page would be acceptable too) // it was going to the third page. - //checkCurrentPageNumber(1); + checkCurrentPageNumber(1); } #endif diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index 0e9b2fba833f..e03b56bf1a3d 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -809,6 +809,14 @@ bool SdOutliner::SearchAndReplaceOnce(std::vector<sd::SearchSelection>* pSelecti if (!getOutlinerView() || !GetEditEngine().HasView(&getOutlinerView()->GetEditView())) { + std::shared_ptr<sd::DrawViewShell> pDrawViewShell ( + std::dynamic_pointer_cast<sd::DrawViewShell>(pViewShell)); + + // Perhaps the user switched to a different page/slide between searches. + // If so, reset the starting search position to the current slide like DetectChange does + if (pDrawViewShell && pDrawViewShell->GetCurPagePos() != maCurrentPosition.mnPageIndex) + maObjectIterator = sd::outliner::OutlinerContainer(this).current(); + mpImpl->ProvideOutlinerView(*this, pViewShell, mpWindow); }