LibreOffice Module slideshow (master) 1
layer.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#ifndef INCLUDED_SLIDESHOW_SOURCE_ENGINE_SLIDE_LAYER_HXX
21#define INCLUDED_SLIDESHOW_SOURCE_ENGINE_SLIDE_LAYER_HXX
22
24
25#include <shape.hxx>
26#include <utility>
27#include <view.hxx>
28
29#include <vector>
30#include <memory>
31
32
33namespace slideshow::internal
34 {
35 class LayerEndUpdate;
36 class Layer;
37 typedef ::std::shared_ptr< Layer > LayerSharedPtr;
38 typedef ::std::weak_ptr< Layer > LayerWeakPtr;
39
40
41 /* Definition of Layer class */
42
61 class Layer : public std::enable_shared_from_this<Layer>
62 {
63 public:
64 typedef std::shared_ptr<LayerEndUpdate> EndUpdater;
65
67 Layer(const Layer&) = delete;
69 Layer& operator=(const Layer&) = delete;
70
77
85
86
92 bool isBackgroundLayer() const { return mbBackgroundLayer; }
93
104 ViewLayerSharedPtr addView( const ViewSharedPtr& rNewView );
105
115
122 void setShapeViews( ShapeSharedPtr const& rShape ) const;
123
124
136 void setPriority( const ::basegfx::B1DRange& rPrioRange );
137
143 void addUpdateRange( ::basegfx::B2DRange const& rUpdateRange );
144
150 bool isUpdatePending() const { return maUpdateAreas.count()!=0; }
151
154 void updateBounds( ShapeSharedPtr const& rShape );
155
165 bool commitBounds();
166
172 void clearUpdateRanges();
173
181 void clearContent();
182
193
198 void endUpdate();
199
205 bool isInsideUpdateArea( ShapeSharedPtr const& rShape ) const;
206
207 private:
209
220 explicit Layer( Dummy eFlag );
221
228 explicit Layer();
229
231 {
233 ViewLayerSharedPtr xViewLayer ) :
234 mpView(std::move( xView )),
235 mpViewLayer(std::move( xViewLayer ))
236 {}
237
240
241 // for generic algo access (which needs actual functions)
242 const ViewSharedPtr& getView() const { return mpView; }
243 const ViewLayerSharedPtr& getViewLayer() const { return mpViewLayer; }
244 };
245
246 typedef ::std::vector< ViewEntry > ViewEntryVector;
247
252 bool mbBoundsDirty; // true, if view layers need resize
253 bool mbBackgroundLayer; // true, if this
254 // layer is the
255 // special
256 // background layer
257 bool mbClipSet; // true, if beginUpdate set a clip
258 };
259
260}
261
262#endif // INCLUDED_SLIDESHOW_SOURCE_ENGINE_SLIDE_LAYER_HXX
263
264/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt32 count() const
This class represents one layer of output on a Slide.
Definition: layer.hxx:62
void updateBounds(ShapeSharedPtr const &rShape)
Update layer bound rect from shape bounds.
Definition: layer.cxx:137
basegfx::B2DPolyRange maUpdateAreas
Definition: layer.hxx:249
Layer()
Create non-background layer.
Definition: layer.cxx:45
ViewLayerSharedPtr addView(const ViewSharedPtr &rNewView)
Add a view to this layer.
Definition: layer.cxx:55
ViewLayerSharedPtr removeView(const ViewSharedPtr &rView)
Remove a view.
Definition: layer.cxx:85
bool isUpdatePending() const
Whether any update ranges have been added.
Definition: layer.hxx:150
void endUpdate()
Finish layer update.
Definition: layer.cxx:242
bool isInsideUpdateArea(ShapeSharedPtr const &rShape) const
Check whether given shape is inside current update area.
Definition: layer.cxx:256
static LayerSharedPtr createBackgroundLayer()
Create background layer.
Definition: layer.cxx:261
bool commitBounds()
Commit collected layer bounds to ViewLayer.
Definition: layer.cxx:150
basegfx::B2DRange maNewBounds
Definition: layer.hxx:251
Layer & operator=(const Layer &)=delete
Forbid copy assignment.
void clearUpdateRanges()
Clear all registered update ranges.
Definition: layer.cxx:177
void addUpdateRange(::basegfx::B2DRange const &rUpdateRange)
Add an area that needs update.
Definition: layer.cxx:129
std::shared_ptr< LayerEndUpdate > EndUpdater
Definition: layer.hxx:64
basegfx::B2DRange maBounds
Definition: layer.hxx:250
void setShapeViews(ShapeSharedPtr const &rShape) const
Init shape with this layer's views.
Definition: layer.cxx:112
void clearContent()
Clear whole layer content.
Definition: layer.cxx:182
void setPriority(const ::basegfx::B1DRange &rPrioRange)
Change layer priority range.
Definition: layer.cxx:120
ViewEntryVector maViewEntries
Definition: layer.hxx:248
bool isBackgroundLayer() const
Predicate, whether this layer is the special background layer.
Definition: layer.hxx:92
::std::vector< ViewEntry > ViewEntryVector
Definition: layer.hxx:246
static LayerSharedPtr createLayer()
Create non-background layer.
Definition: layer.cxx:266
EndUpdater beginUpdate()
Init layer update.
Definition: layer.cxx:208
Layer(const Layer &)=delete
Forbid copy construction.
std::shared_ptr< View > ViewSharedPtr
Definition: view.hxx:80
std::shared_ptr< ViewLayer > ViewLayerSharedPtr
Definition: viewlayer.hxx:168
::std::weak_ptr< Layer > LayerWeakPtr
Definition: layer.hxx:38
::std::shared_ptr< Layer > LayerSharedPtr
Definition: layer.hxx:36
::std::shared_ptr< Shape > ShapeSharedPtr
ViewLayerSharedPtr mpViewLayer
Definition: layer.hxx:239
const ViewLayerSharedPtr & getViewLayer() const
Definition: layer.hxx:243
ViewEntry(ViewSharedPtr xView, ViewLayerSharedPtr xViewLayer)
Definition: layer.hxx:232
const ViewSharedPtr & getView() const
Definition: layer.hxx:242