ooo-build r12876 - in trunk: . patches/dev300



Author: thorstenb
Date: Thu Jun 12 22:56:12 2008
New Revision: 12876
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12876&view=rev

Log:
	* patches/dev300/slideshow-media-control.diff:
	* patches/dev300/apply: added feature to control videos/sounds via
	the smil animation framework. One can now easily start/stop/pause
	media within the normal slide timeline (or at fixed points in
	time). Needs a bit more UI polish, currently the effects are
	hidden in the Entrance/Emphasis/Exit sections, should be own
	section.



Added:
   trunk/patches/dev300/slideshow-media-control.diff
Modified:
   trunk/ChangeLog
   trunk/patches/dev300/apply

Modified: trunk/patches/dev300/apply
==============================================================================
--- trunk/patches/dev300/apply	(original)
+++ trunk/patches/dev300/apply	Thu Jun 12 22:56:12 2008
@@ -2259,6 +2259,7 @@
 
 [ Fixes ]
 cppcanvas-fix-roundcorners.diff, rodo
+slideshow-media-control.diff, thorsten
 
 [ KDE4 ]
 SectionOwner => jholesov

Added: trunk/patches/dev300/slideshow-media-control.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/slideshow-media-control.diff	Thu Jun 12 22:56:12 2008
@@ -0,0 +1,748 @@
+made videos/sounds controllable from smil event framework
+added UI entries for start, stop, pause media, made XCommand receive a target in the sd anim framework
+
+
+---
+
+ .../data/org/openoffice/Office/UI/Effects.xcu      |   22 ++++-
+ sd/source/core/CustomAnimationEffect.cxx           |    9 ++
+ sd/xml/effects.xml                                 |   21 ++++
+ .../engine/animationnodes/animationcommandnode.cxx |   61 +++++++++++++-
+ .../engine/animationnodes/animationcommandnode.hxx |   14 ++-
+ slideshow/source/engine/shapes/appletshape.cxx     |   33 ++++++-
+ .../source/engine/shapes/externalshapebase.cxx     |   27 ++++++
+ .../source/engine/shapes/externalshapebase.hxx     |   18 +++-
+ slideshow/source/engine/shapes/mediashape.cxx      |   45 +++++++++
+ slideshow/source/engine/shapes/viewmediashape.cxx  |   16 +++
+ slideshow/source/engine/shapes/viewmediashape.hxx  |   14 +++
+ slideshow/source/inc/animationnode.hxx             |    5 +
+ slideshow/source/inc/externalmediashape.hxx        |   99 ++++++++++++++++++++
+ xmloff/source/draw/animationimport.cxx             |    8 +-
+ 14 files changed, 359 insertions(+), 33 deletions(-)
+
+diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu
+index 0180f06..eab4b67 100644
+--- officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu
++++ officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu
+@@ -1236,6 +1236,21 @@
+ 					
+ 				</prop>
+ 			</node>
++			<node oor:name="ooo-media-start" oor:op="replace">
++  			    <prop oor:name="Label" oor:type="xs:string">
++                    <value xml:lang="en-US">Start media</value>
++                </prop>
++            </node>
++            <node oor:name="ooo-media-stop" oor:op="replace">
++                <prop oor:name="Label" oor:type="xs:string">
++                    <value xml:lang="en-US">End media</value>
++                </prop>
++            </node>
++            <node oor:name="ooo-media-toggle-pause" oor:op="replace">
++                <prop oor:name="Label" oor:type="xs:string">
++                    <value xml:lang="en-US">Toggle pause</value>
++                </prop>
++            </node>
+ 		</node>
+ 		<node oor:name="Properties">
+ 			<node oor:name="basic" oor:op="replace">
+@@ -1992,7 +2007,7 @@
+ 					
+ 				</prop>
+ 				<prop oor:name="Effects" oor:type="oor:string-list">
+-					<value oor:separator=";">ooo-entrance-appear;ooo-entrance-fly-in;ooo-entrance-venetian-blinds;ooo-entrance-box;ooo-entrance-checkerboard;ooo-entrance-circle;ooo-entrance-fly-in-slow;ooo-entrance-diamond;ooo-entrance-dissolve-in;ooo-entrance-flash-once;ooo-entrance-peek-in;ooo-entrance-plus;ooo-entrance-random-bars;ooo-entrance-split;ooo-entrance-diagonal-squares;ooo-entrance-wedge;ooo-entrance-wheel;ooo-entrance-wipe;ooo-entrance-random</value>
++					<value oor:separator=";">ooo-entrance-appear;ooo-entrance-fly-in;ooo-entrance-venetian-blinds;ooo-entrance-box;ooo-entrance-checkerboard;ooo-entrance-circle;ooo-entrance-fly-in-slow;ooo-entrance-diamond;ooo-entrance-dissolve-in;ooo-entrance-flash-once;ooo-entrance-peek-in;ooo-entrance-plus;ooo-entrance-random-bars;ooo-entrance-split;ooo-entrance-diagonal-squares;ooo-entrance-wedge;ooo-entrance-wheel;ooo-entrance-wipe;ooo-entrance-random;ooo-media-start</value>
+ 				</prop>
+ 			</node>
+ 			<node oor:name="special" oor:op="replace">
+@@ -2030,7 +2045,7 @@
+ 					
+ 				</prop>
+ 				<prop oor:name="Effects" oor:type="oor:string-list">
+-					<value oor:separator=";">ooo-emphasis-fill-color;ooo-emphasis-font;ooo-emphasis-font-color;ooo-emphasis-font-size;ooo-emphasis-font-style;ooo-emphasis-line-color;ooo-emphasis-spin;ooo-emphasis-transparency</value>
++					<value oor:separator=";">ooo-emphasis-fill-color;ooo-emphasis-font;ooo-emphasis-font-color;ooo-emphasis-font-size;ooo-emphasis-font-style;ooo-emphasis-line-color;ooo-emphasis-spin;ooo-emphasis-transparency;ooo-media-toggle-pause</value>
+ 				</prop>
+ 			</node>
+ 			<node oor:name="special" oor:op="replace">
+@@ -2068,7 +2083,8 @@
+ 					
+ 				</prop>
+ 				<prop oor:name="Effects" oor:type="oor:string-list">
+-					<value oor:separator=";">ooo-exit-disappear;ooo-exit-fly-out;ooo-exit-venetian-blinds;ooo-exit-box;ooo-exit-checkerboard;ooo-exit-circle;ooo-exit-crawl-out;ooo-exit-diamond;ooo-exit-dissolve;ooo-exit-flash-once;ooo-exit-peek-out;ooo-exit-plus;ooo-exit-random-bars;ooo-exit-diagonal-squares;ooo-exit-split;ooo-exit-wedge;ooo-exit-wheel;ooo-exit-wipe;ooo-exit-random</value>
++					<value
++					oor:separator=";">ooo-exit-disappear;ooo-exit-fly-out;ooo-exit-venetian-blinds;ooo-exit-box;ooo-exit-checkerboard;ooo-exit-circle;ooo-exit-crawl-out;ooo-exit-diamond;ooo-exit-dissolve;ooo-exit-flash-once;ooo-exit-peek-out;ooo-exit-plus;ooo-exit-random-bars;ooo-exit-diagonal-squares;ooo-exit-split;ooo-exit-wedge;ooo-exit-wheel;ooo-exit-wipe;ooo-exit-random;ooo-media-stop</value>
+ 				</prop>
+ 			</node>
+ 			<node oor:name="special" oor:op="replace">
+diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx
+index 02d6611..2bf295f 100644
+--- sd/source/core/CustomAnimationEffect.cxx
++++ sd/source/core/CustomAnimationEffect.cxx
+@@ -768,9 +768,16 @@ void CustomAnimationEffect::setTarget( const ::com::sun::star::uno::Any& rTarget
+ 					{
+ 						while( xEnumeration->hasMoreElements() )
+ 						{
+-							Reference< XAnimate > xAnimate( xEnumeration->nextElement(), UNO_QUERY );
++							const Any aElem( xEnumeration->nextElement() );
++							Reference< XAnimate > xAnimate( aElem, UNO_QUERY );
+ 							if( xAnimate.is() )
+ 								xAnimate->setTarget( rTarget );
++                            else
++                            {
++                                Reference< XCommand > xCommand( aElem, UNO_QUERY );
++                                if( xCommand.is() )
++                                    xCommand->setTarget( rTarget );
++                            }                                
+ 						}
+ 					}
+ 				}
+diff --git a/sd/xml/effects.xml b/sd/xml/effects.xml
+index ddf5777..983759d 100644
+--- sd/xml/effects.xml
++++ sd/xml/effects.xml
+@@ -2606,4 +2606,25 @@
+ 			</anim:par>
+ 		</anim:par>
+ 	</anim:par>
++	<anim:par smil:begin="indefinite" smil:fill="hold">
++		<anim:par smil:begin="0" smil:fill="hold">
++		    <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-media-start">
++                <anim:command smil:begin="0" smil:dur="0.001" smil:fill="hold" anim:command="play"/>
++			</anim:par>
++		</anim:par>
++    </anim:par>
++	<anim:par smil:begin="indefinite" smil:fill="hold">
++		<anim:par smil:begin="0" smil:fill="hold">
++		    <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-media-stop">
++                <anim:command smil:begin="0" smil:dur="0.001" smil:fill="hold" anim:command="stop"/>
++			</anim:par>
++		</anim:par>
++    </anim:par>
++	<anim:par smil:begin="indefinite" smil:fill="hold">
++		<anim:par smil:begin="0" smil:fill="hold">
++		    <anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="entrance" pres:preset-id="ooo-media-toggle-pause">
++                <anim:command smil:begin="0" smil:dur="0.001" smil:fill="hold" anim:command="toggle-pause"/>
++			</anim:par>
++		</anim:par>
++    </anim:par>
+ </anim:seq>
+diff --git a/slideshow/source/engine/animationnodes/animationcommandnode.cxx b/slideshow/source/engine/animationnodes/animationcommandnode.cxx
+index 92a1cb1..d5ca62b 100644
+--- slideshow/source/engine/animationnodes/animationcommandnode.cxx
++++ slideshow/source/engine/animationnodes/animationcommandnode.cxx
+@@ -40,6 +40,8 @@
+ #include <canvas/debug.hxx>
+ #include <canvas/verbosetrace.hxx>
+ #include <com/sun/star/presentation/EffectCommands.hpp>
++#include <com/sun/star/animations/XAnimate.hpp>
++#include <com/sun/star/beans/PropertyValue.hpp>
+ 
+ #include "animationcommandnode.hxx"
+ #include "delayevent.hxx"
+@@ -48,30 +50,75 @@
+ 
+ #include <boost/bind.hpp>
+ 
++using namespace com::sun::star;
++
+ namespace slideshow {
+ namespace internal {
+ 
++namespace EffectCommands = com::sun::star::presentation::EffectCommands;
++    
++AnimationCommandNode::AnimationCommandNode( uno::Reference<animations::XAnimationNode> const& xNode, 
++                                             ::boost::shared_ptr<BaseContainerNode> const& pParent,
++                                             NodeContext const& rContext ) : 
++    BaseNode( xNode, pParent, rContext ),
++    mpShape(),
++    mxCommandNode( xNode, ::com::sun::star::uno::UNO_QUERY_THROW )
++{
++    uno::Reference< drawing::XShape > xShape( mxCommandNode->getTarget(),
++                                              uno::UNO_QUERY );
++    ShapeSharedPtr pShape( getContext().mpSubsettableShapeManager->lookupShape( xShape ) );
++    mpShape = ::boost::dynamic_pointer_cast< ExternalMediaShape >( pShape );
++}
++
+ void AnimationCommandNode::dispose()
+ {
+     mxCommandNode.clear();
++    mpShape.reset();
+     BaseNode::dispose();
+ }
+ 
+-void AnimationCommandNode::activate_()
++void AnimationCommandNode::activate_st()
+ {
+-    namespace EffectCommands = com::sun::star::presentation::EffectCommands;
+-    
+     switch( mxCommandNode->getCommand() ) {
+         // the command is user defined
+     case EffectCommands::CUSTOM: break;
+         // the command is an ole verb.
+     case EffectCommands::VERB: break;
+         // the command starts playing on a media object
+-    case EffectCommands::PLAY: break;
++    case EffectCommands::PLAY: 
++    {
++        double fMediaTime=0.0;
++        beans::PropertyValue aMediaTime;
++        if( (mxCommandNode->getParameter() >>= aMediaTime) &&
++            aMediaTime.Name.equalsAsciiL( 
++                RTL_CONSTASCII_STRINGPARAM("MediaTime") ))
++        {
++            aMediaTime.Value >>= fMediaTime;
++        }
++        if( mpShape )
++        {
++            mpShape->setMediaTime(fMediaTime/1000.0);
++            mpShape->play();
++        }
++        break;
++    }
+         // the command toggles the pause status on a media object
+-    case EffectCommands::TOGGLEPAUSE: break;
++    case EffectCommands::TOGGLEPAUSE:
++    {
++        if( mpShape )
++            if( mpShape->isPlaying() )
++                mpShape->pause();
++            else
++                mpShape->play();
++        break;
++    }
+         // the command stops the animation on a media object
+-    case EffectCommands::STOP: break;
++    case EffectCommands::STOP:
++    {
++        if( mpShape )
++            mpShape->stop();
++        break;
++    }
+         // the command stops all currently running sound effects
+     case EffectCommands::STOPAUDIO:
+         getContext().mrEventMultiplexer.notifyCommandStopAudio( getSelf() );
+@@ -85,7 +132,7 @@ void AnimationCommandNode::activate_()
+ 
+ bool AnimationCommandNode::hasPendingAnimation() const
+ {
+-    return false;
++    return mxCommandNode->getCommand() == EffectCommands::STOPAUDIO || mpShape;
+ }
+ 
+ } // namespace internal
+diff --git a/slideshow/source/engine/animationnodes/animationcommandnode.hxx b/slideshow/source/engine/animationnodes/animationcommandnode.hxx
+index e8d4352..9e0706e 100644
+--- slideshow/source/engine/animationnodes/animationcommandnode.hxx
++++ slideshow/source/engine/animationnodes/animationcommandnode.hxx
+@@ -36,6 +36,7 @@
+ #define INCLUDED_SLIDESHOW_ANIMATIONCOMMANDNODE_HXX
+ 
+ #include "basecontainernode.hxx"
++#include "externalmediashape.hxx"
+ #include "soundplayer.hxx"
+ #include "com/sun/star/animations/XCommand.hpp"
+ 
+@@ -44,9 +45,8 @@ namespace internal {
+ 
+ /** Command node.
+ 
+-    TODO
+-    This animation node contains a command.  Currently the only implemented
+-    command, is STOPAUDIO.
++    This animation node encapsulates a command. Not yet implemented:
++    verb & custom.
+ */
+ class AnimationCommandNode : public BaseNode
+ {
+@@ -55,20 +55,20 @@ public:
+         ::com::sun::star::uno::Reference<
+         ::com::sun::star::animations::XAnimationNode> const& xNode, 
+         ::boost::shared_ptr<BaseContainerNode> const& pParent,
+-        NodeContext const& rContext )
+-        : BaseNode( xNode, pParent, rContext ),
+-          mxCommandNode( xNode, ::com::sun::star::uno::UNO_QUERY_THROW ) {}
++        NodeContext const& rContext );
+     
+ protected:
+     virtual void dispose();
+     
+ private:
+-    virtual void activate_();
++    virtual void activate_st();
+     virtual bool hasPendingAnimation() const;
+     
+ private:
++    ExternalMediaShapeSharedPtr mpShape;
+     ::com::sun::star::uno::Reference< 
+         ::com::sun::star::animations::XCommand > mxCommandNode;
++    bool                                       mbIsPaused;
+ };
+ 
+ } // namespace internal
+diff --git a/slideshow/source/engine/shapes/appletshape.cxx b/slideshow/source/engine/shapes/appletshape.cxx
+index 48f9995..8f76278 100644
+--- slideshow/source/engine/shapes/appletshape.cxx
++++ slideshow/source/engine/shapes/appletshape.cxx
+@@ -116,6 +116,9 @@ namespace slideshow
+             virtual void implViewsChanged();
+             virtual bool implStartIntrinsicAnimation();
+             virtual bool implEndIntrinsicAnimation();
++            virtual bool implPauseIntrinsicAnimation();
++            virtual bool implIsIntrinsicAnimationPlaying() const;
++            virtual void implSetIntrinsicAnimationTime(double);
+ 
+             const ::rtl::OUString                           maServiceName;
+             const char**                                    mpPropCopyTable;
+@@ -124,6 +127,7 @@ namespace slideshow
+             /// the list of active view shapes (one for each registered view layer)
+             typedef ::std::vector< ViewAppletShapeSharedPtr > ViewAppletShapeVector;
+             ViewAppletShapeVector                           maViewAppletShapes;
++            bool                                             mbIsPlaying;
+         };
+ 
+         AppletShape::AppletShape( const uno::Reference< drawing::XShape >& xShape,
+@@ -136,7 +140,8 @@ namespace slideshow
+             maServiceName( rServiceName ),
+             mpPropCopyTable( pPropCopyTable ),
+             mnNumPropEntries( nNumPropEntries ),
+-            maViewAppletShapes()
++            maViewAppletShapes(),
++            mbIsPlaying(false)
+         {
+         }
+ 
+@@ -270,6 +275,7 @@ namespace slideshow
+                              ::boost::bind( &ViewAppletShape::startApplet,
+                                             _1,
+                                             ::boost::cref( getBounds() )));
++            mbIsPlaying = true;
+             
+             return true;
+         }
+@@ -282,9 +288,34 @@ namespace slideshow
+                              maViewAppletShapes.end(),
+                              ::boost::mem_fn( &ViewAppletShape::endApplet ) );
+ 
++            mbIsPlaying = false;
++
+             return true;
+         }
+ 
++		// ---------------------------------------------------------------------
++        
++        bool AppletShape::implPauseIntrinsicAnimation()
++        {
++            // TODO(F1): any way of temporarily disabling/deactivating
++            // applets?
++            return true;
++        }
++
++		// ---------------------------------------------------------------------
++
++        bool AppletShape::implIsIntrinsicAnimationPlaying() const
++        {
++            return mbIsPlaying;
++        }
++
++		// ---------------------------------------------------------------------
++
++        void AppletShape::implSetIntrinsicAnimationTime(double)
++        {
++            // No way of doing this, or?
++        }
++
+         boost::shared_ptr<Shape> createAppletShape(
+             const uno::Reference< drawing::XShape >& xShape,
+             double                                   nPrio,
+diff --git a/slideshow/source/engine/shapes/externalshapebase.cxx b/slideshow/source/engine/shapes/externalshapebase.cxx
+index 82b70f6..aa0917e 100644
+--- slideshow/source/engine/shapes/externalshapebase.cxx
++++ slideshow/source/engine/shapes/externalshapebase.cxx
+@@ -145,20 +145,41 @@ namespace slideshow
+ 
+ 		// ---------------------------------------------------------------------
+ 		        
+-		void ExternalShapeBase::enterAnimationMode()
++        void ExternalShapeBase::play()
+         {
+             implStartIntrinsicAnimation();
+         }
+ 
+ 		// ---------------------------------------------------------------------
+-		
+-        void ExternalShapeBase::leaveAnimationMode()
++
++        void ExternalShapeBase::stop()
+         {
+             implEndIntrinsicAnimation();
+         }
+ 
+ 		// ---------------------------------------------------------------------
++
++        void ExternalShapeBase::pause()
++        {
++            implPauseIntrinsicAnimation();
++        }
++
++		// ---------------------------------------------------------------------
+ 		
++        bool ExternalShapeBase::isPlaying() const
++        {
++            return implIsIntrinsicAnimationPlaying();
++        }
++
++		// ---------------------------------------------------------------------
++
++        void ExternalShapeBase::setMediaTime(double fTime)
++        {
++            implSetIntrinsicAnimationTime(fTime);
++        }
++
++		// ---------------------------------------------------------------------
++
+         bool ExternalShapeBase::update() const
+         {
+ 			return render();
+diff --git a/slideshow/source/engine/shapes/externalshapebase.hxx b/slideshow/source/engine/shapes/externalshapebase.hxx
+index 09a5bf4..a673486 100644
+--- slideshow/source/engine/shapes/externalshapebase.hxx
++++ slideshow/source/engine/shapes/externalshapebase.hxx
+@@ -38,7 +38,7 @@
+ 
+ #include <vector>
+ 
+-#include "animatableshape.hxx"
++#include "externalmediashape.hxx"
+ #include "unoview.hxx"
+ #include "subsettableshapemanager.hxx"
+ #include "slideshowexceptions.hxx"
+@@ -60,7 +60,7 @@ namespace slideshow
+             (including mutual overdraw). It therefore reports yes for
+             the isBackgroundDetached() question.
+          */
+-        class ExternalShapeBase : public AnimatableShape
++        class ExternalShapeBase : public ExternalMediaShape
+         {
+         public:
+             /** Create a shape for the given XShape for an external shape
+@@ -84,9 +84,11 @@ namespace slideshow
+             // animation methods
+             //------------------------------------------------------------------
+ 
+-            virtual void enterAnimationMode();
+-            virtual void leaveAnimationMode();
+-
++            virtual void play();
++            virtual void stop();
++            virtual void pause();
++            virtual bool isPlaying() const;
++            virtual void setMediaTime(double);
+ 
+             // render methods
+             //------------------------------------------------------------------
+@@ -125,6 +127,12 @@ namespace slideshow
+             virtual bool implStartIntrinsicAnimation() = 0;
+             /// override in derived class to stop external viewer
+             virtual bool implEndIntrinsicAnimation() = 0;
++            /// override in derived class to pause external viewer
++            virtual bool implPauseIntrinsicAnimation() = 0;
++            /// override in derived class to return status of animation
++            virtual bool implIsIntrinsicAnimationPlaying() const = 0;
++            /// override in derived class to set media time
++            virtual void implSetIntrinsicAnimationTime(double) = 0;
+ 
+ 
+             /// The associated XShape
+diff --git a/slideshow/source/engine/shapes/mediashape.cxx b/slideshow/source/engine/shapes/mediashape.cxx
+index 48cdc52..76ec28a 100644
+--- slideshow/source/engine/shapes/mediashape.cxx
++++ slideshow/source/engine/shapes/mediashape.cxx
+@@ -102,10 +102,14 @@ namespace slideshow
+             virtual void implViewsChanged();
+             virtual bool implStartIntrinsicAnimation();
+             virtual bool implEndIntrinsicAnimation();
++            virtual bool implPauseIntrinsicAnimation();
++            virtual bool implIsIntrinsicAnimationPlaying() const;
++            virtual void implSetIntrinsicAnimationTime(double);
+ 
+             /// the list of active view shapes (one for each registered view layer)
+             typedef ::std::vector< ViewMediaShapeSharedPtr > ViewMediaShapeVector;
+             ViewMediaShapeVector                             maViewMediaShapes;
++            bool                                             mbIsPlaying;
+         };
+ 
+ 
+@@ -113,7 +117,8 @@ namespace slideshow
+                               	double									 nPrio,
+                                 const SlideShowContext&                  rContext ) :
+             ExternalShapeBase( xShape, nPrio, rContext ),
+-            maViewMediaShapes() 
++            maViewMediaShapes(),
++            mbIsPlaying(false)
+         {
+         }
+ 
+@@ -234,7 +239,9 @@ namespace slideshow
+             ::std::for_each( maViewMediaShapes.begin(),
+                              maViewMediaShapes.end(),
+                              ::boost::mem_fn( &ViewMediaShape::startMedia ) );
+-            
++
++            mbIsPlaying = true;
++
+             return true;
+         }
+         
+@@ -246,9 +253,43 @@ namespace slideshow
+                              maViewMediaShapes.end(),
+                              ::boost::mem_fn( &ViewMediaShape::endMedia ) );
+ 
++            mbIsPlaying = false;
++
++            return true;
++        }
++
++		// ---------------------------------------------------------------------
++
++        bool MediaShape::implPauseIntrinsicAnimation()
++        {
++            ::std::for_each( maViewMediaShapes.begin(),
++                             maViewMediaShapes.end(),
++                             ::boost::mem_fn( &ViewMediaShape::pauseMedia ) );
++
++            mbIsPlaying = false;
++
+             return true;
+         }
+ 
++		// ---------------------------------------------------------------------
++
++        bool MediaShape::implIsIntrinsicAnimationPlaying() const
++        {
++            return mbIsPlaying;
++        }
++
++		// ---------------------------------------------------------------------
++
++        void MediaShape::implSetIntrinsicAnimationTime(double fTime)
++        {
++            ::std::for_each( maViewMediaShapes.begin(),
++                             maViewMediaShapes.end(),
++                             ::boost::bind( &ViewMediaShape::setMediaTime,
++                                            _1, boost::cref(fTime)) );
++        }
++
++		// ---------------------------------------------------------------------
++
+         ShapeSharedPtr createMediaShape(
+             const uno::Reference< drawing::XShape >& xShape,
+             double                                   nPrio,
+diff --git a/slideshow/source/engine/shapes/viewmediashape.cxx b/slideshow/source/engine/shapes/viewmediashape.cxx
+index 080d02c..fecf362 100644
+--- slideshow/source/engine/shapes/viewmediashape.cxx
++++ slideshow/source/engine/shapes/viewmediashape.cxx
+@@ -192,6 +192,22 @@ namespace slideshow
+ 
+ 		// ---------------------------------------------------------------------
+ 		
++        void ViewMediaShape::pauseMedia()
++        {
++            if( mxPlayer.is() && ( mxPlayer->getDuration() > 0.0 ) )
++				mxPlayer->stop();
++		}
++
++		// ---------------------------------------------------------------------
++
++        void ViewMediaShape::setMediaTime(double fTime)
++        {
++            if( mxPlayer.is() && ( mxPlayer->getDuration() > 0.0 ) )
++				mxPlayer->setMediaTime(fTime);
++        }
++
++		// ---------------------------------------------------------------------
++		
+         bool ViewMediaShape::render( const ::basegfx::B2DRectangle&	rBounds ) const
+         {
+             ::cppcanvas::CanvasSharedPtr pCanvas = mpViewLayer->getCanvas();;
+diff --git a/slideshow/source/engine/shapes/viewmediashape.hxx b/slideshow/source/engine/shapes/viewmediashape.hxx
+index 77bb22a..4cb7caf 100644
+--- slideshow/source/engine/shapes/viewmediashape.hxx
++++ slideshow/source/engine/shapes/viewmediashape.hxx
+@@ -113,6 +113,20 @@ namespace slideshow
+              */
+             void endMedia();
+ 
++            /** Notify the ViewShape that it should pause playback
++
++				This methods pauses animation on the associate
++				target view. The content stays visible (for video)
++             */
++            void pauseMedia();
++
++            /** Set current time of media.
++
++            @param fTime
++            Local media time that should now be presented, in seconds.
++             */
++            void setMediaTime(double fTime);
++
+             // render methods
+             //------------------------------------------------------------------
+ 
+diff --git a/slideshow/source/inc/animationnode.hxx b/slideshow/source/inc/animationnode.hxx
+index dee4ae5..6d0bec7 100644
+--- slideshow/source/inc/animationnode.hxx
++++ slideshow/source/inc/animationnode.hxx
+@@ -155,8 +155,9 @@ public:
+     
+     /** Query node whether it has an animation pending.
+         
+-        @return true, if this node (or at least one of its
+-        children) has an animation pending.
++        @return true, if this node (or at least one of its children)
++        has an animation pending. Used to determine if the main
++        sequence is actually empty, or contains effects
+     */
+     virtual bool hasPendingAnimation() const = 0;
+ };
+diff --git a/slideshow/source/inc/externalmediashape.hxx b/slideshow/source/inc/externalmediashape.hxx
+new file mode 100644
+index 0000000..3ee2e37
+--- /dev/null
++++ slideshow/source/inc/externalmediashape.hxx
+@@ -0,0 +1,99 @@
++/*************************************************************************
++ *
++ *  OpenOffice.org - a multi-platform office productivity suite
++ *
++ *  $RCSfile: animatableshape.hxx,v $
++ *
++ *  $Revision: 1.5 $
++ *
++ *  last change: $Author: obo $ $Date: 2007/07/17 15:01:31 $
++ *
++ *  The Contents of this file are made available subject to
++ *  the terms of GNU Lesser General Public License Version 2.1.
++ *
++ *
++ *    GNU Lesser General Public License Version 2.1
++ *    =============================================
++ *    Copyright 2005 by Sun Microsystems, Inc.
++ *    901 San Antonio Road, Palo Alto, CA 94303, USA
++ *
++ *    This library is free software; you can redistribute it and/or
++ *    modify it under the terms of the GNU Lesser General Public
++ *    License version 2.1, as published by the Free Software Foundation.
++ *
++ *    This library is distributed in the hope that it will be useful,
++ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ *    Lesser General Public License for more details.
++ *
++ *    You should have received a copy of the GNU Lesser General Public
++ *    License along with this library; if not, write to the Free Software
++ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
++ *    MA  02111-1307  USA
++ *
++ ************************************************************************/
++
++#ifndef INCLUDED_SLIDESHOW_EXTERNALMEDIASHAPE_HXX
++#define INCLUDED_SLIDESHOW_EXTERNALMEDIASHAPE_HXX
++
++#include <boost/shared_ptr.hpp>
++
++#include "shape.hxx"
++
++
++namespace slideshow
++{
++    namespace internal
++    {
++        /** Represents a shape containing media (video, sound).
++
++            This interface adds media handling methods to a shape. It
++            allows starting/stopping and pausing playback.
++         */
++        class ExternalMediaShape : public Shape
++        {
++        public:
++            // Animation methods
++            //------------------------------------------------------------------
++
++            /** Notify the Shape that it should start with playback
++
++				This method enters playback mode on all registered
++				views. It makes the media initially visible (for videos). 
++             */
++            virtual void play() = 0;
++
++            /** Notify the Shape that it should stop playback
++
++				This method leaves playback mode on all registered
++				views. The media is then rewound to the start, and
++            removed from screen (for videos)
++             */
++            virtual void stop() = 0;
++
++            /** Notify the Shape that it should pause playback
++
++				This method stops playback on all registered
++				views. The media stays visible (for videos)
++             */
++            virtual void pause() = 0;
++
++            /** Query whether the media is currently playing.
++             */
++            virtual bool isPlaying() const = 0;
++
++            /** Set media time in seconds.
++
++            @param fTime
++            Time in seconds of the media time line, that should now be
++            presented
++             */
++            virtual void setMediaTime(double fTime) = 0;
++        };
++
++        typedef ::boost::shared_ptr< ExternalMediaShape > ExternalMediaShapeSharedPtr;
++
++    }
++}
++
++#endif /* INCLUDED_SLIDESHOW_EXTERNALMEDIASHAPE_HXX */
+diff --git a/xmloff/source/draw/animationimport.cxx b/xmloff/source/draw/animationimport.cxx
+index e8231ef..97fa8c9 100644
+--- xmloff/source/draw/animationimport.cxx
++++ xmloff/source/draw/animationimport.cxx
+@@ -887,6 +887,7 @@ void AnimationNodeContext::init_node(  const ::com::sun::star::uno::Reference< :
+ 
+ 		// query for optional interfaces that are often used later
+ 		Reference< XAnimate > xAnimate( mxNode, UNO_QUERY );
++		Reference< XCommand > xCommand( mxNode, UNO_QUERY );
+ 		Reference< XTransitionFilter > xTransitionFilter( mxNode, UNO_QUERY );
+ 		Reference< XIterateContainer > xIter( mxNode, UNO_QUERY );
+ 
+@@ -1033,6 +1034,10 @@ void AnimationNodeContext::init_node(  const ::com::sun::star::uno::Reference< :
+ 					{
+ 						xIter->setTarget( aTarget );
+ 					}
++                    else if( xCommand.is() )
++					{
++						xCommand->setTarget( aTarget );
++					}
+ 				}
+ 			}
+ 			break;
+@@ -1313,11 +1318,10 @@ void AnimationNodeContext::init_node(  const ::com::sun::star::uno::Reference< :
+ 
+ 			case ANA_Command:
+ 			{
+-				if( nNodeType == AnimationNodeType::COMMAND )
++				if( xCommand.is() && nNodeType == AnimationNodeType::COMMAND )
+ 				{
+ 					if( SvXMLUnitConverter::convertEnum( nEnum, rValue, getAnimationsEnumMap(Animations_EnumMap_Command) ) )
+ 					{
+-						Reference< XCommand > xCommand( mxNode, UNO_QUERY_THROW );
+ 						xCommand->setCommand( (sal_Int16)nEnum );
+ 					}
+ 				}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]