summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSarper Akdemir <q.sarperakdemir@gmail.com>2020-06-10 02:33:22 +0300
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2020-06-30 23:52:55 +0200
commite13dd9546e27bdc3b894718fc2993f99722ea9f1 (patch)
treeeeb8286bf7183f208f487730ac9d924278d5d112
parent7394ac17f3c8bdbb1cb3402a08ba7749906f6793 (diff)
Add Shape mbIsForeground flag and getters and setters for it
mbIsForeground is a flag that is set false if a shape is known to not belong to the foreground. It is set to false while shapes are being imported and the shape belongs to the master slide or is a group shape, right now. Change-Id: Id9738fc943f32a1e1a6e1888d179e69fd60bd022 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95968 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r--slideshow/source/engine/shapes/backgroundshape.cxx1
-rw-r--r--slideshow/source/engine/shapes/shapeimporter.cxx1
-rw-r--r--slideshow/source/engine/slide/slideimpl.cxx3
-rw-r--r--slideshow/source/inc/shape.hxx28
4 files changed, 32 insertions, 1 deletions
diff --git a/slideshow/source/engine/shapes/backgroundshape.cxx b/slideshow/source/engine/shapes/backgroundshape.cxx
index 88d48b7e72e9..093502815eaf 100644
--- a/slideshow/source/engine/shapes/backgroundshape.cxx
+++ b/slideshow/source/engine/shapes/backgroundshape.cxx
@@ -83,6 +83,7 @@ namespace slideshow::internal
virtual ::basegfx::B2DRectangle getUpdateArea() const override;
virtual bool isVisible() const override;
virtual double getPriority() const override;
+ virtual bool isForeground() const override { return false; }
virtual bool isBackgroundDetached() const override;
diff --git a/slideshow/source/engine/shapes/shapeimporter.cxx b/slideshow/source/engine/shapes/shapeimporter.cxx
index b1b1b3417269..8f2abded678d 100644
--- a/slideshow/source/engine/shapes/shapeimporter.cxx
+++ b/slideshow/source/engine/shapes/shapeimporter.cxx
@@ -495,6 +495,7 @@ ShapeSharedPtr ShapeImporter::importShape() // throw (ShapeLoadFailedException)
}
if( bIsGroupShape && pRet )
{
+ pRet->setIsForeground(false);
// push new group on the stack: group traversal
maShapesStack.push( XShapesEntry( pRet ) );
}
diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx
index 0805d084e9fa..a9120c6da829 100644
--- a/slideshow/source/engine/slide/slideimpl.cxx
+++ b/slideshow/source/engine/slide/slideimpl.cxx
@@ -981,7 +981,10 @@ bool SlideImpl::loadShapes()
ShapeSharedPtr const& rShape(
aMPShapesFunctor.importShape() );
if( rShape )
+ {
+ rShape->setIsForeground(false);
mpLayerManager->addShape( rShape );
+ }
}
addPolygons(aMPShapesFunctor.getPolygons());
diff --git a/slideshow/source/inc/shape.hxx b/slideshow/source/inc/shape.hxx
index 9b6099462ab6..1638e87c08a7 100644
--- a/slideshow/source/inc/shape.hxx
+++ b/slideshow/source/inc/shape.hxx
@@ -52,7 +52,7 @@ namespace slideshow
class Shape
{
public:
- Shape() = default;
+ Shape() : mbIsForeground(true) {}
virtual ~Shape() {}
Shape(const Shape&) = delete;
Shape& operator=(const Shape&) = delete;
@@ -204,6 +204,24 @@ namespace slideshow
*/
virtual bool isBackgroundDetached() const = 0;
+ /** Check whether the shape belongs to the foreground
+
+ For instance, if the shape is in the master slide
+ it does not belong to the foreground.
+
+ @return true if the shape is on the foreground
+ */
+ virtual bool isForeground() const { return mbIsForeground; };
+
+ /**
+ Set the flag that holds wheter the shape is
+ in the foreground or not
+
+ @param bIsForeground
+ Shape is on the foreground
+ */
+ virtual void setIsForeground( const bool bIsForeground ) { mbIsForeground = bIsForeground; };
+
// Misc
@@ -247,6 +265,14 @@ namespace slideshow
}
};
+
+ private:
+ /** Flag to check whether the shape belongs to the foreground.
+
+ For instance, it is false if the shape belongs to the master slide or
+ a group shape.
+ */
+ bool mbIsForeground;
};
/** A set which contains all shapes in an ordered fashion.