diff options
Diffstat (limited to 'sd/source/ui/unoidl')
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 42 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unopage.cxx | 4 |
2 files changed, 28 insertions, 18 deletions
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index da1c4ca806e6..96a4e1c07100 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -1632,25 +1632,33 @@ static void ImplPDFExportComments( const uno::Reference< drawing::XDrawPage >& x aNote.maContents = xText->getString(); aNote.maModificationDate = xAnnotation->getDateTime(); auto* pAnnotation = dynamic_cast<sd::Annotation*>(xAnnotation.get()); - if (pAnnotation && pAnnotation->isFreeText()) - { - aNote.meType = vcl::pdf::PDFAnnotationSubType::FreeText; - } - if (pAnnotation && pAnnotation->hasCustomAnnotationMarker()) + + if (pAnnotation && pAnnotation->getCreationInfo().meType != sdr::annotation::AnnotationType::None) { - aNote.maPolygons = pAnnotation->getCustomAnnotationMarker().maPolygons; - aNote.maAnnotationColor = pAnnotation->getCustomAnnotationMarker().maLineColor; - aNote.maInteriorColor = pAnnotation->getCustomAnnotationMarker().maFillColor; - if (aNote.maPolygons.size() == 1) - { - auto const& rPolygon = aNote.maPolygons[0]; - aNote.meType = rPolygon.isClosed() - ? vcl::pdf::PDFAnnotationSubType::Polygon - : vcl::pdf::PDFAnnotationSubType::Polyline; - } - else if (aNote.maPolygons.size() > 1) + sdr::annotation::CreationInfo const& rCreation = pAnnotation->getCreationInfo(); + aNote.maPolygons = rCreation.maPolygons; + aNote.maAnnotationColor = rCreation.maColor; + aNote.maInteriorColor = rCreation.maFillColor; + aNote.mfWidth = rCreation.mnWidth; + switch (rCreation.meType) { - aNote.meType = vcl::pdf::PDFAnnotationSubType::Ink; + case sdr::annotation::AnnotationType::Square: + aNote.meType = vcl::pdf::PDFAnnotationSubType::Square; break; + case sdr::annotation::AnnotationType::Circle: + aNote.meType = vcl::pdf::PDFAnnotationSubType::Circle; break; + case sdr::annotation::AnnotationType::Polygon: + aNote.meType = vcl::pdf::PDFAnnotationSubType::Polygon; break; + case sdr::annotation::AnnotationType::Ink: + aNote.meType = vcl::pdf::PDFAnnotationSubType::Ink; break; + case sdr::annotation::AnnotationType::Highlight: + aNote.meType = vcl::pdf::PDFAnnotationSubType::Highlight; break; + case sdr::annotation::AnnotationType::Line: + aNote.meType = vcl::pdf::PDFAnnotationSubType::Line; break; + case sdr::annotation::AnnotationType::FreeText: + aNote.meType = vcl::pdf::PDFAnnotationSubType::FreeText; break; + default: + aNote.meType = vcl::pdf::PDFAnnotationSubType::Text; + break; } } diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index 6e0f2ad52b13..8f89dc0def6a 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -2529,7 +2529,9 @@ Reference< XAnnotation > SAL_CALL SdGenericDrawPage::createAndInsertAnnotation() if( !GetPage() ) throw DisposedException(); - return GetPage()->createAnnotation(); + auto xAnnotation = GetPage()->createAnnotation(); + GetPage()->addAnnotation(xAnnotation); + return xAnnotation; } void SAL_CALL SdGenericDrawPage::removeAnnotation(const Reference< XAnnotation > & annotation) |