sd/qa/unit/tiledrendering/LOKitSearchTest.cxx | 12 +++--- sd/source/ui/view/Outliner.cxx | 45 +++++++++++++------------- vcl/source/graphic/VectorGraphicSearch.cxx | 14 ++++---- 3 files changed, 36 insertions(+), 35 deletions(-)
New commits: commit ab27ec31ebd82ec5d879b412f20166b1e67c0c04 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Sun May 31 10:05:17 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Sun May 31 10:05:17 2020 +0200 sd: rename testSearchInMixedObject(2) to more descriptive name testSearchInMixedObject -> testSearchIn2MixedObjects testSearchInMixedObject2 -> testSearchIn6MixedObjects Change-Id: Ifba20df38fd33bb86b072ba79085d123c914f916 diff --git a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx index 7786bc1f1dae..ec9f7d95c5da 100644 --- a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx +++ b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx @@ -55,8 +55,8 @@ public: void testDontSearchInMasterPages(); void testSearchInPDFNonExisting(); void testSearchInPDF(); - void testSearchInMixedObject(); - void testSearchInMixedObject2(); + void testSearchIn2MixedObjects(); + void testSearchIn6MixedObjects(); CPPUNIT_TEST_SUITE(LOKitSearchTest); CPPUNIT_TEST(testSearch); @@ -67,8 +67,8 @@ public: CPPUNIT_TEST(testDontSearchInMasterPages); CPPUNIT_TEST(testSearchInPDFNonExisting); CPPUNIT_TEST(testSearchInPDF); - CPPUNIT_TEST(testSearchInMixedObject); - CPPUNIT_TEST(testSearchInMixedObject2); + CPPUNIT_TEST(testSearchIn2MixedObjects); + CPPUNIT_TEST(testSearchIn6MixedObjects); CPPUNIT_TEST_SUITE_END(); private: @@ -332,7 +332,7 @@ void LOKitSearchTest::testSearchInPDF() // Test searching in document with mixed objects. // We have 2 objects: 1. Text Object, 2. Graphic Object with PDF -void LOKitSearchTest::testSearchInMixedObject() +void LOKitSearchTest::testSearchIn2MixedObjects() { SdXImpressDocument* pXImpressDocument = createDoc("MixedTest1.odg"); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); @@ -417,7 +417,7 @@ void LOKitSearchTest::testSearchInMixedObject() } // Test searching in document with mixed objects. We have 6 objects. -void LOKitSearchTest::testSearchInMixedObject2() +void LOKitSearchTest::testSearchIn6MixedObjects() { SdXImpressDocument* pXImpressDocument = createDoc("MixedTest2.odg"); sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); commit 1fbadbebf7c69f3bcbc623b42a2dcc341ce0fe9c Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Sun May 31 09:58:26 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Sun May 31 09:58:26 2020 +0200 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 diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index 04c8201389c3..2fc9bb8f3ab4 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -1171,6 +1171,7 @@ void SdOutliner::ProvideNextTextObject() mbFoundObject = false; // reset the vector search + mpImpl->mbCurrentIsVectorGraphic = false; mpImpl->mpVectorGraphicSearch.reset(); mpView->UnmarkAllObj (mpView->GetSdrPageView()); @@ -1206,6 +1207,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) { @@ -1239,34 +1241,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 { @@ -1299,6 +1297,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; commit 3c0565f4264ac15e4d52f1d38e0976f66b60b57e Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Sun May 31 09:51:33 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Sun May 31 09:51:33 2020 +0200 vcl: VectorGraphicSearch - clean-up SearchContext member vars. Change-Id: I1740be5ed1b47235da3794fa46e3533b17ca1fb8 diff --git a/vcl/source/graphic/VectorGraphicSearch.cxx b/vcl/source/graphic/VectorGraphicSearch.cxx index 4b2aedad1bdc..2fa0d536442d 100644 --- a/vcl/source/graphic/VectorGraphicSearch.cxx +++ b/vcl/source/graphic/VectorGraphicSearch.cxx @@ -34,26 +34,26 @@ public: class SearchContext { -public: - bool bInitialized = false; - +private: FPDF_DOCUMENT mpPdfDocument; - sal_Int32 mnPageIndex; FPDF_PAGE mpPage; FPDF_TEXTPAGE mpTextPage; + FPDF_SCHHANDLE mpSearchHandle; + +public: + sal_Int32 mnPageIndex; OUString maSearchString; SearchStartPosition meStartPosition; - FPDF_SCHHANDLE mpSearchHandle; SearchContext(FPDF_DOCUMENT pPdfDocument, sal_Int32 nPageIndex, OUString const& rSearchString, SearchStartPosition eStartPosition) : mpPdfDocument(pPdfDocument) - , mnPageIndex(nPageIndex) , mpPage(nullptr) , mpTextPage(nullptr) + , mpSearchHandle(nullptr) + , mnPageIndex(nPageIndex) , maSearchString(rSearchString) , meStartPosition(eStartPosition) - , mpSearchHandle(nullptr) { } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits