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

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Wed Feb 10 08:04:11 UTC 2021


 include/vcl/filter/PDFiumLibrary.hxx |   19 ++++++-------------
 vcl/source/pdf/PDFiumLibrary.cxx     |   32 +++++++++++++++++++++++++-------
 2 files changed, 31 insertions(+), 20 deletions(-)

New commits:
commit 4e222d9acf6f2373d505ea8d29056c3aea6b2e0c
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Feb 9 22:12:19 2021 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Feb 10 09:03:33 2021 +0100

    pdfium: eliminate FPDF_SCHHANDLE from the public header
    
    Change-Id: I3b4fe169304c34d78019c4cc84b786ca84221d89
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110659
    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 807a64cfab4e..20480f1e1e26 100644
--- a/include/vcl/filter/PDFiumLibrary.hxx
+++ b/include/vcl/filter/PDFiumLibrary.hxx
@@ -150,22 +150,15 @@ public:
     virtual bool getDrawMode(PDFFillMode& eFillMode, bool& bStroke) = 0;
 };
 
-class VCL_DLLPUBLIC PDFiumSearchHandle final
+class VCL_DLLPUBLIC PDFiumSearchHandle
 {
-private:
-    FPDF_SCHHANDLE mpSearchHandle;
-
-    PDFiumSearchHandle(const PDFiumSearchHandle&) = delete;
-    PDFiumSearchHandle& operator=(const PDFiumSearchHandle&) = delete;
-
 public:
-    PDFiumSearchHandle(FPDF_SCHHANDLE pSearchHandle);
-    ~PDFiumSearchHandle();
+    virtual ~PDFiumSearchHandle() = default;
 
-    bool findNext();
-    bool findPrev();
-    int getSearchResultIndex();
-    int getSearchCount();
+    virtual bool findNext() = 0;
+    virtual bool findPrev() = 0;
+    virtual int getSearchResultIndex() = 0;
+    virtual int getSearchCount() = 0;
 };
 
 class VCL_DLLPUBLIC PDFiumTextPage final
diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx
index ca4da3489c6b..278fb284901d 100644
--- a/vcl/source/pdf/PDFiumLibrary.cxx
+++ b/vcl/source/pdf/PDFiumLibrary.cxx
@@ -249,6 +249,24 @@ public:
     std::unique_ptr<PDFiumBitmap> getImageBitmap() override;
     bool getDrawMode(PDFFillMode& eFillMode, bool& bStroke) override;
 };
+
+class PDFiumSearchHandleImpl final : public PDFiumSearchHandle
+{
+private:
+    FPDF_SCHHANDLE mpSearchHandle;
+
+    PDFiumSearchHandleImpl(const PDFiumSearchHandleImpl&) = delete;
+    PDFiumSearchHandleImpl& operator=(const PDFiumSearchHandleImpl&) = delete;
+
+public:
+    PDFiumSearchHandleImpl(FPDF_SCHHANDLE pSearchHandle);
+    ~PDFiumSearchHandleImpl();
+
+    bool findNext() override;
+    bool findPrev() override;
+    int getSearchResultIndex() override;
+    int getSearchCount() override;
+};
 }
 
 OUString convertPdfDateToISO8601(OUString const& rInput)
@@ -1111,31 +1129,31 @@ std::unique_ptr<PDFiumSearchHandle>
 PDFiumTextPage::findStart(const OUString& rFindWhat, PDFFindFlags nFlags, sal_Int32 nStartIndex)
 {
     FPDF_WIDESTRING pFindWhat = reinterpret_cast<FPDF_WIDESTRING>(rFindWhat.getStr());
-    return std::make_unique<vcl::pdf::PDFiumSearchHandle>(
+    return std::make_unique<vcl::pdf::PDFiumSearchHandleImpl>(
         FPDFText_FindStart(mpTextPage, pFindWhat, static_cast<sal_uInt32>(nFlags), nStartIndex));
 }
 
-PDFiumSearchHandle::PDFiumSearchHandle(FPDF_SCHHANDLE pSearchHandle)
+PDFiumSearchHandleImpl::PDFiumSearchHandleImpl(FPDF_SCHHANDLE pSearchHandle)
     : mpSearchHandle(pSearchHandle)
 {
 }
 
-PDFiumSearchHandle::~PDFiumSearchHandle()
+PDFiumSearchHandleImpl::~PDFiumSearchHandleImpl()
 {
     if (mpSearchHandle)
         FPDFText_FindClose(mpSearchHandle);
 }
 
-bool PDFiumSearchHandle::findNext() { return FPDFText_FindNext(mpSearchHandle); }
+bool PDFiumSearchHandleImpl::findNext() { return FPDFText_FindNext(mpSearchHandle); }
 
-bool PDFiumSearchHandle::findPrev() { return FPDFText_FindPrev(mpSearchHandle); }
+bool PDFiumSearchHandleImpl::findPrev() { return FPDFText_FindPrev(mpSearchHandle); }
 
-int PDFiumSearchHandle::getSearchResultIndex()
+int PDFiumSearchHandleImpl::getSearchResultIndex()
 {
     return FPDFText_GetSchResultIndex(mpSearchHandle);
 }
 
-int PDFiumSearchHandle::getSearchCount() { return FPDFText_GetSchCount(mpSearchHandle); }
+int PDFiumSearchHandleImpl::getSearchCount() { return FPDFText_GetSchCount(mpSearchHandle); }
 
 } // end vcl::pdf
 


More information about the Libreoffice-commits mailing list