From eb2d669af61b8808d5819b16157c59d3c6c3e03b Mon Sep 17 00:00:00 2001 From: Regina Henschel Date: Sun, 19 Apr 2020 18:22:11 +0200 Subject: tdf#129898 Use layer DrawnInSlideshow in edit mode If 'Mouse pointer as pen' is set in slideshow settings, painting in slideshow becomes persistent. A layer DrawnInSlideshow is created for that purpose during slideshow. But that layer was not known to the view from where the slideshow was started. Generating a layer had been done regardless whether such layer already exists or not. That had produced several layers with identical name. That may not happen, because layers are identified by name. Change-Id: I2ba9bad5babe5a1bba3d1fc69d028d9037d2bd47 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92502 Tested-by: Jenkins Reviewed-by: Regina Henschel --- slideshow/source/engine/slideshowimpl.cxx | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'slideshow') diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index f9b5e6ba8032..a0c652450bcb 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -1376,25 +1376,32 @@ void SlideShowImpl::registerUserPaintPolygons( const uno::Reference< lang::XMult maPolygons.insert(make_pair(mpCurrentSlide->getXDrawPage(),mpCurrentSlide->getPolygons())); } - //Creating the layer for shapes + //Creating the layer for shapes drawn during slideshow // query for the XLayerManager uno::Reference< drawing::XLayerSupplier > xLayerSupplier(xDocFactory, uno::UNO_QUERY); uno::Reference< container::XNameAccess > xNameAccess = xLayerSupplier->getLayerManager(); - uno::Reference< drawing::XLayerManager > xLayerManager(xNameAccess, uno::UNO_QUERY); - // create a layer and set its properties - uno::Reference< drawing::XLayer > xDrawnInSlideshow = xLayerManager->insertNewByIndex(xLayerManager->getCount()); - //Layer Name which enables to catch annotations - OUString layerName = "DrawnInSlideshow"; + // create layer + uno::Reference< drawing::XLayer > xDrawnInSlideshow; uno::Any aPropLayer; + OUString sLayerName = "DrawnInSlideshow"; + if (xNameAccess->hasByName(sLayerName)) + { + xNameAccess->getByName(sLayerName) >>= xDrawnInSlideshow; + } + else + { + xDrawnInSlideshow = xLayerManager->insertNewByIndex(xLayerManager->getCount()); + aPropLayer <<= sLayerName; + xDrawnInSlideshow->setPropertyValue("Name", aPropLayer); + } - aPropLayer <<= layerName; - xDrawnInSlideshow->setPropertyValue("Name", aPropLayer); - + // ODF defaults from ctor of SdrLayer are not automatically set on the here + // created XLayer. Need to be done explicitely here. aPropLayer <<= true; xDrawnInSlideshow->setPropertyValue("IsVisible", aPropLayer); - + xDrawnInSlideshow->setPropertyValue("IsPrintable", aPropLayer); aPropLayer <<= false; xDrawnInSlideshow->setPropertyValue("IsLocked", aPropLayer); -- cgit