merge the formfield patch from ooo-build
[ooovba.git] / slideshow / source / engine / shapes / viewmediashape.hxx
blobcff874459e33c1f8598e1934cf194f0ec1940cac
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: viewmediashape.hxx,v $
10 * $Revision: 1.3.18.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef INCLUDED_SLIDESHOW_VIEWMEDIASHAPE_HXX
32 #define INCLUDED_SLIDESHOW_VIEWMEDIASHAPE_HXX
34 #include <basegfx/range/b2drectangle.hxx>
35 #include <com/sun/star/awt/Point.hpp>
37 #include <boost/shared_ptr.hpp>
38 #include <boost/utility.hpp>
40 #include "viewlayer.hxx"
42 class JavaChildWindow;
43 class SystemChildWindow;
45 namespace com { namespace sun { namespace star { namespace drawing {
46 class XShape;
48 namespace media {
49 class XPlayer;
50 class XPlayerWindow;
52 namespace uno {
53 class XComponentContext;
55 namespace beans{
56 class XPropertySet;
57 } } } }
59 namespace slideshow
61 namespace internal
63 /** This class is the viewable representation of a draw
64 document's media object, associated to a specific View
66 The class is able to render the associated media shape on
67 View implementations.
69 class ViewMediaShape : private boost::noncopyable
71 public:
72 /** Create a ViewMediaShape for the given View
74 @param rView
75 The associated View object.
77 ViewMediaShape( const ViewLayerSharedPtr& rViewLayer,
78 const ::com::sun::star::uno::Reference<
79 ::com::sun::star::drawing::XShape >& rxShape,
80 const ::com::sun::star::uno::Reference<
81 ::com::sun::star::uno::XComponentContext >& rxContext );
83 /** destroy the object
85 virtual ~ViewMediaShape();
87 /** Query the associated view layer of this shape
89 ViewLayerSharedPtr getViewLayer() const;
91 // animation methods
92 //------------------------------------------------------------------
94 /** Notify the ViewShape that an animation starts now
96 This method enters animation mode on the associate
97 target view. The shape can be animated in parallel on
98 different views.
100 @return whether the mode change finished successfully.
102 bool startMedia();
104 /** Notify the ViewShape that it is no longer animated
106 This methods ends animation mode on the associate
107 target view
109 void endMedia();
111 /** Notify the ViewShape that it should pause playback
113 This methods pauses animation on the associate
114 target view. The content stays visible (for video)
116 void pauseMedia();
118 /** Set current time of media.
120 @param fTime
121 Local media time that should now be presented, in seconds.
123 void setMediaTime(double fTime);
125 // render methods
126 //------------------------------------------------------------------
128 /** Render the ViewShape
130 This method renders the ViewMediaShape on the associated view.
132 @param rBounds
133 The current media shape bounds
135 @return whether the rendering finished successfully.
137 bool render( const ::basegfx::B2DRectangle& rBounds ) const;
139 /** Resize the ViewShape
141 This method updates the ViewMediaShape size on the
142 associated view. It does not render.
144 @param rBounds
145 The current media shape bounds
147 @return whether the resize finished successfully.
149 bool resize( const ::basegfx::B2DRectangle& rNewBounds ) const;
151 private:
153 bool implInitialize( const ::basegfx::B2DRectangle& rBounds );
154 void implSetMediaProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rxProps );
155 void implInitializeMediaPlayer( const ::rtl::OUString& rMediaURL );
156 bool implInitializeVCLBasedPlayerWindow( const ::basegfx::B2DRectangle& rBounds,
157 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rVCLDeviceParams );
158 bool implInitializeDXBasedPlayerWindow( const ::basegfx::B2DRectangle& rBounds,
159 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rDXDeviceParams );
161 ViewLayerSharedPtr mpViewLayer;
162 #ifdef GSTREAMER
163 ::std::auto_ptr< SystemChildWindow > mpMediaWindow;
164 #else
165 ::std::auto_ptr< JavaChildWindow > mpMediaWindow;
166 #endif
167 mutable ::com::sun::star::awt::Point maWindowOffset;
168 mutable ::basegfx::B2DRectangle maBounds;
170 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxShape;
171 ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > mxPlayer;
172 ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayerWindow > mxPlayerWindow;
173 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> mxComponentContext;
174 bool mbIsSoundEnabled;
177 typedef ::boost::shared_ptr< ViewMediaShape > ViewMediaShapeSharedPtr;
182 #endif /* INCLUDED_SLIDESHOW_VIEWMEDIASHAPE_HXX */