From 7ea49126e7a247ac60ad45ab420106fe4be574ea Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Thu, 15 Oct 2020 12:23:08 +0200 Subject: sd: support text annotation PDF annot. as custom marker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This one is special as it annotates text. Normally the annotation would be present behind the text, but this is not possible in this case, so the best alternative is to use a transparent rectangle over the text. Change-Id: Ib115efa4a5994e17dcf9d7b02591ccae26800928 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104369 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- sd/source/filter/pdf/sdpdffilter.cxx | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'sd') diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx index b2866dd1701d..5e190f8a0117 100644 --- a/sd/source/filter/pdf/sdpdffilter.cxx +++ b/sd/source/filter/pdf/sdpdffilter.cxx @@ -154,6 +154,19 @@ bool SdPdfFilter::Import() rCustomAnnotationMarker.mnLineWidth = pMarker->mnWidth; rCustomAnnotationMarker.maFillColor = pMarker->maFillColor; } + else if (rPDFAnnotation.meSubType == vcl::pdf::PDFAnnotationSubType::Highlight) + { + if (rCustomAnnotationMarker.maLineColor.GetTransparency() == 0) + rCustomAnnotationMarker.maLineColor.SetTransparency(0x90); + auto* pMarker = static_cast( + rPDFAnnotation.mpMarker.get()); + for (auto const& rPolygon : pMarker->maQuads) + rCustomAnnotationMarker.maPolygons.push_back(rPolygon); + rCustomAnnotationMarker.mnLineWidth = 1; + rCustomAnnotationMarker.maFillColor = rPDFAnnotation.maColor; + if (rCustomAnnotationMarker.maFillColor.GetTransparency() == 0) + rCustomAnnotationMarker.maFillColor.SetTransparency(0x90); + } } } } -- cgit