1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SLIDESHOW_SOURCE_ENGINE_SHAPES_VIEWMEDIASHAPE_HXX
21 #define INCLUDED_SLIDESHOW_SOURCE_ENGINE_SHAPES_VIEWMEDIASHAPE_HXX
23 #include <basegfx/range/b2drectangle.hxx>
24 #include <com/sun/star/awt/Point.hpp>
26 #include <boost/shared_ptr.hpp>
27 #include <boost/utility.hpp>
28 #include <boost/scoped_ptr.hpp>
29 #include <vcl/vclptr.hxx>
31 #include "viewlayer.hxx"
33 class SystemChildWindow
;
34 namespace vcl
{ class Window
; }
36 namespace com
{ namespace sun
{ namespace star
{ namespace drawing
{
44 class XComponentContext
;
54 /** This class is the viewable representation of a draw
55 document's media object, associated to a specific View
57 The class is able to render the associated media shape on
60 class ViewMediaShape
: private boost::noncopyable
63 /** Create a ViewMediaShape for the given View
66 The associated View object.
68 ViewMediaShape( const ViewLayerSharedPtr
& rViewLayer
,
69 const ::com::sun::star::uno::Reference
<
70 ::com::sun::star::drawing::XShape
>& rxShape
,
71 const ::com::sun::star::uno::Reference
<
72 ::com::sun::star::uno::XComponentContext
>& rxContext
);
74 /** destroy the object
76 virtual ~ViewMediaShape();
78 /** Query the associated view layer of this shape
80 ViewLayerSharedPtr
getViewLayer() const;
85 /** Notify the ViewShape that an animation starts now
87 This method enters animation mode on the associate
88 target view. The shape can be animated in parallel on
91 @return whether the mode change finished successfully.
95 /** Notify the ViewShape that it is no longer animated
97 This methods ends animation mode on the associate
102 /** Notify the ViewShape that it should pause playback
104 This methods pauses animation on the associate
105 target view. The content stays visible (for video)
109 /** Set current time of media.
112 Local media time that should now be presented, in seconds.
114 void setMediaTime(double fTime
);
119 /** Render the ViewShape
121 This method renders the ViewMediaShape on the associated view.
124 The current media shape bounds
126 @return whether the rendering finished successfully.
128 bool render( const ::basegfx::B2DRectangle
& rBounds
) const;
130 /** Resize the ViewShape
132 This method updates the ViewMediaShape size on the
133 associated view. It does not render.
136 The current media shape bounds
138 @return whether the resize finished successfully.
140 bool resize( const ::basegfx::B2DRectangle
& rNewBounds
) const;
144 bool implInitialize( const ::basegfx::B2DRectangle
& rBounds
);
145 void implSetMediaProperties( const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& rxProps
);
146 void implInitializeMediaPlayer( const OUString
& rMediaURL
, const OUString
& rMimeType
);
147 bool implInitializePlayerWindow( const ::basegfx::B2DRectangle
& rBounds
,
148 const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& rVCLDeviceParams
,
149 const OUString
& rMimeType
);
150 ViewLayerSharedPtr mpViewLayer
;
151 VclPtr
< SystemChildWindow
> mpMediaWindow
;
152 VclPtr
< vcl::Window
> mpEventHandlerParent
;
153 mutable ::com::sun::star::awt::Point maWindowOffset
;
154 mutable ::basegfx::B2DRectangle maBounds
;
156 ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
> mxShape
;
157 ::com::sun::star::uno::Reference
< ::com::sun::star::media::XPlayer
> mxPlayer
;
158 ::com::sun::star::uno::Reference
< ::com::sun::star::media::XPlayerWindow
> mxPlayerWindow
;
159 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> mxComponentContext
;
160 bool mbIsSoundEnabled
;
163 typedef ::boost::shared_ptr
< ViewMediaShape
> ViewMediaShapeSharedPtr
;
168 #endif // INCLUDED_SLIDESHOW_SOURCE_ENGINE_SHAPES_VIEWMEDIASHAPE_HXX
170 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */