[Libreoffice-commits] core.git: include/vcl vcl/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Fri Feb 5 08:08:35 UTC 2021


 include/vcl/filter/PDFiumLibrary.hxx       |    5 ++++-
 vcl/source/graphic/VectorGraphicSearch.cxx |    8 ++++----
 vcl/source/pdf/PDFiumLibrary.cxx           |   11 +++++++++++
 3 files changed, 19 insertions(+), 5 deletions(-)

New commits:
commit 34f5057fbea1cfa01356915d0e8edf2296a4149b
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Feb 4 20:48:46 2021 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Feb 5 09:07:55 2021 +0100

    pdfium: add remaining FPDF_SCHHANDLE wrappers
    
    So we don't have to expose the raw search handle in the public header
    anymore.
    
    Change-Id: I410314424e5a1d3a977c8e3de6f500f7c9a0a332
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110426
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/include/vcl/filter/PDFiumLibrary.hxx b/include/vcl/filter/PDFiumLibrary.hxx
index ab0b5db7e608..807a64cfab4e 100644
--- a/include/vcl/filter/PDFiumLibrary.hxx
+++ b/include/vcl/filter/PDFiumLibrary.hxx
@@ -162,7 +162,10 @@ public:
     PDFiumSearchHandle(FPDF_SCHHANDLE pSearchHandle);
     ~PDFiumSearchHandle();
 
-    FPDF_SCHHANDLE getPointer() { return mpSearchHandle; }
+    bool findNext();
+    bool findPrev();
+    int getSearchResultIndex();
+    int getSearchCount();
 };
 
 class VCL_DLLPUBLIC PDFiumTextPage final
diff --git a/vcl/source/graphic/VectorGraphicSearch.cxx b/vcl/source/graphic/VectorGraphicSearch.cxx
index 59e51ea795e2..aabfd220f651 100644
--- a/vcl/source/graphic/VectorGraphicSearch.cxx
+++ b/vcl/source/graphic/VectorGraphicSearch.cxx
@@ -118,7 +118,7 @@ public:
 
     bool next()
     {
-        if (mpSearchHandle && FPDFText_FindNext(mpSearchHandle->getPointer()))
+        if (mpSearchHandle && mpSearchHandle->findNext())
         {
             mnCurrentIndex = index();
             return true;
@@ -128,7 +128,7 @@ public:
 
     bool previous()
     {
-        if (mpSearchHandle && FPDFText_FindPrev(mpSearchHandle->getPointer()))
+        if (mpSearchHandle && mpSearchHandle->findPrev())
         {
             mnCurrentIndex = index();
             return true;
@@ -139,14 +139,14 @@ public:
     int index()
     {
         if (mpSearchHandle)
-            return FPDFText_GetSchResultIndex(mpSearchHandle->getPointer());
+            return mpSearchHandle->getSearchResultIndex();
         return -1;
     }
 
     int size()
     {
         if (mpSearchHandle)
-            return FPDFText_GetSchCount(mpSearchHandle->getPointer());
+            return mpSearchHandle->getSearchCount();
         return -1;
     }
 
diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx
index 9a13ae930fb5..ca4da3489c6b 100644
--- a/vcl/source/pdf/PDFiumLibrary.cxx
+++ b/vcl/source/pdf/PDFiumLibrary.cxx
@@ -1126,6 +1126,17 @@ PDFiumSearchHandle::~PDFiumSearchHandle()
         FPDFText_FindClose(mpSearchHandle);
 }
 
+bool PDFiumSearchHandle::findNext() { return FPDFText_FindNext(mpSearchHandle); }
+
+bool PDFiumSearchHandle::findPrev() { return FPDFText_FindPrev(mpSearchHandle); }
+
+int PDFiumSearchHandle::getSearchResultIndex()
+{
+    return FPDFText_GetSchResultIndex(mpSearchHandle);
+}
+
+int PDFiumSearchHandle::getSearchCount() { return FPDFText_GetSchCount(mpSearchHandle); }
+
 } // end vcl::pdf
 
 #endif // HAVE_FEATURE_PDFIUM


More information about the Libreoffice-commits mailing list