[Libreoffice-commits] core.git: Branch 'feature/drawinglayercore' - 3 commits - include/vcl sd/qa sd/source vcl/qa vcl/source

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Fri May 29 21:56:14 UTC 2020


 include/vcl/VectorGraphicSearch.hxx           |   13 +++
 sd/qa/unit/tiledrendering/LOKitSearchTest.cxx |   93 ++++++++++++++++++++++++--
 sd/qa/unit/tiledrendering/data/PDFSearch.pdf  |binary
 sd/source/ui/view/Outliner.cxx                |   15 ++++
 vcl/qa/cppunit/VectorGraphicSearchTest.cxx    |   79 ++++++++++++++++++++++
 vcl/source/graphic/VectorGraphicSearch.cxx    |   42 +++++++++--
 6 files changed, 227 insertions(+), 15 deletions(-)

New commits:
commit 8ba5e7cbd070472f49cb5d67e0fc5f12ffa15cc8
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Fri May 29 23:52:50 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Fri May 29 23:52:50 2020 +0200

    vcl: add search start position support for VectorGraphicSearch
    
    By default we start at the begin of the page, but with this change
    make it possible to start at the end. This makes it possible to
    search in the backwards direction (set the start position at to
    the end and search with "previous").
    
    Change-Id: I78fb1461b86bf9eab2f91c3b9a81cbb5c6557332

diff --git a/include/vcl/VectorGraphicSearch.hxx b/include/vcl/VectorGraphicSearch.hxx
index a00c212ad61c..b67c63a844d8 100644
--- a/include/vcl/VectorGraphicSearch.hxx
+++ b/include/vcl/VectorGraphicSearch.hxx
@@ -21,6 +21,12 @@
 
 class SearchContext;
 
+enum class SearchStartPosition
+{
+    Begin,
+    End
+};
+
 class VCL_DLLPUBLIC VectorGraphicSearch final
 {
 private:
@@ -29,12 +35,14 @@ private:
     Graphic maGraphic;
     std::unique_ptr<SearchContext> mpSearchContext;
 
-    bool searchPDF(std::shared_ptr<VectorGraphicData> const& rData, OUString const& rSearchString);
+    bool searchPDF(std::shared_ptr<VectorGraphicData> const& rData, OUString const& rSearchString,
+                   SearchStartPosition eStartPosition);
 
 public:
     VectorGraphicSearch(Graphic const& rGraphic);
     ~VectorGraphicSearch();
-    bool search(OUString const& rSearchString);
+    bool search(OUString const& rSearchString,
+                SearchStartPosition eStartPosition = SearchStartPosition::Begin);
     basegfx::B2DSize pageSize();
     bool next();
     bool previous();
diff --git a/vcl/qa/cppunit/VectorGraphicSearchTest.cxx b/vcl/qa/cppunit/VectorGraphicSearchTest.cxx
index 7962c23f4e8f..5f65b4ba7e3d 100644
--- a/vcl/qa/cppunit/VectorGraphicSearchTest.cxx
+++ b/vcl/qa/cppunit/VectorGraphicSearchTest.cxx
@@ -93,32 +93,71 @@ void VectorGraphicSearchTest::testNextPrevious()
     Graphic aGraphic = rGraphicFilter.ImportUnloadedGraphic(aStream);
     aGraphic.makeAvailable();
 
-    VectorGraphicSearch aSearch(aGraphic);
-    CPPUNIT_ASSERT_EQUAL(true, aSearch.search("lazy"));
+    { // Start from the beginning of the page
+        VectorGraphicSearch aSearch(aGraphic);
+        CPPUNIT_ASSERT_EQUAL(true, aSearch.search("lazy"));
 
-    // next - first match found
-    CPPUNIT_ASSERT_EQUAL(true, aSearch.next());
-    CPPUNIT_ASSERT_EQUAL(34, aSearch.index());
+        // no previous - we are at the begin
+        CPPUNIT_ASSERT_EQUAL(false, aSearch.previous());
+        CPPUNIT_ASSERT_EQUAL(0, aSearch.index()); // nothing was yet found, so it is 0
 
-    // next - second match found
-    CPPUNIT_ASSERT_EQUAL(true, aSearch.next());
-    CPPUNIT_ASSERT_EQUAL(817, aSearch.index());
+        // next - first position found
+        CPPUNIT_ASSERT_EQUAL(true, aSearch.next());
+        CPPUNIT_ASSERT_EQUAL(34, aSearch.index());
 
-    // next - not found, index unchanged
-    CPPUNIT_ASSERT_EQUAL(false, aSearch.next());
-    CPPUNIT_ASSERT_EQUAL(817, aSearch.index());
+        // next - second position found
+        CPPUNIT_ASSERT_EQUAL(true, aSearch.next());
+        CPPUNIT_ASSERT_EQUAL(817, aSearch.index());
 
-    // previous - first match
-    CPPUNIT_ASSERT_EQUAL(true, aSearch.previous());
-    CPPUNIT_ASSERT_EQUAL(34, aSearch.index());
+        // next - not found, index unchanged
+        CPPUNIT_ASSERT_EQUAL(false, aSearch.next());
+        CPPUNIT_ASSERT_EQUAL(817, aSearch.index());
 
-    // previous - not found, index unchanged
-    CPPUNIT_ASSERT_EQUAL(false, aSearch.previous());
-    CPPUNIT_ASSERT_EQUAL(34, aSearch.index());
+        // previous - first position
+        CPPUNIT_ASSERT_EQUAL(true, aSearch.previous());
+        CPPUNIT_ASSERT_EQUAL(34, aSearch.index());
 
-    // next - second match found
-    CPPUNIT_ASSERT_EQUAL(true, aSearch.next());
-    CPPUNIT_ASSERT_EQUAL(817, aSearch.index());
+        // previous - not found, index unchanged
+        CPPUNIT_ASSERT_EQUAL(false, aSearch.previous());
+        CPPUNIT_ASSERT_EQUAL(34, aSearch.index());
+
+        // next - second position found
+        CPPUNIT_ASSERT_EQUAL(true, aSearch.next());
+        CPPUNIT_ASSERT_EQUAL(817, aSearch.index());
+    }
+
+    { // Start from the end of the page
+        VectorGraphicSearch aSearch(aGraphic);
+        CPPUNIT_ASSERT_EQUAL(true, aSearch.search("lazy", SearchStartPosition::End));
+
+        // no next - we are at the end
+        CPPUNIT_ASSERT_EQUAL(false, aSearch.next());
+        CPPUNIT_ASSERT_EQUAL(0, aSearch.index()); // nothing was yet found, so it is 0
+
+        // previous - second position found
+        CPPUNIT_ASSERT_EQUAL(true, aSearch.previous());
+        CPPUNIT_ASSERT_EQUAL(817, aSearch.index());
+
+        // previous - first position found
+        CPPUNIT_ASSERT_EQUAL(true, aSearch.previous());
+        CPPUNIT_ASSERT_EQUAL(34, aSearch.index());
+
+        // previous - not found, index unchanged
+        CPPUNIT_ASSERT_EQUAL(false, aSearch.previous());
+        CPPUNIT_ASSERT_EQUAL(34, aSearch.index());
+
+        // next - second position
+        CPPUNIT_ASSERT_EQUAL(true, aSearch.next());
+        CPPUNIT_ASSERT_EQUAL(817, aSearch.index());
+
+        // next - not found, index unchanged
+        CPPUNIT_ASSERT_EQUAL(false, aSearch.next());
+        CPPUNIT_ASSERT_EQUAL(817, aSearch.index());
+
+        // previous - first match found
+        CPPUNIT_ASSERT_EQUAL(true, aSearch.previous());
+        CPPUNIT_ASSERT_EQUAL(34, aSearch.index());
+    }
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(VectorGraphicSearchTest);
diff --git a/vcl/source/graphic/VectorGraphicSearch.cxx b/vcl/source/graphic/VectorGraphicSearch.cxx
index eb2199c7948d..4b2aedad1bdc 100644
--- a/vcl/source/graphic/VectorGraphicSearch.cxx
+++ b/vcl/source/graphic/VectorGraphicSearch.cxx
@@ -42,14 +42,17 @@ public:
     FPDF_PAGE mpPage;
     FPDF_TEXTPAGE mpTextPage;
     OUString maSearchString;
+    SearchStartPosition meStartPosition;
     FPDF_SCHHANDLE mpSearchHandle;
 
-    SearchContext(FPDF_DOCUMENT pPdfDocument, sal_Int32 nPageIndex, OUString const& rSearchString)
+    SearchContext(FPDF_DOCUMENT pPdfDocument, sal_Int32 nPageIndex, OUString const& rSearchString,
+                  SearchStartPosition eStartPosition)
         : mpPdfDocument(pPdfDocument)
         , mnPageIndex(nPageIndex)
         , mpPage(nullptr)
         , mpTextPage(nullptr)
         , maSearchString(rSearchString)
+        , meStartPosition(eStartPosition)
         , mpSearchHandle(nullptr)
     {
     }
@@ -91,7 +94,17 @@ public:
             return false;
 
         FPDF_WIDESTRING pString = reinterpret_cast<FPDF_WIDESTRING>(maSearchString.getStr());
-        mpSearchHandle = FPDFText_FindStart(mpTextPage, pString, 0, 0);
+
+        // Index where to start to search. -1 => at the end
+        int nStartIndex = meStartPosition == SearchStartPosition::End ? -1 : 0;
+
+        // FPDF_MATCHCASE, FPDF_MATCHWHOLEWORD, FPDF_CONSECUTIVE
+        // FPDF_MATCHCASE - If not set, it will not match case by default.
+        // FPDF_MATCHWHOLEWORD - If not set, it will not match the whole word by default.
+        // FPDF_CONSECUTIVE - If not set, it will skip past the current match to look for the next match.
+        int nSearchFlags = 0;
+
+        mpSearchHandle = FPDFText_FindStart(mpTextPage, pString, nSearchFlags, nStartIndex);
 
         return mpSearchHandle != nullptr;
     }
@@ -182,19 +195,20 @@ VectorGraphicSearch::~VectorGraphicSearch()
     FPDF_DestroyLibrary();
 }
 
-bool VectorGraphicSearch::search(OUString const& rSearchString)
+bool VectorGraphicSearch::search(OUString const& rSearchString, SearchStartPosition eStartPosition)
 {
     auto pData = maGraphic.getVectorGraphicData();
 
     if (pData && pData->getVectorGraphicDataType() == VectorGraphicDataType::Pdf)
     {
-        return searchPDF(pData, rSearchString);
+        return searchPDF(pData, rSearchString, eStartPosition);
     }
     return false;
 }
 
 bool VectorGraphicSearch::searchPDF(std::shared_ptr<VectorGraphicData> const& rData,
-                                    OUString const& rSearchString)
+                                    OUString const& rSearchString,
+                                    SearchStartPosition eStartPosition)
 {
     if (rSearchString.isEmpty())
         return false;
@@ -230,8 +244,8 @@ bool VectorGraphicSearch::searchPDF(std::shared_ptr<VectorGraphicData> const& rD
 
     sal_Int32 nPageIndex = std::max(rData->getPageIndex(), 0);
 
-    mpSearchContext.reset(
-        new SearchContext(mpImplementation->mpPdfDocument, nPageIndex, rSearchString));
+    mpSearchContext.reset(new SearchContext(mpImplementation->mpPdfDocument, nPageIndex,
+                                            rSearchString, eStartPosition));
 
     return mpSearchContext->initialize();
 }
commit c62155656bdc11e1e4c314de7c90daa034502fda
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Fri May 29 23:26:51 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Fri May 29 23:26:51 2020 +0200

    vcl: add "previous" search to VectorGraphicSearch
    
    Previous moves backwards in the search matches.
    
    Change-Id: I88d402e0b8cb9dc4fd93e7f1ce5b08fb42aadd06

diff --git a/include/vcl/VectorGraphicSearch.hxx b/include/vcl/VectorGraphicSearch.hxx
index 5420e161448b..a00c212ad61c 100644
--- a/include/vcl/VectorGraphicSearch.hxx
+++ b/include/vcl/VectorGraphicSearch.hxx
@@ -37,6 +37,7 @@ public:
     bool search(OUString const& rSearchString);
     basegfx::B2DSize pageSize();
     bool next();
+    bool previous();
     int index();
     std::vector<basegfx::B2DRectangle> getTextRectangles();
 };
diff --git a/vcl/qa/cppunit/VectorGraphicSearchTest.cxx b/vcl/qa/cppunit/VectorGraphicSearchTest.cxx
index 01022a3fe225..7962c23f4e8f 100644
--- a/vcl/qa/cppunit/VectorGraphicSearchTest.cxx
+++ b/vcl/qa/cppunit/VectorGraphicSearchTest.cxx
@@ -26,9 +26,11 @@ class VectorGraphicSearchTest : public test::BootstrapFixtureBase
     }
 
     void test();
+    void testNextPrevious();
 
     CPPUNIT_TEST_SUITE(VectorGraphicSearchTest);
     CPPUNIT_TEST(test);
+    CPPUNIT_TEST(testNextPrevious);
     CPPUNIT_TEST_SUITE_END();
 };
 
@@ -81,6 +83,44 @@ void VectorGraphicSearchTest::test()
     CPPUNIT_ASSERT_DOUBLES_EQUAL(6381.04, aRectangles[3].getMaxY(), 1E-2);
 }
 
+// Test next and previous work as expected to move
+// between search matches.
+void VectorGraphicSearchTest::testNextPrevious()
+{
+    OUString aURL = getFullUrl("Pangram.pdf");
+    SvFileStream aStream(aURL, StreamMode::READ);
+    GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter();
+    Graphic aGraphic = rGraphicFilter.ImportUnloadedGraphic(aStream);
+    aGraphic.makeAvailable();
+
+    VectorGraphicSearch aSearch(aGraphic);
+    CPPUNIT_ASSERT_EQUAL(true, aSearch.search("lazy"));
+
+    // next - first match found
+    CPPUNIT_ASSERT_EQUAL(true, aSearch.next());
+    CPPUNIT_ASSERT_EQUAL(34, aSearch.index());
+
+    // next - second match found
+    CPPUNIT_ASSERT_EQUAL(true, aSearch.next());
+    CPPUNIT_ASSERT_EQUAL(817, aSearch.index());
+
+    // next - not found, index unchanged
+    CPPUNIT_ASSERT_EQUAL(false, aSearch.next());
+    CPPUNIT_ASSERT_EQUAL(817, aSearch.index());
+
+    // previous - first match
+    CPPUNIT_ASSERT_EQUAL(true, aSearch.previous());
+    CPPUNIT_ASSERT_EQUAL(34, aSearch.index());
+
+    // previous - not found, index unchanged
+    CPPUNIT_ASSERT_EQUAL(false, aSearch.previous());
+    CPPUNIT_ASSERT_EQUAL(34, aSearch.index());
+
+    // next - second match found
+    CPPUNIT_ASSERT_EQUAL(true, aSearch.next());
+    CPPUNIT_ASSERT_EQUAL(817, aSearch.index());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(VectorGraphicSearchTest);
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/graphic/VectorGraphicSearch.cxx b/vcl/source/graphic/VectorGraphicSearch.cxx
index 56c00efa172a..eb2199c7948d 100644
--- a/vcl/source/graphic/VectorGraphicSearch.cxx
+++ b/vcl/source/graphic/VectorGraphicSearch.cxx
@@ -103,6 +103,13 @@ public:
         return false;
     }
 
+    bool previous()
+    {
+        if (mpSearchHandle)
+            return FPDFText_FindPrev(mpSearchHandle);
+        return false;
+    }
+
     int index()
     {
         if (mpSearchHandle)
@@ -244,6 +251,13 @@ bool VectorGraphicSearch::next()
     return false;
 }
 
+bool VectorGraphicSearch::previous()
+{
+    if (mpSearchContext)
+        return mpSearchContext->previous();
+    return false;
+}
+
 int VectorGraphicSearch::index()
 {
     if (mpSearchContext)
commit f2a97f1e21cd5957ae74eb73eacbe27356a9534f
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Fri May 29 23:06:57 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Fri May 29 23:06:57 2020 +0200

    sd: fix not found case in PDF search + add PDF Search tests
    
    When searching the PDF and the search text is not found (anymore)
    in the current VectorGraphicSearch, we need to remove it and mark
    that we don't currently search in a vector graphic (PDF) anymore.
    This wasn't handled correctly and caused a crash.
    
    In addition add a LOKit test for search into a PDF document, to
    make sure the not-found case and usual searching case are working
    correctly.
    
    Change-Id: I663a6b2cf4879f11d62e440ea0c35ffcd205f81f

diff --git a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
index 4474bd8e4751..33257f12d4ab 100644
--- a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
+++ b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
@@ -24,10 +24,14 @@
 #include <sfx2/viewfrm.hxx>
 #include <svl/srchitem.hxx>
 #include <svl/stritem.hxx>
+#include <vcl/scheduler.hxx>
 #include <ViewShellBase.hxx>
 #include <ViewShell.hxx>
 #include <unomodel.hxx>
 
+#include <sdpage.hxx>
+#include <svx/svdograf.hxx>
+
 #include <com/sun/star/frame/Desktop.hpp>
 
 using namespace css;
@@ -38,7 +42,7 @@ private:
     static constexpr char DATA_DIRECTORY[] = "/sd/qa/unit/tiledrendering/data/";
 
 public:
-    LOKitSearchTest() {}
+    LOKitSearchTest() = default;
 
     virtual void setUp() override;
     virtual void tearDown() override;
@@ -49,6 +53,8 @@ public:
     void testSearchAllNotifications();
     void testSearchAllFollowedBySearch();
     void testDontSearchInMasterPages();
+    void testSearchInPDFNonExisting();
+    void testSearchInPDF();
 
     CPPUNIT_TEST_SUITE(LOKitSearchTest);
     CPPUNIT_TEST(testSearch);
@@ -57,6 +63,8 @@ public:
     CPPUNIT_TEST(testSearchAllNotifications);
     CPPUNIT_TEST(testSearchAllFollowedBySearch);
     CPPUNIT_TEST(testDontSearchInMasterPages);
+    CPPUNIT_TEST(testSearchInPDFNonExisting);
+    CPPUNIT_TEST(testSearchInPDF);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -96,9 +104,11 @@ LOKitSearchTest::createDoc(const char* pName, const uno::Sequence<beans::Propert
 {
     if (mxComponent.is())
         mxComponent->dispose();
+
     mxComponent = loadFromDesktop(m_directories.getURLFromSrc(DATA_DIRECTORY)
-                                      + OUString::createFromAscii(pName),
-                                  "com.sun.star.presentation.PresentationDocument");
+                                  + OUString::createFromAscii(pName));
+
+    CPPUNIT_ASSERT(mxComponent.is());
     SdXImpressDocument* pImpressDocument = dynamic_cast<SdXImpressDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pImpressDocument);
     pImpressDocument->initializeForTiledRendering(rArguments);
@@ -109,15 +119,20 @@ namespace
 {
 void lcl_search(const OUString& rKey, bool bFindAll = false)
 {
+    Scheduler::ProcessEventsToIdle();
+    SvxSearchCmd eSearch = bFindAll ? SvxSearchCmd::FIND_ALL : SvxSearchCmd::FIND;
+
     uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence({
         { "SearchItem.SearchString", uno::makeAny(rKey) },
         { "SearchItem.Backward", uno::makeAny(false) },
-        { "SearchItem.Command", uno::makeAny(static_cast<sal_uInt16>(
-                                    bFindAll ? SvxSearchCmd::FIND_ALL : SvxSearchCmd::FIND)) },
+        { "SearchItem.Command", uno::makeAny(sal_uInt16(eSearch)) },
     }));
+
     comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues);
+    Scheduler::ProcessEventsToIdle();
 }
-}
+
+} // end anonymous namespace
 
 void LOKitSearchTest::testSearch()
 {
@@ -228,6 +243,72 @@ void LOKitSearchTest::testDontSearchInMasterPages()
     CPPUNIT_ASSERT_EQUAL(false, mpCallbackRecorder->m_bFound);
 }
 
+void LOKitSearchTest::testSearchInPDFNonExisting()
+{
+    SdXImpressDocument* pXImpressDocument = createDoc("PDFSearch.pdf");
+    sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
+    CPPUNIT_ASSERT(pViewShell);
+    mpCallbackRecorder->registerCallbacksFor(pViewShell->GetViewShellBase());
+
+    SdPage* pPage = pViewShell->GetActualPage();
+    CPPUNIT_ASSERT(pPage);
+
+    SdrObject* pObject = pPage->GetObj(0);
+    CPPUNIT_ASSERT(pObject);
+
+    SdrGrafObj* pGraphicObject = dynamic_cast<SdrGrafObj*>(pObject);
+    CPPUNIT_ASSERT(pGraphicObject);
+
+    Graphic aGraphic = pGraphicObject->GetGraphic();
+    auto const& pVectorGraphicData = aGraphic.getVectorGraphicData();
+    CPPUNIT_ASSERT(pVectorGraphicData);
+    CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Pdf,
+                         pVectorGraphicData->getVectorGraphicDataType());
+
+    lcl_search("NonExisting");
+
+    CPPUNIT_ASSERT_EQUAL(false, mpCallbackRecorder->m_bFound);
+}
+
+void LOKitSearchTest::testSearchInPDF()
+{
+    SdXImpressDocument* pXImpressDocument = createDoc("PDFSearch.pdf");
+    sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
+    CPPUNIT_ASSERT(pViewShell);
+    mpCallbackRecorder->registerCallbacksFor(pViewShell->GetViewShellBase());
+
+    SdPage* pPage = pViewShell->GetActualPage();
+    CPPUNIT_ASSERT(pPage);
+
+    SdrObject* pObject = pPage->GetObj(0);
+    CPPUNIT_ASSERT(pObject);
+
+    SdrGrafObj* pGraphicObject = dynamic_cast<SdrGrafObj*>(pObject);
+    CPPUNIT_ASSERT(pGraphicObject);
+
+    Graphic aGraphic = pGraphicObject->GetGraphic();
+    auto const& pVectorGraphicData = aGraphic.getVectorGraphicData();
+    CPPUNIT_ASSERT(pVectorGraphicData);
+    CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Pdf,
+                         pVectorGraphicData->getVectorGraphicDataType());
+
+    lcl_search("ABC");
+
+    CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound);
+
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
+
+    CPPUNIT_ASSERT_EQUAL(long(3763), mpCallbackRecorder->m_aSelection[0].Left());
+    CPPUNIT_ASSERT_EQUAL(long(1331), mpCallbackRecorder->m_aSelection[0].Top());
+    CPPUNIT_ASSERT_EQUAL(long(1433), mpCallbackRecorder->m_aSelection[0].GetWidth());
+    CPPUNIT_ASSERT_EQUAL(long(484), mpCallbackRecorder->m_aSelection[0].GetHeight());
+
+    lcl_search("ABC");
+    CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound);
+
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(LOKitSearchTest);
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/qa/unit/tiledrendering/data/PDFSearch.pdf b/sd/qa/unit/tiledrendering/data/PDFSearch.pdf
new file mode 100644
index 000000000000..ea8a0919a4a1
Binary files /dev/null and b/sd/qa/unit/tiledrendering/data/PDFSearch.pdf differ
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index 89f87baa98bf..a87ece2c8b6e 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -851,6 +851,11 @@ bool SdOutliner::SearchAndReplaceOnce(std::vector<sd::SearchSelection>* pSelecti
                         aSubSelections.push_back(aSubSelection);
                     mpView->MarkObj(mpObj, pPageView, false, false, aSubSelections);
                 }
+                else
+                {
+                    mpImpl->mbCurrentIsVectorGraphic = false;
+                    mpImpl->mpVectorGraphicSearch.reset();
+                }
             }
             else
             {
@@ -1257,6 +1262,16 @@ void SdOutliner::ProvideNextTextObject()
 
                             mpDrawDocument->GetDocSh()->SetWaitCursor( false );
                         }
+                        else
+                        {
+                            mpImpl->mbCurrentIsVectorGraphic = false;
+                            mpImpl->mpVectorGraphicSearch.reset();
+                        }
+                    }
+                    else
+                    {
+                        mpImpl->mbCurrentIsVectorGraphic = false;
+                        mpImpl->mpVectorGraphicSearch.reset();
                     }
                 }
                 else


More information about the Libreoffice-commits mailing list