summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2020-10-14 23:00:43 +0200
committerTomaž Vajngerl <quikee@gmail.com>2020-10-15 15:42:11 +0200
commit3e062a80a8f329b593f85a4b3a065389a9e16577 (patch)
tree5f7c4120f962336e23ef3a46ec2cc8bf164dae98
parent342e427d33af0d4bfa694248e7a47fdf1f7f270d (diff)
pdfium: add reading of attachment points to the wrapper
Attachment points are used to define where to highlight the text. Quad points - points of the rectangle that can be rotated (typical text). Change-Id: I5438a6520195b89149c9cd1a8235a77dbc622243 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104362 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r--include/vcl/filter/PDFiumLibrary.hxx2
-rw-r--r--vcl/source/pdf/PDFiumLibrary.cxx20
2 files changed, 22 insertions, 0 deletions
diff --git a/include/vcl/filter/PDFiumLibrary.hxx b/include/vcl/filter/PDFiumLibrary.hxx
index 8e8cba1782e6..2ffbfd951459 100644
--- a/include/vcl/filter/PDFiumLibrary.hxx
+++ b/include/vcl/filter/PDFiumLibrary.hxx
@@ -98,6 +98,8 @@ public:
Color getInteriorColor();
float getBorderWidth();
basegfx::B2DSize getBorderCornerRadius();
+ size_t getAttachmentPointsCount();
+ std::vector<basegfx::B2DPoint> getAttachmentPoints(size_t nIndex);
};
class PDFiumPage;
diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx
index 91bb70051552..64fdd6a7e0d4 100644
--- a/vcl/source/pdf/PDFiumLibrary.cxx
+++ b/vcl/source/pdf/PDFiumLibrary.cxx
@@ -487,6 +487,26 @@ Color PDFiumAnnotation::getInteriorColor()
return aColor;
}
+size_t PDFiumAnnotation::getAttachmentPointsCount()
+{
+ return FPDFAnnot_CountAttachmentPoints(mpAnnotation);
+}
+
+std::vector<basegfx::B2DPoint> PDFiumAnnotation::getAttachmentPoints(size_t nIndex)
+{
+ std::vector<basegfx::B2DPoint> aQuads;
+
+ FS_QUADPOINTSF aQuadpoints;
+ if (FPDFAnnot_GetAttachmentPoints(mpAnnotation, nIndex, &aQuadpoints))
+ {
+ aQuads.emplace_back(aQuadpoints.x1, aQuadpoints.y1);
+ aQuads.emplace_back(aQuadpoints.x2, aQuadpoints.y2);
+ aQuads.emplace_back(aQuadpoints.x3, aQuadpoints.y3);
+ aQuads.emplace_back(aQuadpoints.x4, aQuadpoints.y4);
+ }
+ return aQuads;
+}
+
namespace
{
bool getBorderProperties(FPDF_ANNOTATION mpAnnotation, float& rHorizontalCornerRadius,