summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2018-03-15 23:18:09 +0100
committerJulien Nabet <serval2412@yahoo.fr>2018-03-16 07:05:11 +0100
commitc772d2234c52d450972a2e863dabff4ea46b047c (patch)
treee549220635d7a8d63e9a588d8bf728f06f89d9e5 /filter
parent8805e10f5887df66edfd0a2fa4b70e87f0c74700 (diff)
Modernize a bit filter (part2)
mainly by using for-range loops + some algo simplifications Change-Id: I25b02676527d551985434e07e7dc5f2927d4955e Reviewed-on: https://gerrit.libreoffice.org/51377 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'filter')
-rw-r--r--filter/source/msfilter/mstoolbar.cxx13
-rw-r--r--filter/source/msfilter/msvbahelper.cxx10
-rw-r--r--filter/source/msfilter/svdfppt.cxx25
-rw-r--r--filter/source/pdf/impdialog.cxx9
-rw-r--r--filter/source/svg/svgexport.cxx41
-rw-r--r--filter/source/svg/svgfilter.cxx8
-rw-r--r--filter/source/svg/svgfontexport.cxx44
-rw-r--r--filter/source/svg/svgreader.cxx5
-rw-r--r--filter/source/svg/svgwriter.cxx8
-rw-r--r--filter/source/xsltdialog/typedetectionexport.cxx47
-rw-r--r--filter/source/xsltdialog/typedetectionimport.cxx12
-rw-r--r--filter/source/xsltdialog/xmlfilterjar.cxx31
-rw-r--r--filter/source/xsltdialog/xmlfiltersettingsdialog.cxx25
-rw-r--r--filter/source/xsltdialog/xmlfiltertabpagebasic.cxx17
-rw-r--r--filter/source/xsltfilter/LibXSLTTransformer.cxx20
15 files changed, 128 insertions, 187 deletions
diff --git a/filter/source/msfilter/mstoolbar.cxx b/filter/source/msfilter/mstoolbar.cxx
index 788888321add..ed50eaaccca2 100644
--- a/filter/source/msfilter/mstoolbar.cxx
+++ b/filter/source/msfilter/mstoolbar.cxx
@@ -53,11 +53,11 @@ void CustomToolBarImportHelper::ScaleImage( uno::Reference< graphic::XGraphic >&
void CustomToolBarImportHelper::applyIcons()
{
- for ( std::vector< iconcontrolitem >::iterator it = iconcommands.begin(); it != iconcommands.end(); ++it )
+ for (auto const& concommand : iconcommands)
{
- uno::Sequence<OUString> commands { it->sCommand };
+ uno::Sequence<OUString> commands { concommand.sCommand };
uno::Sequence< uno::Reference< graphic::XGraphic > > images(1);
- images[ 0 ] = it->image;
+ images[ 0 ] = concommand.image;
uno::Reference< ui::XImageManager > xImageManager( getCfgManager()->getImageManager(), uno::UNO_QUERY_THROW );
sal_uInt16 nColor = ui::ImageType::COLOR_NORMAL;
@@ -282,10 +282,11 @@ bool TBCData::ImportToolBarControl( CustomToolBarImportHelper& helper, std::vect
{
// if we have a icon then lets set it for the command
OUString sCommand;
- for ( std::vector< css::beans::PropertyValue >::iterator it = props.begin(); it != props.end(); ++it )
+ for (auto const& property : props)
{
- if ( it->Name == "CommandURL" )
- it->Value >>= sCommand;
+ // TODO JNA : couldn't we break if we find CommandURL to avoid keeping on the loop?
+ if ( property.Name == "CommandURL" )
+ property.Value >>= sCommand;
}
if ( TBCBitMap* pIcon = pSpecificInfo->getIcon() )
{
diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx
index 9640b8895c6f..90a38ca8d979 100644
--- a/filter/source/msfilter/msvbahelper.cxx
+++ b/filter/source/msfilter/msvbahelper.cxx
@@ -437,12 +437,14 @@ MacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const OUString& Macro
#endif
}
- std::vector< OUString >::iterator it_end = sSearchList.end();
- for ( std::vector< OUString >::iterator it = sSearchList.begin(); !aRes.mbFound && (it != it_end); ++it )
+ for (auto const& search : sSearchList)
{
- aRes.mbFound = hasMacro( pShell, *it, sModule, sProcedure );
+ aRes.mbFound = hasMacro( pShell, search, sModule, sProcedure );
if ( aRes.mbFound )
- sContainer = *it;
+ {
+ sContainer = search;
+ break;
+ }
}
//aRes.msResolvedMacro = sProcedure.Insert( '.', 0 ).Insert( sModule, 0).Insert( '.', 0 ).Insert( sContainer, 0 );
aRes.msResolvedMacro = sContainer + "." + sModule + "." + sProcedure;
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 97032a01a56c..74099436968e 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -5416,10 +5416,10 @@ void PPTStyleTextPropReader::Init( SvStream& rIn, const DffRecordHeader& rTextHe
PPTStyleTextPropReader::~PPTStyleTextPropReader()
{
- for ( PPTParaPropSetList::const_iterator it = aParaPropList.begin(); it != aParaPropList.end(); ++it )
- delete *it;
- for ( PPTCharPropSetList::const_iterator it = aCharPropList.begin(); it != aCharPropList.end(); ++it )
- delete *it;
+ for (auto const& paraProp : aParaPropList)
+ delete paraProp;
+ for (auto const& charProp : aCharPropList)
+ delete charProp;
}
PPTPortionObj::PPTPortionObj( const PPTStyleSheet& rStyleSheet, TSS_Type nInstance, sal_uInt32 nDepth ) :
@@ -7514,11 +7514,10 @@ void ApplyCellLineAttributes( const SdrObject* pLine, Reference< XTable > const
}
break;
}
- std::vector< sal_Int32 >::const_iterator aIter( vPositions.begin() );
- while( aIter != vPositions.end() )
+ for (auto const& vPos : vPositions)
{
- sal_Int32 nPosition = *aIter & 0xffffff;
- sal_Int32 nFlags = *aIter &~0xffffff;
+ sal_Int32 nPosition = vPos & 0xffffff;
+ sal_Int32 nFlags = vPos &~0xffffff;
sal_Int32 nRow = nPosition / nColumns;
sal_Int32 nColumn = nPosition - ( nRow * nColumns );
Reference< XCell > xCell( xTable->getCellByPosition( nColumn, nRow ) );
@@ -7536,7 +7535,6 @@ void ApplyCellLineAttributes( const SdrObject* pLine, Reference< XTable > const
xPropSet->setPropertyValue( "DiagonalTLBR", Any( true ) );
if ( nFlags & LinePositionBLTR )
xPropSet->setPropertyValue( "DiagonalBLTR", Any( true ) );
- ++aIter;
}
}
catch( const Exception& )
@@ -7642,13 +7640,12 @@ SdrObject* SdrPowerPointImport::CreateTable( SdrObject* pGroup, const sal_uInt32
GetLinePositions( pObj, aRows, aColumns, vPositions, pGroup->GetSnapRect() );
// correcting merged cell position
- std::vector< sal_Int32 >::iterator aIter( vPositions.begin() );
- while( aIter != vPositions.end() )
+ for (auto & vPos : vPositions)
{
- sal_Int32 nOldPosition = *aIter & 0xffff;
- sal_Int32 nOldFlags = *aIter & 0xffff0000;
+ sal_Int32 nOldPosition = vPos & 0xffff;
+ sal_Int32 nOldFlags = vPos & 0xffff0000;
sal_Int32 nNewPosition = pMergedCellIndexTable[ nOldPosition ] | nOldFlags;
- *aIter++ = nNewPosition;
+ vPos = nNewPosition;
}
ApplyCellLineAttributes( pObj, xTable, vPositions, aColumns.size() );
}
diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index e252156de5dc..68446b6842c7 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -1602,10 +1602,9 @@ ImplErrorDialog::ImplErrorDialog(const std::set< vcl::PDFWriter::ErrorCode >& rE
Image aWarnImg(BitmapEx(IMG_WARN));
Image aErrImg(BitmapEx(IMG_ERR));
- for( std::set<vcl::PDFWriter::ErrorCode>::const_iterator it = rErrors.begin();
- it != rErrors.end(); ++it )
+ for (auto const& error : rErrors)
{
- switch( *it )
+ switch(error)
{
case vcl::PDFWriter::Warning_Transparency_Omitted_PDFA:
{
@@ -1751,9 +1750,9 @@ IMPL_LINK_NOARG( ImpPDFTabSigningPage, ClickmaPbSignCertSelect, Button*, void )
if (aTSAURLs)
{
const css::uno::Sequence<OUString>& rTSAURLs = aTSAURLs.get();
- for (auto i = rTSAURLs.begin(); i != rTSAURLs.end(); ++i)
+ for (auto const& elem : rTSAURLs)
{
- mpLBSignTSA->InsertEntry( *i );
+ mpLBSignTSA->InsertEntry(elem);
}
}
}
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index 7f08357a80ae..46e7adba0df9 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -115,10 +115,9 @@ protected:
{
const sal_Unicode * ustr = sText.getStr();
sal_Int32 nLength = sText.getLength();
- SVGFilter::ObjectSet::const_iterator aMasterPageIt = mMasterPageSet.begin();
- for( ; aMasterPageIt != mMasterPageSet.end(); ++aMasterPageIt )
+ for (auto const& masterPage : mMasterPageSet)
{
- const Reference< XInterface > & xMasterPage = *aMasterPageIt;
+ const Reference< XInterface > & xMasterPage = masterPage;
for( sal_Int32 i = 0; i < nLength; ++i )
{
aTextFieldCharSets[ xMasterPage ][ sTextFieldId ].insert( ustr[i] );
@@ -284,10 +283,9 @@ public:
// we use the unicode char set in an improper way: we put in the date/time format
// in order to pass it to the CalcFieldValue method
static const OUString sFieldId = aOOOAttrDateTimeField + "-variable";
- SVGFilter::ObjectSet::const_iterator aMasterPageIt = mMasterPageSet.begin();
- for( ; aMasterPageIt != mMasterPageSet.end(); ++aMasterPageIt )
+ for (auto const& masterPage : mMasterPageSet)
{
- aTextFieldCharSets[ *aMasterPageIt ][ sFieldId ].insert( static_cast<sal_Unicode>( format ) );
+ aTextFieldCharSets[ masterPage ][ sFieldId ].insert( static_cast<sal_Unicode>( format ) );
}
}
};
@@ -590,11 +588,10 @@ bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
// the maOldFieldHdl for all that have ended up using
// maNewFieldHdl
std::vector<SdrOutliner*> aOutliners(mpSdrModel->GetActiveOutliners());
- for (auto aIter = aOutliners.begin(); aIter != aOutliners.end(); ++aIter)
+ for (auto const& outliner : aOutliners)
{
- SdrOutliner* pOutliner = *aIter;
- if (maNewFieldHdl == pOutliner->GetCalcFieldValueHdl())
- pOutliner->SetCalcFieldValueHdl(maOldFieldHdl);
+ if (maNewFieldHdl == outliner->GetCalcFieldValueHdl())
+ outliner->SetCalcFieldValueHdl(maOldFieldHdl);
}
}
@@ -827,14 +824,12 @@ bool SVGFilter::implExportDocument()
// Create the (Shape, GDIMetaFile) map
if( implCreateObjects() )
{
- ObjectMap::const_iterator aIter( mpObjects->begin() );
::std::vector< ObjectRepresentation > aObjects( mpObjects->size() );
sal_uInt32 nPos = 0;
- while( aIter != mpObjects->end() )
+ for (auto const& elem : *mpObjects)
{
- aObjects[ nPos++ ] = (*aIter).second;
- ++aIter;
+ aObjects[ nPos++ ] = elem.second;
}
mpSVGFontExport = new SVGFontExport( *mpSVGExport, aObjects );
@@ -1262,11 +1257,9 @@ void SVGFilter::implExportTextEmbeddedBitmaps()
OUString sId;
- MetaBitmapActionSet::const_iterator it = mEmbeddedBitmapActionSet.begin();
- MetaBitmapActionSet::const_iterator end = mEmbeddedBitmapActionSet.end();
- for( ; it != end; ++it)
+ for (auto const& embeddedBitmapAction : mEmbeddedBitmapActionSet)
{
- const GDIMetaFile& aMtf = it->GetRepresentation();
+ const GDIMetaFile& aMtf = embeddedBitmapAction.GetRepresentation();
if( aMtf.GetActionSize() == 1 )
{
@@ -1277,7 +1270,7 @@ void SVGFilter::implExportTextEmbeddedBitmaps()
sId = "bitmap(" + OUString::number( nId ) + ")";
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", sId );
- const Reference< XInterface >& rxShape = it->GetObject();
+ const Reference< XInterface >& rxShape = embeddedBitmapAction.GetObject();
Reference< XPropertySet > xShapePropSet( rxShape, UNO_QUERY );
css::awt::Rectangle aBoundRect;
if( xShapePropSet.is() && ( xShapePropSet->getPropertyValue( "BoundRect" ) >>= aBoundRect ) )
@@ -2168,11 +2161,10 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo, void )
{
SvxDateFormat eDateFormat = SvxDateFormat::B, eCurDateFormat;
const UCharSet & aCharSet = (*pCharSetMap)[ aVariableDateTimeId ];
- UCharSet::const_iterator aChar = aCharSet.begin();
// we look for the most verbose date format
- for( ; aChar != aCharSet.end(); ++aChar )
+ for (auto const& elem : aCharSet)
{
- eCurDateFormat = static_cast<SvxDateFormat>( static_cast<int>( *aChar ) & 0x0f );
+ eCurDateFormat = static_cast<SvxDateFormat>( static_cast<int>(elem) & 0x0f );
switch( eDateFormat )
{
case SvxDateFormat::StdSmall:
@@ -2284,10 +2276,9 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo, void )
{
if( pCharSet != nullptr )
{
- UCharSet::const_iterator aChar = pCharSet->begin();
- for( ; aChar != pCharSet->end(); ++aChar )
+ for (auto const& elem : *pCharSet)
{
- aRepresentation += OUStringLiteral1( *aChar );
+ aRepresentation += OUStringLiteral1(elem);
}
}
pInfo->SetRepresentation( aRepresentation );
diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx
index 0f7245c133d9..e64ef5ee063f 100644
--- a/filter/source/svg/svgfilter.cxx
+++ b/filter/source/svg/svgfilter.cxx
@@ -264,11 +264,11 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto
}
// Later we move them to a uno::Sequence so we can get them by index
mMasterPageTargets.resize( aMasterPageTargetSet.size() );
- ObjectSet::const_iterator aElem = aMasterPageTargetSet.begin();
- for( sal_Int32 i = 0; aElem != aMasterPageTargetSet.end(); ++aElem, ++i)
+ sal_Int32 i = 0;
+ for (auto const& masterPageTarget : aMasterPageTargetSet)
{
- uno::Reference< drawing::XDrawPage > xMasterPage( *aElem, uno::UNO_QUERY );
- mMasterPageTargets[i] = xMasterPage;
+ uno::Reference< drawing::XDrawPage > xMasterPage( masterPageTarget, uno::UNO_QUERY );
+ mMasterPageTargets[i++] = xMasterPage;
}
bRet = implExport( rDescriptor );
diff --git a/filter/source/svg/svgfontexport.cxx b/filter/source/svg/svgfontexport.cxx
index 1f31e42e1c3c..69dbb720c2da 100644
--- a/filter/source/svg/svgfontexport.cxx
+++ b/filter/source/svg/svgfontexport.cxx
@@ -72,15 +72,14 @@ SVGFontExport::GlyphSet& SVGFontExport::implGetGlyphSet( const vcl::Font& rFont
void SVGFontExport::implCollectGlyphs()
{
ScopedVclPtrInstance< VirtualDevice > pVDev;
- ObjectVector::const_iterator aIter( maObjects.begin() );
pVDev->EnableOutput( false );
- while( aIter != maObjects.end() )
+ for (auto const& elem : maObjects)
{
- if( (*aIter).HasRepresentation() )
+ if( elem.HasRepresentation() )
{
- const GDIMetaFile& rMtf = (*aIter).GetRepresentation();
+ const GDIMetaFile& rMtf = elem.GetRepresentation();
pVDev->Push();
@@ -163,8 +162,6 @@ void SVGFontExport::implCollectGlyphs()
pVDev->Pop();
}
-
- ++aIter;
}
}
@@ -177,7 +174,6 @@ void SVGFontExport::implEmbedFont( const vcl::Font& rFont )
if( !rGlyphSet.empty() )
{
- GlyphSet::const_iterator aIter( rGlyphSet.begin() );
const OUString aEmbeddedFontStr( "EmbeddedFont_" );
{
@@ -237,11 +233,9 @@ void SVGFontExport::implEmbedFont( const vcl::Font& rFont )
SvXMLElementExport aExp4( mrExport, XML_NAMESPACE_NONE, "missing-glyph", true, true );
}
}
-
- while( aIter != rGlyphSet.end() )
+ for (auto const& glyph : rGlyphSet)
{
- implEmbedGlyph( *pVDev.get(), *aIter );
- ++aIter;
+ implEmbedGlyph( *pVDev.get(), glyph);
}
}
}
@@ -288,35 +282,23 @@ void SVGFontExport::EmbedFonts()
{
implCollectGlyphs();
- GlyphTree::const_iterator aGlyphTreeIter( maGlyphTree.begin() );
-
- while( aGlyphTreeIter != maGlyphTree.end() )
+ for (auto const& glyph : maGlyphTree)
{
- const FontWeightMap& rFontWeightMap = (*aGlyphTreeIter).second;
- FontWeightMap::const_iterator aFontWeightIter( rFontWeightMap.begin() );
-
- while( aFontWeightIter != rFontWeightMap.end() )
+ const FontWeightMap& rFontWeightMap = glyph.second;
+ for (auto const& fontWeight : rFontWeightMap)
{
- const FontItalicMap& rFontItalicMap = (*aFontWeightIter).second;
- FontItalicMap::const_iterator aFontItalicIter( rFontItalicMap.begin() );
-
- while( aFontItalicIter != rFontItalicMap.end() )
+ const FontItalicMap& rFontItalicMap = fontWeight.second;
+ for (auto const& fontItalic : rFontItalicMap)
{
vcl::Font aFont;
- aFont.SetFamilyName( (*aGlyphTreeIter).first );
- aFont.SetWeight( (*aFontWeightIter).first );
- aFont.SetItalic( (*aFontItalicIter).first );
+ aFont.SetFamilyName( glyph.first );
+ aFont.SetWeight( fontWeight.first );
+ aFont.SetItalic( fontItalic.first );
implEmbedFont( aFont );
-
- ++aFontItalicIter;
}
-
- ++aFontWeightIter;
}
-
- ++aGlyphTreeIter;
}
}
diff --git a/filter/source/svg/svgreader.cxx b/filter/source/svg/svgreader.cxx
index 43fe63b07ba6..5227bd072b50 100644
--- a/filter/source/svg/svgreader.cxx
+++ b/filter/source/svg/svgreader.cxx
@@ -1926,10 +1926,9 @@ void writeShapes( StateMap& rStateMap,
ShapeWritingVisitor aVisitor(rStateMap,xDocHdl);
visitElements(aVisitor, rElem, SHAPE_WRITER);
- std::vector< uno::Reference<xml::dom::XElement> >::iterator it;
- for ( it = rUseElementVector.begin() ; it != rUseElementVector.end(); ++it)
+ for (auto const& useElement : rUseElementVector)
{
- visitElements(aVisitor, *it, SHAPE_WRITER);
+ visitElements(aVisitor, useElement, SHAPE_WRITER);
}
}
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index a37c8d001843..12b872a0a588 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -1363,22 +1363,20 @@ void SVGTextWriter::implWriteBulletChars()
mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", "BulletChars" );
SvXMLElementExport aGroupElem( mrExport, XML_NAMESPACE_NONE, aXMLElemG, true, true );
- BulletListItemInfoMap::const_iterator it = maBulletListItemMap.begin();
- BulletListItemInfoMap::const_iterator end = maBulletListItemMap.end();
OUString sId, sPosition, sScaling, sRefId;
- for( ; it != end; ++it )
+ for (auto const& bulletListItem : maBulletListItemMap)
{
// <g id="?" > (used by animations)
// As id we use the id of the text portion placeholder with prefix
// bullet-char-*
- sId = "bullet-char-" + it->first;
+ sId = "bullet-char-" + bulletListItem.first;
mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", sId );
mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", "BulletChar" );
SvXMLElementExport aBulletCharElem( mrExport, XML_NAMESPACE_NONE, aXMLElemG, true, true );
// <g transform="translate(x,y)" >
{
- const BulletListItemInfo& rInfo = it->second;
+ const BulletListItemInfo& rInfo = bulletListItem.second;
// Add positioning attribute through a translation
sPosition = "translate(" +
diff --git a/filter/source/xsltdialog/typedetectionexport.cxx b/filter/source/xsltdialog/typedetectionexport.cxx
index 1219e3cf21d9..85be228fa7eb 100644
--- a/filter/source/xsltdialog/typedetectionexport.cxx
+++ b/filter/source/xsltdialog/typedetectionexport.cxx
@@ -112,36 +112,31 @@ void TypeDetectionExporter::doExport( const Reference< XOutputStream >& xOS, co
xHandler->ignorableWhitespace ( sWhiteSpace );
xHandler->startElement( sNode, xAttrList );
- XMLFilterVector::const_iterator aIter( rFilters.begin() );
- while( aIter != rFilters.end() )
+ for (auto const& filter : rFilters)
{
- const filter_info_impl* pFilter = (*aIter);
-
xAttrList = pAttrList = new ::comphelper::AttributeList;
- pAttrList->AddAttribute( sName, sCdataAttribute, pFilter->maType );
+ pAttrList->AddAttribute( sName, sCdataAttribute, filter->maType );
xHandler->ignorableWhitespace ( sWhiteSpace );
xHandler->startElement( sNode, xAttrList );
OUString sValue("0");
sValue += sComma;
sValue += sComma;
- if( !pFilter->maDocType.isEmpty() )
+ if( !filter->maDocType.isEmpty() )
{
sValue += sDocTypePrefix;
- sValue += pFilter->maDocType;
+ sValue += filter->maDocType;
}
sValue += sComma;
sValue += sComma;
- sValue += pFilter->maExtension;
+ sValue += filter->maExtension;
sValue += sComma;
- sValue += OUString::number( pFilter->mnDocumentIconID );
+ sValue += OUString::number( filter->mnDocumentIconID );
sValue += sComma;
addProperty( xHandler, sData, sValue );
- addLocaleProperty( xHandler, sUIName, pFilter->maInterfaceName );
+ addLocaleProperty( xHandler, sUIName, filter->maInterfaceName );
xHandler->ignorableWhitespace ( sWhiteSpace );
xHandler->endElement( sNode );
-
- ++aIter;
}
xHandler->ignorableWhitespace ( sWhiteSpace );
@@ -155,53 +150,49 @@ void TypeDetectionExporter::doExport( const Reference< XOutputStream >& xOS, co
xHandler->ignorableWhitespace ( sWhiteSpace );
xHandler->startElement( sNode, xAttrList );
- XMLFilterVector::const_iterator aIter( rFilters.begin() );
- while( aIter != rFilters.end() )
+ for (auto const& filter : rFilters)
{
- const filter_info_impl* pFilter = (*aIter);
-
xAttrList = pAttrList = new ::comphelper::AttributeList;
- pAttrList->AddAttribute( sName, sCdataAttribute, pFilter->maFilterName );
+ pAttrList->AddAttribute( sName, sCdataAttribute, filter->maFilterName );
xHandler->ignorableWhitespace ( sWhiteSpace );
xHandler->startElement( sNode, xAttrList );
- addLocaleProperty( xHandler, sUIName, pFilter->maInterfaceName );
+ addLocaleProperty( xHandler, sUIName, filter->maInterfaceName );
OUString sValue("0");
sValue += sComma;
- sValue += pFilter->maType;
+ sValue += filter->maType;
sValue += sComma;
- sValue += pFilter->maDocumentService;
+ sValue += filter->maDocumentService;
sValue += sComma;
sValue += sFilterAdaptorService;
sValue += sComma;
- sValue += OUString::number( pFilter->maFlags );
+ sValue += OUString::number( filter->maFlags );
sValue += sComma;
sValue += sXSLTFilterService;
sValue += sDelim;
- sValue += OUString::boolean( pFilter->mbNeedsXSLT2 );
+ sValue += OUString::boolean( filter->mbNeedsXSLT2 );
sValue += sDelim;
- const application_info_impl* pAppInfo = getApplicationInfo( pFilter->maExportService );
+ const application_info_impl* pAppInfo = getApplicationInfo( filter->maExportService );
sValue += pAppInfo->maXMLImporter;
sValue += sDelim;
sValue += pAppInfo->maXMLExporter;
sValue += sDelim;
- sValue += createRelativeURL( pFilter->maFilterName, pFilter->maImportXSLT );
+ sValue += createRelativeURL( filter->maFilterName, filter->maImportXSLT );
sValue += sDelim;
- sValue += createRelativeURL( pFilter->maFilterName, pFilter->maExportXSLT );
+ sValue += createRelativeURL( filter->maFilterName, filter->maExportXSLT );
sValue += sDelim;
// entry DTD obsolete and removed, but delimiter kept
sValue += sDelim;
- sValue += pFilter->maComment;
+ sValue += filter->maComment;
sValue += sComma;
sValue += "0";
sValue += sComma;
- sValue += createRelativeURL( pFilter->maFilterName, pFilter->maImportTemplate );
+ sValue += createRelativeURL( filter->maFilterName, filter->maImportTemplate );
addProperty( xHandler, sData, sValue );
xHandler->ignorableWhitespace ( sWhiteSpace );
xHandler->endElement( sNode );
- ++aIter;
}
xHandler->endElement( sNode );
diff --git a/filter/source/xsltdialog/typedetectionimport.cxx b/filter/source/xsltdialog/typedetectionimport.cxx
index 07c200d90dc8..bdfd039e5875 100644
--- a/filter/source/xsltdialog/typedetectionimport.cxx
+++ b/filter/source/xsltdialog/typedetectionimport.cxx
@@ -69,20 +69,18 @@ void TypeDetectionImporter::doImport( const Reference< XComponentContext >& rxCo
void TypeDetectionImporter::fillFilterVector( XMLFilterVector& rFilters )
{
// create filter infos from imported filter nodes
- NodeVector::iterator aIter = maFilterNodes.begin();
- while( aIter != maFilterNodes.end() )
+ for (auto const& filterNode : maFilterNodes)
{
- filter_info_impl* pFilter = createFilterForNode( *aIter );
+ filter_info_impl* pFilter = createFilterForNode(filterNode);
if( pFilter )
rFilters.push_back( pFilter );
- delete *aIter++;
+ delete filterNode;
}
// now delete type nodes
- aIter = maTypeNodes.begin();
- while( aIter != maTypeNodes.end() )
- delete *aIter++;
+ for (auto const& typeNode : maTypeNodes)
+ delete typeNode;
}
static OUString getSubdata( int index, sal_Unicode delimiter, const OUString& rData )
diff --git a/filter/source/xsltdialog/xmlfilterjar.cxx b/filter/source/xsltdialog/xmlfilterjar.cxx
index 1b92af47f6c5..deb83c62ec43 100644
--- a/filter/source/xsltdialog/xmlfilterjar.cxx
+++ b/filter/source/xsltdialog/xmlfilterjar.cxx
@@ -168,21 +168,18 @@ bool XMLFilterJarHelper::savePackage( const OUString& rPackageURL, const XMLFilt
xIfc->getByHierarchicalName( "/" ) >>= xRootFolder;
// export filters files
- XMLFilterVector::const_iterator aIter( rFilters.begin() );
- while( aIter != rFilters.end() )
+ for (auto const& filter : rFilters)
{
- const filter_info_impl* pFilter = (*aIter);
-
- Reference< XInterface > xFilterRoot( addFolder( xRootFolder, xFactory, pFilter->maFilterName ) );
+ Reference< XInterface > xFilterRoot( addFolder( xRootFolder, xFactory, filter->maFilterName ) );
if( xFilterRoot.is() )
{
- if( !pFilter->maExportXSLT.isEmpty() )
- addFile( xFilterRoot, xFactory, pFilter->maExportXSLT );
+ if( !filter->maExportXSLT.isEmpty() )
+ addFile( xFilterRoot, xFactory, filter->maExportXSLT );
try
{
- if( !pFilter->maImportXSLT.isEmpty() )
- addFile( xFilterRoot, xFactory, pFilter->maImportXSLT );
+ if( !filter->maImportXSLT.isEmpty() )
+ addFile( xFilterRoot, xFactory, filter->maImportXSLT );
}
catch(const css::container::ElementExistException&)
{
@@ -191,11 +188,9 @@ bool XMLFilterJarHelper::savePackage( const OUString& rPackageURL, const XMLFilt
OSL_FAIL( "XMLFilterJarHelper::same named xslt filter exception!" );
}
- if( !pFilter->maImportTemplate.isEmpty() )
- addFile( xFilterRoot, xFactory, pFilter->maImportTemplate );
+ if( !filter->maImportTemplate.isEmpty() )
+ addFile( xFilterRoot, xFactory, filter->maImportTemplate );
}
-
- ++aIter;
}
// create TypeDetection.xcu
@@ -274,19 +269,17 @@ void XMLFilterJarHelper::openPackage( const OUString& rPackageURL, XMLFilterVect
// copy all files used by the filters imported from the
// typedetection to office/user/xslt
- XMLFilterVector::iterator aIter( aFilters.begin() );
- while( aIter != aFilters.end() )
+ for (auto const& filter : aFilters)
{
- if( copyFiles( xIfc, (*aIter) ) )
+ if( copyFiles( xIfc, filter ) )
{
- rFilters.push_back( *aIter );
+ rFilters.push_back(filter);
}
else
{
// failed to copy all files
- delete *aIter;
+ delete filter;
}
- ++aIter;
}
}
}
diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
index fa0f745ff89c..0806d605ebf4 100644
--- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
@@ -935,18 +935,15 @@ void XMLFilterSettingsDialog::onOpen()
aJarHelper.openPackage( aURL, aFilters );
int nFilters = 0;
- XMLFilterVector::iterator aIter( aFilters.begin() );
- while( aIter != aFilters.end() )
+ for (auto const& filter : aFilters)
{
- filter_info_impl* pInfo = (*aIter++);
-
- if( insertOrEdit( pInfo ) )
+ if( insertOrEdit(filter) )
{
- aFilterName = pInfo->maFilterName;
+ aFilterName = filter->maFilterName;
nFilters++;
}
- delete pInfo;
+ delete filter;
}
disposeFilterList();
@@ -1005,10 +1002,9 @@ bool XMLFilterSettingsDialog::EventNotify( NotifyEvent& rNEvt )
void XMLFilterSettingsDialog::disposeFilterList()
{
- std::vector< filter_info_impl* >::iterator aIter( maFilterVector.begin() );
- while( aIter != maFilterVector.end() )
+ for (auto const& filter : maFilterVector)
{
- delete *aIter++;
+ delete filter;
}
maFilterVector.clear();
@@ -1259,13 +1255,12 @@ std::vector< application_info_impl* >& getApplicationInfos()
const application_info_impl* getApplicationInfo( const OUString& rServiceName )
{
std::vector< application_info_impl* >& rInfos = getApplicationInfos();
- for (std::vector< application_info_impl* >::const_iterator aIter( rInfos.begin() ), aEnd( rInfos.end() );
- aIter != aEnd ; ++aIter)
+ for (auto const& info : rInfos)
{
- if( rServiceName == (*aIter)->maXMLExporter ||
- rServiceName == (*aIter)->maXMLImporter)
+ if( rServiceName == info->maXMLExporter ||
+ rServiceName == info->maXMLImporter)
{
- return (*aIter);
+ return info;
}
}
return nullptr;
diff --git a/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx b/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx
index 0ada6268b69c..a86e68a67f6b 100644
--- a/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx
+++ b/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx
@@ -34,10 +34,9 @@ XMLFilterTabPageBasic::XMLFilterTabPageBasic(vcl::Window* pParent)
m_pEDDescription->set_height_request(m_pEDDescription->GetTextHeight() * 4);
std::vector< application_info_impl* >& rInfos = getApplicationInfos();
- std::vector< application_info_impl* >::iterator aIter( rInfos.begin() );
- while( aIter != rInfos.end() )
+ for (auto const& info : rInfos)
{
- OUString aEntry( (*aIter++)->maDocumentUIName );
+ OUString aEntry( info->maDocumentUIName );
m_pCBApplication->InsertEntry( aEntry );
}
}
@@ -104,17 +103,15 @@ void XMLFilterTabPageBasic::FillInfo( filter_info_impl* pInfo )
if( !pInfo->maDocumentService.isEmpty() )
{
std::vector< application_info_impl* >& rInfos = getApplicationInfos();
- std::vector< application_info_impl* >::iterator aIter( rInfos.begin() );
- while( aIter != rInfos.end() )
+ for (auto const& info : rInfos)
{
- if( pInfo->maDocumentService == (*aIter)->maDocumentUIName )
+ if( pInfo->maDocumentService == info->maDocumentUIName )
{
- pInfo->maDocumentService = (*aIter)->maDocumentService;
- pInfo->maExportService = (*aIter)->maXMLExporter;
- pInfo->maImportService = (*aIter)->maXMLImporter;
+ pInfo->maDocumentService = info->maDocumentService;
+ pInfo->maExportService = info->maXMLExporter;
+ pInfo->maImportService = info->maXMLImporter;
break;
}
- ++aIter;
}
}
}
diff --git a/filter/source/xsltfilter/LibXSLTTransformer.cxx b/filter/source/xsltfilter/LibXSLTTransformer.cxx
index 6cb85e9af6b8..b5691b93c38a 100644
--- a/filter/source/xsltfilter/LibXSLTTransformer.cxx
+++ b/filter/source/xsltfilter/LibXSLTTransformer.cxx
@@ -271,14 +271,13 @@ namespace XSLT
OSL_ASSERT(m_transformer->getInputStream().is());
OSL_ASSERT(m_transformer->getOutputStream().is());
OSL_ASSERT(!m_transformer->getStyleSheetURL().isEmpty());
- ::std::map<const char*, OString>::iterator pit;
::std::map<const char*, OString> pmap = m_transformer->getParameters();
::std::vector< const char* > params( pmap.size() * 2 + 1 ); // build parameters
int paramIndex = 0;
- for (pit = pmap.begin(); pit != pmap.end(); ++pit)
+ for (auto const& elem : pmap)
{
- params[paramIndex++] = (*pit).first;
- params[paramIndex++] = (*pit).second.getStr();
+ params[paramIndex++] = elem.first;
+ params[paramIndex++] = elem.second.getStr();
}
params[paramIndex] = nullptr;
xmlDocPtr doc = xmlReadIO(&ParserInputBufferCallback::on_read,
@@ -422,11 +421,10 @@ namespace XSLT
void
LibXSLTTransformer::start()
{
- ListenerList::iterator it;
ListenerList* l = &m_listeners;
- for (it = l->begin(); it != l->end(); ++it)
+ for (auto const& elem : *l)
{
- css::uno::Reference<XStreamListener> xl = *it;
+ css::uno::Reference<XStreamListener> xl = elem;
xl.get()->started();
}
OSL_ENSURE(!m_Reader.is(), "Somebody forgot to call terminate *and* holds a reference to this LibXSLTTransformer instance");
@@ -440,9 +438,9 @@ namespace XSLT
ListenerList* l = &m_listeners;
Any arg;
arg <<= Exception(msg, *this);
- for (ListenerList::iterator it = l->begin(); it != l->end(); ++it)
+ for (auto const& elem : *l)
{
- css::uno::Reference<XStreamListener> xl = *it;
+ css::uno::Reference<XStreamListener> xl = elem;
if (xl.is())
{
xl.get()->error(arg);
@@ -454,9 +452,9 @@ namespace XSLT
LibXSLTTransformer::done()
{
ListenerList* l = &m_listeners;
- for (ListenerList::iterator it = l->begin(); it != l->end(); ++it)
+ for (auto const& elem : *l)
{
- css::uno::Reference<XStreamListener> xl = *it;
+ css::uno::Reference<XStreamListener> xl = elem;
if (xl.is())
{
xl.get()->closed();