Update ooo320-m1
[ooovba.git] / slideshow / source / inc / viewlayer.hxx
blob478c32f7f948a8afca3458a0aa565449b7b07967
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: viewlayer.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef INCLUDED_SLIDESHOW_VIEWLAYER_HXX
32 #define INCLUDED_SLIDESHOW_VIEWLAYER_HXX
34 #include <sal/config.h>
35 #include <boost/shared_ptr.hpp>
37 namespace basegfx
39 class B1DRange;
40 class B2DRange;
41 class B2DVector;
42 class B2DHomMatrix;
43 class B2DPolyPolygon;
45 namespace cppcanvas
47 class Canvas;
48 class CustomSprite;
52 /* Definition of ViewLayer interface */
54 namespace slideshow
56 namespace internal
58 class View;
60 class ViewLayer
62 public:
63 virtual ~ViewLayer() {}
65 /** Query whether layer displays on given view.
67 @return true, if this layer displays on the given
68 view.
70 virtual bool isOnView(boost::shared_ptr<View> const& rView) const = 0;
72 /** Get the associated canvas of this layer.
74 The canvas returned by this method must not change, as
75 long as this object is alive.
77 virtual boost::shared_ptr< cppcanvas::Canvas > getCanvas() const = 0;
79 /** Clear the clipped view layer area
81 This method clears the area inside the clip polygon,
82 if none is set, the transformed unit rectangle of the
83 view.
85 virtual void clear() const = 0;
87 /** Clear the complete view
89 This method clears the full view area (not only the
90 transformed unit rectangle, or within the clip). If
91 this ViewLayer represents the background layer, the
92 whole XSlideShowView is cleared. If this ViewLayer is
93 implemented using sprites (i.e. one of the upper
94 layers), the sprite is cleared to fully transparent.
96 virtual void clearAll() const = 0;
98 /** Create a sprite for this layer
100 @param rSpriteSizePixel
101 Sprite size in device pixel
103 @param nPriority
104 Sprite priority. This value determines the priority of
105 this sprite, relative to all other sprites of this
106 ViewLayer. The higher the priority, the closer to the
107 foreground the sprite will be.
109 @return the sprite, or NULL on failure (or if this
110 canvas does not support sprites).
112 virtual boost::shared_ptr< cppcanvas::CustomSprite >
113 createSprite( const basegfx::B2DVector& rSpriteSizePixel,
114 double nPriority ) const = 0;
116 /** Set the layer priority range
118 This method influences the relative priority of this
119 layer, i.e. the z position in relation to other layers
120 on the parent view. The higher the priority range, the
121 further in front the layer resides.
123 @param rRange
124 Priority range, must be in the range [0,1]
126 virtual void setPriority( const basegfx::B1DRange& rRange ) = 0;
128 /** Get the overall view transformation.
130 This method should <em>not</em> simply return the
131 underlying canvas' transformation, but rather provide
132 a layer above that. This enables clients of the
133 slideshow to set their own user space transformation
134 at the canvas, whilst the slideshow adds their
135 transformation on top of that. Concretely, this method
136 returns the user transform (implicitely calculated
137 from the setViewSize() method), combined with the view
138 transformation.
140 virtual basegfx::B2DHomMatrix getTransformation() const = 0;
142 /** Get the overall view transformation.
144 Same transformation as with getTransformation(), only
145 that you can safely use this one to position sprites
146 on screen (no ViewLayer offsets included whatsoever).
148 virtual basegfx::B2DHomMatrix getSpriteTransformation() const = 0;
150 /** Set clipping on this view layer.
152 @param rClip
153 Clip poly-polygon to set. The polygon is interpreted
154 in the user coordinate system, i.e. the view layer has
155 the size as given by setViewSize() on its
156 corresponding View.
158 virtual void setClip( const basegfx::B2DPolyPolygon& rClip ) = 0;
160 /** Resize this view layer.
162 @param rArea
163 New area to cover. The area is interpreted in the user
164 coordinate system, i.e. relative to the size as given
165 by setViewSize() on the corresponding View.
167 @return true, if layer was actually resized (which
168 invalidates its content)
170 virtual bool resize( const basegfx::B2DRange& rArea ) = 0;
174 typedef boost::shared_ptr< ViewLayer > ViewLayerSharedPtr;
178 #endif /* INCLUDED_SLIDESHOW_VIEWLAYER_HXX */