1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef INCLUDED_SLIDESHOW_VIEWLAYER_HXX
30 #define INCLUDED_SLIDESHOW_VIEWLAYER_HXX
32 #include <sal/config.h>
33 #include <boost/shared_ptr.hpp>
50 /* Definition of ViewLayer interface */
61 virtual ~ViewLayer() {}
63 /** Query whether layer displays on given view.
65 @return true, if this layer displays on the given
68 virtual bool isOnView(boost::shared_ptr
<View
> const& rView
) const = 0;
70 /** Get the associated canvas of this layer.
72 The canvas returned by this method must not change, as
73 long as this object is alive.
75 virtual boost::shared_ptr
< cppcanvas::Canvas
> getCanvas() const = 0;
77 /** Clear the clipped view layer area
79 This method clears the area inside the clip polygon,
80 if none is set, the transformed unit rectangle of the
83 virtual void clear() const = 0;
85 /** Clear the complete view
87 This method clears the full view area (not only the
88 transformed unit rectangle, or within the clip). If
89 this ViewLayer represents the background layer, the
90 whole XSlideShowView is cleared. If this ViewLayer is
91 implemented using sprites (i.e. one of the upper
92 layers), the sprite is cleared to fully transparent.
94 virtual void clearAll() const = 0;
96 /** Create a sprite for this layer
98 @param rSpriteSizePixel
99 Sprite size in device pixel
102 Sprite priority. This value determines the priority of
103 this sprite, relative to all other sprites of this
104 ViewLayer. The higher the priority, the closer to the
105 foreground the sprite will be.
107 @return the sprite, or NULL on failure (or if this
108 canvas does not support sprites).
110 virtual boost::shared_ptr
< cppcanvas::CustomSprite
>
111 createSprite( const basegfx::B2DVector
& rSpriteSizePixel
,
112 double nPriority
) const = 0;
114 /** Set the layer priority range
116 This method influences the relative priority of this
117 layer, i.e. the z position in relation to other layers
118 on the parent view. The higher the priority range, the
119 further in front the layer resides.
122 Priority range, must be in the range [0,1]
124 virtual void setPriority( const basegfx::B1DRange
& rRange
) = 0;
126 /** Get the overall view transformation.
128 This method should <em>not</em> simply return the
129 underlying canvas' transformation, but rather provide
130 a layer above that. This enables clients of the
131 slideshow to set their own user space transformation
132 at the canvas, whilst the slideshow adds their
133 transformation on top of that. Concretely, this method
134 returns the user transform (implicitely calculated
135 from the setViewSize() method), combined with the view
138 virtual basegfx::B2DHomMatrix
getTransformation() const = 0;
140 /** Get the overall view transformation.
142 Same transformation as with getTransformation(), only
143 that you can safely use this one to position sprites
144 on screen (no ViewLayer offsets included whatsoever).
146 virtual basegfx::B2DHomMatrix
getSpriteTransformation() const = 0;
148 /** Set clipping on this view layer.
151 Clip poly-polygon to set. The polygon is interpreted
152 in the user coordinate system, i.e. the view layer has
153 the size as given by setViewSize() on its
156 virtual void setClip( const basegfx::B2DPolyPolygon
& rClip
) = 0;
158 /** Resize this view layer.
161 New area to cover. The area is interpreted in the user
162 coordinate system, i.e. relative to the size as given
163 by setViewSize() on the corresponding View.
165 @return true, if layer was actually resized (which
166 invalidates its content)
168 virtual bool resize( const basegfx::B2DRange
& rArea
) = 0;
172 typedef boost::shared_ptr
< ViewLayer
> ViewLayerSharedPtr
;
176 #endif /* INCLUDED_SLIDESHOW_VIEWLAYER_HXX */
178 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */