summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2020-10-15 11:01:29 +0200
committerTomaž Vajngerl <quikee@gmail.com>2020-10-18 21:21:00 +0200
commitfb3965470a79d5b45bd211e9f95775c75e793cc8 (patch)
treee0ac9a9ecdaaef26ca3e98fd2a761a1aeb6f7d37 /sd
parent52c2b0fefcd3743c266cccb321ae194fd00720a4 (diff)
sd: support square and circle PDF annot. as custom marker
Use the existing polygon code paths, but convert a ellipse or the rectangle to the polygon, and add that as a custom marker for the annotation. Change-Id: I8f8657b868f2c410a3f604dcc1e609f4c6a12638 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104366 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/filter/pdf/sdpdffilter.cxx25
1 files changed, 25 insertions, 0 deletions
diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx
index a1f6100cfd19..28cf7b6902dd 100644
--- a/sd/source/filter/pdf/sdpdffilter.cxx
+++ b/sd/source/filter/pdf/sdpdffilter.cxx
@@ -120,6 +120,31 @@ bool SdPdfFilter::Import()
rCustomAnnotationMarker.maFillColor = pMarker->maFillColor;
rCustomAnnotationMarker.maPolygons.push_back(pMarker->maPolygon);
}
+ else if (rPDFAnnotation.meSubType == vcl::pdf::PDFAnnotationSubType::Square)
+ {
+ auto* pMarker = static_cast<vcl::pdf::PDFAnnotationMarkerSquare*>(
+ rPDFAnnotation.mpMarker.get());
+ basegfx::B2DPolygon aPoly
+ = basegfx::utils::createPolygonFromRect(rPDFAnnotation.maRectangle);
+ rCustomAnnotationMarker.mnLineWidth = pMarker->mnWidth;
+ rCustomAnnotationMarker.maFillColor = pMarker->maFillColor;
+ rCustomAnnotationMarker.maPolygons.push_back(aPoly);
+ }
+ else if (rPDFAnnotation.meSubType == vcl::pdf::PDFAnnotationSubType::Circle)
+ {
+ auto* pMarker = static_cast<vcl::pdf::PDFAnnotationMarkerCircle*>(
+ rPDFAnnotation.mpMarker.get());
+
+ basegfx::B2DPoint rCenter = rPDFAnnotation.maRectangle.getCenter();
+ double fRadiusX = rPDFAnnotation.maRectangle.getWidth() / 2;
+ double fRadiusY = rPDFAnnotation.maRectangle.getHeight() / 2;
+
+ basegfx::B2DPolygon aPoly
+ = basegfx::utils::createPolygonFromEllipse(rCenter, fRadiusX, fRadiusY);
+ rCustomAnnotationMarker.mnLineWidth = pMarker->mnWidth;
+ rCustomAnnotationMarker.maFillColor = pMarker->maFillColor;
+ rCustomAnnotationMarker.maPolygons.push_back(aPoly);
+ }
}
}
}