summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2024-06-13 14:25:21 +0900
committerTomaž Vajngerl <quikee@gmail.com>2024-06-14 04:07:21 +0200
commit66a68fcb5639c3f0e42385fcdb08f16b9c96f243 (patch)
treeba92bde0a3d7866294aab2deafd81379c3e9c4f3 /sd
parent0fb1e4e9a74b566fb075a58ae2c7632f2cc068de (diff)
annot: add support to import Stamp annotation from PDF
Stamp annotation shows an arbitrary bitmap in the document, where the most common bitmaps are stamps like "Approved", "Confidential", "Expired", "Sold",... Change-Id: I332e34cbb346a686ee16eac7ca437ec4048e65ed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168760 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/filter/pdf/sdpdffilter.cxx8
-rw-r--r--sd/source/ui/annotations/annotationmanager.cxx13
2 files changed, 21 insertions, 0 deletions
diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx
index 6b69530454c3..58e2dfead82f 100644
--- a/sd/source/filter/pdf/sdpdffilter.cxx
+++ b/sd/source/filter/pdf/sdpdffilter.cxx
@@ -210,6 +210,14 @@ bool SdPdfFilter::Import()
{
aInfo.meType = sdr::annotation::AnnotationType::FreeText;
}
+ else if (rPDFAnnotation.meSubType == vcl::pdf::PDFAnnotationSubType::Stamp)
+ {
+ auto* pMarker = static_cast<vcl::pdf::PDFAnnotationMarkerStamp*>(
+ rPDFAnnotation.mpMarker.get());
+
+ aInfo.meType = sdr::annotation::AnnotationType::Stamp;
+ aInfo.maBitmapEx = pMarker->maBitmapEx;
+ }
xAnnotation->setCreationInfo(aInfo);
}
diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx
index 28850c0dd57c..31292315787e 100644
--- a/sd/source/ui/annotations/annotationmanager.cxx
+++ b/sd/source/ui/annotations/annotationmanager.cxx
@@ -82,6 +82,7 @@
#include <svx/svdorect.hxx>
#include <svx/svdopath.hxx>
#include <svx/svdotext.hxx>
+#include <svx/svdograf.hxx>
#include <svx/xfillit0.hxx>
#include <svx/xflclit.hxx>
@@ -1067,6 +1068,18 @@ void AnnotationManagerImpl::SyncAnnotationObjects()
applyAnnotationCommon(*pNewObject, xAnnotation);
applyAnnotationProperties(*pNewObject, rInfo);
}
+ else if (rInfo.meType == sdr::annotation::AnnotationType::Stamp)
+ {
+ pNewObject = new SdrCircObj(rModel, SdrCircKind::Full, aRectangle);
+
+ rtl::Reference<SdrGrafObj> pGrafObject = new SdrGrafObj(rModel, Graphic(rInfo.maBitmapEx), aRectangle);
+ pNewObject = pGrafObject;
+
+ applyAnnotationCommon(*pNewObject, xAnnotation);
+
+ pGrafObject->SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE));
+ pGrafObject->SetMergedItem(XFillStyleItem(drawing::FillStyle_NONE));
+ }
else
{
SdrObjKind ekind = SdrObjKind::Polygon;