sw a11y: clang-format SidebarWinAccessible code
[LibreOffice.git] / slideshow / source / inc / viewlayer.hxx
blobbffe685f9d650ebafebb8aaf6642388145bc31f9
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 class 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::internal
49 class View;
50 typedef std::shared_ptr< View > ViewSharedPtr;
52 class ViewLayer
54 public:
55 virtual ~ViewLayer() {}
57 /** Query whether layer displays on given view.
59 @return true, if this layer displays on the given
60 view.
62 virtual bool isOnView(ViewSharedPtr const& rView) const = 0;
64 /** Get the associated canvas of this layer.
66 The canvas returned by this method must not change, as
67 long as this object is alive.
69 virtual cppcanvas::CanvasSharedPtr getCanvas() const = 0;
71 /** Clear the clipped view layer area
73 This method clears the area inside the clip polygon,
74 if none is set, the transformed unit rectangle of the
75 view.
77 virtual void clear() const = 0;
79 /** Clear the complete view
81 This method clears the full view area (not only the
82 transformed unit rectangle, or within the clip). If
83 this ViewLayer represents the background layer, the
84 whole XSlideShowView is cleared. If this ViewLayer is
85 implemented using sprites (i.e. one of the upper
86 layers), the sprite is cleared to fully transparent.
88 virtual void clearAll() const = 0;
90 /** Create a sprite for this layer
92 @param rSpriteSizePixel
93 Sprite size in device pixel
95 @param nPriority
96 Sprite priority. This value determines the priority of
97 this sprite, relative to all other sprites of this
98 ViewLayer. The higher the priority, the closer to the
99 foreground the sprite will be.
101 @return the sprite, or NULL on failure (or if this
102 canvas does not support sprites).
104 virtual cppcanvas::CustomSpriteSharedPtr
105 createSprite( const basegfx::B2DSize& rSpriteSizePixel,
106 double nPriority ) const = 0;
108 /** Set the layer priority range
110 This method influences the relative priority of this
111 layer, i.e. the z position in relation to other layers
112 on the parent view. The higher the priority range, the
113 further in front the layer resides.
115 @param rRange
116 Priority range, must be in the range [0,1]
118 virtual void setPriority( const basegfx::B1DRange& rRange ) = 0;
120 /** Get the overall view transformation.
122 This method should <em>not</em> simply return the
123 underlying canvas' transformation, but rather provide
124 a layer above that. This enables clients of the
125 slideshow to set their own user space transformation
126 at the canvas, whilst the slideshow adds their
127 transformation on top of that. Concretely, this method
128 returns the user transform (implicitly calculated
129 from the setViewSize() method), combined with the view
130 transformation.
132 virtual basegfx::B2DHomMatrix getTransformation() const = 0;
134 virtual css::geometry::IntegerSize2D getTranslationOffset() const = 0;
136 /** Get the overall view transformation.
138 Same transformation as with getTransformation(), only
139 that you can safely use this one to position sprites
140 on screen (no ViewLayer offsets included whatsoever).
142 virtual basegfx::B2DHomMatrix getSpriteTransformation() const = 0;
144 /** Set clipping on this view layer.
146 @param rClip
147 Clip poly-polygon to set. The polygon is interpreted
148 in the user coordinate system, i.e. the view layer has
149 the size as given by setViewSize() on its
150 corresponding View.
152 virtual void setClip( const basegfx::B2DPolyPolygon& rClip ) = 0;
154 /** Resize this view layer.
156 @param rArea
157 New area to cover. The area is interpreted in the user
158 coordinate system, i.e. relative to the size as given
159 by setViewSize() on the corresponding View.
161 @return true, if layer was actually resized (which
162 invalidates its content)
164 virtual bool resize( const basegfx::B2DRange& rArea ) = 0;
168 typedef std::shared_ptr< ViewLayer > ViewLayerSharedPtr;
171 #endif // INCLUDED_SLIDESHOW_SOURCE_INC_VIEWLAYER_HXX
173 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */