[Libreoffice-commits] core.git: animations/Library_animcore.mk animations/source include/animations offapi/com offapi/UnoApi_offapi.mk slideshow/inc slideshow/Library_slideshow.mk slideshow/source

Marcos Paulo de Souza marcos.souza.org at gmail.com
Mon Mar 10 01:24:43 PDT 2014


 animations/Library_animcore.mk                                  |    1 
 animations/source/animcore/animcore.component                   |    3 
 animations/source/animcore/factreg.cxx                          |    1 
 animations/source/animcore/factreg.hxx                          |    1 
 animations/source/animcore/targetpropertiescreator.cxx          |  486 ----------
 include/animations/animationnodehelper.hxx                      |   44 
 offapi/UnoApi_offapi.mk                                         |    2 
 offapi/com/sun/star/animations/TargetPropertiesCreator.idl      |   35 
 offapi/com/sun/star/animations/XTargetPropertiesCreator.idl     |   63 -
 slideshow/Library_slideshow.mk                                  |    1 
 slideshow/inc/pch/precompiled_slideshow.hxx                     |    1 
 slideshow/source/engine/animationnodes/animationnodefactory.cxx |    9 
 slideshow/source/engine/slide/slideimpl.cxx                     |   44 
 slideshow/source/engine/slide/targetpropertiescreator.cxx       |  365 +++++++
 slideshow/source/engine/slide/targetpropertiescreator.hxx       |   47 
 slideshow/source/inc/tools.hxx                                  |   54 +
 16 files changed, 471 insertions(+), 686 deletions(-)

New commits:
commit b8183958e6b5367eeebd5d07fa5f26561fa1dc4a
Author: Marcos Paulo de Souza <marcos.souza.org at gmail.com>
Date:   Fri Feb 28 02:22:12 2014 -0300

    fdo#60698: Split out slideshow code from animations
    
    Also remove the TargetPropertiesCreator service since just slideshow uses this.
    
    Change-Id: I80816f6225b7bd9fb18f48e69eb5dfd6709b6e56

diff --git a/animations/Library_animcore.mk b/animations/Library_animcore.mk
index 4cfca54..2f08ae3 100644
--- a/animations/Library_animcore.mk
+++ b/animations/Library_animcore.mk
@@ -35,7 +35,6 @@ $(eval $(call gb_Library_use_libraries,animcore,\
 $(eval $(call gb_Library_add_exception_objects,animcore,\
     animations/source/animcore/animcore \
 	animations/source/animcore/factreg \
-    animations/source/animcore/targetpropertiescreator \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/animations/source/animcore/animcore.component b/animations/source/animcore/animcore.component
index 4b3030e..ceb6288 100644
--- a/animations/source/animcore/animcore.component
+++ b/animations/source/animcore/animcore.component
@@ -49,9 +49,6 @@
   <implementation name="animcore::SequenceTimeContainer">
     <service name="com.sun.star.animations.SequenceTimeContainer"/>
   </implementation>
-  <implementation name="animcore::TargetPropertiesCreator">
-    <service name="com.sun.star.animations.TargetPropertiesCreator"/>
-  </implementation>
   <implementation name="animcore::TransitionFilter">
     <service name="com.sun.star.animations.TransitionFilter"/>
   </implementation>
diff --git a/animations/source/animcore/factreg.cxx b/animations/source/animcore/factreg.cxx
index d957981..3757e76 100644
--- a/animations/source/animcore/factreg.cxx
+++ b/animations/source/animcore/factreg.cxx
@@ -53,7 +53,6 @@ static const struct ImplementationEntry g_entries[] =
     IMPLEMENTATION_ENTRY( TRANSITIONFILTER ),
     IMPLEMENTATION_ENTRY( AUDIO ),
     IMPLEMENTATION_ENTRY( COMMAND ),
-    IMPLEMENTATION_ENTRY( TargetPropertiesCreator ),
     { 0, 0, 0, 0, 0, 0 }
 };
 
diff --git a/animations/source/animcore/factreg.hxx b/animations/source/animcore/factreg.hxx
index a6ede62..9d503de 100644
--- a/animations/source/animcore/factreg.hxx
+++ b/animations/source/animcore/factreg.hxx
@@ -38,7 +38,6 @@ DECL_NODE_FACTORY( ANIMATETRANSFORM );
 DECL_NODE_FACTORY( TRANSITIONFILTER );
 DECL_NODE_FACTORY( AUDIO );
 DECL_NODE_FACTORY( COMMAND );
-DECL_NODE_FACTORY( TargetPropertiesCreator );
 
 }
 
diff --git a/include/animations/animationnodehelper.hxx b/include/animations/animationnodehelper.hxx
index d6f000d..840dadd 100644
--- a/include/animations/animationnodehelper.hxx
+++ b/include/animations/animationnodehelper.hxx
@@ -36,50 +36,6 @@ namespace anim
     // only a function pointer, and a thin templated wrapper around
     // that which converts member functions into that.
 
-    /** Apply given functor to every animation node child.
-
-        @param xNode
-        Parent node
-
-        @param rFunctor
-        Functor to apply. The functor must have an appropriate
-        operator()( const ::com::sun::star::uno::Reference<
-        ::com::sun::star::animations::XAnimationNode >& ) member.
-
-        @return true, if the functor was successfully applied to
-        all children, false otherwise.
-    */
-    template< typename Functor > inline bool for_each_childNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >&    xNode,
-                                                          Functor&                                                                                  rFunctor )
-    {
-        try
-        {
-            // get an XEnumerationAccess to the children
-            ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumerationAccess >
-                  xEnumerationAccess( xNode,
-                                      ::com::sun::star::uno::UNO_QUERY_THROW );
-            ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration >
-                  xEnumeration( xEnumerationAccess->createEnumeration(),
-                                ::com::sun::star::uno::UNO_QUERY_THROW );
-
-            while( xEnumeration->hasMoreElements() )
-            {
-                ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >
-                      xChildNode( xEnumeration->nextElement(),
-                                  ::com::sun::star::uno::UNO_QUERY_THROW );
-
-                rFunctor( xChildNode );
-            }
-
-            return true;
-        }
-        catch( ::com::sun::star::uno::Exception& )
-        {
-            return false;
-        }
-    }
-
-
     /** pushes the given node to the given vector and recursivly calls itself for each child node.
     */
     inline void create_deep_vector( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode,
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 3ae45b0..8074e8b 100755
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -35,7 +35,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/animations,\
 	IterateContainer \
 	ParallelTimeContainer \
 	SequenceTimeContainer \
-	TargetPropertiesCreator \
 ))
 $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/auth,\
 	SSOManagerFactory \
@@ -1681,7 +1680,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/animations,\
 	XCommand \
 	XIterateContainer \
     XParallelTimeContainer \
-	XTargetPropertiesCreator \
 	XTimeContainer \
 	XTransitionFilter \
 ))
diff --git a/offapi/com/sun/star/animations/XTargetPropertiesCreator.idl b/offapi/com/sun/star/animations/XTargetPropertiesCreator.idl
deleted file mode 100644
index b5d782a..0000000
--- a/offapi/com/sun/star/animations/XTargetPropertiesCreator.idl
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- 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 __com_sun_star_animations_XTargetPropertiesCreator_idl__
-#define __com_sun_star_animations_XTargetPropertiesCreator_idl__
-
-#include <com/sun/star/animations/TargetProperties.idl>
-#include <com/sun/star/animations/XAnimationNode.idl>
-
-
- module com {  module sun {  module star {  module animations {
-
-
-/** Factory interface to generate properties for all animated targets.<p>
-
-    Depending on mode and content of a SMIL animation tree, animation
-    targets can have global properties different from the target's
-    default. The most prominent example for such a difference is shape
-    visibility: when a shape is to become visible in the course of a
-    SMIL animation, it naturally has to be initially invisible for
-    that effect to have any visible impact.<p>
-
-    This factory interface is able to generate sequences of global
-    properties for all targets referenced in a given SMIL animation
-    tree.
- */
-interface XTargetPropertiesCreator : ::com::sun::star::uno::XInterface
-{
-    /** Determine a sequence of global target properties.<p>
-
-        This method generates a sequence of TargetProperties in effect
-        before the given SMIL animations start. These properties
-        should be applied to the given animation targets, to achieve
-        correct playback of the SMIL animations.<p>
-
-        @param rootNode
-        Root node of the SMIL animation tree.
-     */
-    sequence< TargetProperties > createInitialTargetProperties( [in] XAnimationNode rootNode );
-
-};
-
-
-}; }; }; };
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/Library_slideshow.mk b/slideshow/Library_slideshow.mk
index 49c0c17..fb5e93d 100644
--- a/slideshow/Library_slideshow.mk
+++ b/slideshow/Library_slideshow.mk
@@ -108,6 +108,7 @@ $(eval $(call gb_Library_add_exception_objects,slideshow,\
     slideshow/source/engine/slideshowimpl \
     slideshow/source/engine/slide/slideanimations \
     slideshow/source/engine/slide/slideimpl \
+    slideshow/source/engine/slide/targetpropertiescreator \
     slideshow/source/engine/slide/userpaintoverlay \
     slideshow/source/engine/slideview \
     slideshow/source/engine/smilfunctionparser \
diff --git a/slideshow/inc/pch/precompiled_slideshow.hxx b/slideshow/inc/pch/precompiled_slideshow.hxx
index 2a4ec7b..d755e3d 100644
--- a/slideshow/inc/pch/precompiled_slideshow.hxx
+++ b/slideshow/inc/pch/precompiled_slideshow.hxx
@@ -78,7 +78,6 @@
 #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
 #include <com/sun/star/animations/XAudio.hpp>
 #include <com/sun/star/animations/XIterateContainer.hpp>
-#include <com/sun/star/animations/XTargetPropertiesCreator.hpp>
 #include <com/sun/star/animations/XTransitionFilter.hpp>
 #include <com/sun/star/awt/FontSlant.hpp>
 #include <com/sun/star/awt/FontUnderline.hpp>
diff --git a/slideshow/source/engine/animationnodes/animationnodefactory.cxx b/slideshow/source/engine/animationnodes/animationnodefactory.cxx
index 311cd05..15f9e07 100644
--- a/slideshow/source/engine/animationnodes/animationnodefactory.cxx
+++ b/slideshow/source/engine/animationnodes/animationnodefactory.cxx
@@ -38,7 +38,6 @@
 #include <com/sun/star/animations/XAudio.hpp>
 #include <com/sun/star/presentation/ParagraphTarget.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
-#include <animations/animationnodehelper.hxx>
 #include <basegfx/numeric/ftools.hxx>
 
 #include "animationnodefactory.hxx"
@@ -309,8 +308,7 @@ bool implCreateIteratedNodes(
         // ONLY_TEXT, if a paragraph is referenced as the
         // master of an iteration effect.
         NodeCreator aCreator( rParent, aContext );
-        if( !::anim::for_each_childNode( xNode,
-                                         aCreator ) )
+        if( !for_each_childNode( xNode, aCreator ) )
         {
             ENSURE_OR_RETURN_FALSE(
                 false,
@@ -431,8 +429,7 @@ bool implCreateIteratedNodes(
                 }
 
                 CloningNodeCreator aCreator( rParent, aContext );
-                if( !::anim::for_each_childNode( xNode,
-                                                 aCreator ) )
+                if( !for_each_childNode( xNode, aCreator ) )
                 {
                     ENSURE_OR_RETURN_FALSE(
                         false, "implCreateIteratedNodes(): "
@@ -565,7 +562,7 @@ BaseNodeSharedPtr implCreateAnimationNode(
         {
             // no iterate subset node, just plain child generation now
             NodeCreator aCreator( pCreatedContainer, rContext );
-            if( !::anim::for_each_childNode( xNode, aCreator ) )
+            if( !for_each_childNode( xNode, aCreator ) )
             {
                 OSL_FAIL( "implCreateAnimationNode(): "
                             "child node creation failed" );
diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx
index 1ba3723..08ccce2 100644
--- a/slideshow/source/engine/slide/slideimpl.cxx
+++ b/slideshow/source/engine/slide/slideimpl.cxx
@@ -39,11 +39,8 @@
 #include <com/sun/star/presentation/ParagraphTarget.hpp>
 #include <com/sun/star/presentation/EffectNodeType.hpp>
 #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
-#include <com/sun/star/animations/XTargetPropertiesCreator.hpp>
 #include <com/sun/star/drawing/TextAnimationKind.hpp>
 
-#include <animations/animationnodehelper.hxx>
-
 #include <cppuhelper/exc_hlp.hxx>
 #include <comphelper/anytostring.hxx>
 
@@ -62,6 +59,7 @@
 #include "usereventqueue.hxx"
 #include "userpaintoverlay.hxx"
 #include "event.hxx"
+#include "targetpropertiescreator.hxx"
 #include "tools.hxx"
 
 #include <o3tl/compat_functional.hxx>
@@ -849,7 +847,7 @@ bool SlideImpl::implPrefetchShow()
             // don't block nextEvent() from issuing the next
             // slide)
             MainSequenceSearcher aSearcher;
-            if( ::anim::for_each_childNode( mxRootNode, aSearcher ) )
+            if( for_each_childNode( mxRootNode, aSearcher ) )
                 mbMainSequenceFound = aSearcher.getMainSequence().is();
 
             // import successfully done
@@ -966,44 +964,8 @@ bool SlideImpl::applyInitialShapeAttributes(
                      // succeeded
     }
 
-    uno::Reference< animations::XTargetPropertiesCreator > xPropsCreator;
-
-    try
-    {
-        ENSURE_OR_RETURN_FALSE( maContext.mxComponentContext.is(),
-                           "SlideImpl::applyInitialShapeAttributes(): Invalid component context" );
-
-        uno::Reference<lang::XMultiComponentFactory> xFac(
-            maContext.mxComponentContext->getServiceManager() );
-
-        xPropsCreator.set(
-            xFac->createInstanceWithContext(
-                OUString(
-                                     "com.sun.star.animations.TargetPropertiesCreator"),
-                maContext.mxComponentContext ),
-            uno::UNO_QUERY_THROW );
-    }
-    catch( uno::RuntimeException& )
-    {
-        throw;
-    }
-    catch( uno::Exception& )
-    {
-        OSL_FAIL(
-            OUStringToOString(
-                comphelper::anyToString(cppu::getCaughtException()),
-                RTL_TEXTENCODING_UTF8).getStr() );
-
-        // could not determine initial shape attributes - this
-        // is an error, as some effects might then be plainly
-        // invisible
-        ENSURE_OR_RETURN_FALSE( false,
-                           "SlideImpl::applyInitialShapeAttributes(): "
-                           "couldn't create TargetPropertiesCreator." );
-    }
-
     uno::Sequence< animations::TargetProperties > aProps(
-        xPropsCreator->createInitialTargetProperties( xRootAnimationNode ) );
+        TargetPropertiesCreator::createInitialTargetProperties( xRootAnimationNode ) );
 
     // apply extracted values to our shapes
     const ::std::size_t nSize( aProps.getLength() );
diff --git a/animations/source/animcore/targetpropertiescreator.cxx b/slideshow/source/engine/slide/targetpropertiescreator.cxx
similarity index 73%
rename from animations/source/animcore/targetpropertiescreator.cxx
rename to slideshow/source/engine/slide/targetpropertiescreator.cxx
index 84f0618..5902c29 100644
--- a/animations/source/animcore/targetpropertiescreator.cxx
+++ b/slideshow/source/engine/slide/targetpropertiescreator.cxx
@@ -18,93 +18,24 @@
  */
 
 #include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/lang/XTypeProvider.hpp>
-#include <com/sun/star/animations/XTargetPropertiesCreator.hpp>
 #include <com/sun/star/animations/XIterateContainer.hpp>
-#include <com/sun/star/animations/TargetProperties.hpp>
 #include <com/sun/star/presentation/ParagraphTarget.hpp>
 #include <com/sun/star/registry/XRegistryKey.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/lang/XServiceName.hpp>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
 #include <com/sun/star/drawing/XShape.hpp>
 #include <com/sun/star/animations/AnimationNodeType.hpp>
 #include <com/sun/star/animations/XAnimate.hpp>
 
-#include <animations/animationnodehelper.hxx>
 #include <boost/unordered_map.hpp>
-#include <cppuhelper/compbase3.hxx>
-#include <cppuhelper/factory.hxx>
-#include <cppuhelper/implementationentry.hxx>
-#include <cppuhelper/supportsservice.hxx>
-#include <comphelper/broadcasthelper.hxx>
-#include <comphelper/sequence.hxx>
 #include <vector>
 
+#include "targetpropertiescreator.hxx"
+#include "tools.hxx"
 
-using namespace ::com::sun::star;
-
-#define IMPLEMENTATION_NAME "animcore::TargetPropertiesCreator"
-#define SERVICE_NAME "com.sun.star.animations.TargetPropertiesCreator"
-
-namespace animcore
+namespace slideshow
+{
+namespace internal
 {
-    typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::animations::XTargetPropertiesCreator,
-                                              lang::XServiceInfo,
-                                              lang::XServiceName >  TargetPropertiesCreator_Base;
-
-    class TargetPropertiesCreator : public ::comphelper::OBaseMutex,
-                                    public TargetPropertiesCreator_Base
-    {
-    public:
-        static uno::Reference< uno::XInterface > SAL_CALL createInstance( const uno::Reference< uno::XComponentContext >& xContext ) throw ( uno::Exception )
-        {
-            return uno::Reference< uno::XInterface >( static_cast<cppu::OWeakObject*>(new TargetPropertiesCreator( xContext )) );
-        }
-
-        /// Dispose all internal references
-        virtual void SAL_CALL disposing();
-
-        // XTargetPropertiesCreator
-        virtual uno::Sequence< animations::TargetProperties > SAL_CALL createInitialTargetProperties( const uno::Reference< animations::XAnimationNode >& rootNode ) throw (uno::RuntimeException, std::exception);
-
-        // XServiceInfo
-        virtual OUString SAL_CALL getImplementationName() throw( uno::RuntimeException, std::exception );
-        virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( uno::RuntimeException, std::exception );
-        virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()  throw( uno::RuntimeException, std::exception );
-
-        // XServiceName
-        virtual OUString SAL_CALL getServiceName(  ) throw (uno::RuntimeException, std::exception);
-
-    protected:
-        ~TargetPropertiesCreator(); // we're a ref-counted UNO class. _We_ destroy ourselves.
-
-    private:
-        // default: disabled copy/assignment
-        TargetPropertiesCreator(const TargetPropertiesCreator&);
-        TargetPropertiesCreator& operator=( const TargetPropertiesCreator& );
-
-        TargetPropertiesCreator( const uno::Reference< uno::XComponentContext >& rxContext );
-    };
-
-    uno::Reference< uno::XInterface > SAL_CALL createInstance_TargetPropertiesCreator( const uno::Reference< uno::XComponentContext > & rSMgr ) throw (uno::Exception)
-    {
-        return TargetPropertiesCreator::createInstance( rSMgr );
-    }
-
-    OUString getImplementationName_TargetPropertiesCreator()
-    {
-        return OUString( IMPLEMENTATION_NAME );
-    }
-
-    uno::Sequence< OUString > getSupportedServiceNames_TargetPropertiesCreator(void)
-    {
-        uno::Sequence< OUString > aRet(1);
-        aRet.getArray()[0] = SERVICE_NAME;
-        return aRet;
-    }
-
     namespace
     {
         // Vector containing all properties for a given shape
@@ -241,8 +172,7 @@ namespace animcore
                         NodeFunctor aFunctor( mrShapeHash,
                                               xTargetShape,
                                               nParagraphIndex );
-                        if( !::anim::for_each_childNode( xNode,
-                                                         aFunctor ) )
+                        if( !for_each_childNode( xNode, aFunctor ) )
                         {
                             OSL_FAIL( "AnimCore: NodeFunctor::operator(): child node iteration failed, "
                                         "or extraneous container nodes encountered" );
@@ -356,18 +286,10 @@ namespace animcore
                                     }
                                 }
                             }
-
-                            /*if( bVisible )
-                            {
-                                // target is set to 'visible' at the
-                                // first relevant effect. Thus, target
-                                // must be initially _hidden_, for the
-                                // effect to have visible impact.
-                                */
-                }
-                            // target is set the 'visible' value,
-                            // so we should record the opposite value
-                mrShapeHash.insert(
+                        }
+                        // target is set the 'visible' value,
+                        // so we should record the opposite value
+                        mrShapeHash.insert(
                                     XShapeHash::value_type(
                                         aTarget,
                                         VectorOfNamedValues(
@@ -376,10 +298,8 @@ namespace animcore
                                                 //xAnimateNode->getAttributeName(),
                                                 OUString("visibility"),
                                                 uno::makeAny( !bVisible ) ) ) ) );
-                            //}
-                        //}
-                    }
                     break;
+                    }
                 }
             }
 
@@ -390,28 +310,11 @@ namespace animcore
         };
     }
 
-    TargetPropertiesCreator::TargetPropertiesCreator( const uno::Reference< uno::XComponentContext >&  ) :
-        TargetPropertiesCreator_Base( m_aMutex )
-    {
-    }
-
-    TargetPropertiesCreator::~TargetPropertiesCreator()
-    {
-    }
-
-    void SAL_CALL TargetPropertiesCreator::disposing()
-    {
-        ::osl::MutexGuard aGuard( m_aMutex );
-    }
-
-    // XTargetPropertiesCreator
     uno::Sequence< animations::TargetProperties > SAL_CALL TargetPropertiesCreator::createInitialTargetProperties
         (
             const uno::Reference< animations::XAnimationNode >& xRootNode
-        ) throw (uno::RuntimeException, std::exception)
+        ) //throw (uno::RuntimeException, std::exception)
     {
-        ::osl::MutexGuard aGuard( m_aMutex );
-
         // scan all nodes for visibility changes, and record first
         // 'visibility=true' for each shape
         XShapeHash aShapeHash( 101 );
@@ -456,31 +359,7 @@ namespace animcore
         return aRes;
     }
 
-    // XServiceInfo
-    OUString SAL_CALL TargetPropertiesCreator::getImplementationName() throw( uno::RuntimeException, std::exception )
-    {
-        return OUString( IMPLEMENTATION_NAME );
-    }
-
-    sal_Bool SAL_CALL TargetPropertiesCreator::supportsService( const OUString& ServiceName ) throw( uno::RuntimeException, std::exception )
-    {
-        return cppu::supportsService(this, ServiceName);
-    }
-
-    uno::Sequence< OUString > SAL_CALL TargetPropertiesCreator::getSupportedServiceNames()  throw( uno::RuntimeException, std::exception )
-    {
-        uno::Sequence< OUString > aRet(1);
-        aRet[0] = SERVICE_NAME;
-
-        return aRet;
-    }
-
-    // XServiceName
-    OUString SAL_CALL TargetPropertiesCreator::getServiceName(  ) throw (uno::RuntimeException, std::exception)
-    {
-        return OUString( SERVICE_NAME );
-    }
-
-} // namespace animcore
+} // namespace internal
+} // namespace slideshow
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/animations/TargetPropertiesCreator.idl b/slideshow/source/engine/slide/targetpropertiescreator.hxx
similarity index 52%
rename from offapi/com/sun/star/animations/TargetPropertiesCreator.idl
rename to slideshow/source/engine/slide/targetpropertiescreator.hxx
index d40d765..6c6bef6 100644
--- a/offapi/com/sun/star/animations/TargetPropertiesCreator.idl
+++ b/slideshow/source/engine/slide/targetpropertiescreator.hxx
@@ -17,19 +17,31 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef __com_sun_star_animations_TargetPropertiesCreator_idl__
-#define __com_sun_star_animations_TargetPropertiesCreator_idl__
-
-#include <com/sun/star/animations/XTargetPropertiesCreator.idl>
-
-
- module com {  module sun {  module star {  module animations {
-
-
-service TargetPropertiesCreator: XTargetPropertiesCreator;
-
-}; }; }; };
-
-#endif
+#include <com/sun/star/animations/TargetProperties.hpp>
+
+#include <comphelper/broadcasthelper.hxx>
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/implementationentry.hxx>
+#include <comphelper/sequence.hxx>
+
+using namespace ::com::sun::star;
+
+namespace slideshow
+{
+    namespace internal
+    {
+        class TargetPropertiesCreator : public ::comphelper::OBaseMutex
+        {
+            public:
+                static uno::Sequence< animations::TargetProperties > SAL_CALL createInitialTargetProperties( const uno::Reference< animations::XAnimationNode >& rootNode );
+
+            private:
+                // default: disabled copy/assignment
+                TargetPropertiesCreator(const TargetPropertiesCreator&);
+                TargetPropertiesCreator& operator=( const TargetPropertiesCreator& );
+        };
+
+    } // namespace internal
+} // namespace slideshow
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/source/inc/tools.hxx b/slideshow/source/inc/tools.hxx
index d9b82d4..66f851b 100644
--- a/slideshow/source/inc/tools.hxx
+++ b/slideshow/source/inc/tools.hxx
@@ -22,6 +22,12 @@
 
 #include <com/sun/star/uno/Sequence.hxx>
 #include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/animations/XAnimationNode.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+
+#include <vector>
 
 #include <cppcanvas/color.hxx>
 
@@ -38,8 +44,6 @@
 #include <string.h>
 #include <algorithm>
 
-
-
 namespace com { namespace sun { namespace star { namespace beans {
     struct NamedValue;
 } } } }
@@ -388,6 +392,52 @@ namespace slideshow
         basegfx::B2IVector getSlideSizePixel( const basegfx::B2DVector&         rSize,
                                               const boost::shared_ptr<UnoView>& pView );
     }
+
+    // TODO(Q1): this could possibly be implemented with a somewhat
+    // more lightweight template, by having the actual worker receive
+    // only a function pointer, and a thin templated wrapper around
+    // that which converts member functions into that.
+
+    /** Apply given functor to every animation node child.
+
+        @param xNode
+        Parent node
+
+        @param rFunctor
+        Functor to apply. The functor must have an appropriate
+        operator()( const ::com::sun::star::uno::Reference<
+        ::com::sun::star::animations::XAnimationNode >& ) member.
+
+        @return true, if the functor was successfully applied to
+        all children, false otherwise.
+    */
+    template< typename Functor > inline bool for_each_childNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >&    xNode,
+                                                                 Functor&                                                                                  rFunctor )
+    {
+        try
+        {
+            // get an XEnumerationAccess to the children
+            ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumerationAccess >
+                   xEnumerationAccess( xNode,
+                                       ::com::sun::star::uno::UNO_QUERY_THROW );
+            ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration >
+                   xEnumeration( xEnumerationAccess->createEnumeration(),
+                                 ::com::sun::star::uno::UNO_QUERY_THROW );
+
+            while( xEnumeration->hasMoreElements() )
+            {
+                ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >
+                           xChildNode( xEnumeration->nextElement(),
+                                      ::com::sun::star::uno::UNO_QUERY_THROW );
+                rFunctor( xChildNode );
+            }
+                                                                                                                                                                                                                           return true;
+        }
+        catch( ::com::sun::star::uno::Exception& )
+        {
+            return false;
+        }
+    }
 }
 
 #endif /* INCLUDED_SLIDESHOW_TOOLS_HXX */


More information about the Libreoffice-commits mailing list