[Libreoffice-commits] core.git: 2 commits - slideshow/source

Zolnai Tamás tamas.zolnai at collabora.com
Wed Apr 16 00:32:43 PDT 2014


 slideshow/source/engine/animationnodes/animationcommandnode.cxx |    2 
 slideshow/source/engine/animationnodes/animationcommandnode.hxx |    5 
 slideshow/source/engine/shapes/appletshape.cxx                  |   26 +
 slideshow/source/engine/shapes/externalshapebase.cxx            |   43 ++-
 slideshow/source/engine/shapes/externalshapebase.hxx            |  139 ++++++++++
 slideshow/source/engine/shapes/mediashape.cxx                   |   27 +
 slideshow/source/inc/externalshapebase.hxx                      |  131 ---------
 slideshow/source/inc/iexternalmediashapebase.hxx                |   86 ++++++
 8 files changed, 298 insertions(+), 161 deletions(-)

New commits:
commit cae4370bce63e161fc5ecceb70f74ca50d64ed93
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Wed Apr 16 09:28:51 2014 +0200

    Rename ExternalMediaShape to IExternalMediaShapeBase
    
    "I" because of interface.
    "Base" because it's an interface of a base class
    and because it's easy to mix it up with the inherited MediaShape.
    (MediaShape also an externally rendered thing so
    the name ExternalMediaShape doesn't make any
    difference between the two classes)
    
    Change-Id: I4a03dd090034092942eea39d35894ce6cfc9947b

diff --git a/slideshow/source/engine/animationnodes/animationcommandnode.cxx b/slideshow/source/engine/animationnodes/animationcommandnode.cxx
index c7cbf09..be7b2b7 100644
--- a/slideshow/source/engine/animationnodes/animationcommandnode.cxx
+++ b/slideshow/source/engine/animationnodes/animationcommandnode.cxx
@@ -49,7 +49,7 @@ AnimationCommandNode::AnimationCommandNode( uno::Reference<animations::XAnimatio
     uno::Reference< drawing::XShape > xShape( mxCommandNode->getTarget(),
                                               uno::UNO_QUERY );
     ShapeSharedPtr pShape( getContext().mpSubsettableShapeManager->lookupShape( xShape ) );
-    mpShape = ::boost::dynamic_pointer_cast< ExternalMediaShape >( pShape );
+    mpShape = ::boost::dynamic_pointer_cast< IExternalMediaShapeBase >( pShape );
 }
 
 void AnimationCommandNode::dispose()
diff --git a/slideshow/source/engine/animationnodes/animationcommandnode.hxx b/slideshow/source/engine/animationnodes/animationcommandnode.hxx
index 3ce5f23..f9e61fd 100644
--- a/slideshow/source/engine/animationnodes/animationcommandnode.hxx
+++ b/slideshow/source/engine/animationnodes/animationcommandnode.hxx
@@ -20,7 +20,7 @@
 #define INCLUDED_SLIDESHOW_ANIMATIONCOMMANDNODE_HXX
 
 #include "basecontainernode.hxx"
-#include "externalmediashape.hxx"
+#include "iexternalmediashapebase.hxx"
 #include "soundplayer.hxx"
 #include "com/sun/star/animations/XCommand.hpp"
 
@@ -49,7 +49,7 @@ private:
     virtual bool hasPendingAnimation() const SAL_OVERRIDE;
 
 private:
-    ExternalMediaShapeSharedPtr mpShape;
+    IExternalMediaShapeBaseSharedPtr mpShape;
     ::com::sun::star::uno::Reference<
         ::com::sun::star::animations::XCommand > mxCommandNode;
 };
diff --git a/slideshow/source/engine/shapes/externalshapebase.hxx b/slideshow/source/engine/shapes/externalshapebase.hxx
index 4de1360..1f240aa 100644
--- a/slideshow/source/engine/shapes/externalshapebase.hxx
+++ b/slideshow/source/engine/shapes/externalshapebase.hxx
@@ -22,7 +22,7 @@
 
 #include <vector>
 
-#include "externalmediashape.hxx"
+#include "iexternalmediashapebase.hxx"
 #include "unoview.hxx"
 #include "subsettableshapemanager.hxx"
 #include "slideshowexceptions.hxx"
@@ -44,7 +44,7 @@ namespace slideshow
             (including mutual overdraw). It therefore reports yes for
             the isBackgroundDetached() question.
          */
-        class ExternalShapeBase : public ExternalMediaShape
+        class ExternalShapeBase : public IExternalMediaShapeBase
         {
         public:
             /** Create a shape for the given XShape for an external shape
diff --git a/slideshow/source/inc/externalmediashape.hxx b/slideshow/source/inc/iexternalmediashapebase.hxx
similarity index 88%
rename from slideshow/source/inc/externalmediashape.hxx
rename to slideshow/source/inc/iexternalmediashapebase.hxx
index c55d0ba..134a4df 100644
--- a/slideshow/source/inc/externalmediashape.hxx
+++ b/slideshow/source/inc/iexternalmediashapebase.hxx
@@ -29,12 +29,13 @@ namespace slideshow
 {
     namespace internal
     {
-        /** Represents a shape containing media (video, sound).
+        /** Represents a shape containing playable content rendered by
+            external engine (e.g. media or applet).
 
             This interface adds media handling methods to a shape. It
             allows starting/stopping and pausing playback.
-         */
-        class ExternalMediaShape : public Shape
+        */
+        class IExternalMediaShapeBase : public Shape
         {
         public:
             // Animation methods
@@ -51,7 +52,7 @@ namespace slideshow
 
                 This method leaves playback mode on all registered
                 views. The media is then rewound to the start, and
-            removed from screen (for videos)
+                removed from screen (for videos)
              */
             virtual void stop() = 0;
 
@@ -75,7 +76,7 @@ namespace slideshow
             virtual void setMediaTime(double fTime) = 0;
         };
 
-        typedef ::boost::shared_ptr< ExternalMediaShape > ExternalMediaShapeSharedPtr;
+        typedef ::boost::shared_ptr< IExternalMediaShapeBase > IExternalMediaShapeBaseSharedPtr;
 
     }
 }
commit 728acd3390ebcf546765f33b750f3c5f784d7aa3
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Wed Apr 16 08:26:48 2014 +0200

    Revertion of changes related to ExternalShapeBase
    
    This reverts commits:
    50b60c5508b3ba5a0b8dc05eac511d7edaa5a343
    0ae0301d1cd6e690473f932411ca880c20f45e13
    2a594eb22bfed62fdbcef51a56c2c180bea0283f
    
    Got some suggestions that the deleted things can be usefull.

diff --git a/slideshow/source/engine/animationnodes/animationcommandnode.cxx b/slideshow/source/engine/animationnodes/animationcommandnode.cxx
index 53f9c8c..c7cbf09 100644
--- a/slideshow/source/engine/animationnodes/animationcommandnode.cxx
+++ b/slideshow/source/engine/animationnodes/animationcommandnode.cxx
@@ -49,7 +49,7 @@ AnimationCommandNode::AnimationCommandNode( uno::Reference<animations::XAnimatio
     uno::Reference< drawing::XShape > xShape( mxCommandNode->getTarget(),
                                               uno::UNO_QUERY );
     ShapeSharedPtr pShape( getContext().mpSubsettableShapeManager->lookupShape( xShape ) );
-    mpShape = ::boost::dynamic_pointer_cast< ExternalShapeBase >( pShape );
+    mpShape = ::boost::dynamic_pointer_cast< ExternalMediaShape >( pShape );
 }
 
 void AnimationCommandNode::dispose()
diff --git a/slideshow/source/engine/animationnodes/animationcommandnode.hxx b/slideshow/source/engine/animationnodes/animationcommandnode.hxx
index 9d8f278..3ce5f23 100644
--- a/slideshow/source/engine/animationnodes/animationcommandnode.hxx
+++ b/slideshow/source/engine/animationnodes/animationcommandnode.hxx
@@ -20,10 +20,9 @@
 #define INCLUDED_SLIDESHOW_ANIMATIONCOMMANDNODE_HXX
 
 #include "basecontainernode.hxx"
-#include "externalshapebase.hxx"
+#include "externalmediashape.hxx"
 #include "soundplayer.hxx"
 #include "com/sun/star/animations/XCommand.hpp"
-#include <boost/shared_ptr.hpp>
 
 namespace slideshow {
 namespace internal {
@@ -50,7 +49,7 @@ private:
     virtual bool hasPendingAnimation() const SAL_OVERRIDE;
 
 private:
-    boost::shared_ptr< ExternalShapeBase > mpShape;
+    ExternalMediaShapeSharedPtr mpShape;
     ::com::sun::star::uno::Reference<
         ::com::sun::star::animations::XCommand > mxCommandNode;
 };
diff --git a/slideshow/source/engine/shapes/appletshape.cxx b/slideshow/source/engine/shapes/appletshape.cxx
index d9fc316..f5de6d8 100644
--- a/slideshow/source/engine/shapes/appletshape.cxx
+++ b/slideshow/source/engine/shapes/appletshape.cxx
@@ -79,12 +79,6 @@ namespace slideshow
                          sal_Size                                   nNumPropEntries,
                          const SlideShowContext&                    rContext ); // throw ShapeLoadFailedException;
 
-            virtual void play() SAL_OVERRIDE;
-            virtual void stop() SAL_OVERRIDE;
-            virtual void pause() SAL_OVERRIDE;
-            virtual bool isPlaying() const SAL_OVERRIDE;
-            virtual void setMediaTime(double) SAL_OVERRIDE;
-
         private:
 
             // View layer methods
@@ -102,6 +96,11 @@ namespace slideshow
             virtual bool implRender( const ::basegfx::B2DRange& rCurrBounds ) const SAL_OVERRIDE;
             virtual void implViewChanged( const UnoViewSharedPtr& rView ) SAL_OVERRIDE;
             virtual void implViewsChanged() SAL_OVERRIDE;
+            virtual bool implStartIntrinsicAnimation() SAL_OVERRIDE;
+            virtual bool implEndIntrinsicAnimation() SAL_OVERRIDE;
+            virtual bool implPauseIntrinsicAnimation() SAL_OVERRIDE;
+            virtual bool implIsIntrinsicAnimationPlaying() const SAL_OVERRIDE;
+            virtual void implSetIntrinsicAnimationTime(double) SAL_OVERRIDE;
 
             const OUString                           maServiceName;
             const char**                                    mpPropCopyTable;
@@ -251,7 +250,7 @@ namespace slideshow
 
 
 
-        void AppletShape::play()
+        bool AppletShape::implStartIntrinsicAnimation()
         {
             ::std::for_each( maViewAppletShapes.begin(),
                              maViewAppletShapes.end(),
@@ -259,37 +258,42 @@ namespace slideshow
                                             _1,
                                             ::boost::cref( getBounds() )));
             mbIsPlaying = true;
+
+            return true;
         }
 
 
 
-        void AppletShape::stop()
+        bool AppletShape::implEndIntrinsicAnimation()
         {
             ::std::for_each( maViewAppletShapes.begin(),
                              maViewAppletShapes.end(),
                              ::boost::mem_fn( &ViewAppletShape::endApplet ) );
 
             mbIsPlaying = false;
+
+            return true;
         }
 
 
 
-        void AppletShape::pause()
+        bool AppletShape::implPauseIntrinsicAnimation()
         {
             // TODO(F1): any way of temporarily disabling/deactivating
             // applets?
+            return true;
         }
 
 
 
-        bool AppletShape::isPlaying() const
+        bool AppletShape::implIsIntrinsicAnimationPlaying() const
         {
             return mbIsPlaying;
         }
 
 
 
-        void AppletShape::setMediaTime(double)
+        void AppletShape::implSetIntrinsicAnimationTime(double)
         {
             // No way of doing this, or?
         }
diff --git a/slideshow/source/engine/shapes/externalshapebase.cxx b/slideshow/source/engine/shapes/externalshapebase.cxx
index 05ad628..00c0766 100644
--- a/slideshow/source/engine/shapes/externalshapebase.cxx
+++ b/slideshow/source/engine/shapes/externalshapebase.cxx
@@ -73,13 +73,11 @@ namespace slideshow
 
             virtual bool enableAnimations() SAL_OVERRIDE
             {
-                mrBase.play();
-                return true;
+                return mrBase.implStartIntrinsicAnimation();
             }
             virtual bool disableAnimations() SAL_OVERRIDE
             {
-                mrBase.stop();
-                return true;
+                return mrBase.implEndIntrinsicAnimation();
             }
 
             ExternalShapeBase& mrBase;
@@ -128,6 +126,43 @@ namespace slideshow
             return mxShape;
         }
 
+
+
+        void ExternalShapeBase::play()
+        {
+            implStartIntrinsicAnimation();
+        }
+
+
+
+        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/inc/externalshapebase.hxx b/slideshow/source/engine/shapes/externalshapebase.hxx
similarity index 87%
rename from slideshow/source/inc/externalshapebase.hxx
rename to slideshow/source/engine/shapes/externalshapebase.hxx
index 67a1c2e..4de1360 100644
--- a/slideshow/source/inc/externalshapebase.hxx
+++ b/slideshow/source/engine/shapes/externalshapebase.hxx
@@ -22,11 +22,11 @@
 
 #include <vector>
 
+#include "externalmediashape.hxx"
 #include "unoview.hxx"
 #include "subsettableshapemanager.hxx"
 #include "slideshowexceptions.hxx"
 #include "slideshowcontext.hxx"
-#include "shape.hxx"
 
 
 namespace slideshow
@@ -44,7 +44,7 @@ namespace slideshow
             (including mutual overdraw). It therefore reports yes for
             the isBackgroundDetached() question.
          */
-        class ExternalShapeBase : public Shape
+        class ExternalShapeBase : public ExternalMediaShape
         {
         public:
             /** Create a shape for the given XShape for an external shape
@@ -67,16 +67,12 @@ namespace slideshow
 
             // animation methods
 
-            /// override in derived class to play external viewer
-            virtual void play() = 0;
-            /// override in derived class to stop external viewer
-            virtual void stop() = 0;
-            /// override in derived class to pause external viewer
-            virtual void pause() = 0;
-            /// override in derived class to return status of animation
-            virtual bool isPlaying() const = 0;
-            /// override in derived class to set media time
-            virtual void setMediaTime(double) = 0;
+
+            virtual void play() SAL_OVERRIDE;
+            virtual void stop() SAL_OVERRIDE;
+            virtual void pause() SAL_OVERRIDE;
+            virtual bool isPlaying() const SAL_OVERRIDE;
+            virtual void setMediaTime(double) SAL_OVERRIDE;
 
             // render methods
 
@@ -111,6 +107,18 @@ namespace slideshow
             /// override in derived class to resize
             virtual void implViewsChanged() = 0;
 
+            /// override in derived class to start external viewer
+            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
             ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >   mxShape;
 
diff --git a/slideshow/source/engine/shapes/mediashape.cxx b/slideshow/source/engine/shapes/mediashape.cxx
index 83f3df8..f50e84b 100644
--- a/slideshow/source/engine/shapes/mediashape.cxx
+++ b/slideshow/source/engine/shapes/mediashape.cxx
@@ -65,12 +65,6 @@ namespace slideshow
                         double                                      nPrio,
                         const SlideShowContext&                     rContext ); // throw ShapeLoadFailedException;
 
-            virtual void play() SAL_OVERRIDE;
-            virtual void stop() SAL_OVERRIDE;
-            virtual void pause() SAL_OVERRIDE;
-            virtual bool isPlaying() const SAL_OVERRIDE;
-            virtual void setMediaTime(double) SAL_OVERRIDE;
-
         private:
 
             // View layer methods
@@ -88,6 +82,11 @@ namespace slideshow
             virtual bool implRender( const ::basegfx::B2DRange& rCurrBounds ) const SAL_OVERRIDE;
             virtual void implViewChanged( const UnoViewSharedPtr& rView ) SAL_OVERRIDE;
             virtual void implViewsChanged() SAL_OVERRIDE;
+            virtual bool implStartIntrinsicAnimation() SAL_OVERRIDE;
+            virtual bool implEndIntrinsicAnimation() SAL_OVERRIDE;
+            virtual bool implPauseIntrinsicAnimation() SAL_OVERRIDE;
+            virtual bool implIsIntrinsicAnimationPlaying() const SAL_OVERRIDE;
+            virtual void implSetIntrinsicAnimationTime(double) SAL_OVERRIDE;
 
             /// the list of active view shapes (one for each registered view layer)
             typedef ::std::vector< ViewMediaShapeSharedPtr > ViewMediaShapeVector;
@@ -217,47 +216,53 @@ namespace slideshow
 
 
 
-        void MediaShape::play()
+        bool MediaShape::implStartIntrinsicAnimation()
         {
             ::std::for_each( maViewMediaShapes.begin(),
                              maViewMediaShapes.end(),
                              ::boost::mem_fn( &ViewMediaShape::startMedia ) );
 
             mbIsPlaying = true;
+
+            return true;
         }
 
 
 
-        void MediaShape::stop()
+        bool MediaShape::implEndIntrinsicAnimation()
         {
             ::std::for_each( maViewMediaShapes.begin(),
                              maViewMediaShapes.end(),
                              ::boost::mem_fn( &ViewMediaShape::endMedia ) );
 
             mbIsPlaying = false;
+
+            return true;
         }
 
 
 
-        void MediaShape::pause()
+        bool MediaShape::implPauseIntrinsicAnimation()
         {
             ::std::for_each( maViewMediaShapes.begin(),
                              maViewMediaShapes.end(),
                              ::boost::mem_fn( &ViewMediaShape::pauseMedia ) );
 
             mbIsPlaying = false;
+
+            return true;
         }
 
 
 
-        bool MediaShape::isPlaying() const
+        bool MediaShape::implIsIntrinsicAnimationPlaying() const
         {
             return mbIsPlaying;
         }
 
 
 
-        void MediaShape::setMediaTime(double fTime)
+        void MediaShape::implSetIntrinsicAnimationTime(double fTime)
         {
             ::std::for_each( maViewMediaShapes.begin(),
                              maViewMediaShapes.end(),
diff --git a/slideshow/source/inc/externalmediashape.hxx b/slideshow/source/inc/externalmediashape.hxx
new file mode 100644
index 0000000..c55d0ba
--- /dev/null
+++ b/slideshow/source/inc/externalmediashape.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#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 */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list