LibreOffice Module slideshow (master) 1
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
slideshow::internal::Layer Class Reference

This class represents one layer of output on a Slide. More...

#include <layer.hxx>

Inheritance diagram for slideshow::internal::Layer:
[legend]
Collaboration diagram for slideshow::internal::Layer:
[legend]

Classes

struct  ViewEntry
 

Public Types

typedef std::shared_ptr< LayerEndUpdateEndUpdater
 

Public Member Functions

 Layer (const Layer &)=delete
 Forbid copy construction. More...
 
Layeroperator= (const Layer &)=delete
 Forbid copy assignment. More...
 
bool isBackgroundLayer () const
 Predicate, whether this layer is the special background layer. More...
 
ViewLayerSharedPtr addView (const ViewSharedPtr &rNewView)
 Add a view to this layer. More...
 
ViewLayerSharedPtr removeView (const ViewSharedPtr &rView)
 Remove a view. More...
 
void setShapeViews (ShapeSharedPtr const &rShape) const
 Init shape with this layer's views. More...
 
void setPriority (const ::basegfx::B1DRange &rPrioRange)
 Change layer priority range. More...
 
void addUpdateRange (::basegfx::B2DRange const &rUpdateRange)
 Add an area that needs update. More...
 
bool isUpdatePending () const
 Whether any update ranges have been added. More...
 
void updateBounds (ShapeSharedPtr const &rShape)
 Update layer bound rect from shape bounds. More...
 
bool commitBounds ()
 Commit collected layer bounds to ViewLayer. More...
 
void clearUpdateRanges ()
 Clear all registered update ranges. More...
 
void clearContent ()
 Clear whole layer content. More...
 
EndUpdater beginUpdate ()
 Init layer update. More...
 
void endUpdate ()
 Finish layer update. More...
 
bool isInsideUpdateArea (ShapeSharedPtr const &rShape) const
 Check whether given shape is inside current update area. More...
 

Static Public Member Functions

static LayerSharedPtr createBackgroundLayer ()
 Create background layer. More...
 
static LayerSharedPtr createLayer ()
 Create non-background layer. More...
 

Private Types

enum  Dummy { BackgroundLayer }
 
typedef ::std::vector< ViewEntryViewEntryVector
 

Private Member Functions

 Layer (Dummy eFlag)
 Create background layer. More...
 
 Layer ()
 Create non-background layer. More...
 

Private Attributes

ViewEntryVector maViewEntries
 
basegfx::B2DPolyRange maUpdateAreas
 
basegfx::B2DRange maBounds
 
basegfx::B2DRange maNewBounds
 
bool mbBoundsDirty
 
bool mbBackgroundLayer
 
bool mbClipSet
 

Detailed Description

This class represents one layer of output on a Slide.

Layers group shapes for a certain depth region of a slide.

Since slides have a notion of depth, i.e. shapes on it have a certain order in which they lie upon each other, this layering must be modelled. A prime example for this necessity are animations of shapes lying behind other shapes. Then, everything behind the animated shape will be in a background layer, the shape itself will be in an animation layer, and everything before it will be in a foreground layer (these layers are most preferably modelled as XSprite objects internally).

Attention: \n All methods of this class are only supposed to
be called from the LayerManager. Normally, it shouldn't be possible to get hold of an instance of this class at all.

Definition at line 61 of file layer.hxx.

Member Typedef Documentation

◆ EndUpdater

Definition at line 64 of file layer.hxx.

◆ ViewEntryVector

typedef ::std::vector< ViewEntry > slideshow::internal::Layer::ViewEntryVector
private

Definition at line 246 of file layer.hxx.

Member Enumeration Documentation

◆ Dummy

Enumerator
BackgroundLayer 

Definition at line 208 of file layer.hxx.

Constructor & Destructor Documentation

◆ Layer() [1/3]

slideshow::internal::Layer::Layer ( const Layer )
delete

Forbid copy construction.

◆ Layer() [2/3]

slideshow::internal::Layer::Layer ( Dummy  eFlag)
explicitprivate

Create background layer.

This constructor will create a layer without a ViewLayer, i.e. one that displays directly on the background.

Parameters
eFlagDummy parameter, to disambiguate from normal layer constructor

Definition at line 35 of file layer.cxx.

◆ Layer() [3/3]

slideshow::internal::Layer::Layer ( )
explicitprivate

Create non-background layer.

This constructor will create a layer in front of the background, to contain shapes that should appear in front of animated objects.

Definition at line 45 of file layer.cxx.

Referenced by createBackgroundLayer().

Member Function Documentation

◆ addUpdateRange()

void slideshow::internal::Layer::addUpdateRange ( ::basegfx::B2DRange const &  rUpdateRange)

Add an area that needs update.

Parameters
rUpdateRangeArea on this layer that needs update

Definition at line 129 of file layer.cxx.

References basegfx::B2DPolyRange::appendElement(), basegfx::Range2D< typename TYPE, typename TRAITS >::isEmpty(), maUpdateAreas, and basegfx::Positive.

◆ addView()

ViewLayerSharedPtr slideshow::internal::Layer::addView ( const ViewSharedPtr rNewView)

Add a view to this layer.

If the view is already added, this method does not add it a second time, just returning the existing ViewLayer.

Parameters
rNewViewNew view to add to this layer.
Returns
the newly generated ViewLayer for this View

Definition at line 55 of file layer.cxx.

References maBounds, maViewEntries, and mbBackgroundLayer.

◆ beginUpdate()

Layer::EndUpdater slideshow::internal::Layer::beginUpdate ( )

Init layer update.

This method initializes a full layer update of the update area. When the last copy of the returned EndUpdater is destroyed, the Layer leaves update mode again.

Returns
an update end RAII object.

Definition at line 208 of file layer.cxx.

References basegfx::B2DPolyPolygon::count(), basegfx::B2DPolyRange::count(), maUpdateAreas, maViewEntries, mbClipSet, and basegfx::B2DPolyRange::solveCrossovers().

◆ clearContent()

void slideshow::internal::Layer::clearContent ( )

Clear whole layer content.

This method clears the whole layer content. As a byproduct, all update ranges are cleared as well. It makes no sense to maintain them any further, since they only serve for partial updates.

Definition at line 182 of file layer.cxx.

References clearUpdateRanges(), and maViewEntries.

◆ clearUpdateRanges()

void slideshow::internal::Layer::clearUpdateRanges ( )

Clear all registered update ranges.

This method clears all update ranges that are registered at this layer.

Definition at line 177 of file layer.cxx.

References basegfx::B2DPolyRange::clear(), and maUpdateAreas.

Referenced by clearContent(), commitBounds(), and endUpdate().

◆ commitBounds()

bool slideshow::internal::Layer::commitBounds ( )

Commit collected layer bounds to ViewLayer.

Call this method when you're done adding new shapes to the layer.

Returns
true, if layer needed a resize (which invalidates its content - you have to repaint all contained shapes!)

Definition at line 150 of file layer.cxx.

References clearUpdateRanges(), maBounds, maNewBounds, maViewEntries, mbBackgroundLayer, and mbBoundsDirty.

◆ createBackgroundLayer()

LayerSharedPtr slideshow::internal::Layer::createBackgroundLayer ( )
static

Create background layer.

This method will create a layer without a ViewLayer, i.e. one that displays directly on the background.

Definition at line 261 of file layer.cxx.

References BackgroundLayer, and Layer().

Referenced by slideshow::internal::LayerManager::LayerManager().

◆ createLayer()

LayerSharedPtr slideshow::internal::Layer::createLayer ( )
static

Create non-background layer.

This method will create a layer in front of the background, to contain shapes that should appear in front of animated objects.

Definition at line 266 of file layer.cxx.

Referenced by slideshow::internal::LayerManager::createForegroundLayer().

◆ endUpdate()

void slideshow::internal::Layer::endUpdate ( )

Finish layer update.

Resets clipping and transformation to normal values

Definition at line 242 of file layer.cxx.

References clearUpdateRanges(), maViewEntries, and mbClipSet.

◆ isBackgroundLayer()

bool slideshow::internal::Layer::isBackgroundLayer ( ) const
inline

Predicate, whether this layer is the special background layer.

This method is mostly useful for checking invariants.

Definition at line 92 of file layer.hxx.

References mbBackgroundLayer.

◆ isInsideUpdateArea()

bool slideshow::internal::Layer::isInsideUpdateArea ( ShapeSharedPtr const &  rShape) const

Check whether given shape is inside current update area.

Returns
true, if the given shape is at least partially inside the current update area.

Definition at line 256 of file layer.cxx.

References maUpdateAreas, and basegfx::B2DPolyRange::overlaps().

◆ isUpdatePending()

bool slideshow::internal::Layer::isUpdatePending ( ) const
inline

Whether any update ranges have been added.

Returns
true, if any non-empty addUpdateRange() calls have been made since the last render()/update() call.

Definition at line 150 of file layer.hxx.

References basegfx::B2DPolyRange::count(), and maUpdateAreas.

Referenced by slideshow::internal::LayerManager::isUpdatePending(), and slideshow::internal::LayerManager::update().

◆ operator=()

Layer & slideshow::internal::Layer::operator= ( const Layer )
delete

Forbid copy assignment.

◆ removeView()

ViewLayerSharedPtr slideshow::internal::Layer::removeView ( const ViewSharedPtr rView)

Remove a view.

This method removes the view from this Layer and all shapes included herein.

Returns
the ViewLayer of the removed Layer, if any. Otherwise, NULL is returned.

Definition at line 85 of file layer.cxx.

References maViewEntries.

◆ setPriority()

void slideshow::internal::Layer::setPriority ( const ::basegfx::B1DRange rPrioRange)

Change layer priority range.

The layer priority affects the position of the layer in the z direction (i.e. before/behind which other layers this one appears). The higher the prio, the further on top of the layer stack this one appears.

Parameters
rPrioRangeThe priority range of differing layers must not intersect

Definition at line 120 of file layer.cxx.

References maViewEntries, and mbBackgroundLayer.

◆ setShapeViews()

void slideshow::internal::Layer::setShapeViews ( ShapeSharedPtr const &  rShape) const

Init shape with this layer's views.

Parameters
rShapeThe shape, that will subsequently display on this layer's views

Definition at line 112 of file layer.cxx.

References maViewEntries.

◆ updateBounds()

void slideshow::internal::Layer::updateBounds ( ShapeSharedPtr const &  rShape)

Member Data Documentation

◆ maBounds

basegfx::B2DRange slideshow::internal::Layer::maBounds
private

Definition at line 250 of file layer.hxx.

Referenced by addView(), and commitBounds().

◆ maNewBounds

basegfx::B2DRange slideshow::internal::Layer::maNewBounds
private

Definition at line 251 of file layer.hxx.

Referenced by commitBounds(), and updateBounds().

◆ maUpdateAreas

basegfx::B2DPolyRange slideshow::internal::Layer::maUpdateAreas
private

◆ maViewEntries

ViewEntryVector slideshow::internal::Layer::maViewEntries
private

◆ mbBackgroundLayer

bool slideshow::internal::Layer::mbBackgroundLayer
private

Definition at line 253 of file layer.hxx.

Referenced by addView(), commitBounds(), isBackgroundLayer(), setPriority(), and updateBounds().

◆ mbBoundsDirty

bool slideshow::internal::Layer::mbBoundsDirty
private

Definition at line 252 of file layer.hxx.

Referenced by commitBounds(), and updateBounds().

◆ mbClipSet

bool slideshow::internal::Layer::mbClipSet
private

Definition at line 257 of file layer.hxx.

Referenced by beginUpdate(), and endUpdate().


The documentation for this class was generated from the following files: