1*b1cdbd2cSJim Jagielski /**************************************************************
2*b1cdbd2cSJim Jagielski  *
3*b1cdbd2cSJim Jagielski  * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski  * or more contributor license agreements.  See the NOTICE file
5*b1cdbd2cSJim Jagielski  * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski  * regarding copyright ownership.  The ASF licenses this file
7*b1cdbd2cSJim Jagielski  * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski  * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski  * with the License.  You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski  *
11*b1cdbd2cSJim Jagielski  *   http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski  *
13*b1cdbd2cSJim Jagielski  * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski  * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski  * KIND, either express or implied.  See the License for the
17*b1cdbd2cSJim Jagielski  * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski  * under the License.
19*b1cdbd2cSJim Jagielski  *
20*b1cdbd2cSJim Jagielski  *************************************************************/
21*b1cdbd2cSJim Jagielski 
22*b1cdbd2cSJim Jagielski 
23*b1cdbd2cSJim Jagielski 
24*b1cdbd2cSJim Jagielski #ifndef INCLUDED_SLIDESHOW_VIEWMEDIASHAPE_HXX
25*b1cdbd2cSJim Jagielski #define INCLUDED_SLIDESHOW_VIEWMEDIASHAPE_HXX
26*b1cdbd2cSJim Jagielski 
27*b1cdbd2cSJim Jagielski #include <basegfx/range/b2drectangle.hxx>
28*b1cdbd2cSJim Jagielski #include <com/sun/star/awt/Point.hpp>
29*b1cdbd2cSJim Jagielski 
30*b1cdbd2cSJim Jagielski #include <boost/shared_ptr.hpp>
31*b1cdbd2cSJim Jagielski #include <boost/utility.hpp>
32*b1cdbd2cSJim Jagielski 
33*b1cdbd2cSJim Jagielski #include "viewlayer.hxx"
34*b1cdbd2cSJim Jagielski 
35*b1cdbd2cSJim Jagielski class SystemChildWindow;
36*b1cdbd2cSJim Jagielski 
37*b1cdbd2cSJim Jagielski namespace com { namespace sun { namespace star { namespace drawing {
38*b1cdbd2cSJim Jagielski     class XShape;
39*b1cdbd2cSJim Jagielski }
40*b1cdbd2cSJim Jagielski namespace media {
41*b1cdbd2cSJim Jagielski     class XPlayer;
42*b1cdbd2cSJim Jagielski     class XPlayerWindow;
43*b1cdbd2cSJim Jagielski }
44*b1cdbd2cSJim Jagielski namespace uno {
45*b1cdbd2cSJim Jagielski     class XComponentContext;
46*b1cdbd2cSJim Jagielski }
47*b1cdbd2cSJim Jagielski namespace beans{
48*b1cdbd2cSJim Jagielski     class XPropertySet;
49*b1cdbd2cSJim Jagielski } } } }
50*b1cdbd2cSJim Jagielski 
51*b1cdbd2cSJim Jagielski namespace slideshow
52*b1cdbd2cSJim Jagielski {
53*b1cdbd2cSJim Jagielski     namespace internal
54*b1cdbd2cSJim Jagielski     {
55*b1cdbd2cSJim Jagielski         /** This class is the viewable representation of a draw
56*b1cdbd2cSJim Jagielski             document's media object, associated to a specific View
57*b1cdbd2cSJim Jagielski 
58*b1cdbd2cSJim Jagielski             The class is able to render the associated media shape on
59*b1cdbd2cSJim Jagielski             View implementations.
60*b1cdbd2cSJim Jagielski          */
61*b1cdbd2cSJim Jagielski         class ViewMediaShape : private boost::noncopyable
62*b1cdbd2cSJim Jagielski         {
63*b1cdbd2cSJim Jagielski         public:
64*b1cdbd2cSJim Jagielski             /** Create a ViewMediaShape for the given View
65*b1cdbd2cSJim Jagielski 
66*b1cdbd2cSJim Jagielski             	@param rView
67*b1cdbd2cSJim Jagielski                 The associated View object.
68*b1cdbd2cSJim Jagielski              */
69*b1cdbd2cSJim Jagielski             ViewMediaShape( const ViewLayerSharedPtr&                          rViewLayer,
70*b1cdbd2cSJim Jagielski                             const ::com::sun::star::uno::Reference<
71*b1cdbd2cSJim Jagielski                                   ::com::sun::star::drawing::XShape >&         rxShape,
72*b1cdbd2cSJim Jagielski                              const ::com::sun::star::uno::Reference<
73*b1cdbd2cSJim Jagielski                                    ::com::sun::star::uno::XComponentContext >& rxContext );
74*b1cdbd2cSJim Jagielski 
75*b1cdbd2cSJim Jagielski             /** destroy the object
76*b1cdbd2cSJim Jagielski              */
77*b1cdbd2cSJim Jagielski             virtual ~ViewMediaShape();
78*b1cdbd2cSJim Jagielski 
79*b1cdbd2cSJim Jagielski             /** Query the associated view layer of this shape
80*b1cdbd2cSJim Jagielski              */
81*b1cdbd2cSJim Jagielski             ViewLayerSharedPtr getViewLayer() const;
82*b1cdbd2cSJim Jagielski 
83*b1cdbd2cSJim Jagielski             // animation methods
84*b1cdbd2cSJim Jagielski             //------------------------------------------------------------------
85*b1cdbd2cSJim Jagielski 
86*b1cdbd2cSJim Jagielski             /** Notify the ViewShape that an animation starts now
87*b1cdbd2cSJim Jagielski 
88*b1cdbd2cSJim Jagielski 				This method enters animation mode on the associate
89*b1cdbd2cSJim Jagielski 				target view. The shape can be animated in parallel on
90*b1cdbd2cSJim Jagielski 				different views.
91*b1cdbd2cSJim Jagielski 
92*b1cdbd2cSJim Jagielski 	            @return whether the mode change finished successfully.
93*b1cdbd2cSJim Jagielski              */
94*b1cdbd2cSJim Jagielski             bool startMedia();
95*b1cdbd2cSJim Jagielski 
96*b1cdbd2cSJim Jagielski             /** Notify the ViewShape that it is no longer animated
97*b1cdbd2cSJim Jagielski 
98*b1cdbd2cSJim Jagielski 				This methods ends animation mode on the associate
99*b1cdbd2cSJim Jagielski 				target view
100*b1cdbd2cSJim Jagielski              */
101*b1cdbd2cSJim Jagielski             void endMedia();
102*b1cdbd2cSJim Jagielski 
103*b1cdbd2cSJim Jagielski             /** Notify the ViewShape that it should pause playback
104*b1cdbd2cSJim Jagielski 
105*b1cdbd2cSJim Jagielski 				This methods pauses animation on the associate
106*b1cdbd2cSJim Jagielski 				target view. The content stays visible (for video)
107*b1cdbd2cSJim Jagielski              */
108*b1cdbd2cSJim Jagielski             void pauseMedia();
109*b1cdbd2cSJim Jagielski 
110*b1cdbd2cSJim Jagielski             /** Set current time of media.
111*b1cdbd2cSJim Jagielski 
112*b1cdbd2cSJim Jagielski             @param fTime
113*b1cdbd2cSJim Jagielski             Local media time that should now be presented, in seconds.
114*b1cdbd2cSJim Jagielski              */
115*b1cdbd2cSJim Jagielski             void setMediaTime(double fTime);
116*b1cdbd2cSJim Jagielski 
117*b1cdbd2cSJim Jagielski             // render methods
118*b1cdbd2cSJim Jagielski             //------------------------------------------------------------------
119*b1cdbd2cSJim Jagielski 
120*b1cdbd2cSJim Jagielski             /** Render the ViewShape
121*b1cdbd2cSJim Jagielski 
122*b1cdbd2cSJim Jagielski 				This method renders the ViewMediaShape on the associated view.
123*b1cdbd2cSJim Jagielski 
124*b1cdbd2cSJim Jagielski                 @param rBounds
125*b1cdbd2cSJim Jagielski                 The current media shape bounds
126*b1cdbd2cSJim Jagielski 
127*b1cdbd2cSJim Jagielski 	            @return whether the rendering finished successfully.
128*b1cdbd2cSJim Jagielski             */
129*b1cdbd2cSJim Jagielski             bool render( const ::basegfx::B2DRectangle&	rBounds ) const;
130*b1cdbd2cSJim Jagielski 
131*b1cdbd2cSJim Jagielski             /** Resize the ViewShape
132*b1cdbd2cSJim Jagielski 
133*b1cdbd2cSJim Jagielski 				This method updates the ViewMediaShape size on the
134*b1cdbd2cSJim Jagielski 				associated view. It does not render.
135*b1cdbd2cSJim Jagielski 
136*b1cdbd2cSJim Jagielski                 @param rBounds
137*b1cdbd2cSJim Jagielski                 The current media shape bounds
138*b1cdbd2cSJim Jagielski 
139*b1cdbd2cSJim Jagielski 	            @return whether the resize finished successfully.
140*b1cdbd2cSJim Jagielski             */
141*b1cdbd2cSJim Jagielski             bool resize( const ::basegfx::B2DRectangle&	rNewBounds ) const;
142*b1cdbd2cSJim Jagielski 
143*b1cdbd2cSJim Jagielski         private:
144*b1cdbd2cSJim Jagielski 
145*b1cdbd2cSJim Jagielski 			bool implInitialize( const ::basegfx::B2DRectangle& rBounds );
146*b1cdbd2cSJim Jagielski 			void implSetMediaProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rxProps );
147*b1cdbd2cSJim Jagielski 			void implInitializeMediaPlayer( const ::rtl::OUString& rMediaURL );
148*b1cdbd2cSJim Jagielski 			bool implInitializeVCLBasedPlayerWindow( const ::basegfx::B2DRectangle& rBounds,
149*b1cdbd2cSJim Jagielski 													 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rVCLDeviceParams );
150*b1cdbd2cSJim Jagielski 			bool implInitializeDXBasedPlayerWindow( const ::basegfx::B2DRectangle& rBounds,
151*b1cdbd2cSJim Jagielski 													const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rDXDeviceParams );
152*b1cdbd2cSJim Jagielski 
153*b1cdbd2cSJim Jagielski 			ViewLayerSharedPtr					  mpViewLayer;
154*b1cdbd2cSJim Jagielski 			::std::auto_ptr< SystemChildWindow >    mpMediaWindow;
155*b1cdbd2cSJim Jagielski 			mutable ::com::sun::star::awt::Point  maWindowOffset;
156*b1cdbd2cSJim Jagielski             mutable ::basegfx::B2DRectangle       maBounds;
157*b1cdbd2cSJim Jagielski 
158*b1cdbd2cSJim Jagielski 			::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >		mxShape;
159*b1cdbd2cSJim Jagielski 			::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer >		mxPlayer;
160*b1cdbd2cSJim Jagielski 			::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayerWindow >	mxPlayerWindow;
161*b1cdbd2cSJim Jagielski             ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>	mxComponentContext;
162*b1cdbd2cSJim Jagielski             bool mbIsSoundEnabled;
163*b1cdbd2cSJim Jagielski 		};
164*b1cdbd2cSJim Jagielski 
165*b1cdbd2cSJim Jagielski         typedef ::boost::shared_ptr< ViewMediaShape > ViewMediaShapeSharedPtr;
166*b1cdbd2cSJim Jagielski 
167*b1cdbd2cSJim Jagielski     }
168*b1cdbd2cSJim Jagielski }
169*b1cdbd2cSJim Jagielski 
170*b1cdbd2cSJim Jagielski #endif /* INCLUDED_SLIDESHOW_VIEWMEDIASHAPE_HXX */
171