xref: /aoo42x/main/slideshow/source/inc/slide.hxx (revision 32698fcc)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef INCLUDED_SLIDESHOW_SLIDE_HXX
25 #define INCLUDED_SLIDESHOW_SLIDE_HXX
26 
27 #include "shapemanager.hxx"
28 #include "subsettableshapemanager.hxx"
29 #include "unoviewcontainer.hxx"
30 #include "slidebitmap.hxx"
31 #include "shapemaps.hxx"
32 
33 #include <boost/shared_ptr.hpp>
34 
35 namespace com {  namespace sun { namespace star {
36     namespace drawing {
37         class XDrawPage;
38         class XDrawPagesSupplier;
39     }
40     namespace uno {
41         class XComponentContext;
42     }
43     namespace animations {
44         class XAnimationNode;
45 } } } }
46 
47 namespace basegfx
48 {
49     class B2IVector;
50 }
51 
52 /* Definition of Slide interface */
53 
54 namespace slideshow
55 {
56     namespace internal
57     {
58         class RGBColor;
59         class ScreenUpdater;
60         typedef ::std::vector< ::cppcanvas::PolyPolygonSharedPtr> PolyPolygonVector;
61         class Slide
62         {
63         public:
64             // Showing
65             // -------------------------------------------------------------------
66 
67             /** Prepares to show slide.
68 
69             	Call this method to reduce the timeout show(), and
70             	getInitialSlideBitmap() need to complete. If
71             	prefetch() is not called explicitly, the named
72             	methods will call it implicitly.
73              */
74             virtual bool prefetch() = 0;
75 
76             /** Shows the slide on all registered views
77 
78                 After this call, the slide will render itself to the
79                 views, and start its animations.
80 
81                 @param bSlideBackgoundPainted
82                 When true, the initial slide content on the background
83                 layer is already rendered (e.g. from a previous slide
84                 transition). When false, Slide renders initial content of
85                 slide.
86              */
87             virtual bool show( bool bSlideBackgoundPainted ) = 0;
88 
89             /** Force-ends the slide
90 
91                 After this call, the slide has stopped all animations,
92                 and ceased rendering/visualization on all views.
93              */
94             virtual void hide() = 0;
95 
96 
97             // Queries
98             // -------------------------------------------------------------------
99 
100             /** Query the size of this slide in user coordinates
101 
102                 This value is retrieved from the XDrawPage properties.
103              */
104             virtual basegfx::B2IVector getSlideSize() const = 0;
105 
106             /// Gets the underlying API page
107             virtual ::com::sun::star::uno::Reference<
108                 ::com::sun::star::drawing::XDrawPage > getXDrawPage() const = 0;
109 
110             /// Gets the animation node.
111             virtual ::com::sun::star::uno::Reference<
112                 ::com::sun::star::animations::XAnimationNode > getXAnimationNode() const = 0;
113 
114             ///Gets the slide Polygons
115             virtual PolyPolygonVector getPolygons() = 0;
116 
117             ///Draw the slide Polygons
118             virtual void drawPolygons() const = 0;
119 
120             ///Check if paint overlay is already active
121             virtual bool isPaintOverlayActive() const = 0;
122 
123 			virtual void enablePaintOverlay() = 0;
124 			virtual void disablePaintOverlay() = 0;
125 
126 			virtual void update_settings( bool bUserPaintEnabled, RGBColor const& aUserPaintColor, double dUserPaintStrokeWidth ) = 0;
127 
128             // Slide bitmaps
129             // -------------------------------------------------------------------
130 
131             /** Request bitmap for current slide appearance.
132 
133             	The bitmap returned by this method depends on the
134             	current state of the slide and the contained
135             	animations. A newly generated slide will return the
136             	initial slide content here (e.g. with all 'appear'
137             	effect shapes invisible), a slide whose effects are
138             	currently running will return a bitmap corresponding
139             	to the current position on the animation timeline, and
140             	a slide whose effects have all been run will generate
141             	a bitmap with the final slide appearance (e.g. with
142             	all 'hide' effect shapes invisible).
143 
144             	@param rView
145                 View to retrieve bitmap for (note that the bitmap will
146                 have device-pixel equivalence to the content that
147                 would have been rendered onto the given view). Note
148                 that the view must have been added to this slide
149                 before via viewAdded().
150              */
151             virtual SlideBitmapSharedPtr
152                 getCurrentSlideBitmap( const UnoViewSharedPtr& rView ) const = 0;
153         };
154 
155         typedef ::boost::shared_ptr< Slide > SlideSharedPtr;
156 
157         class EventQueue;
158         class CursorManager;
159         class EventMultiplexer;
160         class ActivitiesQueue;
161         class UserEventQueue;
162         class RGBColor;
163 
164         /** Construct from XDrawPage
165 
166             The Slide object generally works in XDrawPage model
167             coordinates, that is, the page will have the width and
168             height as specified in the XDrawPage's property
169             set. The top, left corner of the page will be rendered
170             at (0,0) in the given canvas' view coordinate system.
171 
172             Does not render anything initially
173 
174             @param xDrawPage
175             Page to display on this slide
176 
177             @param xRootNode
178             Root of the SMIL animation tree. Used to animate the slide.
179 
180             @param rEventQueue
181             EventQueue. Used to post events.
182 
183             @param rActivitiesQueue
184             ActivitiesQueue. Used to run animations.
185 
186             @param rEventMultiplexer
187             Event source
188 
189             @param rUserEventQueue
190             UserEeventQueue
191         */
192         SlideSharedPtr createSlide( const ::com::sun::star::uno::Reference<
193                                        ::com::sun::star::drawing::XDrawPage >& 		    xDrawPage,
194                                    const ::com::sun::star::uno::Reference<
195                                        ::com::sun::star::drawing::XDrawPagesSupplier >& xDrawPages,
196                                     const ::com::sun::star::uno::Reference<
197                                        ::com::sun::star::animations::XAnimationNode >&  xRootNode,
198                                     EventQueue&									        rEventQueue,
199                                     EventMultiplexer&								    rEventMultiplexer,
200                                     ScreenUpdater&                                      rScreenUpdater,
201                                     ActivitiesQueue&								    rActivitiesQueue,
202                                     UserEventQueue&									    rUserEventQueue,
203                                     CursorManager&                                      rCursorManager,
204                                     const UnoViewContainer&                             rViewContainer,
205                                     const ::com::sun::star::uno::Reference<
206                                        ::com::sun::star::uno::XComponentContext >&      xContext,
207                                     const ShapeEventListenerMap&                        rShapeListenerMap,
208                                     const ShapeCursorMap&                               rShapeCursorMap,
209                                     const PolyPolygonVector&                            rPolyPolygonVector,
210                                     RGBColor const&                                     aUserPaintColor,
211                                     double                                              dUserPaintStrokeWidth,
212                                     bool                                                bUserPaintEnabled,
213                                     bool                                                bIntrinsicAnimationsAllowed,
214                                     bool                                                bDisableAnimationZOrder );
215     }
216 }
217 
218 #endif /* INCLUDED_SLIDESHOW_SLIDE_HXX */
219