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

Miklos Vajna vmiklos at collabora.co.uk
Wed Jun 1 09:48:35 UTC 2016


 sw/source/filter/ww8/docxsdrexport.cxx      |    6 +-
 sw/source/filter/ww8/rtfattributeoutput.cxx |   26 +++++------
 sw/source/filter/ww8/rtfexport.cxx          |   40 +++++++---------
 sw/source/filter/ww8/rtfexportfilter.cxx    |    8 +--
 sw/source/filter/ww8/rtfsdrexport.cxx       |   66 ++++++++++++++--------------
 sw/source/filter/ww8/rtfstringbuffer.cxx    |   20 ++++----
 6 files changed, 81 insertions(+), 85 deletions(-)

New commits:
commit e0f9d3c5bc448868732e8e21568a596340512ce3
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Jun 1 10:07:17 2016 +0200

    RTF export: use auto where it improves code readability
    
    for (std::vector< OUString >::const_iterator it = rStarts.begin(), end = rStarts.end(); it != end; ++it)
    
    vs
    
    for (const auto& rStart : rStarts)
    
    and so on.
    
    Change-Id: I75eff3c28fea11e78415a2183622090804d34f0e
    Reviewed-on: https://gerrit.libreoffice.org/25755
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index 33648ab..3604ee2 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -332,7 +332,7 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons
         uno::Any aAny;
         pObject->GetGrabBagItem(aAny);
         comphelper::SequenceAsHashMap aGrabBag(aAny);
-        comphelper::SequenceAsHashMap::iterator it = aGrabBag.find("CT_EffectExtent");
+        auto it = aGrabBag.find("CT_EffectExtent");
         if (it != aGrabBag.end())
         {
             comphelper::SequenceAsHashMap aEffectExtent(it->second);
@@ -646,7 +646,7 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons
         uno::Any aAny;
         pObject->GetGrabBagItem(aAny);
         comphelper::SequenceAsHashMap aGrabBag(aAny);
-        comphelper::SequenceAsHashMap::iterator it = aGrabBag.find("EG_WrapType");
+        auto it = aGrabBag.find("EG_WrapType");
         if (it != aGrabBag.end())
         {
             OUString sType = it->second.get<OUString>();
@@ -668,7 +668,7 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons
                                                        FSEND);
                 drawing::PointSequenceSequence aSeqSeq = it->second.get< drawing::PointSequenceSequence >();
                 std::vector<awt::Point> aPoints(comphelper::sequenceToContainer<std::vector<awt::Point> >(aSeqSeq[0]));
-                for (std::vector<awt::Point>::iterator i = aPoints.begin(); i != aPoints.end(); ++i)
+                for (auto i = aPoints.begin(); i != aPoints.end(); ++i)
                 {
                     awt::Point& rPoint = *i;
                     m_pImpl->m_pSerializer->singleElementNS(XML_wp, (i == aPoints.begin() ? XML_start : XML_lineTo),
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index ff3cf5f..854b599 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -1604,18 +1604,18 @@ void RtfAttributeOutput::WriteField_Impl(const SwField* pField, ww::eField eType
 
 void RtfAttributeOutput::WriteBookmarks_Impl(std::vector< OUString >& rStarts, std::vector< OUString >& rEnds)
 {
-    for (std::vector< OUString >::const_iterator it = rStarts.begin(), end = rStarts.end(); it != end; ++it)
+    for (const auto& rStart : rStarts)
     {
         m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_BKMKSTART " ");
-        m_aRun->append(msfilter::rtfutil::OutString(*it, m_rExport.m_eCurrentEncoding));
+        m_aRun->append(msfilter::rtfutil::OutString(rStart, m_rExport.m_eCurrentEncoding));
         m_aRun->append('}');
     }
     rStarts.clear();
 
-    for (std::vector< OUString >::const_iterator it = rEnds.begin(), end = rEnds.end(); it != end; ++it)
+    for (const auto& rEnd : rEnds)
     {
         m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_BKMKEND " ");
-        m_aRun->append(msfilter::rtfutil::OutString(*it, m_rExport.m_eCurrentEncoding));
+        m_aRun->append(msfilter::rtfutil::OutString(rEnd, m_rExport.m_eCurrentEncoding));
         m_aRun->append('}');
     }
     rEnds.clear();
@@ -1623,9 +1623,9 @@ void RtfAttributeOutput::WriteBookmarks_Impl(std::vector< OUString >& rStarts, s
 
 void RtfAttributeOutput::WriteAnnotationMarks_Impl(std::vector< OUString >& rStarts, std::vector< OUString >& rEnds)
 {
-    for (std::vector< OUString >::const_iterator i = rStarts.begin(), end = rStarts.end(); i != end; ++i)
+    for (const auto& rStart : rStarts)
     {
-        OString rName = OUStringToOString(*i, RTL_TEXTENCODING_UTF8);
+        OString rName = OUStringToOString(rStart, RTL_TEXTENCODING_UTF8);
 
         // Output the annotation mark
         const sal_Int32 nId = m_nNextAnnotationMarkId++;
@@ -1636,12 +1636,12 @@ void RtfAttributeOutput::WriteAnnotationMarks_Impl(std::vector< OUString >& rSta
     }
     rStarts.clear();
 
-    for (std::vector< OUString >::const_iterator i = rEnds.begin(), end = rEnds.end(); i != end; ++i)
+    for (const auto& rEnd : rEnds)
     {
-        OString rName = OUStringToOString(*i, RTL_TEXTENCODING_UTF8);
+        OString rName = OUStringToOString(rEnd, RTL_TEXTENCODING_UTF8);
 
         // Get the id of the annotation mark
-        std::map<OString, sal_Int32>::iterator it = m_rOpenedAnnotationMarksIds.find(rName);
+        auto it = m_rOpenedAnnotationMarksIds.find(rName);
         if (it != m_rOpenedAnnotationMarksIds.end())
         {
             const sal_Int32 nId = it->second;
@@ -3433,7 +3433,7 @@ void RtfAttributeOutput::PostitField(const SwField* pField)
     const SwPostItField& rPField = *static_cast<const SwPostItField*>(pField);
 
     OString aName = OUStringToOString(rPField.GetName(), RTL_TEXTENCODING_UTF8);
-    std::map<OString, sal_Int32>::iterator it = m_rOpenedAnnotationMarksIds.find(aName);
+    auto it = m_rOpenedAnnotationMarksIds.find(aName);
     if (it != m_rOpenedAnnotationMarksIds.end())
     {
         // In case this field is inside annotation marks, we want to write the
@@ -3908,11 +3908,11 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat
     aRendered.Height() = rS.GetHeight();
 
     ww8::Frame* pFrame = nullptr;
-    for (ww8::FrameIter it = m_rExport.m_aFrames.begin(); it != m_rExport.m_aFrames.end(); ++it)
+    for (auto& rFrame : m_rExport.m_aFrames)
     {
-        if (pFlyFrameFormat == &it->GetFrameFormat())
+        if (pFlyFrameFormat == &rFrame.GetFrameFormat())
         {
-            pFrame = &(*it);
+            pFrame = &rFrame;
             break;
         }
     }
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index 2cd959a..1a772bf 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -111,10 +111,8 @@ void RtfExport::AppendBookmarks(const SwTextNode& rNode, sal_Int32 nAktPos, sal_
     IMarkVector aMarks;
     if (GetBookmarks(rNode, nAktPos, nAktPos + nLen, aMarks))
     {
-        for (IMarkVector::const_iterator it = aMarks.begin(), end = aMarks.end();
-                it != end; ++it)
+        for (const auto& pMark : aMarks)
         {
-            sw::mark::IMark* pMark = (*it);
             const sal_Int32 nStart = pMark->GetMarkStart().nContent.GetIndex();
             const sal_Int32 nEnd = pMark->GetMarkEnd().nContent.GetIndex();
 
@@ -148,10 +146,8 @@ void RtfExport::AppendAnnotationMarks(const SwTextNode& rNode, sal_Int32 nAktPos
     IMarkVector aMarks;
     if (GetAnnotationMarks(rNode, nAktPos, nAktPos + nLen, aMarks))
     {
-        for (IMarkVector::const_iterator it = aMarks.begin(), end = aMarks.end();
-                it != end; ++it)
+        for (const auto& pMark : aMarks)
         {
-            sw::mark::IMark* pMark = (*it);
             const sal_Int32 nStart = pMark->GetMarkStart().nContent.GetIndex();
             const sal_Int32 nEnd = pMark->GetMarkEnd().nContent.GetIndex();
 
@@ -997,11 +993,11 @@ void RtfExport::OutDateTime(const sal_Char* pStr, const util::DateTime& rDT)
 
 sal_uInt16 RtfExport::GetColor(const Color& rColor) const
 {
-    for (RtfColorTable::const_iterator it=m_aColTable.begin() ; it != m_aColTable.end(); ++it)
-        if ((*it).second == rColor)
+    for (const auto& rEntry : m_aColTable)
+        if (rEntry.second == rColor)
         {
-            SAL_INFO("sw.rtf", OSL_THIS_FUNC << " returning " << (*it).first << " (" << rColor.GetRed() << "," << rColor.GetGreen() << "," << rColor.GetBlue() << ")");
-            return (*it).first;
+            SAL_INFO("sw.rtf", OSL_THIS_FUNC << " returning " << rEntry.first << " (" << rColor.GetRed() << "," << rColor.GetGreen() << "," << rColor.GetBlue() << ")");
+            return rEntry.first;
         }
     OSL_FAIL("No such Color in m_aColTable!");
     return 0;
@@ -1011,11 +1007,11 @@ void RtfExport::InsColor(const Color& rCol)
 {
     sal_uInt16 n;
     bool bAutoColorInTable = false;
-    for (RtfColorTable::iterator it=m_aColTable.begin() ; it != m_aColTable.end(); ++it)
+    for (const auto& rEntry : m_aColTable)
     {
-        if ((*it).second == rCol)
+        if (rEntry.second == rCol)
             return; // Already in the table
-        if ((*it).second == COL_AUTO)
+        if (rEntry.second == COL_AUTO)
             bAutoColorInTable = true;
     }
     if (rCol.GetColor() == COL_AUTO)
@@ -1202,17 +1198,17 @@ void RtfExport::InsStyle(sal_uInt16 nId, const OString& rStyle)
 
 OString* RtfExport::GetStyle(sal_uInt16 nId)
 {
-    std::map<sal_uInt16,OString>::iterator i = m_aStyTable.find(nId);
-    if (i != m_aStyTable.end())
-        return &i->second;
+    auto it = m_aStyTable.find(nId);
+    if (it != m_aStyTable.end())
+        return &it->second;
     return nullptr;
 }
 
 sal_uInt16 RtfExport::GetRedline(const OUString& rAuthor)
 {
-    std::map<OUString,sal_uInt16>::iterator i = m_aRedlineTable.find(rAuthor);
-    if (i != m_aRedlineTable.end())
-        return i->second;
+    auto it = m_aRedlineTable.find(rAuthor);
+    if (it != m_aRedlineTable.end())
+        return it->second;
 
     const sal_uInt16 nId = static_cast<sal_uInt16>(m_aRedlineTable.size());
     m_aRedlineTable.insert(std::pair<OUString,sal_uInt16>(rAuthor,nId));
@@ -1221,9 +1217,9 @@ sal_uInt16 RtfExport::GetRedline(const OUString& rAuthor)
 
 const OUString* RtfExport::GetRedline(sal_uInt16 nId)
 {
-    for (std::map<OUString,sal_uInt16>::iterator aIter = m_aRedlineTable.begin(); aIter != m_aRedlineTable.end(); ++aIter)
-        if ((*aIter).second == nId)
-            return &(*aIter).first;
+    for (const auto& rEntry : m_aRedlineTable)
+        if (rEntry.second == nId)
+            return &rEntry.first;
     return nullptr;
 }
 
diff --git a/sw/source/filter/ww8/rtfexportfilter.cxx b/sw/source/filter/ww8/rtfexportfilter.cxx
index fa2134c..26236de 100644
--- a/sw/source/filter/ww8/rtfexportfilter.cxx
+++ b/sw/source/filter/ww8/rtfexportfilter.cxx
@@ -27,6 +27,7 @@
 
 #include <unotools/mediadescriptor.hxx>
 #include <unotools/ucbstreamhelper.hxx>
+#include <o3tl/make_unique.hxx>
 
 using namespace ::com::sun::star;
 
@@ -71,19 +72,18 @@ sal_Bool RtfExportFilter::filter(const uno::Sequence< beans::PropertyValue >& aD
     aPam.SetMark();
     aPam.Move(fnMoveBackward, fnGoDoc);
 
-    SwPaM* pCurPam = new SwPaM(*aPam.End(), *aPam.Start());
+    auto pCurPam = o3tl::make_unique<SwPaM>(*aPam.End(), *aPam.Start());
 
     // export the document
     // (in a separate block so that it's destructed before the commit)
     {
-        RtfExport aExport(this, pDoc, pCurPam, &aPam, nullptr);
+        RtfExport aExport(this, pDoc, pCurPam.get(), &aPam, nullptr);
         aExport.ExportDocument(true);
     }
 
     // delete the pCurPam
-    while (pCurPam->GetNext() != pCurPam)
+    while (pCurPam->GetNext() != pCurPam.get())
         delete pCurPam->GetNext();
-    delete pCurPam;
     delete pStream;
 
     return true;
diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx
index 77d4645..3855935 100644
--- a/sw/source/filter/ww8/rtfsdrexport.cxx
+++ b/sw/source/filter/ww8/rtfsdrexport.cxx
@@ -143,16 +143,16 @@ void RtfSdrExport::Commit(EscherPropertyContainer& rProps, const Rectangle& rRec
 
     // properties
     const EscherProperties& rOpts = rProps.GetOpts();
-    for (EscherProperties::const_iterator it = rOpts.begin(); it != rOpts.end(); ++it)
+    for (const auto& rOpt : rOpts)
     {
-        sal_uInt16 nId = (it->nPropId & 0x0FFF);
+        sal_uInt16 nId = (rOpt.nPropId & 0x0FFF);
 
         switch (nId)
         {
         case ESCHER_Prop_WrapText:
         {
             int nWrapType = 0;
-            switch (it->nPropValue)
+            switch (rOpt.nPropValue)
             {
             case ESCHER_WrapSquare:
                 nWrapType = 2;
@@ -175,34 +175,34 @@ void RtfSdrExport::Commit(EscherPropertyContainer& rProps, const Rectangle& rRec
         }
         break;
         case ESCHER_Prop_fillColor:
-            m_aShapeProps.insert(std::pair<OString,OString>("fillColor", OString::number(it->nPropValue)));
+            m_aShapeProps.insert(std::pair<OString,OString>("fillColor", OString::number(rOpt.nPropValue)));
             break;
         case ESCHER_Prop_fillBackColor:
-            m_aShapeProps.insert(std::pair<OString,OString>("fillBackColor", OString::number(it->nPropValue)));
+            m_aShapeProps.insert(std::pair<OString,OString>("fillBackColor", OString::number(rOpt.nPropValue)));
             break;
         case ESCHER_Prop_AnchorText:
-            m_aShapeProps.insert(std::pair<OString,OString>("anchorText", OString::number(it->nPropValue)));
+            m_aShapeProps.insert(std::pair<OString,OString>("anchorText", OString::number(rOpt.nPropValue)));
             break;
         case ESCHER_Prop_fNoFillHitTest:
-            if (it->nPropValue)
+            if (rOpt.nPropValue)
                 m_aShapeProps.insert(std::pair<OString,OString>("fNoFillHitTest", OString::number(1)));
             break;
         case ESCHER_Prop_fNoLineDrawDash:
             // for some reason the value is set to 0x90000 if lines are switched off
-            if (it->nPropValue == 0x90000)
+            if (rOpt.nPropValue == 0x90000)
                 m_aShapeProps.insert(std::pair<OString,OString>("fLine", OString::number(0)));
             break;
         case ESCHER_Prop_lineColor:
-            m_aShapeProps.insert(std::pair<OString,OString>("lineColor", OString::number(it->nPropValue)));
+            m_aShapeProps.insert(std::pair<OString,OString>("lineColor", OString::number(rOpt.nPropValue)));
             break;
         case ESCHER_Prop_lineBackColor:
-            m_aShapeProps.insert(std::pair<OString,OString>("lineBackColor", OString::number(it->nPropValue)));
+            m_aShapeProps.insert(std::pair<OString,OString>("lineBackColor", OString::number(rOpt.nPropValue)));
             break;
         case ESCHER_Prop_lineJoinStyle:
-            m_aShapeProps.insert(std::pair<OString,OString>("lineJoinStyle", OString::number(it->nPropValue)));
+            m_aShapeProps.insert(std::pair<OString,OString>("lineJoinStyle", OString::number(rOpt.nPropValue)));
             break;
         case ESCHER_Prop_fshadowObscured:
-            if (it->nPropValue)
+            if (rOpt.nPropValue)
                 m_aShapeProps.insert(std::pair<OString,OString>("fshadowObscured", "1"));
             break;
         case ESCHER_Prop_geoLeft:
@@ -212,12 +212,12 @@ void RtfSdrExport::Commit(EscherPropertyContainer& rProps, const Rectangle& rRec
 
             if (nId == ESCHER_Prop_geoLeft)
             {
-                nLeft = it->nPropValue;
+                nLeft = rOpt.nPropValue;
                 rProps.GetOpt(ESCHER_Prop_geoTop, nTop);
             }
             else
             {
-                nTop = it->nPropValue;
+                nTop = rOpt.nPropValue;
                 rProps.GetOpt(ESCHER_Prop_geoLeft, nLeft);
             }
 
@@ -237,12 +237,12 @@ void RtfSdrExport::Commit(EscherPropertyContainer& rProps, const Rectangle& rRec
 
             if (nId == ESCHER_Prop_geoRight)
             {
-                nRight = it->nPropValue;
+                nRight = rOpt.nPropValue;
                 rProps.GetOpt(ESCHER_Prop_geoBottom, nBottom);
             }
             else
             {
-                nBottom = it->nPropValue;
+                nBottom = rOpt.nPropValue;
                 rProps.GetOpt(ESCHER_Prop_geoRight, nRight);
             }
 
@@ -333,7 +333,7 @@ void RtfSdrExport::Commit(EscherPropertyContainer& rProps, const Rectangle& rRec
                     case msopathEnd:
                         break;
                     default:
-                        SAL_WARN("oox", "Totally b0rked\n");
+                        SAL_WARN("sw.rtf", "Totally b0rked\n");
                         break;
                     }
                 }
@@ -354,48 +354,48 @@ void RtfSdrExport::Commit(EscherPropertyContainer& rProps, const Rectangle& rRec
             // noop, we use pSegmentInfo instead
             break;
         case ESCHER_Prop_fFillOK:
-            if (!it->nPropValue)
+            if (!rOpt.nPropValue)
                 m_aShapeProps.insert(std::pair<OString,OString>("fFillOK", "0"));
             break;
         case ESCHER_Prop_dxTextLeft:
-            m_aShapeProps.insert(std::pair<OString,OString>("dxTextLeft", OString::number(it->nPropValue)));
+            m_aShapeProps.insert(std::pair<OString,OString>("dxTextLeft", OString::number(rOpt.nPropValue)));
             break;
         case ESCHER_Prop_dyTextTop:
-            m_aShapeProps.insert(std::pair<OString,OString>("dyTextTop", OString::number(it->nPropValue)));
+            m_aShapeProps.insert(std::pair<OString,OString>("dyTextTop", OString::number(rOpt.nPropValue)));
             break;
         case ESCHER_Prop_dxTextRight:
-            m_aShapeProps.insert(std::pair<OString,OString>("dxTextRight", OString::number(it->nPropValue)));
+            m_aShapeProps.insert(std::pair<OString,OString>("dxTextRight", OString::number(rOpt.nPropValue)));
             break;
         case ESCHER_Prop_dyTextBottom:
-            m_aShapeProps.insert(std::pair<OString,OString>("dyTextBottom", OString::number(it->nPropValue)));
+            m_aShapeProps.insert(std::pair<OString,OString>("dyTextBottom", OString::number(rOpt.nPropValue)));
             break;
         case ESCHER_Prop_FitTextToShape:
             // Size text to fit shape size: not supported by RTF
             break;
         case ESCHER_Prop_adjustValue:
-            m_aShapeProps.insert(std::pair<OString,OString>("adjustValue", OString::number(it->nPropValue)));
+            m_aShapeProps.insert(std::pair<OString,OString>("adjustValue", OString::number(rOpt.nPropValue)));
             break;
         case ESCHER_Prop_txflTextFlow:
-            m_aShapeProps.insert(std::pair<OString,OString>("txflTextFlow", OString::number(it->nPropValue)));
+            m_aShapeProps.insert(std::pair<OString,OString>("txflTextFlow", OString::number(rOpt.nPropValue)));
             break;
         case ESCHER_Prop_fillType:
-            m_aShapeProps.insert(std::pair<OString,OString>("fillType", OString::number(it->nPropValue)));
+            m_aShapeProps.insert(std::pair<OString,OString>("fillType", OString::number(rOpt.nPropValue)));
             break;
         case ESCHER_Prop_fillOpacity:
-            m_aShapeProps.insert(std::pair<OString,OString>("fillOpacity", OString::number(it->nPropValue)));
+            m_aShapeProps.insert(std::pair<OString,OString>("fillOpacity", OString::number(rOpt.nPropValue)));
             break;
         case ESCHER_Prop_fillBlip:
         {
             OStringBuffer aBuf;
             aBuf.append('{').append(OOO_STRING_SVTOOLS_RTF_PICT).append(OOO_STRING_SVTOOLS_RTF_PNGBLIP).append(SAL_NEWLINE_STRING);
             int nHeaderSize = 25; // The first bytes are WW8-specific, we're only interested in the PNG
-            aBuf.append(RtfAttributeOutput::WriteHex(it->pBuf + nHeaderSize, it->nPropSize - nHeaderSize));
+            aBuf.append(RtfAttributeOutput::WriteHex(rOpt.pBuf + nHeaderSize, rOpt.nPropSize - nHeaderSize));
             aBuf.append('}');
             m_aShapeProps.insert(std::pair<OString,OString>("fillBlip", aBuf.makeStringAndClear()));
         }
         break;
         default:
-            SAL_INFO("sw.rtf", OSL_THIS_FUNC << ": unhandled property: " << nId << " (value: " << it->nPropValue << ")");
+            SAL_INFO("sw.rtf", OSL_THIS_FUNC << ": unhandled property: " << nId << " (value: " << rOpt.nPropValue << ")");
             break;
         }
     }
@@ -504,8 +504,8 @@ sal_Int32 RtfSdrExport::StartShape()
     // Ignore \shpbypage, \shpbymargin, and \shpbycolumn, in favor of the posrelh property.
     m_rAttrOutput.RunText().append(OOO_STRING_SVTOOLS_RTF_SHPBYIGNORE);
 
-    for (std::map<OString,OString>::reverse_iterator i = m_aShapeProps.rbegin(); i != m_aShapeProps.rend(); ++i)
-        lcl_AppendSP(m_rAttrOutput.RunText(), (*i).first.getStr(), (*i).second);
+    for (auto it = m_aShapeProps.rbegin(); it != m_aShapeProps.rend(); ++it)
+        lcl_AppendSP(m_rAttrOutput.RunText(), (*it).first.getStr(), (*it).second);
 
     lcl_AppendSP(m_rAttrOutput.RunText(), "wzDescription", msfilter::rtfutil::OutString(m_pSdrObject->GetDescription(), m_rExport.m_eCurrentEncoding));
     lcl_AppendSP(m_rAttrOutput.RunText(), "wzName", msfilter::rtfutil::OutString(m_pSdrObject->GetTitle(), m_rExport.m_eCurrentEncoding));
@@ -517,11 +517,11 @@ sal_Int32 RtfSdrExport::StartShape()
         if (SwFrameFormat* pTextBox = SwTextBoxHelper::findTextBox(pShape))
         {
             ww8::Frame* pFrame = nullptr;
-            for (ww8::FrameIter it = m_rExport.m_aFrames.begin(); it != m_rExport.m_aFrames.end(); ++it)
+            for (auto& rFrame : m_rExport.m_aFrames)
             {
-                if (pTextBox == &it->GetFrameFormat())
+                if (pTextBox == &rFrame.GetFrameFormat())
                 {
-                    pFrame = &(*it);
+                    pFrame = &rFrame;
                     break;
                 }
             }
diff --git a/sw/source/filter/ww8/rtfstringbuffer.cxx b/sw/source/filter/ww8/rtfstringbuffer.cxx
index 55c4d68..a8394d0 100644
--- a/sw/source/filter/ww8/rtfstringbuffer.cxx
+++ b/sw/source/filter/ww8/rtfstringbuffer.cxx
@@ -49,24 +49,24 @@ RtfStringBuffer::RtfStringBuffer()
 sal_Int32 RtfStringBuffer::getLength() const
 {
     sal_Int32 nRet = 0;
-    for (RtfStringBuffer::Values_t::const_iterator i = m_aValues.begin(); i != m_aValues.end(); ++i)
-        if (!i->isGraphic())
-            nRet += i->m_aBuffer.getLength();
+    for (const auto& rValue : m_aValues)
+        if (!rValue.isGraphic())
+            nRet += rValue.m_aBuffer.getLength();
     return nRet;
 }
 
 void RtfStringBuffer::makeStringAndClear(RtfAttributeOutput* pAttributeOutput)
 {
-    for (RtfStringBuffer::Values_t::iterator i = m_aValues.begin(); i != m_aValues.end(); ++i)
-        i->makeStringAndClear(pAttributeOutput);
+    for (auto& rValue : m_aValues)
+        rValue.makeStringAndClear(pAttributeOutput);
 }
 
 OString RtfStringBuffer::makeStringAndClear()
 {
     OStringBuffer aBuf;
-    for (RtfStringBuffer::Values_t::iterator i = m_aValues.begin(); i != m_aValues.end(); ++i)
-        if (!i->isGraphic())
-            aBuf.append(i->makeStringAndClear());
+    for (auto& rValue : m_aValues)
+        if (!rValue.isGraphic())
+            aBuf.append(rValue.makeStringAndClear());
     return aBuf.makeStringAndClear();
 }
 
@@ -94,8 +94,8 @@ void RtfStringBuffer::append(const SwFlyFrameFormat* pFlyFrameFormat, const SwGr
 
 void RtfStringBuffer::appendAndClear(RtfStringBuffer& rBuf)
 {
-    for (RtfStringBuffer::Values_t::iterator i = rBuf.m_aValues.begin(); i != rBuf.m_aValues.end(); ++i)
-        m_aValues.push_back(*i);
+    for (const auto& rValue : rBuf.m_aValues)
+        m_aValues.push_back(rValue);
     rBuf.clear();
 }
 


More information about the Libreoffice-commits mailing list