summaryrefslogtreecommitdiff
path: root/slideshow
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2009-01-06 08:40:41 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2009-01-06 08:40:41 +0000
commit5d06990ec5f71b3c6c462ca55f46ec0a4d2ccd96 (patch)
treeff4ef820dd70bca6de20f2dc2e6b28538a0136f1 /slideshow
parent4774bcff020f1b9bf79141f6d7fb630fa2b724cd (diff)
CWS-TOOLING: integrate CWS impress147
2008-12-16 15:51:15 +0100 wg r265553 : i96805 2008-12-03 12:32:33 +0100 wg r264766 : 96805 2008-12-03 11:40:11 +0100 wg r264761 : 96805 2008-11-20 15:39:56 +0100 cl r264062 : migrated cws from cvs to svn 2008-11-19 14:16:40 +0100 cl r263992 : CWS-TOOLING: rebase CWS impress147 to trunk@263288 (milestone: DEV300:m35)
Diffstat (limited to 'slideshow')
-rw-r--r--slideshow/source/engine/animationnodes/animationcommandnode.cxx63
-rw-r--r--slideshow/source/engine/animationnodes/animationcommandnode.hxx16
-rw-r--r--slideshow/source/engine/shapes/appletshape.cxx35
-rw-r--r--slideshow/source/engine/shapes/externalshapebase.cxx27
-rw-r--r--slideshow/source/engine/shapes/externalshapebase.hxx20
-rw-r--r--slideshow/source/engine/shapes/mediashape.cxx45
-rw-r--r--slideshow/source/engine/shapes/viewmediashape.cxx18
-rw-r--r--slideshow/source/engine/shapes/viewmediashape.hxx16
-rw-r--r--slideshow/source/inc/animationnode.hxx7
-rw-r--r--slideshow/source/inc/externalmediashape.hxx99
10 files changed, 312 insertions, 34 deletions
diff --git a/slideshow/source/engine/animationnodes/animationcommandnode.cxx b/slideshow/source/engine/animationnodes/animationcommandnode.cxx
index 181b42b72206..366e74c783ba 100644
--- a/slideshow/source/engine/animationnodes/animationcommandnode.cxx
+++ b/slideshow/source/engine/animationnodes/animationcommandnode.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: animationcommandnode.cxx,v $
- * $Revision: 1.9 $
+ * $Revision: 1.9.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -35,6 +35,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"
@@ -43,30 +45,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() );
@@ -80,7 +127,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 f923afa52a55..0c72412ce4d7 100644
--- a/slideshow/source/engine/animationnodes/animationcommandnode.hxx
+++ b/slideshow/source/engine/animationnodes/animationcommandnode.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: animationcommandnode.hxx,v $
- * $Revision: 1.6 $
+ * $Revision: 1.6.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -31,6 +31,7 @@
#define INCLUDED_SLIDESHOW_ANIMATIONCOMMANDNODE_HXX
#include "basecontainernode.hxx"
+#include "externalmediashape.hxx"
#include "soundplayer.hxx"
#include "com/sun/star/animations/XCommand.hpp"
@@ -39,9 +40,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
{
@@ -50,20 +50,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 49f856478216..94b7db2a0ef2 100644
--- a/slideshow/source/engine/shapes/appletshape.cxx
+++ b/slideshow/source/engine/shapes/appletshape.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: appletshape.cxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.3.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -111,6 +111,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;
@@ -119,6 +122,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,
@@ -131,7 +135,8 @@ namespace slideshow
maServiceName( rServiceName ),
mpPropCopyTable( pPropCopyTable ),
mnNumPropEntries( nNumPropEntries ),
- maViewAppletShapes()
+ maViewAppletShapes(),
+ mbIsPlaying(false)
{
}
@@ -265,6 +270,7 @@ namespace slideshow
::boost::bind( &ViewAppletShape::startApplet,
_1,
::boost::cref( getBounds() )));
+ mbIsPlaying = true;
return true;
}
@@ -277,9 +283,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 7c7925d3396e..a2f4e1d96b1a 100644
--- a/slideshow/source/engine/shapes/externalshapebase.cxx
+++ b/slideshow/source/engine/shapes/externalshapebase.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: externalshapebase.cxx,v $
- * $Revision: 1.4 $
+ * $Revision: 1.4.2.1 $
*
* This file is part of OpenOffice.org.
*
@@ -141,20 +141,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 cdedfcab8ca5..9af0b01bc59a 100644
--- a/slideshow/source/engine/shapes/externalshapebase.hxx
+++ b/slideshow/source/engine/shapes/externalshapebase.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: externalshapebase.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.3.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -33,7 +33,7 @@
#include <vector>
-#include "animatableshape.hxx"
+#include "externalmediashape.hxx"
#include "unoview.hxx"
#include "subsettableshapemanager.hxx"
#include "slideshowexceptions.hxx"
@@ -55,7 +55,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
@@ -79,9 +79,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
//------------------------------------------------------------------
@@ -120,6 +122,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 796c9c3af567..326fda9bb69c 100644
--- a/slideshow/source/engine/shapes/mediashape.cxx
+++ b/slideshow/source/engine/shapes/mediashape.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: mediashape.cxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.3.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -97,10 +97,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;
};
@@ -108,7 +112,8 @@ namespace slideshow
double nPrio,
const SlideShowContext& rContext ) :
ExternalShapeBase( xShape, nPrio, rContext ),
- maViewMediaShapes()
+ maViewMediaShapes(),
+ mbIsPlaying(false)
{
}
@@ -230,6 +235,8 @@ namespace slideshow
maViewMediaShapes.end(),
::boost::mem_fn( &ViewMediaShape::startMedia ) );
+ mbIsPlaying = true;
+
return true;
}
@@ -241,9 +248,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 98afed06b4ca..a02c795d4943 100644
--- a/slideshow/source/engine/shapes/viewmediashape.cxx
+++ b/slideshow/source/engine/shapes/viewmediashape.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: viewmediashape.cxx,v $
- * $Revision: 1.6 $
+ * $Revision: 1.6.2.1 $
*
* This file is part of OpenOffice.org.
*
@@ -166,6 +166,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 6fbf482c633b..09f4d4fa53ef 100644
--- a/slideshow/source/engine/shapes/viewmediashape.hxx
+++ b/slideshow/source/engine/shapes/viewmediashape.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: viewmediashape.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.3.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -107,6 +107,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 ff6f71a02a49..d3ddc6dad171 100644
--- a/slideshow/source/inc/animationnode.hxx
+++ b/slideshow/source/inc/animationnode.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: animationnode.hxx,v $
- * $Revision: 1.6 $
+ * $Revision: 1.6.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -150,8 +150,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 000000000000..9cdeac6010a4
--- /dev/null
+++ b/slideshow/source/inc/externalmediashape.hxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: externalmediashape.hxx,v $
+ *
+ * $Revision: 1.1.2.1 $
+ *
+ * last change: $Author: thb $ $Date: 2008/07/02 19:51:17 $
+ *
+ * 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 */