summaryrefslogtreecommitdiff
path: root/sd/source/ui/annotations
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2020-10-15 09:38:56 +0200
committerTomaž Vajngerl <quikee@gmail.com>2020-10-18 21:20:40 +0200
commit52c2b0fefcd3743c266cccb321ae194fd00720a4 (patch)
tree96b1e786cdb1f2295d688b99f7ca5e45ae3540b3 /sd/source/ui/annotations
parentcf9dd0ab74db5e1f97c20737290a55a30a8738e5 (diff)
sd: custom annotation marker and draw polygon annotation from PDF
This implements custom annotation marker, which overrides the default marker drawing of comments in Draw/Impress. The polygon is transported from the import of PDF to SdPdfFilter, then the sd::Annotation is set-up, by settuing up the new class CustomAnnotationMarker. CustomAnnotationMarker also supports setting of the line color, line width and fill color. The OverlayPolyPolygon is the new class that is responsible for the marker overlay, mainly to create the Primitive2D of the marker, that will be shown on the screen. This only implements Polygon PDF annotation sub-type. Change-Id: Ic663c31c5b3db5c13179dde63c1a0b81159f4b80 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104365 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sd/source/ui/annotations')
-rw-r--r--sd/source/ui/annotations/annotationtag.cxx37
1 files changed, 31 insertions, 6 deletions
diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx
index 6d918775f73d..61c8ac8b2a3d 100644
--- a/sd/source/ui/annotations/annotationtag.cxx
+++ b/sd/source/ui/annotations/annotationtag.cxx
@@ -28,6 +28,7 @@
#include <svx/sdr/overlay/overlayanimatedbitmapex.hxx>
#include <svx/sdr/overlay/overlaybitmapex.hxx>
+#include <svx/sdr/overlay/overlaypolypolygon.hxx>
#include <svx/svdpagv.hxx>
#include <svx/sdrpagewindow.hxx>
#include <svx/sdrpaintwindow.hxx>
@@ -40,6 +41,7 @@
#include "annotationmanagerimpl.hxx"
#include "annotationwindow.hxx"
#include "annotationtag.hxx"
+#include <Annotation.hxx>
#include <ViewShell.hxx>
#include <Window.hxx>
#include <drawdoc.hxx>
@@ -182,7 +184,7 @@ void AnnotationHdl::CreateB2dIAObject()
// first throw away old one
GetRidOfIAObject();
- if( !mxAnnotation.is() )
+ if (!mxAnnotation.is())
return;
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
@@ -221,16 +223,39 @@ void AnnotationHdl::CreateB2dIAObject()
{
std::unique_ptr<sdr::overlay::OverlayObject> pOverlayObject;
- // animate focused handles
- if(bFocused)
+ auto* pAnnotation = dynamic_cast<sd::Annotation*>(mxAnnotation.get());
+
+ if (pAnnotation && pAnnotation->hasCustomAnnotationMarker())
{
- const sal_uInt64 nBlinkTime = rStyleSettings.GetCursorBlinkTime();
+ CustomAnnotationMarker& rCustomAnnotationMarker = pAnnotation->getCustomAnnotationMarker();
- pOverlayObject.reset(new sdr::overlay::OverlayAnimatedBitmapEx(aPosition, aBitmapEx, aBitmapEx2, nBlinkTime, 0, 0, 0, 0 ));
+ auto& rPolygons = rCustomAnnotationMarker.maPolygons;
+ if (!rPolygons.empty())
+ {
+ basegfx::B2DPolyPolygon aPolyPolygon;
+ for (auto const & rPolygon : rPolygons)
+ aPolyPolygon.append(rPolygon);
+
+ pOverlayObject.reset(new sdr::overlay::OverlayPolyPolygon(
+ aPolyPolygon,
+ rCustomAnnotationMarker.maLineColor,
+ rCustomAnnotationMarker.mnLineWidth,
+ rCustomAnnotationMarker.maFillColor));
+ }
}
else
{
- pOverlayObject.reset(new sdr::overlay::OverlayBitmapEx( aPosition, aBitmapEx, 0, 0 ));
+ // animate focused handles
+ if(bFocused)
+ {
+ const sal_uInt64 nBlinkTime = rStyleSettings.GetCursorBlinkTime();
+
+ pOverlayObject.reset(new sdr::overlay::OverlayAnimatedBitmapEx(aPosition, aBitmapEx, aBitmapEx2, nBlinkTime, 0, 0, 0, 0 ));
+ }
+ else
+ {
+ pOverlayObject.reset(new sdr::overlay::OverlayBitmapEx( aPosition, aBitmapEx, 0, 0 ));
+ }
}
// OVERLAYMANAGER