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 : #include <com/sun/star/geometry/IntegerSize2D.hpp>
26 :
27 : namespace basegfx
28 : {
29 : class B1DRange;
30 : class B2DRange;
31 : class B2DVector;
32 : class B2DHomMatrix;
33 : class B2DPolyPolygon;
34 : }
35 : namespace cppcanvas
36 : {
37 : class Canvas;
38 : class CustomSprite;
39 : }
40 :
41 :
42 : /* Definition of ViewLayer interface */
43 :
44 : namespace slideshow
45 : {
46 : namespace internal
47 : {
48 : class View;
49 :
50 0 : class ViewLayer
51 : {
52 : public:
53 0 : virtual ~ViewLayer() {}
54 :
55 : /** Query whether layer displays on given view.
56 :
57 : @return true, if this layer displays on the given
58 : view.
59 : */
60 : virtual bool isOnView(boost::shared_ptr<View> const& rView) const = 0;
61 :
62 : /** Get the associated canvas of this layer.
63 :
64 : The canvas returned by this method must not change, as
65 : long as this object is alive.
66 : */
67 : virtual boost::shared_ptr< cppcanvas::Canvas > getCanvas() const = 0;
68 :
69 : /** Clear the clipped view layer area
70 :
71 : This method clears the area inside the clip polygon,
72 : if none is set, the transformed unit rectangle of the
73 : view.
74 : */
75 : virtual void clear() const = 0;
76 :
77 : /** Clear the complete view
78 :
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.
85 : */
86 : virtual void clearAll() const = 0;
87 :
88 : /** Create a sprite for this layer
89 :
90 : @param rSpriteSizePixel
91 : Sprite size in device pixel
92 :
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.
98 :
99 : @return the sprite, or NULL on failure (or if this
100 : canvas does not support sprites).
101 : */
102 : virtual boost::shared_ptr< cppcanvas::CustomSprite >
103 : createSprite( const basegfx::B2DVector& rSpriteSizePixel,
104 : double nPriority ) const = 0;
105 :
106 : /** Set the layer priority range
107 :
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.
112 :
113 : @param rRange
114 : Priority range, must be in the range [0,1]
115 : */
116 : virtual void setPriority( const basegfx::B1DRange& rRange ) = 0;
117 :
118 : /** Get the overall view transformation.
119 :
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 (implicitely calculated
127 : from the setViewSize() method), combined with the view
128 : transformation.
129 : */
130 : virtual basegfx::B2DHomMatrix getTransformation() const = 0;
131 :
132 : virtual ::com::sun::star::geometry::IntegerSize2D getTranslationOffset() const = 0;
133 :
134 : /** Get the overall view transformation.
135 :
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).
139 : */
140 : virtual basegfx::B2DHomMatrix getSpriteTransformation() const = 0;
141 :
142 : /** Set clipping on this view layer.
143 :
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.
149 : */
150 : virtual void setClip( const basegfx::B2DPolyPolygon& rClip ) = 0;
151 :
152 : /** Resize this view layer.
153 :
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.
158 :
159 : @return true, if layer was actually resized (which
160 : invalidates its content)
161 : */
162 : virtual bool resize( const basegfx::B2DRange& rArea ) = 0;
163 :
164 : };
165 :
166 : typedef boost::shared_ptr< ViewLayer > ViewLayerSharedPtr;
167 : }
168 : }
169 :
170 : #endif /* INCLUDED_SLIDESHOW_VIEWLAYER_HXX */
171 :
172 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|