summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2020-06-15 14:44:19 +0200
committerTomaž Vajngerl <quikee@gmail.com>2020-06-20 14:24:33 +0200
commit7e4dc3b1eabcb1993d4143c046a2f32fedc852ed (patch)
tree20af7c9e4d2502e713e2ed0f672c1cc2d9c293e5 /include
parent03f0ea92bc381ef5a8df7de1ae9edf4aed45a3b2 (diff)
vcl: Add annotation reading to PDFiumLibrary c++ wrapper
Also add tests readin annotations from Evince and Acrobat modified PDF files. Change-Id: I4565c6b621774fc8485a6c33bc18708664917b73 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96756 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/vcl/filter/PDFiumLibrary.hxx30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/vcl/filter/PDFiumLibrary.hxx b/include/vcl/filter/PDFiumLibrary.hxx
index 6dde31f2927b..9deff47e0ab9 100644
--- a/include/vcl/filter/PDFiumLibrary.hxx
+++ b/include/vcl/filter/PDFiumLibrary.hxx
@@ -19,12 +19,17 @@
#include <memory>
#include <rtl/instance.hxx>
#include <basegfx/vector/b2dsize.hxx>
+#include <basegfx/range/b2drectangle.hxx>
#include <rtl/ustring.hxx>
#include <fpdf_doc.h>
namespace vcl::pdf
{
+constexpr char constDictionaryKeyTitle[] = "T";
+constexpr char constDictionaryKeyContents[] = "Contents";
+constexpr char constDictionaryKeyPopup[] = "Popup";
+
class PDFiumDocument;
class VCL_DLLPUBLIC PDFium final
@@ -44,6 +49,26 @@ public:
std::unique_ptr<PDFiumDocument> openDocument(const void* pData, int nSize);
};
+class VCL_DLLPUBLIC PDFiumAnnotation final
+{
+private:
+ FPDF_ANNOTATION mpAnnotation;
+
+ PDFiumAnnotation(const PDFiumAnnotation&) = delete;
+ PDFiumAnnotation& operator=(const PDFiumAnnotation&) = delete;
+
+public:
+ PDFiumAnnotation(FPDF_ANNOTATION pAnnotation);
+ ~PDFiumAnnotation();
+ FPDF_ANNOTATION getPointer() { return mpAnnotation; }
+
+ int getSubType();
+ basegfx::B2DRectangle getRectangle();
+ bool hasKey(OString const& rKey);
+ OUString getString(OString const& rKey);
+ std::unique_ptr<PDFiumAnnotation> getLinked(OString const& rKey);
+};
+
class VCL_DLLPUBLIC PDFiumPage final
{
private:
@@ -64,6 +89,11 @@ public:
if (mpPage)
FPDF_ClosePage(mpPage);
}
+
+ int getAnnotationCount();
+ int getAnnotationIndex(std::unique_ptr<PDFiumAnnotation> const& rAnnotation);
+
+ std::unique_ptr<PDFiumAnnotation> getAnnotation(int nIndex);
};
class VCL_DLLPUBLIC PDFiumDocument final