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

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


 include/vcl/filter/PDFiumLibrary.hxx |   23 +++++++++--------------
 vcl/source/pdf/PDFiumLibrary.cxx     |   34 ++++++++++++++++++++++++++--------
 2 files changed, 35 insertions(+), 22 deletions(-)

New commits:
commit dba40f311bc512c05ea59fbdfeb794ef44af72a6
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Feb 16 21:07:53 2021 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Feb 17 09:10:05 2021 +0100

    pdfium: eliminate FPDF_SIGNATURE from public header
    
    Change-Id: I9c8297c69ca359d861c8506e41c069692331eb8f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111005
    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 8a3e05b5b2d2..1c60e52d5f09 100644
--- a/include/vcl/filter/PDFiumLibrary.hxx
+++ b/include/vcl/filter/PDFiumLibrary.hxx
@@ -222,22 +222,17 @@ public:
 };
 
 /// Represents one digital signature, as exposed by PDFium.
-class VCL_DLLPUBLIC PDFiumSignature final
+class VCL_DLLPUBLIC PDFiumSignature
 {
-private:
-    FPDF_SIGNATURE mpSignature;
-    PDFiumSignature(const PDFiumSignature&) = delete;
-    PDFiumSignature& operator=(const PDFiumSignature&) = delete;
-
 public:
-    PDFiumSignature(FPDF_SIGNATURE pSignature);
-
-    std::vector<int> getByteRange();
-    int getDocMDPPermission();
-    std::vector<unsigned char> getContents();
-    OString getSubFilter();
-    OUString getReason();
-    css::util::DateTime getTime();
+    virtual ~PDFiumSignature() = default;
+
+    virtual std::vector<int> getByteRange() = 0;
+    virtual int getDocMDPPermission() = 0;
+    virtual std::vector<unsigned char> getContents() = 0;
+    virtual OString getSubFilter() = 0;
+    virtual OUString getReason() = 0;
+    virtual css::util::DateTime getTime() = 0;
 };
 
 class VCL_DLLPUBLIC PDFiumDocument final
diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx
index 29d5bb8f3ba6..d183cd6f22c3 100644
--- a/vcl/source/pdf/PDFiumLibrary.cxx
+++ b/vcl/source/pdf/PDFiumLibrary.cxx
@@ -306,6 +306,24 @@ public:
     /// Returned rect is no longer upside down and is in mm100.
     basegfx::B2DRectangle getCharBox(int nIndex, double fPageHeight) override;
 };
+
+class PDFiumSignatureImpl final : public PDFiumSignature
+{
+private:
+    FPDF_SIGNATURE mpSignature;
+    PDFiumSignatureImpl(const PDFiumSignatureImpl&) = delete;
+    PDFiumSignatureImpl& operator=(const PDFiumSignatureImpl&) = delete;
+
+public:
+    PDFiumSignatureImpl(FPDF_SIGNATURE pSignature);
+
+    std::vector<int> getByteRange() override;
+    int getDocMDPPermission() override;
+    std::vector<unsigned char> getContents() override;
+    OString getSubFilter() override;
+    OUString getReason() override;
+    css::util::DateTime getTime() override;
+};
 }
 
 OUString convertPdfDateToISO8601(OUString const& rInput)
@@ -438,12 +456,12 @@ std::unique_ptr<PDFiumBitmap> PDFium::createBitmap(int nWidth, int nHeight, int
     return pPDFiumBitmap;
 }
 
-PDFiumSignature::PDFiumSignature(FPDF_SIGNATURE pSignature)
+PDFiumSignatureImpl::PDFiumSignatureImpl(FPDF_SIGNATURE pSignature)
     : mpSignature(pSignature)
 {
 }
 
-std::vector<int> PDFiumSignature::getByteRange()
+std::vector<int> PDFiumSignatureImpl::getByteRange()
 {
     int nByteRangeLen = FPDFSignatureObj_GetByteRange(mpSignature, nullptr, 0);
     std::vector<int> aByteRange(nByteRangeLen);
@@ -456,12 +474,12 @@ std::vector<int> PDFiumSignature::getByteRange()
     return aByteRange;
 }
 
-int PDFiumSignature::getDocMDPPermission()
+int PDFiumSignatureImpl::getDocMDPPermission()
 {
     return FPDFSignatureObj_GetDocMDPPermission(mpSignature);
 }
 
-std::vector<unsigned char> PDFiumSignature::getContents()
+std::vector<unsigned char> PDFiumSignatureImpl::getContents()
 {
     int nContentsLen = FPDFSignatureObj_GetContents(mpSignature, nullptr, 0);
     std::vector<unsigned char> aContents(nContentsLen);
@@ -474,7 +492,7 @@ std::vector<unsigned char> PDFiumSignature::getContents()
     return aContents;
 }
 
-OString PDFiumSignature::getSubFilter()
+OString PDFiumSignatureImpl::getSubFilter()
 {
     int nSubFilterLen = FPDFSignatureObj_GetSubFilter(mpSignature, nullptr, 0);
     std::vector<char> aSubFilterBuf(nSubFilterLen);
@@ -484,7 +502,7 @@ OString PDFiumSignature::getSubFilter()
     return aSubFilter;
 }
 
-OUString PDFiumSignature::getReason()
+OUString PDFiumSignatureImpl::getReason()
 {
     int nReasonLen = FPDFSignatureObj_GetReason(mpSignature, nullptr, 0);
     OUString aRet;
@@ -498,7 +516,7 @@ OUString PDFiumSignature::getReason()
     return aRet;
 }
 
-util::DateTime PDFiumSignature::getTime()
+util::DateTime PDFiumSignatureImpl::getTime()
 {
     util::DateTime aRet;
     int nTimeLen = FPDFSignatureObj_GetTime(mpSignature, nullptr, 0);
@@ -551,7 +569,7 @@ std::unique_ptr<PDFiumSignature> PDFiumDocument::getSignature(int nIndex)
     FPDF_SIGNATURE pSignature = FPDF_GetSignatureObject(mpPdfDocument, nIndex);
     if (pSignature)
     {
-        pPDFiumSignature = std::make_unique<PDFiumSignature>(pSignature);
+        pPDFiumSignature = std::make_unique<PDFiumSignatureImpl>(pSignature);
     }
     return pPDFiumSignature;
 }


More information about the Libreoffice-commits mailing list