diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2020-05-31 09:58:26 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2020-06-04 00:42:39 +0200 |
commit | f60caab2c867a578b6e6b963ebd5a72b5a12463e (patch) | |
tree | 3fc2545f23d77cadd2ba1b53030bdf6741de5b5a /sd | |
parent | ceaa07e1a1aafd9a11b8baea242605f32c56e584 (diff) |
sd: PDF search - reset mpVectorGraphicSearch at more places
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 <quikee@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/view/Outliner.cxx | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index 52326f0dfbf8..44ecd9182e6b 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -1159,6 +1159,7 @@ void SdOutliner::ProvideNextTextObject() mbFoundObject = false; // reset the vector search + mpImpl->mbCurrentIsVectorGraphic = false; mpImpl->mpVectorGraphicSearch.reset(); mpView->UnmarkAllObj (mpView->GetSdrPageView()); @@ -1194,6 +1195,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) { @@ -1227,34 +1229,30 @@ void SdOutliner::ProvideNextTextObject() OUString const & rString = mpSearchItem->GetSearchString(); mpImpl->mpVectorGraphicSearch = std::make_unique<VectorGraphicSearch>(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<basegfx::B2DRectangle> aSubSelections; - basegfx::B2DRectangle aSubSelection = getPDFSelection(mpImpl->mpVectorGraphicSearch, mpObj); - if (!aSubSelection.isEmpty()) - aSubSelections.push_back(aSubSelection); + std::vector<basegfx::B2DRectangle> 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 { @@ -1287,6 +1285,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; |