[Libreoffice-commits] core.git: slideshow/source

Sarper Akdemir (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 30 21:53:34 UTC 2020


 slideshow/source/engine/shapes/backgroundshape.cxx |    1 
 slideshow/source/engine/shapes/shapeimporter.cxx   |    1 
 slideshow/source/engine/slide/slideimpl.cxx        |    3 ++
 slideshow/source/inc/shape.hxx                     |   28 ++++++++++++++++++++-
 4 files changed, 32 insertions(+), 1 deletion(-)

New commits:
commit e13dd9546e27bdc3b894718fc2993f99722ea9f1
Author:     Sarper Akdemir <q.sarperakdemir at gmail.com>
AuthorDate: Wed Jun 10 02:33:22 2020 +0300
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Tue Jun 30 23:52:55 2020 +0200

    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 at CIB.de>

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.


More information about the Libreoffice-commits mailing list