1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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
{
53 class XComponentContext
;
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
69 class ViewMediaShape
: private boost::noncopyable
72 /** Create a ViewMediaShape for the given View
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;
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
100 @return whether the mode change finished successfully.
104 /** Notify the ViewShape that it is no longer animated
106 This methods ends animation mode on the associate
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)
118 /** Set current time of media.
121 Local media time that should now be presented, in seconds.
123 void setMediaTime(double fTime
);
126 //------------------------------------------------------------------
128 /** Render the ViewShape
130 This method renders the ViewMediaShape on the associated view.
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.
145 The current media shape bounds
147 @return whether the resize finished successfully.
149 bool resize( const ::basegfx::B2DRectangle
& rNewBounds
) const;
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
;
163 ::std::auto_ptr
< SystemChildWindow
> mpMediaWindow
;
165 ::std::auto_ptr
< JavaChildWindow
> mpMediaWindow
;
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 */