diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-05-05 11:18:30 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-05-06 13:22:15 +0200 |
commit | 7f5c4144c4107dac266317a4b651ed42ea5c0839 (patch) | |
tree | 76b9a1ddc1183d807867b26f42357e0b684fafa8 /include/vcl | |
parent | 858cd97b2682510cbf6abddf68e63a502a4b3202 (diff) |
vcl pdfium render: handle widget annotations for form fields
Note that we render the bitmaps without FPDF_ANNOT, so comments are not
rendered into the bitmaps, rather we create them on top of the bitmaps
in Draw, explicitly.
FPDF_FFLDraw() draws content which is already an annotation, but not yet
interactive content; so this just fixes "missing text", as far as the
user is concerned.
Verified that e.g. vcl/qa/cppunit/data/PangramAcrobatAnnotations.pdf
indeed still doesn't render comments into bitmaps after this.
(cherry picked from commit 92cba30d5ce45e4f4a9516a80c9fe9915add6905)
Conflicts:
include/vcl/filter/PDFiumLibrary.hxx
vcl/source/pdf/PDFiumLibrary.cxx
Change-Id: I2b74d585729305cc1d3a9fefa258d4d76d1bd038
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115143
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include/vcl')
-rw-r--r-- | include/vcl/filter/PDFiumLibrary.hxx | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/include/vcl/filter/PDFiumLibrary.hxx b/include/vcl/filter/PDFiumLibrary.hxx index 8d139889591a..c61860b3a530 100644 --- a/include/vcl/filter/PDFiumLibrary.hxx +++ b/include/vcl/filter/PDFiumLibrary.hxx @@ -31,6 +31,7 @@ #include <vcl/pdf/PDFPageObjectType.hxx> #include <fpdf_doc.h> +#include <fpdf_formfill.h> class SvMemoryStream; @@ -79,7 +80,8 @@ public: ~PDFiumBitmap(); FPDF_BITMAP getPointer() { return mpBitmap; } void fillRect(int left, int top, int width, int height, sal_uInt32 nColor); - void renderPageBitmap(PDFiumPage* pPage, int nStartX, int nStartY, int nSizeX, int nSizeY); + void renderPageBitmap(PDFiumDocument* pDoc, PDFiumPage* pPage, int nStartX, int nStartY, + int nSizeX, int nSizeY); ConstScanline getBuffer(); int getStride(); }; @@ -244,10 +246,27 @@ public: FPDF_SIGNATURE getPointer() { return mpSignature; } }; +/// Wrapper around FPDF_FORMHANDLE. +class PDFiumFormHandle final +{ +private: + FPDF_FORMHANDLE mpHandle; + + PDFiumFormHandle(const PDFiumFormHandle&) = delete; + PDFiumFormHandle& operator=(const PDFiumFormHandle&) = delete; + +public: + PDFiumFormHandle(FPDF_FORMHANDLE pHandle); + ~PDFiumFormHandle(); + FPDF_FORMHANDLE getPointer(); +}; + class VCL_DLLPUBLIC PDFiumDocument final { private: FPDF_DOCUMENT mpPdfDocument; + FPDF_FORMFILLINFO m_aFormCallbacks; + std::unique_ptr<PDFiumFormHandle> m_pFormHandle; private: PDFiumDocument(const PDFiumDocument&) = delete; @@ -256,6 +275,7 @@ private: public: PDFiumDocument(FPDF_DOCUMENT pPdfDocument); ~PDFiumDocument(); + FPDF_FORMHANDLE getFormHandlePointer(); // Page size in points basegfx::B2DSize getPageSize(int nIndex); |