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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Jul 28 15:23:53 UTC 2018


 lotuswordpro/source/filter/lwpstory.cxx               |    7 ++++---
 lotuswordpro/source/filter/lwptblformula.cxx          |   12 ++++++------
 lotuswordpro/source/filter/xfilter/xfdrawpath.cxx     |   17 ++++++++++-------
 lotuswordpro/source/filter/xfilter/xfdrawpolygon.cxx  |    9 +++++----
 lotuswordpro/source/filter/xfilter/xfdrawpolyline.cxx |    9 +++++----
 5 files changed, 30 insertions(+), 24 deletions(-)

New commits:
commit 0c64757b574f8dcffe76087db34310786029e625
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sat Jul 28 11:30:44 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Jul 28 17:23:33 2018 +0200

    loplugin:stringloop in lotuswordpro
    
    Change-Id: I4fb61b92c76550def03b960cb4d1c16a1d63de67
    Reviewed-on: https://gerrit.libreoffice.org/58214
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/lotuswordpro/source/filter/lwpstory.cxx b/lotuswordpro/source/filter/lwpstory.cxx
index 320400ea01e5..b0f9586270e2 100644
--- a/lotuswordpro/source/filter/lwpstory.cxx
+++ b/lotuswordpro/source/filter/lwpstory.cxx
@@ -66,6 +66,7 @@
 #include "lwppara.hxx"
 #include <lwpobjfactory.hxx>
 #include "lwppagelayout.hxx"
+#include <rtl/ustrbuf.hxx>
 
 #include <set>
 
@@ -427,16 +428,16 @@ OUString LwpStory::GetContentText(bool bAllText)
 {
     if (bAllText)//convert all text fribs
     {
-        OUString sText("");
+        OUStringBuffer sText;
         //process para list
         LwpPara* pPara = dynamic_cast<LwpPara*>(GetFirstPara().obj().get());
         while (pPara)
         {
             pPara->SetFoundry(m_pFoundry);
-            sText += pPara->GetContentText(true);
+            sText.append(pPara->GetContentText(true));
             pPara = dynamic_cast<LwpPara*>(pPara->GetNext().obj().get());
         }
-        return sText;
+        return sText.makeStringAndClear();
     }
     else //only the first text frib
     {
diff --git a/lotuswordpro/source/filter/lwptblformula.cxx b/lotuswordpro/source/filter/lwptblformula.cxx
index c0d00f9a22f1..768e54f14a65 100644
--- a/lotuswordpro/source/filter/lwptblformula.cxx
+++ b/lotuswordpro/source/filter/lwptblformula.cxx
@@ -441,29 +441,29 @@ OUString LwpFormulaFunc::ToArgString(LwpTableLayout* pCellsMap)
 */
 OUString LwpFormulaFunc::ToString(LwpTableLayout* pCellsMap)
 {
-    OUString aFormula;
+    OUStringBuffer aFormula;
 
     OUString aFuncName = LwpFormulaTools::GetName(m_nTokenType);
-    aFormula += aFuncName;
-    aFormula += " ";//Append a blank space
+    aFormula.append(aFuncName);
+    aFormula.append(" ");//Append a blank space
 
     //Append args
     for (auto const& elem : m_aArgs)
     {
-        aFormula += elem->ToArgString(pCellsMap) + "|"; //separator
+        aFormula.append(elem->ToArgString(pCellsMap)).append("|"); //separator
     }
 
     //erase the last "|"
     if (!m_aArgs.empty())
     {
-        aFormula = aFormula.replaceAt(aFormula.getLength()-1,1,"");
+        aFormula.setLength(aFormula.getLength()-1);
     }
     else
     {
         assert(false);
     }
 
-    return aFormula;
+    return aFormula.makeStringAndClear();
 }
 
 /**
diff --git a/lotuswordpro/source/filter/xfilter/xfdrawpath.cxx b/lotuswordpro/source/filter/xfilter/xfdrawpath.cxx
index f5cd90b1102a..e9ae753773a4 100644
--- a/lotuswordpro/source/filter/xfilter/xfdrawpath.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfdrawpath.cxx
@@ -58,6 +58,7 @@
  * Draw path object.
  ************************************************************************/
 #include <xfilter/xfdrawpath.hxx>
+#include <rtl/ustrbuf.hxx>
 
 XFSvgPathEntry::XFSvgPathEntry()
 {
@@ -66,13 +67,14 @@ XFSvgPathEntry::XFSvgPathEntry()
 OUString XFSvgPathEntry::ToString()
 {
     assert(!m_strCommand.isEmpty());
-    OUString str = m_strCommand;
+    OUStringBuffer str = m_strCommand;
 
     for (auto const& point : m_aPoints)
     {
-        str += OUString::number(point.GetX()*1000) + " " + OUString::number(point.GetY()*1000) + " ";
+        str.append(OUString::number(point.GetX()*1000)).append(" ").append(OUString::number(point.GetY()*1000)).append(" ");
     }
-    return str.trim();
+    str.stripEnd(' ');
+    return str.makeStringAndClear();
 }
 
 XFDrawPath::XFDrawPath()
@@ -132,13 +134,14 @@ void    XFDrawPath::ToXml(IXFStream *pStrm)
     pAttrList->AddAttribute( "svg:viewBox", strViewBox);
 
     //points
-    OUString   strPath;
+    OUStringBuffer strPath;
     for (auto & path : m_aPaths)
     {
-        strPath += path.ToString();
+        strPath.append(path.ToString());
     }
-    strPath = strPath.trim();
-    pAttrList->AddAttribute( "svg:d", strPath);
+    if (!strPath.isEmpty())
+        strPath.setLength(strPath.getLength()-1);
+    pAttrList->AddAttribute( "svg:d", strPath.makeStringAndClear());
 
     SetPosition(rect);
     XFDrawObject::ToXml(pStrm);
diff --git a/lotuswordpro/source/filter/xfilter/xfdrawpolygon.cxx b/lotuswordpro/source/filter/xfilter/xfdrawpolygon.cxx
index 6159bff3f80a..6b50db7c56ed 100644
--- a/lotuswordpro/source/filter/xfilter/xfdrawpolygon.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfdrawpolygon.cxx
@@ -58,6 +58,7 @@
  * Polygon object.
  */
 #include <xfilter/xfdrawpolygon.hxx>
+#include <rtl/ustrbuf.hxx>
 
 XFDrawPolygon::XFDrawPolygon()
 {
@@ -76,15 +77,15 @@ void XFDrawPolygon::ToXml(IXFStream *pStrm)
     pAttrList->AddAttribute( "svg:viewBox", strViewBox);
 
     //points
-    OUString   strPoints;
+    OUStringBuffer strPoints;
     for (auto const& point : m_aPoints)
     {
         double  x = (point.GetX()-rect.GetX())*1000;
         double  y = (point.GetY()-rect.GetY())*1000;
-        strPoints += OUString::number(x) + " " + OUString::number(y) + " ";
+        strPoints.append(OUString::number(x)).append(" ").append(OUString::number(y)).append(" ");
     }
-    strPoints = strPoints.trim();
-    pAttrList->AddAttribute( "draw:points", strPoints);
+    strPoints.stripEnd(' ');
+    pAttrList->AddAttribute( "draw:points", strPoints.makeStringAndClear());
 
     SetPosition(rect.GetX(),rect.GetY(),rect.GetWidth(),rect.GetHeight());
     XFDrawObject::ToXml(pStrm);
diff --git a/lotuswordpro/source/filter/xfilter/xfdrawpolyline.cxx b/lotuswordpro/source/filter/xfilter/xfdrawpolyline.cxx
index b96410b9dd40..2ddeca7f0c58 100644
--- a/lotuswordpro/source/filter/xfilter/xfdrawpolyline.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfdrawpolyline.cxx
@@ -58,6 +58,7 @@
  * Polyline.
  ************************************************************************/
 #include <xfilter/xfdrawpolyline.hxx>
+#include <rtl/ustrbuf.hxx>
 
 XFDrawPolyline::XFDrawPolyline()
 {
@@ -76,15 +77,15 @@ void XFDrawPolyline::ToXml(IXFStream *pStrm)
     pAttrList->AddAttribute( "svg:viewBox", strViewBox);
 
     //points
-    OUString   strPoints;
+    OUStringBuffer strPoints;
     for (auto const& point : m_aPoints)
     {
         double  x = (point.GetX()-rect.GetX())*1000;
         double  y = (point.GetY()-rect.GetY())*1000;
-        strPoints += OUString::number(x) + "," + OUString::number(y) + " ";
+        strPoints.append(OUString::number(x)).append(",").append(OUString::number(y)).append(" ");
     }
-    strPoints = strPoints.trim();
-    pAttrList->AddAttribute( "draw:points", strPoints);
+    strPoints.stripEnd(' ');
+    pAttrList->AddAttribute( "draw:points", strPoints.makeStringAndClear());
 
     SetPosition(rect.GetX(),rect.GetY(),rect.GetWidth(),rect.GetHeight());
     XFDrawObject::ToXml(pStrm);


More information about the Libreoffice-commits mailing list