Bump version to 6.4-15
[LibreOffice.git] / slideshow / source / inc / viewlayer.hxx
bloba3a331a1666e74f2ae6337999b33d40735ae6b6b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SLIDESHOW_SOURCE_INC_VIEWLAYER_HXX
21 #define INCLUDED_SLIDESHOW_SOURCE_INC_VIEWLAYER_HXX
23 #include <sal/config.h>
24 #include <memory>
25 #include <com/sun/star/geometry/IntegerSize2D.hpp>
27 namespace basegfx
29 class B1DRange;
30 class B2DRange;
31 class B2DVector;
32 class B2DHomMatrix;
33 class B2DPolyPolygon;
34 typedef B2DVector B2DSize;
36 namespace cppcanvas
38 class Canvas;
39 class CustomSprite;
40 typedef std::shared_ptr< Canvas > CanvasSharedPtr;
41 typedef std::shared_ptr< ::cppcanvas::CustomSprite > CustomSpriteSharedPtr;
45 /* Definition of ViewLayer interface */
47 namespace slideshow
49 namespace internal
51 class View;
52 typedef std::shared_ptr< View > ViewSharedPtr;
54 class ViewLayer
56 public:
57 virtual ~ViewLayer() {}
59 /** Query whether layer displays on given view.
61 @return true, if this layer displays on the given
62 view.
64 virtual bool isOnView(ViewSharedPtr const& rView) const = 0;
66 /** Get the associated canvas of this layer.
68 The canvas returned by this method must not change, as
69 long as this object is alive.
71 virtual cppcanvas::CanvasSharedPtr getCanvas() const = 0;
73 /** Clear the clipped view layer area
75 This method clears the area inside the clip polygon,
76 if none is set, the transformed unit rectangle of the
77 view.
79 virtual void clear() const = 0;
81 /** Clear the complete view
83 This method clears the full view area (not only the
84 transformed unit rectangle, or within the clip). If
85 this ViewLayer represents the background layer, the
86 whole XSlideShowView is cleared. If this ViewLayer is
87 implemented using sprites (i.e. one of the upper
88 layers), the sprite is cleared to fully transparent.
90 virtual void clearAll() const = 0;
92 /** Create a sprite for this layer
94 @param rSpriteSizePixel
95 Sprite size in device pixel
97 @param nPriority
98 Sprite priority. This value determines the priority of
99 this sprite, relative to all other sprites of this
100 ViewLayer. The higher the priority, the closer to the
101 foreground the sprite will be.
103 @return the sprite, or NULL on failure (or if this
104 canvas does not support sprites).
106 virtual cppcanvas::CustomSpriteSharedPtr
107 createSprite( const basegfx::B2DSize& rSpriteSizePixel,
108 double nPriority ) const = 0;
110 /** Set the layer priority range
112 This method influences the relative priority of this
113 layer, i.e. the z position in relation to other layers
114 on the parent view. The higher the priority range, the
115 further in front the layer resides.
117 @param rRange
118 Priority range, must be in the range [0,1]
120 virtual void setPriority( const basegfx::B1DRange& rRange ) = 0;
122 /** Get the overall view transformation.
124 This method should <em>not</em> simply return the
125 underlying canvas' transformation, but rather provide
126 a layer above that. This enables clients of the
127 slideshow to set their own user space transformation
128 at the canvas, whilst the slideshow adds their
129 transformation on top of that. Concretely, this method
130 returns the user transform (implicitly calculated
131 from the setViewSize() method), combined with the view
132 transformation.
134 virtual basegfx::B2DHomMatrix getTransformation() const = 0;
136 virtual css::geometry::IntegerSize2D getTranslationOffset() const = 0;
138 /** Get the overall view transformation.
140 Same transformation as with getTransformation(), only
141 that you can safely use this one to position sprites
142 on screen (no ViewLayer offsets included whatsoever).
144 virtual basegfx::B2DHomMatrix getSpriteTransformation() const = 0;
146 /** Set clipping on this view layer.
148 @param rClip
149 Clip poly-polygon to set. The polygon is interpreted
150 in the user coordinate system, i.e. the view layer has
151 the size as given by setViewSize() on its
152 corresponding View.
154 virtual void setClip( const basegfx::B2DPolyPolygon& rClip ) = 0;
156 /** Resize this view layer.
158 @param rArea
159 New area to cover. The area is interpreted in the user
160 coordinate system, i.e. relative to the size as given
161 by setViewSize() on the corresponding View.
163 @return true, if layer was actually resized (which
164 invalidates its content)
166 virtual bool resize( const basegfx::B2DRange& rArea ) = 0;
170 typedef std::shared_ptr< ViewLayer > ViewLayerSharedPtr;
174 #endif // INCLUDED_SLIDESHOW_SOURCE_INC_VIEWLAYER_HXX
176 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */