From 695c15ed6e8c4d0236970798f463c7488a903a38 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Tue, 17 Oct 2017 22:10:20 +0200 Subject: Replace lists by vectors in oox Change-Id: I951466552fd1cdb3b8f1cbfc07e64f5e0424552e Reviewed-on: https://gerrit.libreoffice.org/43469 Tested-by: Jenkins Reviewed-by: Noel Grandin --- 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 ++++++++--------- 8 files changed, 25 insertions(+), 28 deletions(-) (limited to 'oox') 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 +#include #include #include @@ -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 +#include #include #include @@ -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 +#include #include @@ -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; -- cgit