summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2020-09-29 11:42:20 +0200
committerTomaž Vajngerl <quikee@gmail.com>2020-10-04 08:38:41 +0200
commitd30d41b36118ccfa473fab1e82c94c016e3a3f21 (patch)
treecd98bbb7f67c031fbb477e61648b600369b0e95c
parentf266feaebea39668392e3a3830e20e4670344658 (diff)
pdfium: add getObject, getValueType for PDFiumAnnotation
Change-Id: Iadfd767463a57958f5ffb2dc5c8b5387b59373fd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103883 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r--include/vcl/filter/PDFiumLibrary.hxx5
-rw-r--r--vcl/source/pdf/PDFiumLibrary.cxx16
2 files changed, 21 insertions, 0 deletions
diff --git a/include/vcl/filter/PDFiumLibrary.hxx b/include/vcl/filter/PDFiumLibrary.hxx
index bc3314fa56f6..3688d091d601 100644
--- a/include/vcl/filter/PDFiumLibrary.hxx
+++ b/include/vcl/filter/PDFiumLibrary.hxx
@@ -20,6 +20,7 @@
#include <rtl/instance.hxx>
#include <basegfx/vector/b2dsize.hxx>
#include <basegfx/range/b2drectangle.hxx>
+#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <rtl/ustring.hxx>
#include <tools/color.hxx>
@@ -34,7 +35,9 @@ constexpr char constDictionaryKeyTitle[] = "T";
constexpr char constDictionaryKeyContents[] = "Contents";
constexpr char constDictionaryKeyPopup[] = "Popup";
constexpr char constDictionaryKeyModificationDate[] = "M";
+
class PDFiumDocument;
+class PDFiumPageObject;
class VCL_DLLPUBLIC PDFium final
{
@@ -69,9 +72,11 @@ public:
PDFAnnotationSubType getSubType();
basegfx::B2DRectangle getRectangle();
bool hasKey(OString const& rKey);
+ int getValueType(OString const& rKey);
OUString getString(OString const& rKey);
std::unique_ptr<PDFiumAnnotation> getLinked(OString const& rKey);
int getObjectCount();
+ std::unique_ptr<PDFiumPageObject> getObject(int nIndex);
};
class PDFiumTextPage;
diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx
index f25ff480f7d4..136a40786112 100644
--- a/vcl/source/pdf/PDFiumLibrary.cxx
+++ b/vcl/source/pdf/PDFiumLibrary.cxx
@@ -432,6 +432,11 @@ bool PDFiumAnnotation::hasKey(OString const& rKey)
return FPDFAnnot_HasKey(mpAnnotation, rKey.getStr());
}
+int PDFiumAnnotation::getValueType(OString const& rKey)
+{
+ return FPDFAnnot_GetValueType(mpAnnotation, rKey.getStr());
+}
+
OUString PDFiumAnnotation::getString(OString const& rKey)
{
OUString rString;
@@ -473,6 +478,17 @@ std::unique_ptr<PDFiumAnnotation> PDFiumAnnotation::getLinked(OString const& rKe
int PDFiumAnnotation::getObjectCount() { return FPDFAnnot_GetObjectCount(mpAnnotation); }
+std::unique_ptr<PDFiumPageObject> PDFiumAnnotation::getObject(int nIndex)
+{
+ std::unique_ptr<PDFiumPageObject> pPDFiumPageObject;
+ FPDF_PAGEOBJECT pPageObject = FPDFAnnot_GetObject(mpAnnotation, nIndex);
+ if (pPageObject)
+ {
+ pPDFiumPageObject = std::make_unique<PDFiumPageObject>(pPageObject);
+ }
+ return pPDFiumPageObject;
+}
+
PDFiumTextPage::PDFiumTextPage(FPDF_TEXTPAGE pTextPage)
: mpTextPage(pTextPage)
{