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>
This commit is contained in:
Sarper Akdemir
2020-06-30 23:52:55 +02:00
committed by Thorsten Behrens
parent 7394ac17f3
commit e13dd9546e
4 changed files with 32 additions and 1 deletions
@@ -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;
@@ -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 ) );
}
@@ -981,7 +981,10 @@ bool SlideImpl::loadShapes()
ShapeSharedPtr const& rShape(
aMPShapesFunctor.importShape() );
if( rShape )
{
rShape->setIsForeground(false);
mpLayerManager->addShape( rShape );
}
}
addPolygons(aMPShapesFunctor.getPolygons());
+27 -1
View File
@@ -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.