diff options
author | Regina Henschel <rb.henschel@t-online.de> | 2020-04-19 18:22:11 +0200 |
---|---|---|
committer | Regina Henschel <rb.henschel@t-online.de> | 2020-04-25 14:49:30 +0200 |
commit | eb2d669af61b8808d5819b16157c59d3c6c3e03b (patch) | |
tree | 504c6c46494d41d85c6ac73387b47ce305895f7b /slideshow | |
parent | 10dba26804cc0c14f74069c26112e75dacf3865b (diff) |
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 <rb.henschel@t-online.de>
Diffstat (limited to 'slideshow')
-rw-r--r-- | slideshow/source/engine/slideshowimpl.cxx | 27 |
1 files changed, 17 insertions, 10 deletions
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); |