[Libreoffice-commits] core.git: include/oox oox/inc oox/source

Julien Nabet serval2412 at yahoo.fr
Wed Oct 18 06:41:11 UTC 2017


 include/oox/ppt/animationspersist.hxx                   |    6 ++---
 include/oox/ppt/slidepersist.hxx                        |    6 ++---
 include/oox/ppt/timenode.hxx                            |    4 +--
 oox/inc/drawingml/textparagraphpropertiescontext.hxx    |    4 +--
 oox/source/drawingml/textfield.cxx                      |   13 +++++-------
 oox/source/drawingml/textparagraphpropertiescontext.cxx |    2 -
 oox/source/drawingml/texttabstoplistcontext.cxx         |    4 +--
 oox/source/drawingml/texttabstoplistcontext.hxx         |    6 ++---
 oox/source/ppt/commonbehaviorcontext.cxx                |    5 +---
 oox/source/ppt/commonbehaviorcontext.hxx                |    2 -
 oox/source/ppt/timenodelistcontext.cxx                  |   17 +++++++---------
 11 files changed, 33 insertions(+), 36 deletions(-)

New commits:
commit 695c15ed6e8c4d0236970798f463c7488a903a38
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Tue Oct 17 22:10:20 2017 +0200

    Replace lists by vectors in oox
    
    Change-Id: I951466552fd1cdb3b8f1cbfc07e64f5e0424552e
    Reviewed-on: https://gerrit.libreoffice.org/43469
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/oox/ppt/animationspersist.hxx b/include/oox/ppt/animationspersist.hxx
index a10c9c6d573e..cd18b9101615 100644
--- a/include/oox/ppt/animationspersist.hxx
+++ b/include/oox/ppt/animationspersist.hxx
@@ -22,7 +22,7 @@
 #define INCLUDED_OOX_PPT_ANIMATIONSPERSIST_HXX
 
 #include <array>
-#include <list>
+#include <vector>
 #include <memory>
 
 #include <com/sun/star/uno/Any.hxx>
@@ -85,7 +85,7 @@ namespace oox { namespace ppt {
 
     struct AnimationCondition;
 
-    typedef std::list< AnimationCondition > AnimationConditionList;
+    typedef std::vector< AnimationCondition > AnimationConditionList;
 
     /** data for CT_TLTimeCondition */
     struct AnimationCondition
@@ -113,7 +113,7 @@ namespace oox { namespace ppt {
         css::uno::Any       maValue;
     };
 
-    typedef ::std::list< TimeAnimationValue > TimeAnimationValueList;
+    typedef ::std::vector< TimeAnimationValue > TimeAnimationValueList;
 
 } }
 
diff --git a/include/oox/ppt/slidepersist.hxx b/include/oox/ppt/slidepersist.hxx
index ae6d8b2b1680..cd1ca4ec4e07 100644
--- a/include/oox/ppt/slidepersist.hxx
+++ b/include/oox/ppt/slidepersist.hxx
@@ -20,7 +20,7 @@
 #ifndef INCLUDED_OOX_PPT_SLIDEPERSIST_HXX
 #define INCLUDED_OOX_PPT_SLIDEPERSIST_HXX
 
-#include <list>
+#include <vector>
 #include <map>
 #include <memory>
 
@@ -109,7 +109,7 @@ public:
 
     const oox::drawingml::ShapePtr& getShapes() { return maShapesPtr; }
     void hideShapesAsMasterShapes();
-    ::std::list< std::shared_ptr< TimeNode > >& getTimeNodeList() { return maTimeNodeList; }
+    ::std::vector< std::shared_ptr< TimeNode > >& getTimeNodeList() { return maTimeNodeList; }
     oox::ppt::HeaderFooter& getHeaderFooter(){ return maHeaderFooter; };
 
     oox::vml::Drawing* getDrawing() { return mpDrawingPtr.get(); }
@@ -138,7 +138,7 @@ private:
     oox::drawingml::ShapePtr                                                maShapesPtr;
     oox::drawingml::Color                                                   maBackgroundColor;
     oox::drawingml::FillPropertiesPtr                                       mpBackgroundPropertiesPtr;
-    ::std::list< std::shared_ptr< TimeNode > >                              maTimeNodeList;
+    ::std::vector< std::shared_ptr< TimeNode > >                            maTimeNodeList;
 
     oox::ppt::HeaderFooter                                                  maHeaderFooter;
     sal_Int32                                                               mnLayoutValueToken;
diff --git a/include/oox/ppt/timenode.hxx b/include/oox/ppt/timenode.hxx
index 0c3cd403b93d..1aee1a893ed3 100644
--- a/include/oox/ppt/timenode.hxx
+++ b/include/oox/ppt/timenode.hxx
@@ -21,7 +21,7 @@
 #ifndef INCLUDED_OOX_PPT_TIMENODE_HXX
 #define INCLUDED_OOX_PPT_TIMENODE_HXX
 
-#include <list>
+#include <vector>
 #include <map>
 #include <memory>
 
@@ -44,7 +44,7 @@ namespace oox { namespace ppt {
     class TimeNode;
 
     typedef std::shared_ptr< TimeNode > TimeNodePtr;
-    typedef std::list< TimeNodePtr > TimeNodePtrList;
+    typedef std::vector< TimeNodePtr > TimeNodePtrList;
 
     class TimeNode final
     {
diff --git a/oox/inc/drawingml/textparagraphpropertiescontext.hxx b/oox/inc/drawingml/textparagraphpropertiescontext.hxx
index b16ba562e550..24a40c136ba0 100644
--- a/oox/inc/drawingml/textparagraphpropertiescontext.hxx
+++ b/oox/inc/drawingml/textparagraphpropertiescontext.hxx
@@ -20,7 +20,7 @@
 #ifndef INCLUDED_OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIESCONTEXT_HXX
 #define INCLUDED_OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIESCONTEXT_HXX
 
-#include <list>
+#include <vector>
 
 #include <com/sun/star/style/TabStop.hpp>
 #include <oox/drawingml/drawingmltypes.hxx>
@@ -44,7 +44,7 @@ protected:
     TextParagraphProperties& mrTextParagraphProperties;
     TextSpacing     maLineSpacing;
     BulletList&     mrBulletList;
-    std::list< css::style::TabStop >  maTabList;
+    std::vector< css::style::TabStop >  maTabList;
     std::shared_ptr< BlipFillProperties > mxBlipProps;
 };
 
diff --git a/oox/source/drawingml/textfield.cxx b/oox/source/drawingml/textfield.cxx
index 3fed73ce56d9..f3f8c08beabd 100644
--- a/oox/source/drawingml/textfield.cxx
+++ b/oox/source/drawingml/textfield.cxx
@@ -48,13 +48,13 @@ TextField::TextField()
 
 namespace {
 
-/** intsanciate the textfields. Because of semantics difference between
+/** instanciate the textfields. Because of semantics difference between
  * OpenXML and OpenOffice, some OpenXML field might cause two fields to be created.
  * @param aFields the created fields. The list is empty if no field has been created.
  * @param xModel the model
  * @param sType the OpenXML field type.
  */
-void lclCreateTextFields( std::list< Reference< XTextField > > & aFields,
+void lclCreateTextFields( std::vector< Reference< XTextField > > & aFields,
                                                             const Reference< XModel > & xModel, const OUString & sType )
 {
     Reference< XInterface > xIface;
@@ -204,17 +204,16 @@ sal_Int32 TextField::insertAt(
             nCharHeight = aTextCharacterProps.moHeight.get();
         aTextCharacterProps.pushToPropSet( aPropSet, rFilterBase );
 
-        std::list< Reference< XTextField > > fields;
+        std::vector< Reference< XTextField > > fields;
         lclCreateTextFields( fields, rFilterBase.getModel(), msType );
         if( !fields.empty() )
         {
             bool bFirst = true;
-            for( std::list< Reference< XTextField > >::iterator iter = fields.begin();
-                     iter != fields.end(); ++iter )
+            for (auto const& field : fields)
             {
-                if( iter->is() )
+                if( field.is() )
                 {
-                    Reference< XTextContent > xContent( *iter, UNO_QUERY);
+                    Reference< XTextContent > xContent( field, UNO_QUERY);
                     if( bFirst)
                     {
                         bFirst = false;
diff --git a/oox/source/drawingml/textparagraphpropertiescontext.cxx b/oox/source/drawingml/textparagraphpropertiescontext.cxx
index 0723afdb6070..18bcd3cbea54 100644
--- a/oox/source/drawingml/textparagraphpropertiescontext.cxx
+++ b/oox/source/drawingml/textparagraphpropertiescontext.cxx
@@ -138,7 +138,7 @@ TextParagraphPropertiesContext::~TextParagraphPropertiesContext()
     else
         rPropertyMap.setProperty( PROP_ParaLineSpacing, css::style::LineSpacing( css::style::LineSpacingMode::PROP, 100 ));
 
-    ::std::list< TabStop >::size_type nTabCount = maTabList.size();
+    ::std::vector< TabStop >::size_type nTabCount = maTabList.size();
     if( nTabCount != 0 )
     {
         Sequence< TabStop > aSeq( nTabCount );
diff --git a/oox/source/drawingml/texttabstoplistcontext.cxx b/oox/source/drawingml/texttabstoplistcontext.cxx
index 12a908b58fb5..f03152009318 100644
--- a/oox/source/drawingml/texttabstoplistcontext.cxx
+++ b/oox/source/drawingml/texttabstoplistcontext.cxx
@@ -17,7 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <list>
+#include <vector>
 #include <algorithm>
 
 #include <rtl/ustring.hxx>
@@ -35,7 +35,7 @@ using namespace ::com::sun::star::xml::sax;
 
 namespace oox { namespace drawingml {
 
-        TextTabStopListContext::TextTabStopListContext( ContextHandler2Helper const & rParent, std::list< TabStop >  & aTabList )
+        TextTabStopListContext::TextTabStopListContext( ContextHandler2Helper const & rParent, std::vector< TabStop >  & aTabList )
             : ContextHandler2( rParent )
             , maTabList( aTabList )
         {
diff --git a/oox/source/drawingml/texttabstoplistcontext.hxx b/oox/source/drawingml/texttabstoplistcontext.hxx
index 6c63313d91d5..b304852d8ae3 100644
--- a/oox/source/drawingml/texttabstoplistcontext.hxx
+++ b/oox/source/drawingml/texttabstoplistcontext.hxx
@@ -20,7 +20,7 @@
 #ifndef INCLUDED_OOX_SOURCE_DRAWINGML_TEXTTABSTOPLISTCONTEXT_HXX
 #define INCLUDED_OOX_SOURCE_DRAWINGML_TEXTTABSTOPLISTCONTEXT_HXX
 
-#include <list>
+#include <vector>
 
 #include <com/sun/star/style/TabStop.hpp>
 
@@ -32,13 +32,13 @@ namespace oox { namespace drawingml {
     {
     public:
         TextTabStopListContext( ::oox::core::ContextHandler2Helper const & rParent,
-                ::std::list< css::style::TabStop >  & aTabList );
+                ::std::vector< css::style::TabStop >  & aTabList );
         virtual ~TextTabStopListContext() override;
 
         virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override;
 
 protected:
-        ::std::list< css::style::TabStop >  & maTabList;
+        ::std::vector< css::style::TabStop >  & maTabList;
     };
 
 } }
diff --git a/oox/source/ppt/commonbehaviorcontext.cxx b/oox/source/ppt/commonbehaviorcontext.cxx
index 4c30b5ece3d8..bf403d7e9e0b 100644
--- a/oox/source/ppt/commonbehaviorcontext.cxx
+++ b/oox/source/ppt/commonbehaviorcontext.cxx
@@ -60,14 +60,13 @@ namespace oox { namespace ppt {
             if( !maAttributes.empty() )
             {
                 OUStringBuffer sAttributes;
-                std::list< Attribute >::const_iterator iter;
-                for(iter = maAttributes.begin(); iter != maAttributes.end(); ++iter)
+                for (auto const& attribute : maAttributes)
                 {
                     if( !sAttributes.isEmpty() )
                     {
                         sAttributes.append( ";" );
                     }
-                    sAttributes.append( iter->name );
+                    sAttributes.append( attribute.name );
                 }
                 OUString sTmp( sAttributes.makeStringAndClear() );
                 mpNode->getNodeProperties()[ NP_ATTRIBUTENAME ] <<= sTmp;
diff --git a/oox/source/ppt/commonbehaviorcontext.hxx b/oox/source/ppt/commonbehaviorcontext.hxx
index 0cf0a1c5089a..ee8d45caf3c4 100644
--- a/oox/source/ppt/commonbehaviorcontext.hxx
+++ b/oox/source/ppt/commonbehaviorcontext.hxx
@@ -53,7 +53,7 @@ namespace oox { namespace ppt {
     private:
         bool              mbInAttrList;
         bool              mbIsInAttrName;
-        std::list< Attribute > maAttributes;
+        std::vector< Attribute > maAttributes;
         OUString   msCurrentAttribute;
     };
 
diff --git a/oox/source/ppt/timenodelistcontext.cxx b/oox/source/ppt/timenodelistcontext.cxx
index 8df88793822a..e47b8a7d2f38 100644
--- a/oox/source/ppt/timenodelistcontext.cxx
+++ b/oox/source/ppt/timenodelistcontext.cxx
@@ -541,33 +541,32 @@ namespace oox { namespace ppt {
 
         virtual ~AnimContext() throw () override
             {
-                ::std::list< TimeAnimationValue >::iterator iter, end;
                 int nKeyTimes = maTavList.size();
                 if( nKeyTimes > 0)
                 {
-                    int i;
+                    int i=0;
                     Sequence< double > aKeyTimes( nKeyTimes );
                     Sequence< Any > aValues( nKeyTimes );
 
                     NodePropertyMap & aProps( mpNode->getNodeProperties() );
-                    end = maTavList.end();
-                    for(iter = maTavList.begin(), i=0; iter != end; ++iter,++i)
+                    for (auto const& tav : maTavList)
                     {
                         // TODO what to do if it is Timing_INFINITE ?
-                        Any aTime = GetTimeAnimateValueTime( iter->msTime );
+                        Any aTime = GetTimeAnimateValueTime( tav.msTime );
                         aTime >>= aKeyTimes[i];
-                        aValues[i] = iter->maValue;
+                        aValues[i] = tav.maValue;
 
                         OUString aTest;
-                        iter->maValue >>= aTest;
+                        tav.maValue >>= aTest;
                         if( !aTest.isEmpty() )
                         {
-                            aValues[i] = iter->maValue;
+                            aValues[i] = tav.maValue;
                         }
                         else
                         {
-                            aProps[ NP_FORMULA ] <<= iter->msFormula;
+                            aProps[ NP_FORMULA ] <<= tav.msFormula;
                         }
+                        ++i;
                     }
                     aProps[ NP_VALUES ] <<= aValues;
                     aProps[ NP_KEYTIMES ] <<= aKeyTimes;


More information about the Libreoffice-commits mailing list