[Libreoffice-commits] core.git: animations/source sd/inc sd/source

Julien Nabet serval2412 at yahoo.fr
Sat Nov 4 16:54:57 UTC 2017


 animations/source/animcore/animcore.cxx  |   48 +++++++++++++------------------
 sd/inc/animations.hxx                    |    2 -
 sd/source/core/CustomAnimationEffect.cxx |    2 -
 sd/source/filter/ppt/pptinanimations.hxx |    2 -
 4 files changed, 23 insertions(+), 31 deletions(-)

New commits:
commit 393fa77d278eae7a72a8dc78f81082bbdd63a656
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sat Nov 4 14:45:32 2017 +0100

    Replace lists by vectors in animation parts (sd/animations)
    
    Change-Id: Ie5306041e5cde5617e460ae4d98861e8d26e389d
    Reviewed-on: https://gerrit.libreoffice.org/44297
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/animations/source/animcore/animcore.cxx b/animations/source/animcore/animcore.cxx
index 05b7a4747970..f4af2aada347 100644
--- a/animations/source/animcore/animcore.cxx
+++ b/animations/source/animcore/animcore.cxx
@@ -56,7 +56,7 @@
 #include <cppuhelper/implbase.hxx>
 
 #include <osl/mutex.hxx>
-#include <list>
+#include <vector>
 #include <algorithm>
 #include <string.h>
 
@@ -100,10 +100,6 @@ using namespace ::com::sun::star::animations::AnimationNodeType;
 namespace animcore
 {
 
-
-typedef std::list< Reference< XAnimationNode > > ChildList_t;
-
-
 class AnimationNodeBase :   public XAnimateMotion,
                             public XAnimateColor,
                             public XTransitionFilter,
@@ -344,14 +340,14 @@ private:
     double  mfIterateInterval;
 
     /** sorted list of child nodes for XTimeContainer*/
-    ChildList_t             maChildren;
+    std::vector< Reference< XAnimationNode > > maChildren;
 };
 
 
 class TimeContainerEnumeration : public ::cppu::WeakImplHelper< XEnumeration >
 {
 public:
-    explicit TimeContainerEnumeration( const ChildList_t &rChildren );
+    explicit TimeContainerEnumeration( const std::vector< Reference< XAnimationNode > > &rChildren );
 
     // Methods
     virtual sal_Bool SAL_CALL hasMoreElements() override;
@@ -359,16 +355,16 @@ public:
 
 private:
     /** sorted list of child nodes */
-    ChildList_t             maChildren;
+    std::vector< Reference< XAnimationNode > > maChildren;
 
     /** current iteration position */
-    ChildList_t::iterator   maIter;
+    std::vector< Reference< XAnimationNode > >::iterator   maIter;
 
     /** our first, last and only protection from multi-threads! */
     Mutex                   maMutex;
 };
 
-TimeContainerEnumeration::TimeContainerEnumeration( const ChildList_t &rChildren )
+TimeContainerEnumeration::TimeContainerEnumeration( const std::vector< Reference< XAnimationNode > > &rChildren )
 : maChildren( rChildren )
 {
     maIter = maChildren.begin();
@@ -1192,11 +1188,9 @@ Reference< XCloneable > SAL_CALL AnimationNode::createClone()
             Reference< XTimeContainer > xContainer( xNewNode, UNO_QUERY );
             if( xContainer.is() )
             {
-                ChildList_t::iterator aIter( maChildren.begin() );
-                ChildList_t::iterator aEnd( maChildren.end() );
-                while( aIter != aEnd )
+                for (auto const& child : maChildren)
                 {
-                    Reference< XCloneable > xCloneable((*aIter++), UNO_QUERY );
+                    Reference< XCloneable > xCloneable(child, UNO_QUERY );
                     if( xCloneable.is() ) try
                     {
                         Reference< XAnimationNode > xNewChildNode( xCloneable->createClone(), UNO_QUERY );
@@ -1768,13 +1762,13 @@ Reference< XAnimationNode > SAL_CALL AnimationNode::insertBefore( const Referenc
     if( !newChild.is() || !refChild.is() )
         throw IllegalArgumentException();
 
-    ChildList_t::iterator before = std::find(maChildren.begin(), maChildren.end(), refChild);
-    if( before == maChildren.end() )
-        throw NoSuchElementException();
-
     if( std::find(maChildren.begin(), maChildren.end(), newChild) != maChildren.end() )
         throw ElementExistException();
 
+    auto before = std::find(maChildren.begin(), maChildren.end(), refChild);
+    if( before == maChildren.end() )
+        throw NoSuchElementException();
+
     maChildren.insert( before, newChild );
 
     Reference< XInterface > xThis( static_cast< OWeakObject * >(this) );
@@ -1792,13 +1786,13 @@ Reference< XAnimationNode > SAL_CALL AnimationNode::insertAfter( const Reference
     if( !newChild.is() || !refChild.is() )
         throw IllegalArgumentException();
 
-    ChildList_t::iterator before = std::find(maChildren.begin(), maChildren.end(), refChild);
-    if( before == maChildren.end() )
-        throw NoSuchElementException();
-
     if( std::find(maChildren.begin(), maChildren.end(), newChild) != maChildren.end() )
         throw ElementExistException();
 
+    auto before = std::find(maChildren.begin(), maChildren.end(), refChild);
+    if( before == maChildren.end() )
+        throw NoSuchElementException();
+
     ++before;
     if( before != maChildren.end() )
         maChildren.insert( before, newChild );
@@ -1820,13 +1814,13 @@ Reference< XAnimationNode > SAL_CALL AnimationNode::replaceChild( const Referenc
     if( !newChild.is() || !oldChild.is() )
         throw IllegalArgumentException();
 
-    ChildList_t::iterator replace = std::find(maChildren.begin(), maChildren.end(), oldChild);
-    if( replace == maChildren.end() )
-        throw NoSuchElementException();
-
     if( std::find(maChildren.begin(), maChildren.end(), newChild) != maChildren.end() )
         throw ElementExistException();
 
+    auto replace = std::find(maChildren.begin(), maChildren.end(), oldChild);
+    if( replace == maChildren.end() )
+        throw NoSuchElementException();
+
     Reference< XInterface > xNull( nullptr );
     oldChild->setParent( xNull );
 
@@ -1847,7 +1841,7 @@ Reference< XAnimationNode > SAL_CALL AnimationNode::removeChild( const Reference
     if( !oldChild.is() )
         throw IllegalArgumentException();
 
-    ChildList_t::iterator old = std::find(maChildren.begin(), maChildren.end(), oldChild);
+    auto old = std::find(maChildren.begin(), maChildren.end(), oldChild);
     if( old == maChildren.end() )
         throw NoSuchElementException();
 
diff --git a/sd/inc/animations.hxx b/sd/inc/animations.hxx
index bffe1877fa25..bb7f61339a95 100644
--- a/sd/inc/animations.hxx
+++ b/sd/inc/animations.hxx
@@ -38,8 +38,6 @@ struct AfterEffectNode
         : mxNode( xNode ), mxMaster( xMaster ), mbOnNextEffect( bOnNextEffect ) {}
 };
 
-typedef std::list< AfterEffectNode > AfterEffectNodeList;
-
 /** inserts the animation node in the given AfterEffectNode at the correct position
     in the timing hierarchy of its master */
 SD_DLLPUBLIC void stl_process_after_effect_node_func(AfterEffectNode const & rNode);
diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx
index 1d0975a4f2e0..33c7f895025d 100644
--- a/sd/source/core/CustomAnimationEffect.cxx
+++ b/sd/source/core/CustomAnimationEffect.cxx
@@ -1822,7 +1822,7 @@ void EffectSequenceHelper::implRebuild()
         EffectSequence::iterator aEnd( maEffects.end() );
         if( aIter != aEnd )
         {
-            AfterEffectNodeList aAfterEffects;
+            std::vector< sd::AfterEffectNode > aAfterEffects;
 
             CustomAnimationEffectPtr pEffect = (*aIter++);
 
diff --git a/sd/source/filter/ppt/pptinanimations.hxx b/sd/source/filter/ppt/pptinanimations.hxx
index 77e599a72833..5cbb40592862 100644
--- a/sd/source/filter/ppt/pptinanimations.hxx
+++ b/sd/source/filter/ppt/pptinanimations.hxx
@@ -89,7 +89,7 @@ private:
     ImplSdPPTImport* mpPPTImport;
     SvStream&   mrStCtrl;
 
-    sd::AfterEffectNodeList maAfterEffectNodes;
+    std::vector< sd::AfterEffectNode > maAfterEffectNodes;
 
 #ifdef DBG_ANIM_LOG
     FILE * mpFile;


More information about the Libreoffice-commits mailing list