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