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