summaryrefslogtreecommitdiff
path: root/oox/source/ppt
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2018-03-31 12:17:55 +0200
committerJulien Nabet <serval2412@yahoo.fr>2018-03-31 13:25:28 +0200
commit0d06d1d16775fde3b0b34f3374907e07cbba763d (patch)
treebd74c0df75afe158c8ae9a67dd1c41d2cd2239eb /oox/source/ppt
parent67c04cecc86f4a2e11da3b1fd982940a526cb6cb (diff)
Use for-range loops in oox (part2)
Change-Id: I7cbeb67a1adcdb9b0003e22b61789a882fc336c9 Reviewed-on: https://gerrit.libreoffice.org/52182 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'oox/source/ppt')
-rw-r--r--oox/source/ppt/animationspersist.cxx5
-rw-r--r--oox/source/ppt/comments.cxx21
-rw-r--r--oox/source/ppt/pptshapegroupcontext.cxx9
-rw-r--r--oox/source/ppt/presentationfragmenthandler.cxx28
-rw-r--r--oox/source/ppt/slidefragmenthandler.cxx12
-rw-r--r--oox/source/ppt/slidepersist.cxx32
-rw-r--r--oox/source/ppt/timenode.cxx7
7 files changed, 49 insertions, 65 deletions
diff --git a/oox/source/ppt/animationspersist.cxx b/oox/source/ppt/animationspersist.cxx
index 2c1aaa2c88c7..6841c7ff2558 100644
--- a/oox/source/ppt/animationspersist.cxx
+++ b/oox/source/ppt/animationspersist.cxx
@@ -186,10 +186,9 @@ namespace oox { namespace ppt {
Any AnimationCondition::convertList(const SlidePersistPtr & pSlide, const AnimationConditionList & l)
{
Any aAny;
- for( AnimationConditionList::const_iterator iter = l.begin();
- iter != l.end(); ++iter)
+ for (auto const& elem : l)
{
- aAny = addToSequence( aAny, iter->convert(pSlide) );
+ aAny = addToSequence( aAny, elem.convert(pSlide) );
}
return aAny;
}
diff --git a/oox/source/ppt/comments.cxx b/oox/source/ppt/comments.cxx
index 8a731c550713..34206cffa37e 100644
--- a/oox/source/ppt/comments.cxx
+++ b/oox/source/ppt/comments.cxx
@@ -15,16 +15,16 @@ namespace oox { namespace ppt {
void CommentAuthorList::setValues(const CommentAuthorList& list)
{
- std::vector<CommentAuthor>::const_iterator it;
- for(it = list.cmAuthorLst.begin(); it != list.cmAuthorLst.end(); ++it)
+ for (auto const& author : list.cmAuthorLst)
{
CommentAuthor temp;
+ // TODO JNA : why not doing push_back at the end instead of using back()?
cmAuthorLst.push_back(temp);
- cmAuthorLst.back().clrIdx = it->clrIdx;
- cmAuthorLst.back().id = it->id;
- cmAuthorLst.back().initials = it->initials;
- cmAuthorLst.back().lastIdx = it->lastIdx;
- cmAuthorLst.back().name = it->name;
+ cmAuthorLst.back().clrIdx = author.clrIdx;
+ cmAuthorLst.back().id = author.id;
+ cmAuthorLst.back().initials = author.initials;
+ cmAuthorLst.back().lastIdx = author.lastIdx;
+ cmAuthorLst.back().name = author.name;
}
}
@@ -65,11 +65,10 @@ void Comment::setDateTime (const OUString& _datetime)
OUString Comment::getAuthor ( const CommentAuthorList& list )
{
const sal_Int32 nId = authorId.toInt32();
- std::vector<CommentAuthor>::const_iterator it;
- for(it = list.cmAuthorLst.begin(); it != list.cmAuthorLst.end(); ++it)
+ for (auto const& author : list.cmAuthorLst)
{
- if(it->id.toInt32() == nId)
- return it->name;
+ if(author.id.toInt32() == nId)
+ return author.name;
}
return OUString("Anonymous");
}
diff --git a/oox/source/ppt/pptshapegroupcontext.cxx b/oox/source/ppt/pptshapegroupcontext.cxx
index 235dd3fc6c10..1d639f3316b3 100644
--- a/oox/source/ppt/pptshapegroupcontext.cxx
+++ b/oox/source/ppt/pptshapegroupcontext.cxx
@@ -133,10 +133,9 @@ void PPTShapeGroupContext::importExtDrawings( )
{
if( pGraphicShape )
{
- for( ::std::vector<OUString>::const_iterator aIt = pGraphicShape->getExtDrawings().begin(), aEnd = pGraphicShape->getExtDrawings().end();
- aIt != aEnd; ++aIt )
+ for (auto const& extDrawing : pGraphicShape->getExtDrawings())
{
- getFilter().importFragment( new ExtDrawingFragmentHandler( getFilter(), getFragmentPathFromRelId( *aIt ),
+ getFilter().importFragment( new ExtDrawingFragmentHandler( getFilter(), getFragmentPathFromRelId(extDrawing),
mpSlidePersistPtr,
meShapeLocation,
mpGroupShapePtr,
@@ -153,9 +152,9 @@ void PPTShapeGroupContext::applyFontRefColor(const oox::drawingml::ShapePtr& pSh
{
pShape->getShapeStyleRefs()[XML_fontRef].maPhClr = rFontRefColor;
std::vector< oox::drawingml::ShapePtr >& vChildren = pShape->getChildren();
- for( std::vector< oox::drawingml::ShapePtr >::iterator aIter = vChildren.begin(); aIter != vChildren.end(); ++aIter )
+ for (auto const& child : vChildren)
{
- applyFontRefColor( *aIter ,rFontRefColor);
+ applyFontRefColor(child, rFontRefColor);
}
}
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx
index a874c73099b5..9b6a35c804ee 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -85,13 +85,13 @@ PresentationFragmentHandler::PresentationFragmentHandler(XmlFilterBase& rFilter,
, mpTextListStyle( new TextListStyle )
, mbCommentAuthorsRead(false)
{
+ // TODO JNA Typo
TextParagraphPropertiesVector& rParagraphDefaulsVector( mpTextListStyle->getListStyle() );
- TextParagraphPropertiesVector::iterator aParagraphDefaultIter( rParagraphDefaulsVector.begin() );
- while( aParagraphDefaultIter != rParagraphDefaulsVector.end() )
+ for (auto const& elem : rParagraphDefaulsVector)
{
// ppt is having zero bottom margin per default, whereas OOo is 0,5cm,
// so this attribute needs to be set always
- (*aParagraphDefaultIter++)->getParaBottomMargin() = TextSpacing( 0 );
+ elem->getParaBottomMargin() = TextSpacing( 0 );
}
}
@@ -105,14 +105,13 @@ void ResolveTextFields( XmlFilterBase const & rFilter )
if ( !rTextFields.empty() )
{
Reference< frame::XModel > xModel( rFilter.getModel() );
- oox::core::TextFieldStack::const_iterator aIter( rTextFields.begin() );
- while( aIter != rTextFields.end() )
+ for (auto const& textField : rTextFields)
{
const OUString sURL = "URL";
Reference< drawing::XDrawPagesSupplier > xDPS( xModel, uno::UNO_QUERY_THROW );
Reference< drawing::XDrawPages > xDrawPages( xDPS->getDrawPages(), uno::UNO_QUERY_THROW );
- const oox::core::TextField& rTextField( *aIter++ );
+ const oox::core::TextField& rTextField( textField );
Reference< XPropertySet > xPropSet( rTextField.xTextField, UNO_QUERY );
Reference< XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
if ( xPropSetInfo->hasPropertyByName( sURL ) )
@@ -257,15 +256,13 @@ void PresentationFragmentHandler::importSlide(sal_uInt32 nSlide, bool bFirstPage
{
// check if the corresponding masterpage+layout has already been imported
std::vector< SlidePersistPtr >& rMasterPages( rFilter.getMasterPages() );
- std::vector< SlidePersistPtr >::iterator aIter( rMasterPages.begin() );
- while( aIter != rMasterPages.end() )
+ for (auto const& masterPage : rMasterPages)
{
- if ( ( (*aIter)->getPath() == aMasterFragmentPath ) && ( (*aIter)->getLayoutPath() == aLayoutFragmentPath ) )
+ if ( ( masterPage->getPath() == aMasterFragmentPath ) && ( masterPage->getLayoutPath() == aLayoutFragmentPath ) )
{
- pMasterPersistPtr = *aIter;
+ pMasterPersistPtr = masterPage;
break;
}
- ++aIter;
}
if ( !pMasterPersistPtr.get() )
@@ -471,9 +468,7 @@ void PresentationFragmentHandler::finalizeImport()
}
StringRangeEnumerator aRangeEnumerator( aPageRange, 0, nPageCount - 1 );
- StringRangeEnumerator::Iterator aIter = aRangeEnumerator.begin();
- StringRangeEnumerator::Iterator aEnd = aRangeEnumerator.end();
- if (aIter!=aEnd)
+ if (aRangeEnumerator.size())
{
// todo: localized progress bar text
const Reference< task::XStatusIndicator >& rxStatusIndicator( getFilter().getStatusIndicator() );
@@ -483,14 +478,13 @@ void PresentationFragmentHandler::finalizeImport()
try
{
int nPagesImported = 0;
- while (aIter!=aEnd)
+ for (auto const& elem : aRangeEnumerator)
{
if ( rxStatusIndicator.is() )
rxStatusIndicator->setValue((nPagesImported * 10000) / aRangeEnumerator.size());
- importSlide(*aIter, !nPagesImported, bImportNotesPages);
+ importSlide(elem, !nPagesImported, bImportNotesPages);
nPagesImported++;
- ++aIter;
}
ResolveTextFields( rFilter );
}
diff --git a/oox/source/ppt/slidefragmenthandler.cxx b/oox/source/ppt/slidefragmenthandler.cxx
index 7e5530322dc8..b04cbdb3cd90 100644
--- a/oox/source/ppt/slidefragmenthandler.cxx
+++ b/oox/source/ppt/slidefragmenthandler.cxx
@@ -95,18 +95,18 @@ SlideFragmentHandler::~SlideFragmentHandler()
OUString aNotesFragmentPath = getFragmentPathFromFirstTypeFromOfficeDoc( "notesMaster" );
std::vector< SlidePersistPtr >& rMasterPages( rFilter.getMasterPages() );
- std::vector< SlidePersistPtr >::iterator aIter( rMasterPages.begin() );
- while( aIter != rMasterPages.end() )
+ bool bNotesFragmentPathFound = false;
+ for (auto const& masterPage : rMasterPages)
{
- if( (*aIter)->getPath() == aNotesFragmentPath )
+ if( masterPage->getPath() == aNotesFragmentPath )
{
if( !mpSlidePersistPtr->getMasterPersist() )
- mpSlidePersistPtr->setMasterPersist( *aIter );
+ mpSlidePersistPtr->setMasterPersist(masterPage);
+ bNotesFragmentPathFound=true;
break;
}
- ++aIter;
}
- if( aIter == rMasterPages.end() && !mpSlidePersistPtr->getMasterPersist() )
+ if( !bNotesFragmentPathFound && !mpSlidePersistPtr->getMasterPersist() )
{
TextListStylePtr pTextListStyle(new TextListStyle);
SlidePersistPtr pMasterPersistPtr = std::make_shared<SlidePersist>( rFilter, true, true, mpSlidePersistPtr->getPage(),
diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx
index fa330a2bacf7..8d6abaab47e1 100644
--- a/oox/source/ppt/slidepersist.cxx
+++ b/oox/source/ppt/slidepersist.cxx
@@ -133,21 +133,17 @@ void SlidePersist::createXShapes( XmlFilterBase& rFilterBase )
Reference< XShapes > xShapes( getPage(), UNO_QUERY );
std::vector< oox::drawingml::ShapePtr >& rShapes( maShapesPtr->getChildren() );
- const std::vector< oox::drawingml::ShapePtr >::const_iterator aShapesEnd( rShapes.end() );
- for (std::vector< oox::drawingml::ShapePtr >::const_iterator aShapesIter( rShapes.begin() );
- aShapesIter != aShapesEnd ; ++aShapesIter)
+ for (auto const& shape : rShapes)
{
- std::vector< oox::drawingml::ShapePtr >& rChildren( (*aShapesIter)->getChildren() );
- const std::vector< oox::drawingml::ShapePtr >::const_iterator aChildEnd( rChildren.end() );
- for (std::vector< oox::drawingml::ShapePtr >::const_iterator aChildIter( rChildren.begin() );
- aChildIter != aChildEnd ; ++aChildIter)
+ std::vector< oox::drawingml::ShapePtr >& rChildren( shape->getChildren() );
+ for (auto const& child : rChildren)
{
- PPTShape* pPPTShape = dynamic_cast< PPTShape* >( (*aChildIter).get() );
+ PPTShape* pPPTShape = dynamic_cast< PPTShape* >( child.get() );
basegfx::B2DHomMatrix aTransformation;
if ( pPPTShape )
pPPTShape->addShape( rFilterBase, *this, getTheme().get(), xShapes, aTransformation, &getShapeMap() );
else
- (*aChildIter)->addShape( rFilterBase, getTheme().get(), xShapes, aTransformation, maShapesPtr->getFillProperties(), &getShapeMap() );
+ child->addShape( rFilterBase, getTheme().get(), xShapes, aTransformation, maShapesPtr->getFillProperties(), &getShapeMap() );
}
}
@@ -308,19 +304,15 @@ void SlidePersist::applyTextStyles( const XmlFilterBase& rFilterBase )
void SlidePersist::hideShapesAsMasterShapes()
{
std::vector< oox::drawingml::ShapePtr >& rShapes( maShapesPtr->getChildren() );
- std::vector< oox::drawingml::ShapePtr >::iterator aShapesIter( rShapes.begin() );
- while( aShapesIter != rShapes.end() )
+ for (auto const& shape : rShapes)
{
- while( aShapesIter != rShapes.end() )
+ std::vector< oox::drawingml::ShapePtr >& rChildren( shape->getChildren() );
+ for (auto const& child : rChildren)
{
- std::vector< oox::drawingml::ShapePtr >& rChildren( (*aShapesIter++)->getChildren() );
- std::vector< oox::drawingml::ShapePtr >::iterator aChildIter( rChildren.begin() );
- while( aChildIter != rChildren.end() ) {
- PPTShape* pPPTShape = dynamic_cast< PPTShape* >( (*aChildIter++).get() );
- if (!pPPTShape)
- continue;
- pPPTShape->setHiddenMasterShape( true );
- }
+ PPTShape* pPPTShape = dynamic_cast< PPTShape* >( child.get() );
+ if (!pPPTShape)
+ continue;
+ pPPTShape->setHiddenMasterShape( true );
}
}
}
diff --git a/oox/source/ppt/timenode.cxx b/oox/source/ppt/timenode.cxx
index 09d99e3aa102..f695d7918b96 100644
--- a/oox/source/ppt/timenode.cxx
+++ b/oox/source/ppt/timenode.cxx
@@ -269,10 +269,11 @@ namespace oox { namespace ppt {
{
Sequence< NamedValue > aUserDataSeq( static_cast< sal_Int32 >( maUserData.size() ) );
NamedValue* pValues = aUserDataSeq.getArray();
- for( UserDataMap::const_iterator aIt = maUserData.begin(), aEnd = maUserData.end(); aIt != aEnd; ++aIt, ++pValues )
+ for (auto const& elem : maUserData)
{
- pValues->Name = aIt->first;
- pValues->Value = aIt->second;
+ pValues->Name = elem.first;
+ pValues->Value = elem.second;
+ ++pValues;
}
maNodeProperties[ NP_USERDATA ] <<= aUserDataSeq;
}