From dead431f4197a278a16782762371a617c5c468f8 Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Sun, 31 May 2020 09:58:26 +0200 Subject: sd: PDF search - reset mpVectorGraphicSearch at more places MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit and simplify the case when the search doesn't find a match in the vector graphic. Change-Id: I3e086e8e36f8a578711eed6d4dcca65c0c4c6268 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95456 Tested-by: Tomaž Vajngerl Reviewed-by: Tomaž Vajngerl (cherry picked from commit f60caab2c867a578b6e6b963ebd5a72b5a12463e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95942 Tested-by: Jenkins CollaboraOffice (cherry picked from commit f0ef50cbfe6039dc9dd00f89af8596f309223cb7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99811 --- sd/source/ui/view/Outliner.cxx | 45 +++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index 801acc7c6859..441a0d3ac242 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -1187,6 +1187,7 @@ void SdOutliner::ProvideNextTextObject() mbFoundObject = false; // reset the vector search + mpImpl->mbCurrentIsVectorGraphic = false; mpImpl->mpVectorGraphicSearch.reset(); mpView->UnmarkAllObj (mpView->GetSdrPageView()); @@ -1222,6 +1223,7 @@ void SdOutliner::ProvideNextTextObject() bool bForbiddenPage = comphelper::LibreOfficeKit::isActive() && (maCurrentPosition.mePageKind != PageKind::Standard || maCurrentPosition.meEditMode != EditMode::Page); mpImpl->mbCurrentIsVectorGraphic = false; + mpImpl->mpVectorGraphicSearch.reset(); if (!bForbiddenPage) { @@ -1255,34 +1257,30 @@ void SdOutliner::ProvideNextTextObject() OUString const & rString = mpSearchItem->GetSearchString(); mpImpl->mpVectorGraphicSearch = std::make_unique(pGraphicObject->GetGraphic()); - if (mpImpl->mpVectorGraphicSearch->search(rString)) + + bool bResult = mpImpl->mpVectorGraphicSearch->search(rString); + if (bResult) + bResult = mpImpl->mpVectorGraphicSearch->next(); + + if (bResult) { - bool bResult = mpImpl->mpVectorGraphicSearch->next(); - if (bResult) - { - mpObj = SetObject(maCurrentPosition); + mpObj = SetObject(maCurrentPosition); - mbStringFound = true; - mbMatchMayExist = true; - mbFoundObject = true; + mbStringFound = true; + mbMatchMayExist = true; + mbFoundObject = true; - SdrPageView* pPageView = mpView->GetSdrPageView(); - mpView->UnmarkAllObj(pPageView); + SdrPageView* pPageView = mpView->GetSdrPageView(); + mpView->UnmarkAllObj(pPageView); - std::vector aSubSelections; - basegfx::B2DRectangle aSubSelection = getPDFSelection(mpImpl->mpVectorGraphicSearch, mpObj); - if (!aSubSelection.isEmpty()) - aSubSelections.push_back(aSubSelection); + std::vector aSubSelections; + basegfx::B2DRectangle aSubSelection = getPDFSelection(mpImpl->mpVectorGraphicSearch, mpObj); + if (!aSubSelection.isEmpty()) + aSubSelections.push_back(aSubSelection); - mpView->MarkObj(mpObj, pPageView, false, false, aSubSelections); + mpView->MarkObj(mpObj, pPageView, false, false, aSubSelections); - mpDrawDocument->GetDocSh()->SetWaitCursor( false ); - } - else - { - mpImpl->mbCurrentIsVectorGraphic = false; - mpImpl->mpVectorGraphicSearch.reset(); - } + mpDrawDocument->GetDocSh()->SetWaitCursor( false ); } else { @@ -1315,6 +1313,9 @@ void SdOutliner::ProvideNextTextObject() } else { + mpImpl->mbCurrentIsVectorGraphic = false; + mpImpl->mpVectorGraphicSearch.reset(); + if (meMode == SEARCH) // Instead of doing a full-blown SetObject(), which would do the same -- but would also possibly switch pages. mbStringFound = false; -- cgit