[Libreoffice-commits] core.git: include/vcl vcl/source

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Thu Oct 15 13:42:57 UTC 2020


 include/vcl/filter/PDFiumLibrary.hxx |    2 ++
 vcl/source/pdf/PDFiumLibrary.cxx     |   20 ++++++++++++++++++++
 2 files changed, 22 insertions(+)

New commits:
commit 3e062a80a8f329b593f85a4b3a065389a9e16577
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed Oct 14 23:00:43 2020 +0200
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Thu Oct 15 15:42:11 2020 +0200

    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 at gmail.com>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

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,


More information about the Libreoffice-commits mailing list