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

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 18 23:49:12 UTC 2019


 sc/source/filter/excel/excrecds.cxx          |   12 ++-------
 sc/source/filter/excel/xepivotxml.cxx        |   11 +++-----
 sc/source/filter/excel/xerecord.cxx          |    7 +----
 sc/source/filter/inc/xerecord.hxx            |    4 ---
 sc/source/filter/inc/xestream.hxx            |    5 ---
 sc/source/filter/xcl97/XclExpChangeTrack.cxx |   34 +++++++++++----------------
 sc/source/filter/xcl97/xcl97rec.cxx          |   16 +++---------
 7 files changed, 31 insertions(+), 58 deletions(-)

New commits:
commit 5e4a02028a8b885997eab7693ef131f4a0c02d8a
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Fri Apr 19 01:05:01 2019 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Fri Apr 19 01:47:35 2019 +0200

    Further cleanup to not use FSEND and useless string conversions
    
    ... in XclExpXmlStream::WriteAttributes
    
    Change-Id: Ideae6685e7f035970850d86bcaea74c525f1ec81
    Reviewed-on: https://gerrit.libreoffice.org/70957
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx
index 07926576e087..fc0b2bbd2caa 100644
--- a/sc/source/filter/excel/excrecds.cxx
+++ b/sc/source/filter/excel/excrecds.cxx
@@ -265,16 +265,12 @@ void Exc1904::SaveXml( XclExpXmlStream& rStrm )
 
     if( bISOIEC )
     {
-        rStrm.WriteAttributes(
-            XML_dateCompatibility, ToPsz( bDateCompatibility ),
-            FSEND );
+        rStrm.WriteAttributes(XML_dateCompatibility, ToPsz(bDateCompatibility));
     }
 
     if( !bISOIEC || bDateCompatibility )
     {
-        rStrm.WriteAttributes(
-            XML_date1904, ToPsz( bVal ),
-            FSEND );
+        rStrm.WriteAttributes(XML_date1904, ToPsz(bVal));
     }
 }
 
@@ -408,9 +404,7 @@ XclExpWindowProtection::XclExpWindowProtection(bool bValue) :
 
 void XclExpWindowProtection::SaveXml( XclExpXmlStream& rStrm )
 {
-    rStrm.WriteAttributes(
-            XML_lockWindows, ToPsz( GetBool() ),
-            FSEND );
+    rStrm.WriteAttributes(XML_lockWindows, ToPsz(GetBool()));
 }
 
 // XclExpDocProtection ===============================================================
diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx
index 43dc30196160..e2d7b03c7884 100644
--- a/sc/source/filter/excel/xepivotxml.cxx
+++ b/sc/source/filter/excel/xepivotxml.cxx
@@ -823,15 +823,14 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP
     pPivotStrm->write("<")->writeId(XML_location);
     rStrm.WriteAttributes(XML_ref,
         XclXmlUtils::ToOString(aOutRange),
-        XML_firstHeaderRow, OString::number(nFirstHeaderRow).getStr(),
-        XML_firstDataRow, OString::number(nFirstDataRow).getStr(),
-        XML_firstDataCol, OString::number(nFirstDataCol).getStr(),
-        FSEND);
+        XML_firstHeaderRow, OUString::number(nFirstHeaderRow),
+        XML_firstDataRow, OUString::number(nFirstDataRow),
+        XML_firstDataCol, OUString::number(nFirstDataCol));
 
     if (!aPageFields.empty())
     {
-        rStrm.WriteAttributes(XML_rowPageCount, OString::number(static_cast<long>(aPageFields.size())).getStr(), FSEND);
-        rStrm.WriteAttributes(XML_colPageCount, OString::number(1).getStr(), FSEND);
+        rStrm.WriteAttributes(XML_rowPageCount, OUString::number(static_cast<long>(aPageFields.size())));
+        rStrm.WriteAttributes(XML_colPageCount, OUString::number(1));
     }
 
     pPivotStrm->write("/>");
diff --git a/sc/source/filter/excel/xerecord.cxx b/sc/source/filter/excel/xerecord.cxx
index 85fb4a51a663..ff4d7cefce38 100644
--- a/sc/source/filter/excel/xerecord.cxx
+++ b/sc/source/filter/excel/xerecord.cxx
@@ -160,9 +160,7 @@ void XclExpValueRecord<double>::SaveXml( XclExpXmlStream& rStrm )
 {
     if( mnAttribute == -1 )
         return;
-    rStrm.WriteAttributes(
-        mnAttribute,    OString::number( maValue ).getStr(),
-        FSEND );
+    rStrm.WriteAttributes(mnAttribute, OUString::number(maValue));
 }
 
 void XclExpBoolRecord::WriteBody( XclExpStream& rStrm )
@@ -177,8 +175,7 @@ void XclExpBoolRecord::SaveXml( XclExpXmlStream& rStrm )
 
     rStrm.WriteAttributes(
             // HACK: HIDEOBJ (excdoc.cxx) should be its own object to handle XML_showObjects
-            mnAttribute, mnAttribute == XML_showObjects ? "all" : ToPsz( mbValue ),
-            FSEND );
+            mnAttribute, mnAttribute == XML_showObjects ? "all" : ToPsz( mbValue ));
 }
 
 XclExpDummyRecord::XclExpDummyRecord( sal_uInt16 nRecId, const void* pRecData, std::size_t nRecSize ) :
diff --git a/sc/source/filter/inc/xerecord.hxx b/sc/source/filter/inc/xerecord.hxx
index 0e3f019374c5..e3e81a017c6a 100644
--- a/sc/source/filter/inc/xerecord.hxx
+++ b/sc/source/filter/inc/xerecord.hxx
@@ -214,9 +214,7 @@ void XclExpValueRecord< Type >::SaveXml( XclExpXmlStream& rStrm )
 {
     if( mnAttribute == -1 )
         return;
-    rStrm.WriteAttributes(
-        mnAttribute,    OString::number( maValue ).getStr(),
-        FSEND );
+    rStrm.WriteAttributes(mnAttribute, OUString::number(maValue));
 }
 
 template<>
diff --git a/sc/source/filter/inc/xestream.hxx b/sc/source/filter/inc/xestream.hxx
index 859fc59d2c8f..ecbe291621f7 100644
--- a/sc/source/filter/inc/xestream.hxx
+++ b/sc/source/filter/inc/xestream.hxx
@@ -286,16 +286,13 @@ public:
 
     sax_fastparser::FSHelperPtr     GetStreamForPath( const OUString& rPath );
 
-    template <typename Str> void WriteAttributes(sal_Int32 nAttribute, const Str& value, FSEND_t)
-    {
-        WriteAttribute(nAttribute, value);
-    }
     template <typename Str, typename... Args>
     void WriteAttributes(sal_Int32 nAttribute, const Str& value, Args... rest)
     {
         WriteAttribute(nAttribute, value);
         WriteAttributes(rest...);
     }
+    static void WriteAttributes() {}
 
     sax_fastparser::FSHelperPtr     CreateOutputStream (
                                         const OUString& sFullStream,
diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
index 7c491e5497cb..e3e48b2dac0b 100644
--- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
@@ -352,7 +352,7 @@ void XclExpChTrHeader::SaveXml( XclExpXmlStream& rRevisionHeadersStrm )
 {
     sax_fastparser::FSHelperPtr pHeaders = rRevisionHeadersStrm.GetCurrentStream();
     rRevisionHeadersStrm.WriteAttributes(
-            XML_guid,               lcl_GuidToOString( aGUID ).getStr(),
+            XML_guid,               lcl_GuidToOString(aGUID),
             XML_lastGuid,           nullptr,   // OOXTODO
             XML_shared,             nullptr,   // OOXTODO
             XML_diskRevisions,      nullptr,   // OOXTODO
@@ -363,8 +363,7 @@ void XclExpChTrHeader::SaveXml( XclExpXmlStream& rRevisionHeadersStrm )
             XML_version,            nullptr,   // OOXTODO
             XML_keepChangeHistory,  nullptr,   // OOXTODO
             XML_protected,          nullptr,   // OOXTODO
-            XML_preserveHistory,    nullptr,   // OOXTODO
-            FSEND );
+            XML_preserveHistory,    nullptr);  // OOXTODO
     pHeaders->write( ">" );
 }
 
@@ -380,9 +379,9 @@ void XclExpXmlChTrHeaders::SaveXml( XclExpXmlStream& rStrm )
     pHeaders->write("<")->writeId(XML_headers);
 
     rStrm.WriteAttributes(
-        XML_xmlns,              rStrm.getNamespaceURL(OOX_NS(xls)).toUtf8().getStr(),
-        FSNS(XML_xmlns, XML_r), rStrm.getNamespaceURL(OOX_NS(officeRel)).toUtf8().getStr(),
-        XML_guid,               lcl_GuidToOString(maGUID).getStr(),
+        XML_xmlns,              rStrm.getNamespaceURL(OOX_NS(xls)),
+        FSNS(XML_xmlns, XML_r), rStrm.getNamespaceURL(OOX_NS(officeRel)),
+        XML_guid,               lcl_GuidToOString(maGUID),
         XML_lastGuid,           nullptr,   // OOXTODO
         XML_shared,             nullptr,   // OOXTODO
         XML_diskRevisions,      nullptr,   // OOXTODO
@@ -393,8 +392,7 @@ void XclExpXmlChTrHeaders::SaveXml( XclExpXmlStream& rStrm )
         XML_version,            nullptr,   // OOXTODO
         XML_keepChangeHistory,  nullptr,   // OOXTODO
         XML_protected,          nullptr,   // OOXTODO
-        XML_preserveHistory,    nullptr,   // OOXTODO
-        FSEND);
+        XML_preserveHistory,    nullptr);  // OOXTODO
 
     pHeaders->write(">");
 }
@@ -429,21 +427,20 @@ void XclExpXmlChTrHeader::SaveXml( XclExpXmlStream& rStrm )
             &aRelId);
 
     rStrm.WriteAttributes(
-        XML_guid, lcl_GuidToOString(maGUID).getStr(),
-        XML_dateTime, lcl_DateTimeToOString(maDateTime).getStr(),
-        XML_userName, maUserName.toUtf8(),
-        FSNS(XML_r, XML_id), aRelId.toUtf8(),
-        FSEND);
+        XML_guid, lcl_GuidToOString(maGUID),
+        XML_dateTime, lcl_DateTimeToOString(maDateTime),
+        XML_userName, maUserName,
+        FSNS(XML_r, XML_id), aRelId);
 
     if (mnMinAction)
-        rStrm.WriteAttributes(XML_minRId, OString::number(mnMinAction).getStr(), FSEND);
+        rStrm.WriteAttributes(XML_minRId, OUString::number(mnMinAction));
 
     if (mnMaxAction)
-        rStrm.WriteAttributes(XML_maxRId, OString::number(mnMaxAction).getStr(), FSEND);
+        rStrm.WriteAttributes(XML_maxRId, OUString::number(mnMaxAction));
 
     if (!maTabBuffer.empty())
         // next available sheet index.
-        rStrm.WriteAttributes(XML_maxSheetId, OString::number(maTabBuffer.back()+1).getStr(), FSEND);
+        rStrm.WriteAttributes(XML_maxSheetId, OUString::number(maTabBuffer.back()+1));
 
     pHeader->write(">");
 
@@ -473,9 +470,8 @@ void XclExpXmlChTrHeader::SaveXml( XclExpXmlStream& rStrm )
     pRevLogStrm->write("<")->writeId(XML_revisions);
 
     rStrm.WriteAttributes(
-        XML_xmlns,              rStrm.getNamespaceURL(OOX_NS(xls)).toUtf8(),
-        FSNS(XML_xmlns, XML_r), rStrm.getNamespaceURL(OOX_NS(officeRel)).toUtf8(),
-        FSEND);
+        XML_xmlns,              rStrm.getNamespaceURL(OOX_NS(xls)),
+        FSNS(XML_xmlns, XML_r), rStrm.getNamespaceURL(OOX_NS(officeRel)));
 
     pRevLogStrm->write(">");
 
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index 4c55ed88ec03..2b6cb7fb4300 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -1642,9 +1642,7 @@ std::size_t XclCalccount::GetLen() const
 
 void XclCalccount::SaveXml( XclExpXmlStream& rStrm )
 {
-    rStrm.WriteAttributes(
-            XML_iterateCount, OString::number( nCount ).getStr(),
-            FSEND );
+    rStrm.WriteAttributes(XML_iterateCount, OUString::number(nCount));
 }
 
 void XclIteration::SaveCont( XclExpStream& rStrm )
@@ -1669,9 +1667,7 @@ std::size_t XclIteration::GetLen() const
 
 void XclIteration::SaveXml( XclExpXmlStream& rStrm )
 {
-    rStrm.WriteAttributes(
-            XML_iterate, ToPsz( nIter == 1 ),
-            FSEND );
+    rStrm.WriteAttributes(XML_iterate, ToPsz(nIter == 1));
 }
 
 void XclDelta::SaveCont( XclExpStream& rStrm )
@@ -1696,9 +1692,7 @@ std::size_t XclDelta::GetLen() const
 
 void XclDelta::SaveXml( XclExpXmlStream& rStrm )
 {
-    rStrm.WriteAttributes(
-            XML_iterateDelta, OString::number( fDelta ).getStr(),
-            FSEND );
+    rStrm.WriteAttributes(XML_iterateDelta, OUString::number(fDelta));
 }
 
 XclExpFileEncryption::XclExpFileEncryption( const XclExpRoot& rRoot ) :
@@ -1867,9 +1861,7 @@ XclRefmode::XclRefmode( const ScDocument& rDoc ) :
 
 void XclRefmode::SaveXml( XclExpXmlStream& rStrm )
 {
-    rStrm.WriteAttributes(
-            XML_refMode, GetBool() ? "A1" : "R1C1",
-            FSEND );
+    rStrm.WriteAttributes(XML_refMode, GetBool() ? "A1" : "R1C1");
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list