diff options
-rw-r--r-- | include/vcl/filter/PDFiumLibrary.hxx | 1 | ||||
-rw-r--r-- | vcl/source/pdf/PDFiumLibrary.cxx | 2 | ||||
-rw-r--r-- | xmlsecurity/qa/unit/signing/signing.cxx | 13 |
3 files changed, 9 insertions, 7 deletions
diff --git a/include/vcl/filter/PDFiumLibrary.hxx b/include/vcl/filter/PDFiumLibrary.hxx index 6386441b6f39..8a8aae569e22 100644 --- a/include/vcl/filter/PDFiumLibrary.hxx +++ b/include/vcl/filter/PDFiumLibrary.hxx @@ -71,6 +71,7 @@ public: bool hasKey(OString const& rKey); OUString getString(OString const& rKey); std::unique_ptr<PDFiumAnnotation> getLinked(OString const& rKey); + int getObjectCount(); }; class PDFiumTextPage; diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx index 360c88657161..6205bbbf0ea7 100644 --- a/vcl/source/pdf/PDFiumLibrary.cxx +++ b/vcl/source/pdf/PDFiumLibrary.cxx @@ -467,6 +467,8 @@ std::unique_ptr<PDFiumAnnotation> PDFiumAnnotation::getLinked(OString const& rKe return pPDFiumAnnotation; } +int PDFiumAnnotation::getObjectCount() { return FPDFAnnot_GetObjectCount(mpAnnotation); } + PDFiumTextPage::PDFiumTextPage(FPDF_TEXTPAGE pTextPage) : mpTextPage(pTextPage) { diff --git a/xmlsecurity/qa/unit/signing/signing.cxx b/xmlsecurity/qa/unit/signing/signing.cxx index 6f9d05b4651a..513ebcce6009 100644 --- a/xmlsecurity/qa/unit/signing/signing.cxx +++ b/xmlsecurity/qa/unit/signing/signing.cxx @@ -57,7 +57,6 @@ #if HAVE_FEATURE_PDFIUM #include <fpdf_annot.h> #include <fpdfview.h> -#include <cpp/fpdf_scopers.h> #endif using namespace com::sun::star; @@ -647,16 +646,16 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPDFAddVisibleSignature) SvFileStream aFile(aTempFile.GetURL(), StreamMode::READ); SvMemoryStream aMemory; aMemory.WriteStream(aFile); - ScopedFPDFDocument pPdfDocument( - FPDF_LoadMemDocument(aMemory.GetData(), aMemory.GetSize(), /*password=*/nullptr)); - ScopedFPDFPage pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0)); - CPPUNIT_ASSERT_EQUAL(1, FPDFPage_GetAnnotCount(pPdfPage.get())); - ScopedFPDFAnnotation pAnnot(FPDFPage_GetAnnot(pPdfPage.get(), 0)); + std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument + = pPDFium->openDocument(aMemory.GetData(), aMemory.GetSize()); + std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0); + CPPUNIT_ASSERT_EQUAL(1, pPdfPage->getAnnotationCount()); + std::unique_ptr<vcl::pdf::PDFiumAnnotation> pAnnot = pPdfPage->getAnnotation(/*nIndex=*/0); // Without the accompanying fix in place, this test would have failed with: // - Expected: 4 // - Actual : 0 // i.e. the signature was there, but it was empty / not visible. - CPPUNIT_ASSERT_EQUAL(4, FPDFAnnot_GetObjectCount(pAnnot.get())); + CPPUNIT_ASSERT_EQUAL(4, pAnnot->getObjectCount()); } #endif |