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>
diff --git a/include/vcl/filter/PDFiumLibrary.hxx b/include/vcl/filter/PDFiumLibrary.hxx
index 8e8cba1..2ffbfd9 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 91bb700..64fdd6a 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,