Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : :
20 : : #ifndef INCLUDED_SLIDESHOW_VIEWLAYER_HXX
21 : : #define INCLUDED_SLIDESHOW_VIEWLAYER_HXX
22 : :
23 : : #include <sal/config.h>
24 : : #include <boost/shared_ptr.hpp>
25 : :
26 : : namespace basegfx
27 : : {
28 : : class B1DRange;
29 : : class B2DRange;
30 : : class B2DVector;
31 : : class B2DHomMatrix;
32 : : class B2DPolyPolygon;
33 : : }
34 : : namespace cppcanvas
35 : : {
36 : : class Canvas;
37 : : class CustomSprite;
38 : : }
39 : :
40 : :
41 : : /* Definition of ViewLayer interface */
42 : :
43 : : namespace slideshow
44 : : {
45 : : namespace internal
46 : : {
47 : : class View;
48 : :
49 : 0 : class ViewLayer
50 : : {
51 : : public:
52 : 0 : virtual ~ViewLayer() {}
53 : :
54 : : /** Query whether layer displays on given view.
55 : :
56 : : @return true, if this layer displays on the given
57 : : view.
58 : : */
59 : : virtual bool isOnView(boost::shared_ptr<View> const& rView) const = 0;
60 : :
61 : : /** Get the associated canvas of this layer.
62 : :
63 : : The canvas returned by this method must not change, as
64 : : long as this object is alive.
65 : : */
66 : : virtual boost::shared_ptr< cppcanvas::Canvas > getCanvas() const = 0;
67 : :
68 : : /** Clear the clipped view layer area
69 : :
70 : : This method clears the area inside the clip polygon,
71 : : if none is set, the transformed unit rectangle of the
72 : : view.
73 : : */
74 : : virtual void clear() const = 0;
75 : :
76 : : /** Clear the complete view
77 : :
78 : : This method clears the full view area (not only the
79 : : transformed unit rectangle, or within the clip). If
80 : : this ViewLayer represents the background layer, the
81 : : whole XSlideShowView is cleared. If this ViewLayer is
82 : : implemented using sprites (i.e. one of the upper
83 : : layers), the sprite is cleared to fully transparent.
84 : : */
85 : : virtual void clearAll() const = 0;
86 : :
87 : : /** Create a sprite for this layer
88 : :
89 : : @param rSpriteSizePixel
90 : : Sprite size in device pixel
91 : :
92 : : @param nPriority
93 : : Sprite priority. This value determines the priority of
94 : : this sprite, relative to all other sprites of this
95 : : ViewLayer. The higher the priority, the closer to the
96 : : foreground the sprite will be.
97 : :
98 : : @return the sprite, or NULL on failure (or if this
99 : : canvas does not support sprites).
100 : : */
101 : : virtual boost::shared_ptr< cppcanvas::CustomSprite >
102 : : createSprite( const basegfx::B2DVector& rSpriteSizePixel,
103 : : double nPriority ) const = 0;
104 : :
105 : : /** Set the layer priority range
106 : :
107 : : This method influences the relative priority of this
108 : : layer, i.e. the z position in relation to other layers
109 : : on the parent view. The higher the priority range, the
110 : : further in front the layer resides.
111 : :
112 : : @param rRange
113 : : Priority range, must be in the range [0,1]
114 : : */
115 : : virtual void setPriority( const basegfx::B1DRange& rRange ) = 0;
116 : :
117 : : /** Get the overall view transformation.
118 : :
119 : : This method should <em>not</em> simply return the
120 : : underlying canvas' transformation, but rather provide
121 : : a layer above that. This enables clients of the
122 : : slideshow to set their own user space transformation
123 : : at the canvas, whilst the slideshow adds their
124 : : transformation on top of that. Concretely, this method
125 : : returns the user transform (implicitely calculated
126 : : from the setViewSize() method), combined with the view
127 : : transformation.
128 : : */
129 : : virtual basegfx::B2DHomMatrix getTransformation() const = 0;
130 : :
131 : : /** Get the overall view transformation.
132 : :
133 : : Same transformation as with getTransformation(), only
134 : : that you can safely use this one to position sprites
135 : : on screen (no ViewLayer offsets included whatsoever).
136 : : */
137 : : virtual basegfx::B2DHomMatrix getSpriteTransformation() const = 0;
138 : :
139 : : /** Set clipping on this view layer.
140 : :
141 : : @param rClip
142 : : Clip poly-polygon to set. The polygon is interpreted
143 : : in the user coordinate system, i.e. the view layer has
144 : : the size as given by setViewSize() on its
145 : : corresponding View.
146 : : */
147 : : virtual void setClip( const basegfx::B2DPolyPolygon& rClip ) = 0;
148 : :
149 : : /** Resize this view layer.
150 : :
151 : : @param rArea
152 : : New area to cover. The area is interpreted in the user
153 : : coordinate system, i.e. relative to the size as given
154 : : by setViewSize() on the corresponding View.
155 : :
156 : : @return true, if layer was actually resized (which
157 : : invalidates its content)
158 : : */
159 : : virtual bool resize( const basegfx::B2DRange& rArea ) = 0;
160 : :
161 : : };
162 : :
163 : : typedef boost::shared_ptr< ViewLayer > ViewLayerSharedPtr;
164 : : }
165 : : }
166 : :
167 : : #endif /* INCLUDED_SLIDESHOW_VIEWLAYER_HXX */
168 : :
169 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|