diff options
-rw-r--r-- | include/vcl/pdf/PDFAnnotationMarker.hxx | 6 | ||||
-rw-r--r-- | sd/source/filter/pdf/sdpdffilter.cxx | 13 | ||||
-rw-r--r-- | vcl/source/filter/ipdf/pdfread.cxx | 24 |
3 files changed, 42 insertions, 1 deletions
diff --git a/include/vcl/pdf/PDFAnnotationMarker.hxx b/include/vcl/pdf/PDFAnnotationMarker.hxx index 2c525f85cbd5..d797115437e9 100644 --- a/include/vcl/pdf/PDFAnnotationMarker.hxx +++ b/include/vcl/pdf/PDFAnnotationMarker.hxx @@ -45,6 +45,12 @@ struct VCL_DLLPUBLIC PDFAnnotationMarkerPolygon : public PDFAnnotationMarker basegfx::B2DPolygon maPolygon; }; +struct VCL_DLLPUBLIC PDFAnnotationMarkerLine : public PDFAnnotationMarker +{ + basegfx::B2DPoint maLineStart; + basegfx::B2DPoint maLineEnd; +}; + enum class PDFTextMarkerType { Highlight, diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx index e903c015d4be..4b52f9e4b574 100644 --- a/sd/source/filter/pdf/sdpdffilter.cxx +++ b/sd/source/filter/pdf/sdpdffilter.cxx @@ -170,6 +170,19 @@ bool SdPdfFilter::Import() if (rCustomAnnotationMarker.maFillColor.GetTransparency() == 0) rCustomAnnotationMarker.maFillColor.SetTransparency(0x90); } + else if (rPDFAnnotation.meSubType == vcl::pdf::PDFAnnotationSubType::Line) + { + auto* pMarker = static_cast<vcl::pdf::PDFAnnotationMarkerLine*>( + rPDFAnnotation.mpMarker.get()); + + basegfx::B2DPolygon aPoly; + aPoly.append(pMarker->maLineStart); + aPoly.append(pMarker->maLineEnd); + rCustomAnnotationMarker.maPolygons.push_back(aPoly); + + rCustomAnnotationMarker.mnLineWidth = pMarker->mnWidth; + rCustomAnnotationMarker.maFillColor = COL_TRANSPARENT; + } } } } diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx index 9be28fcf0c9b..3ccad9b10ecc 100644 --- a/vcl/source/filter/ipdf/pdfread.cxx +++ b/vcl/source/filter/ipdf/pdfread.cxx @@ -259,7 +259,8 @@ findAnnotations(const std::unique_ptr<vcl::pdf::PDFiumPage>& pPage, basegfx::B2D || eSubtype == vcl::pdf::PDFAnnotationSubType::Circle || eSubtype == vcl::pdf::PDFAnnotationSubType::Square || eSubtype == vcl::pdf::PDFAnnotationSubType::Ink - || eSubtype == vcl::pdf::PDFAnnotationSubType::Highlight) + || eSubtype == vcl::pdf::PDFAnnotationSubType::Highlight + || eSubtype == vcl::pdf::PDFAnnotationSubType::Line) { OUString sAuthor = pAnnotation->getString(vcl::pdf::constDictionaryKeyTitle); OUString sText = pAnnotation->getString(vcl::pdf::constDictionaryKeyContents); @@ -394,6 +395,27 @@ findAnnotations(const std::unique_ptr<vcl::pdf::PDFiumPage>& pPage, basegfx::B2D } } } + else if (eSubtype == vcl::pdf::PDFAnnotationSubType::Line) + { + auto const& rLineGeometry = pAnnotation->getLineGeometry(); + if (!rLineGeometry.empty()) + { + double x, y; + auto pMarker = std::make_shared<vcl::pdf::PDFAnnotationMarkerLine>(); + rPDFGraphicAnnotation.mpMarker = pMarker; + + x = convertPointToMm100(rLineGeometry[0].getX()); + y = convertPointToMm100(aPageSize.getY() - rLineGeometry[0].getY()); + pMarker->maLineStart = basegfx::B2DPoint(x, y); + + x = convertPointToMm100(rLineGeometry[1].getX()); + y = convertPointToMm100(aPageSize.getY() - rLineGeometry[1].getY()); + pMarker->maLineEnd = basegfx::B2DPoint(x, y); + + float fWidth = pAnnotation->getBorderWidth(); + pMarker->mnWidth = convertPointToMm100(fWidth); + } + } } } } |