bump product version to 5.0.4.1
[LibreOffice.git] / slideshow / source / inc / viewlayer.hxx
bloba30d210820a540f30834a0dd2b1a7e006418731d
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 <boost/shared_ptr.hpp>
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;
35 namespace cppcanvas
37 class Canvas;
38 class CustomSprite;
42 /* Definition of ViewLayer interface */
44 namespace slideshow
46 namespace internal
48 class View;
50 class ViewLayer
52 public:
53 virtual ~ViewLayer() {}
55 /** Query whether layer displays on given view.
57 @return true, if this layer displays on the given
58 view.
60 virtual bool isOnView(boost::shared_ptr<View> const& rView) const = 0;
62 /** Get the associated canvas of this layer.
64 The canvas returned by this method must not change, as
65 long as this object is alive.
67 virtual boost::shared_ptr< cppcanvas::Canvas > getCanvas() const = 0;
69 /** Clear the clipped view layer area
71 This method clears the area inside the clip polygon,
72 if none is set, the transformed unit rectangle of the
73 view.
75 virtual void clear() const = 0;
77 /** Clear the complete view
79 This method clears the full view area (not only the
80 transformed unit rectangle, or within the clip). If
81 this ViewLayer represents the background layer, the
82 whole XSlideShowView is cleared. If this ViewLayer is
83 implemented using sprites (i.e. one of the upper
84 layers), the sprite is cleared to fully transparent.
86 virtual void clearAll() const = 0;
88 /** Create a sprite for this layer
90 @param rSpriteSizePixel
91 Sprite size in device pixel
93 @param nPriority
94 Sprite priority. This value determines the priority of
95 this sprite, relative to all other sprites of this
96 ViewLayer. The higher the priority, the closer to the
97 foreground the sprite will be.
99 @return the sprite, or NULL on failure (or if this
100 canvas does not support sprites).
102 virtual boost::shared_ptr< cppcanvas::CustomSprite >
103 createSprite( const basegfx::B2DVector& rSpriteSizePixel,
104 double nPriority ) const = 0;
106 /** Set the layer priority range
108 This method influences the relative priority of this
109 layer, i.e. the z position in relation to other layers
110 on the parent view. The higher the priority range, the
111 further in front the layer resides.
113 @param rRange
114 Priority range, must be in the range [0,1]
116 virtual void setPriority( const basegfx::B1DRange& rRange ) = 0;
118 /** Get the overall view transformation.
120 This method should <em>not</em> simply return the
121 underlying canvas' transformation, but rather provide
122 a layer above that. This enables clients of the
123 slideshow to set their own user space transformation
124 at the canvas, whilst the slideshow adds their
125 transformation on top of that. Concretely, this method
126 returns the user transform (implicitly calculated
127 from the setViewSize() method), combined with the view
128 transformation.
130 virtual basegfx::B2DHomMatrix getTransformation() const = 0;
132 virtual ::com::sun::star::geometry::IntegerSize2D getTranslationOffset() const = 0;
134 /** Get the overall view transformation.
136 Same transformation as with getTransformation(), only
137 that you can safely use this one to position sprites
138 on screen (no ViewLayer offsets included whatsoever).
140 virtual basegfx::B2DHomMatrix getSpriteTransformation() const = 0;
142 /** Set clipping on this view layer.
144 @param rClip
145 Clip poly-polygon to set. The polygon is interpreted
146 in the user coordinate system, i.e. the view layer has
147 the size as given by setViewSize() on its
148 corresponding View.
150 virtual void setClip( const basegfx::B2DPolyPolygon& rClip ) = 0;
152 /** Resize this view layer.
154 @param rArea
155 New area to cover. The area is interpreted in the user
156 coordinate system, i.e. relative to the size as given
157 by setViewSize() on the corresponding View.
159 @return true, if layer was actually resized (which
160 invalidates its content)
162 virtual bool resize( const basegfx::B2DRange& rArea ) = 0;
166 typedef boost::shared_ptr< ViewLayer > ViewLayerSharedPtr;
170 #endif // INCLUDED_SLIDESHOW_SOURCE_INC_VIEWLAYER_HXX
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */