[Libreoffice-commits] core.git: lotuswordpro/source

Julien Nabet serval2412 at yahoo.fr
Fri Mar 30 05:05:05 UTC 2018


 lotuswordpro/source/filter/lwpbulletstylemgr.cxx          |    7 --
 lotuswordpro/source/filter/lwpchangemgr.cxx               |   43 ++++++--------
 lotuswordpro/source/filter/lwpgrfobj.cxx                  |    5 -
 lotuswordpro/source/filter/lwpstory.cxx                   |    4 -
 lotuswordpro/source/filter/lwptblformula.cxx              |    5 -
 lotuswordpro/source/filter/xfilter/xfcolumns.cxx          |    5 -
 lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx |    7 --
 lotuswordpro/source/filter/xfilter/xfdrawpath.cxx         |   12 +--
 lotuswordpro/source/filter/xfilter/xfdrawpolygon.cxx      |    7 --
 lotuswordpro/source/filter/xfilter/xfdrawpolyline.cxx     |   29 +++------
 lotuswordpro/source/filter/xfilter/xffontfactory.cxx      |    7 --
 lotuswordpro/source/filter/xfilter/xfindex.cxx            |   12 +--
 lotuswordpro/source/filter/xfilter/xfrow.cxx              |    7 --
 lotuswordpro/source/filter/xfilter/xfstylecont.cxx        |   42 ++++---------
 lotuswordpro/source/filter/xfilter/xfstylemanager.cxx     |   11 +--
 lotuswordpro/source/filter/xfilter/xftable.cxx            |   25 +++-----
 lotuswordpro/source/filter/xfilter/xftextspan.cxx         |   15 +---
 lotuswordpro/source/filter/xfilter/xftimestyle.cxx        |    5 -
 18 files changed, 101 insertions(+), 147 deletions(-)

New commits:
commit 3d14fb1ef44144d69e73d047c547508219a57b62
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Thu Mar 29 20:33:12 2018 +0200

    Use for-range loops in lotuswordpro
    
    Change-Id: Ib14bc1f00914253f000a2bb9c3f780b04fdd126c
    Reviewed-on: https://gerrit.libreoffice.org/52125
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/lotuswordpro/source/filter/lwpbulletstylemgr.cxx b/lotuswordpro/source/filter/lwpbulletstylemgr.cxx
index 4b97c6551e6e..40aef7d0618b 100644
--- a/lotuswordpro/source/filter/lwpbulletstylemgr.cxx
+++ b/lotuswordpro/source/filter/lwpbulletstylemgr.cxx
@@ -127,11 +127,10 @@ OUString LwpBulletStyleMgr::RegisterBulletStyle(LwpPara* pPara, LwpBulletOverrid
     std::shared_ptr<LwpBulletOverride> pBulletOver(pBullOver->clone());
 
     sal_uInt16 nNameIndex = 0;
-    std::vector <OverridePair>::iterator iter;
-    for(iter = m_vIDsPairList.begin(); iter != m_vIDsPairList.end(); ++iter)
+    for (auto const& vIDsPair : m_vIDsPairList)
     {
-        if (iter->first->GetSilverBullet() == aBulletID && iter->second == aIndentID
-            && iter->first->IsRightAligned() == pBullOver->IsRightAligned())
+        if (vIDsPair.first->GetSilverBullet() == aBulletID && vIDsPair.second == aIndentID
+            && vIDsPair.first->IsRightAligned() == pBullOver->IsRightAligned())
         {
             return m_vStyleNameList[nNameIndex];
         }
diff --git a/lotuswordpro/source/filter/lwpchangemgr.cxx b/lotuswordpro/source/filter/lwpchangemgr.cxx
index c04241aaccb4..1c2816fceba2 100644
--- a/lotuswordpro/source/filter/lwpchangemgr.cxx
+++ b/lotuswordpro/source/filter/lwpchangemgr.cxx
@@ -108,8 +108,7 @@ void LwpChangeMgr::AddChangeFrib(LwpFrib* pFrib)
 
 OUString LwpChangeMgr::GetChangeID(LwpFrib* pFrib)
 {
-    std::map<LwpFrib*,OUString>::iterator iter;
-    iter = m_pFribMap->find(pFrib);
+    auto iter = m_pFribMap->find(pFrib);
     if (iter == m_pFribMap->end())
         return OUString();
     else
@@ -118,41 +117,38 @@ OUString LwpChangeMgr::GetChangeID(LwpFrib* pFrib)
 
 void LwpChangeMgr::ConvertAllChange(IXFStream* pStream)
 {
-    std::map<LwpFrib*,OUString>::iterator iter;
-    for (iter=m_DocFribMap.begin();iter !=m_DocFribMap.end();++iter)
+    for (auto const& docFrib : m_DocFribMap)
     {
-        if (iter->first->GetRevisionType() == LwpFrib::REV_INSERT)
+        if (docFrib.first->GetRevisionType() == LwpFrib::REV_INSERT)
         {
             XFChangeInsert* pInsert = new XFChangeInsert;
-            pInsert->SetChangeID(iter->second);
-            pInsert->SetEditor(iter->first->GetEditor());
+            pInsert->SetChangeID(docFrib.second);
+            pInsert->SetEditor(docFrib.first->GetEditor());
             m_ChangeList.push_back(pInsert);
         }
-        else if (iter->first->GetRevisionType() == LwpFrib::REV_DELETE)
+        else if (docFrib.first->GetRevisionType() == LwpFrib::REV_DELETE)
         {
             XFChangeDelete* pDelete = new XFChangeDelete;
-            pDelete->SetChangeID(iter->second);
-            pDelete->SetEditor(iter->first->GetEditor());
+            pDelete->SetChangeID(docFrib.second);
+            pDelete->SetEditor(docFrib.first->GetEditor());
             m_ChangeList.push_back(pDelete);
         }
     }
 
-    std::vector<XFChangeRegion*>::iterator iter1;
     pStream->GetAttrList()->Clear();
     if (m_ChangeList.empty())
             return;
     // Add for disable change tracking
     pStream->GetAttrList()->AddAttribute( "text:track-changes","false");
     pStream->StartElement( "text:tracked-changes" );
-    for (iter1=m_ChangeList.begin();iter1 !=m_ChangeList.end();++iter1)
-        (*iter1)->ToXml(pStream);
+    for (auto const& elem : m_ChangeList)
+        elem->ToXml(pStream);
 
     pStream->EndElement("text:tracked-changes");
 
-    for (iter1=m_ChangeList.begin();iter1 !=m_ChangeList.end();++iter1)
+    for (auto const& elem : m_ChangeList)
     {
-        delete *iter1;
-        *iter1=nullptr;
+        delete elem;
     }
     m_ChangeList.clear();
 }
@@ -169,23 +165,22 @@ void LwpChangeMgr::SetHeadFootFribMap(bool bFlag)
 
 void LwpChangeMgr::SetHeadFootChange(XFContentContainer* pCont)
 {
-    std::map<LwpFrib*,OUString>::iterator iter;
     XFChangeList* pChangeList = new XFChangeList;
 
-    for (iter=m_HeadFootFribMap.begin();iter !=m_HeadFootFribMap.end();++iter)
+    for (auto const& headFootFrib : m_HeadFootFribMap)
     {
-        if (iter->first->GetRevisionType() == LwpFrib::REV_INSERT)
+        if (headFootFrib.first->GetRevisionType() == LwpFrib::REV_INSERT)
         {
             XFChangeInsert* pInsert = new XFChangeInsert;
-            pInsert->SetChangeID(iter->second);
-            pInsert->SetEditor(iter->first->GetEditor());
+            pInsert->SetChangeID(headFootFrib.second);
+            pInsert->SetEditor(headFootFrib.first->GetEditor());
             pChangeList->Add(pInsert);
         }
-        else if (iter->first->GetRevisionType() == LwpFrib::REV_DELETE)
+        else if (headFootFrib.first->GetRevisionType() == LwpFrib::REV_DELETE)
         {
             XFChangeDelete* pDelete = new XFChangeDelete;
-            pDelete->SetChangeID(iter->second);
-            pDelete->SetEditor(iter->first->GetEditor());
+            pDelete->SetChangeID(headFootFrib.second);
+            pDelete->SetEditor(headFootFrib.first->GetEditor());
             pChangeList->Add(pDelete);
         }
     }
diff --git a/lotuswordpro/source/filter/lwpgrfobj.cxx b/lotuswordpro/source/filter/lwpgrfobj.cxx
index f0e355125249..6947bc064b20 100644
--- a/lotuswordpro/source/filter/lwpgrfobj.cxx
+++ b/lotuswordpro/source/filter/lwpgrfobj.cxx
@@ -208,10 +208,9 @@ void LwpGraphicObject::XFConvert (XFContentContainer* pCont)
 {
     if (m_sServerContextFormat[1]=='s'&&m_sServerContextFormat[2]=='d'&&m_sServerContextFormat[3]=='w')
     {
-        std::vector< rtl::Reference<XFFrame> >::iterator iter;
-        for (iter = m_vXFDrawObjects.begin(); iter != m_vXFDrawObjects.end(); ++iter)
+        for (auto const& vXFDrawObject : m_vXFDrawObjects)
         {
-            pCont->Add(iter->get());
+            pCont->Add(vXFDrawObject.get());
         }
     }
     else if (IsGrafFormatValid() && !m_vXFDrawObjects.empty())
diff --git a/lotuswordpro/source/filter/lwpstory.cxx b/lotuswordpro/source/filter/lwpstory.cxx
index f52cf6d6ebbe..1911229f3192 100644
--- a/lotuswordpro/source/filter/lwpstory.cxx
+++ b/lotuswordpro/source/filter/lwpstory.cxx
@@ -245,9 +245,9 @@ void LwpStory::SortPageLayout()
     //put all the sorted  layouts into list
     m_LayoutList.clear();
 
-    for( aIt = aLayoutList.begin(); aIt != aLayoutList.end(); ++aIt)
+    for (auto const& layout : aLayoutList)
     {
-        m_LayoutList.push_back(*aIt);
+        m_LayoutList.push_back(layout);
     }
 }
 
diff --git a/lotuswordpro/source/filter/lwptblformula.cxx b/lotuswordpro/source/filter/lwptblformula.cxx
index 8d0fcff0592e..c0d00f9a22f1 100644
--- a/lotuswordpro/source/filter/lwptblformula.cxx
+++ b/lotuswordpro/source/filter/lwptblformula.cxx
@@ -448,10 +448,9 @@ OUString LwpFormulaFunc::ToString(LwpTableLayout* pCellsMap)
     aFormula += " ";//Append a blank space
 
     //Append args
-    std::vector<LwpFormulaArg*>::iterator aItr;
-    for (aItr=m_aArgs.begin();aItr!=m_aArgs.end();++aItr)
+    for (auto const& elem : m_aArgs)
     {
-        aFormula += (*aItr)->ToArgString(pCellsMap) + "|"; //separator
+        aFormula += elem->ToArgString(pCellsMap) + "|"; //separator
     }
 
     //erase the last "|"
diff --git a/lotuswordpro/source/filter/xfilter/xfcolumns.cxx b/lotuswordpro/source/filter/xfilter/xfcolumns.cxx
index 635fc9111add..3616610151af 100644
--- a/lotuswordpro/source/filter/xfilter/xfcolumns.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfcolumns.cxx
@@ -170,10 +170,9 @@ void    XFColumns::ToXml(IXFStream *pStrm)
 
     if(!(m_nFlag&XFCOLUMNS_FLAG_GAP) )
     {
-        std::vector<XFColumn>::iterator it;
-        for( it = m_aColumns.begin(); it != m_aColumns.end(); ++it )
+        for (auto & column : m_aColumns)
         {
-            (*it).ToXml(pStrm);
+            column.ToXml(pStrm);
         }
     }
     pStrm->EndElement( "style:columns" );
diff --git a/lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx b/lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx
index b1398bc023cd..c8e8de733027 100644
--- a/lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx
@@ -128,11 +128,9 @@ enumXFContent   XFContentContainer::GetContentType()
 
 void    XFContentContainer::ToXml(IXFStream *pStrm)
 {
-    std::vector< rtl::Reference<XFContent> >::iterator it;
-
-    for( it = m_aContents.begin(); it != m_aContents.end(); ++it )
+    for (auto const& content : m_aContents)
     {
-        XFContent *pContent = it->get();
+        XFContent *pContent = content.get();
         if( pContent )
             pContent->DoToXml(pStrm);
     }
@@ -140,6 +138,7 @@ void    XFContentContainer::ToXml(IXFStream *pStrm)
 
 rtl::Reference<XFContent> XFContentContainer::GetLastContent()
 {
+    // TODO JNA : if m_aContents size is 0, there's some pb
     sal_uInt32 index = m_aContents.size()-1;
     if(index >0)
     {
diff --git a/lotuswordpro/source/filter/xfilter/xfdrawpath.cxx b/lotuswordpro/source/filter/xfilter/xfdrawpath.cxx
index dc217b233f92..f5cd90b1102a 100644
--- a/lotuswordpro/source/filter/xfilter/xfdrawpath.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfdrawpath.cxx
@@ -67,12 +67,10 @@ OUString XFSvgPathEntry::ToString()
 {
     assert(!m_strCommand.isEmpty());
     OUString str = m_strCommand;
-    std::vector<XFPoint>::iterator it;
 
-    for( it = m_aPoints.begin(); it != m_aPoints.end(); ++it )
+    for (auto const& point : m_aPoints)
     {
-        XFPoint aPt= *it;
-        str += OUString::number(aPt.GetX()*1000) + " " + OUString::number(aPt.GetY()*1000) + " ";
+        str += OUString::number(point.GetX()*1000) + " " + OUString::number(point.GetY()*1000) + " ";
     }
     return str.trim();
 }
@@ -135,11 +133,9 @@ void    XFDrawPath::ToXml(IXFStream *pStrm)
 
     //points
     OUString   strPath;
-    std::vector<XFSvgPathEntry>::iterator it;
-    for( it = m_aPaths.begin(); it != m_aPaths.end(); ++it )
+    for (auto & path : m_aPaths)
     {
-        XFSvgPathEntry  aSvg = *it;
-        strPath += aSvg.ToString();
+        strPath += path.ToString();
     }
     strPath = strPath.trim();
     pAttrList->AddAttribute( "svg:d", strPath);
diff --git a/lotuswordpro/source/filter/xfilter/xfdrawpolygon.cxx b/lotuswordpro/source/filter/xfilter/xfdrawpolygon.cxx
index 4298eb5111fa..ac67588bf8cb 100644
--- a/lotuswordpro/source/filter/xfilter/xfdrawpolygon.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfdrawpolygon.cxx
@@ -78,11 +78,10 @@ void XFDrawPolygon::ToXml(IXFStream *pStrm)
 
     //points
     OUString   strPoints;
-    for( it = m_aPoints.begin(); it != m_aPoints.end(); ++it )
+    for (auto const& point : m_aPoints)
     {
-        XFPoint pt = *it;
-        double  x = (pt.GetX()-rect.GetX())*1000;
-        double  y = (pt.GetY()-rect.GetY())*1000;
+        double  x = (point.GetX()-rect.GetX())*1000;
+        double  y = (point.GetY()-rect.GetY())*1000;
         strPoints += OUString::number(x) + " " + OUString::number(y) + " ";
     }
     strPoints = strPoints.trim();
diff --git a/lotuswordpro/source/filter/xfilter/xfdrawpolyline.cxx b/lotuswordpro/source/filter/xfilter/xfdrawpolyline.cxx
index 847f9be1c62d..b96410b9dd40 100644
--- a/lotuswordpro/source/filter/xfilter/xfdrawpolyline.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfdrawpolyline.cxx
@@ -66,7 +66,6 @@ XFDrawPolyline::XFDrawPolyline()
 void XFDrawPolyline::ToXml(IXFStream *pStrm)
 {
     IXFAttrList *pAttrList = pStrm->GetAttrList();
-    std::vector<XFPoint>::iterator it;
 
     pAttrList->Clear();
     //view-box:
@@ -78,11 +77,10 @@ void XFDrawPolyline::ToXml(IXFStream *pStrm)
 
     //points
     OUString   strPoints;
-    for( it = m_aPoints.begin(); it != m_aPoints.end(); ++it )
+    for (auto const& point : m_aPoints)
     {
-        XFPoint pt = *it;
-        double  x = (pt.GetX()-rect.GetX())*1000;
-        double  y = (pt.GetY()-rect.GetY())*1000;
+        double  x = (point.GetX()-rect.GetX())*1000;
+        double  y = (point.GetY()-rect.GetY())*1000;
         strPoints += OUString::number(x) + "," + OUString::number(y) + " ";
     }
     strPoints = strPoints.trim();
@@ -103,27 +101,24 @@ XFRect  XFDrawPolyline::CalcViewBox()
     double  x2 = 0;
     double  y2 = 0;
     XFPoint aPoint;
-    std::vector<XFPoint>::iterator it = m_aPoints.begin();
 
     assert(!m_aPoints.empty());
 
-    aPoint = *it;
     x1 = aPoint.GetX();
     x2 = aPoint.GetX();
     y1 = aPoint.GetY();
     y2 = aPoint.GetY();
-    for( ; it != m_aPoints.end(); ++it )
+    for (auto const& point : m_aPoints)
     {
-        aPoint = *it;
-        if( x1>aPoint.GetX() )
-            x1 = aPoint.GetX();
-        if( x2<aPoint.GetX() )
-            x2 = aPoint.GetX();
+        if( x1>point.GetX() )
+            x1 = point.GetX();
+        if( x2<point.GetX() )
+            x2 = point.GetX();
 
-        if( y1>aPoint.GetY() )
-            y1 = aPoint.GetY();
-        if( y2<aPoint.GetY() )
-            y2 = aPoint.GetY();
+        if( y1>point.GetY() )
+            y1 = point.GetY();
+        if( y2<point.GetY() )
+            y2 = point.GetY();
     }
     return XFRect(x1,y1,x2-x1,y2-y1);
 }
diff --git a/lotuswordpro/source/filter/xfilter/xffontfactory.cxx b/lotuswordpro/source/filter/xfilter/xffontfactory.cxx
index c4f06d64a74b..a3eb1d921142 100644
--- a/lotuswordpro/source/filter/xfilter/xffontfactory.cxx
+++ b/lotuswordpro/source/filter/xfilter/xffontfactory.cxx
@@ -74,11 +74,10 @@ void XFFontFactory::AddFont(rtl::Reference<XFFont> const & pFont)
 
 rtl::Reference<XFFont> XFFontFactory::FindSameFont(rtl::Reference<XFFont> const & pFont)
 {
-    std::vector< rtl::Reference<XFFont> >::iterator it;
-    for( it = s_aFonts.begin(); it != s_aFonts.end(); ++it )
+    for (auto const& font : s_aFonts)
     {
-        if( *pFont == **it )
-            return *it;
+        if( *pFont == *font )
+            return font;
     }
 
     return nullptr;
diff --git a/lotuswordpro/source/filter/xfilter/xfindex.cxx b/lotuswordpro/source/filter/xfilter/xfindex.cxx
index de8d041e9bca..74411f1d5a6c 100644
--- a/lotuswordpro/source/filter/xfilter/xfindex.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfindex.cxx
@@ -183,11 +183,10 @@ void    XFIndex::ToXml(IXFStream *pStrm)
     pStrm->EndElement( "text:index-title-template" );
 
     //entry templates:
-    std::vector<XFIndexTemplate *>::iterator it;
-    for (it = m_aTemplates.begin(); it != m_aTemplates.end(); ++it)
+    for (auto const& elem : m_aTemplates)
     {
-        (*it)->SetTagName( strTplName);
-        (*it)->ToXml(pStrm);
+        elem->SetTagName( strTplName);
+        elem->ToXml(pStrm);
     }
 
     // by
@@ -205,11 +204,10 @@ void    XFIndex::ToXml(IXFStream *pStrm)
             pAttrList->AddAttribute( "text:outline-level", OUString::number(i));
             pStrm->StartElement( "text:index-source-styles" );
 
-            std::vector<OUString>::iterator it_str;
-            for (it_str = m_aTOCSource[i].begin(); it_str != m_aTOCSource[i].end(); ++it_str)
+            for (auto const& elemTOCSource : m_aTOCSource[i])
             {
                 pAttrList->Clear();
-                pAttrList->AddAttribute( "text:style-name", *it_str);
+                pAttrList->AddAttribute( "text:style-name", elemTOCSource);
                 pStrm->StartElement( "text:index-source-style" );
                 pStrm->EndElement( "text:index-source-style" );
             }
diff --git a/lotuswordpro/source/filter/xfilter/xfrow.cxx b/lotuswordpro/source/filter/xfilter/xfrow.cxx
index 157c198cd42b..85a12973183d 100644
--- a/lotuswordpro/source/filter/xfilter/xfrow.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfrow.cxx
@@ -112,11 +112,10 @@ void    XFRow::ToXml(IXFStream *pStrm)
         pAttrList->AddAttribute( "table:number-rows-repeated", OUString::number(m_nRepeat) );
     pStrm->StartElement( "table:table-row" );
 
-    auto it = m_aCells.begin();
-    for( ; it!=m_aCells.end(); ++it )
+    for (auto const& cell : m_aCells)
     {
-        int col = (*it).first;
-        XFCell *pCell = (*it).second.get();
+        int col = cell.first;
+        XFCell *pCell = cell.second.get();
         if( !pCell )
             continue;
         if( col>lastCol+1 )
diff --git a/lotuswordpro/source/filter/xfilter/xfstylecont.cxx b/lotuswordpro/source/filter/xfilter/xfstylecont.cxx
index 5d94e127ac40..811c1b9c2e52 100644
--- a/lotuswordpro/source/filter/xfilter/xfstylecont.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfstylecont.cxx
@@ -72,22 +72,17 @@ XFStyleContainer::XFStyleContainer(const OUString& strStyleNamePrefix)
 
 XFStyleContainer::~XFStyleContainer()
 {
-    std::vector<IXFStyle*>::iterator it;
-    for( it = m_aStyles.begin(); it != m_aStyles.end(); ++it )
+    for (auto const& style : m_aStyles)
     {
-        IXFStyle *pStyle = *it;
-        delete pStyle;
+        delete style;
     }
 }
 
 void    XFStyleContainer::Reset()
 {
-    std::vector<IXFStyle*>::iterator it;
-
-    for( it = m_aStyles.begin(); it != m_aStyles.end(); ++it )
+    for (auto const& style : m_aStyles)
     {
-        IXFStyle *pStyle = *it;
-        delete pStyle;
+        delete style;
     }
     m_aStyles.clear();
 }
@@ -141,13 +136,11 @@ IXFStyleRet XFStyleContainer::AddStyle(IXFStyle *pStyle)
 
 IXFStyle*   XFStyleContainer::FindSameStyle(IXFStyle *pStyle)
 {
-    std::vector<IXFStyle*>::iterator it;
-    for( it = m_aStyles.begin(); it != m_aStyles.end(); ++it )
+    for (auto const& style : m_aStyles)
     {
-        IXFStyle *pConStyle = *it;
-        assert(pConStyle);
-        if( pConStyle->Equal(pStyle) )
-            return pConStyle;
+        assert(style);
+        if( style->Equal(pStyle) )
+            return style;
     }
 
     return nullptr;
@@ -155,13 +148,11 @@ IXFStyle*   XFStyleContainer::FindSameStyle(IXFStyle *pStyle)
 
 IXFStyle*   XFStyleContainer::FindStyle(const OUString& name)
 {
-    std::vector<IXFStyle*>::iterator it;
-    for( it = m_aStyles.begin(); it != m_aStyles.end(); ++it )
+    for (auto const& style : m_aStyles)
     {
-        IXFStyle *pConStyle = *it;
-        assert(pConStyle);
-        if( pConStyle->GetStyleName() == name )
-            return pConStyle;
+        assert(style);
+        if( style->GetStyleName() == name )
+            return style;
     }
 
     return nullptr;
@@ -179,13 +170,10 @@ const IXFStyle* XFStyleContainer::Item(size_t index) const
 
 void    XFStyleContainer::ToXml(IXFStream *pStrm)
 {
-    std::vector<IXFStyle*>::iterator it;
-
-    for( it = m_aStyles.begin(); it != m_aStyles.end(); ++it )
+    for (auto const& style : m_aStyles)
     {
-        IXFStyle *pStyle = *it;
-        assert(pStyle);
-        pStyle->ToXml(pStrm);
+        assert(style);
+        style->ToXml(pStrm);
     }
 }
 
diff --git a/lotuswordpro/source/filter/xfilter/xfstylemanager.cxx b/lotuswordpro/source/filter/xfilter/xfstylemanager.cxx
index 634869d0ae8e..bff7a1b3354b 100644
--- a/lotuswordpro/source/filter/xfilter/xfstylemanager.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfstylemanager.cxx
@@ -314,21 +314,18 @@ void    XFStyleManager::SetEndnoteConfig(XFEndnoteConfig *pENConfig)
 
 void    XFStyleManager::ToXml(IXFStream *pStrm)
 {
-    std::vector<XFFontDecl>::iterator   itDecl;
     IXFAttrList *pAttrList = pStrm->GetAttrList();
 
     pAttrList->Clear();
     pStrm->StartElement( "office:font-decls" );
 
     //font declarations:
-    for( itDecl = s_aFontDecls.begin(); itDecl != s_aFontDecls.end(); ++itDecl )
+    for (auto & fontDecl : s_aFontDecls)
     {
-        XFFontDecl &f = *itDecl;
-
         pAttrList->Clear();
-        pAttrList->AddAttribute( "style:name", f.GetFontName() );
-        pAttrList->AddAttribute( "fo:font-family", f.GetFontFamily() );
-        if( f.GetFontPitchFixed() )
+        pAttrList->AddAttribute( "style:name", fontDecl.GetFontName() );
+        pAttrList->AddAttribute( "fo:font-family", fontDecl.GetFontFamily() );
+        if( fontDecl.GetFontPitchFixed() )
             pAttrList->AddAttribute( "style:font-pitch", "fixed" );
         else
             pAttrList->AddAttribute( "style:font-pitch", "variable" );
diff --git a/lotuswordpro/source/filter/xfilter/xftable.cxx b/lotuswordpro/source/filter/xfilter/xftable.cxx
index 209a06d8b654..9fb95b03ba9f 100644
--- a/lotuswordpro/source/filter/xfilter/xftable.cxx
+++ b/lotuswordpro/source/filter/xfilter/xftable.cxx
@@ -125,10 +125,10 @@ OUString XFTable::GetTableName()
 sal_uInt16 XFTable::GetRowCount()
 {
     sal_uInt16 rowMax = 0;
-    for(auto it=m_aRows.begin(); it!=m_aRows.end(); ++it )
+    for (auto const& row : m_aRows)
     {
-        if (it->first > rowMax)
-            rowMax = it->first;
+        if (row.first > rowMax)
+            rowMax = row.first;
     }
 
     return rowMax;
@@ -142,11 +142,10 @@ XFRow*  XFTable::GetRow(sal_Int32 row)
 sal_Int32   XFTable::GetColumnCount()
 {
     int     colMax = -1;
-    std::map<sal_Int32,OUString>::iterator it;
-    for( it=m_aColumns.begin(); it!=m_aColumns.end(); ++it )
+    for (auto const& column : m_aColumns)
     {
-        if( it->first>colMax )
-            colMax = it->first;
+        if( column.first>colMax )
+            colMax = column.first;
     }
     return colMax;
 }
@@ -176,10 +175,9 @@ void    XFTable::ToXml(IXFStream *pStrm)
     //output columns:
     {
         int lastCol = 0;
-        std::map<sal_Int32,OUString>::iterator it;
-        for( it=m_aColumns.begin(); it!=m_aColumns.end(); ++it )
+        for (auto const& column : m_aColumns)
         {
-            sal_Int32   col = (*it).first;
+            sal_Int32   col = column.first;
             OUString   style = m_aColumns[col];
 
             //default col repeated:
@@ -217,11 +215,10 @@ void    XFTable::ToXml(IXFStream *pStrm)
     {
         int     lastRow = 0;
 
-        auto it = m_aRows.begin();
-        for( ; it!=m_aRows.end(); ++it )
+        for (auto const& elem : m_aRows)
         {
-            int row = (*it).first;
-            XFRow *pRow = (*it).second.get();
+            int row = elem.first;
+            XFRow *pRow = elem.second.get();
 
             //null row repeated:
             if( row>lastRow+1 )
diff --git a/lotuswordpro/source/filter/xfilter/xftextspan.cxx b/lotuswordpro/source/filter/xfilter/xftextspan.cxx
index 0820987ff838..14a6874c27f0 100644
--- a/lotuswordpro/source/filter/xfilter/xftextspan.cxx
+++ b/lotuswordpro/source/filter/xfilter/xftextspan.cxx
@@ -107,10 +107,9 @@ void    XFTextSpan::ToXml(IXFStream *pStrm)
         pAttrList->AddAttribute( "text:style-name", GetStyleName() );
     pStrm->StartElement( "text:span" );
 
-    std::vector< rtl::Reference<XFContent> >::iterator it;
-    for( it= m_aContents.begin(); it!= m_aContents.end(); ++it )
+    for (auto const& content : m_aContents)
     {
-        XFContent *pContent = it->get();
+        XFContent *pContent = content.get();
         if( pContent )
             pContent->DoToXml(pStrm);
     }
@@ -130,20 +129,18 @@ void    XFTextSpanStart::ToXml(IXFStream *pStrm)
         pAttrList->AddAttribute( "text:style-name", GetStyleName() );
     pStrm->StartElement( "text:span" );
 
-    std::vector< rtl::Reference<XFContent> >::iterator it;
-    for( it= m_aContents.begin(); it!= m_aContents.end(); ++it )
+    for (auto const& content : m_aContents)
     {
-        XFContent *pContent = it->get();
+        XFContent *pContent = content.get();
         if( pContent )
             pContent->DoToXml(pStrm);
     }
 }
 void    XFTextSpanEnd::ToXml(IXFStream *pStrm)
 {
-    std::vector< rtl::Reference<XFContent> >::iterator it;
-    for( it= m_aContents.begin(); it!= m_aContents.end(); ++it )
+    for (auto const& content : m_aContents)
     {
-        XFContent *pContent = it->get();
+        XFContent *pContent = content.get();
         if( pContent )
             pContent->DoToXml(pStrm);
     }
diff --git a/lotuswordpro/source/filter/xfilter/xftimestyle.cxx b/lotuswordpro/source/filter/xfilter/xftimestyle.cxx
index f88080bdf028..2f378094f379 100644
--- a/lotuswordpro/source/filter/xfilter/xftimestyle.cxx
+++ b/lotuswordpro/source/filter/xfilter/xftimestyle.cxx
@@ -134,10 +134,9 @@ void    XFTimeStyle::ToXml(IXFStream *pStrm)
         pAttrList->AddAttribute( "number:truncate-on-overflow", "false" );
     pStrm->StartElement( "number:time-style" );
 
-    std::vector<XFTimePart>::iterator it;
-    for( it = m_aParts.begin(); it != m_aParts.end(); ++it )
+    for (auto & part : m_aParts)
     {
-        (*it).ToXml(pStrm);
+        part.ToXml(pStrm);
     }
     if( m_bAmPm )
     {


More information about the Libreoffice-commits mailing list