summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-10-04 11:55:05 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2019-10-04 12:40:06 +0200
commit59e5d2c8839ee6bf2bb237c0db4a618cb98b2dd9 (patch)
tree804dba11b76c99a695d58c8f5b164a592b7ba3ac /sc
parent314958decf4491ca7b11c2ef014d29ea2ae14d69 (diff)
Deduplicate some serializer writing code, and simplify writing OString
Change-Id: I391f8cb499a83f1f774fdcaa794169a218bdc7e5 Reviewed-on: https://gerrit.libreoffice.org/80189 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/excel/xecontent.cxx2
-rw-r--r--sc/source/filter/excel/xeextlst.cxx2
-rw-r--r--sc/source/filter/excel/xestream.cxx27
-rw-r--r--sc/source/filter/inc/xestream.hxx12
4 files changed, 11 insertions, 32 deletions
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index 444b737d038c..c61425647e59 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -1507,7 +1507,7 @@ void XclExpDataBar::SaveXml( XclExpXmlStream& rStrm )
XML_uri, "{B025F937-C7B1-47D3-B67F-A62EFF666E3E}");
rWorksheet->startElementNS( XML_x14, XML_id );
- rWorksheet->write( maGUID.getStr() );
+ rWorksheet->write(maGUID);
rWorksheet->endElementNS( XML_x14, XML_id );
rWorksheet->endElement( XML_ext );
diff --git a/sc/source/filter/excel/xeextlst.cxx b/sc/source/filter/excel/xeextlst.cxx
index 2d74db8b25dd..c2764b43da26 100644
--- a/sc/source/filter/excel/xeextlst.cxx
+++ b/sc/source/filter/excel/xeextlst.cxx
@@ -464,7 +464,7 @@ void XclExpExtConditionalFormatting::SaveXml( XclExpXmlStream& rStrm )
maCfRules.SaveXml( rStrm );
rWorksheet->startElementNS(XML_xm, XML_sqref);
- rWorksheet->write(XclXmlUtils::ToOString(maRange).getStr());
+ rWorksheet->write(XclXmlUtils::ToOString(maRange));
rWorksheet->endElementNS( XML_xm, XML_sqref );
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index 98444d6ca0b4..937a7d0c8ed2 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -813,33 +813,6 @@ OUString XclXmlUtils::ToOUString( const XclExpString& s )
return ToOUString( s.GetUnicodeBuffer() );
}
-sax_fastparser::FSHelperPtr XclXmlUtils::WriteElement( sax_fastparser::FSHelperPtr pStream, sal_Int32 nElement, sal_Int32 nValue )
-{
- pStream->startElement(nElement);
- pStream->write( nValue );
- pStream->endElement( nElement );
-
- return pStream;
-}
-
-sax_fastparser::FSHelperPtr XclXmlUtils::WriteElement( sax_fastparser::FSHelperPtr pStream, sal_Int32 nElement, sal_Int64 nValue )
-{
- pStream->startElement(nElement);
- pStream->write( nValue );
- pStream->endElement( nElement );
-
- return pStream;
-}
-
-sax_fastparser::FSHelperPtr XclXmlUtils::WriteElement( sax_fastparser::FSHelperPtr pStream, sal_Int32 nElement, const char* sValue )
-{
- pStream->startElement(nElement);
- pStream->write( sValue );
- pStream->endElement( nElement );
-
- return pStream;
-}
-
static void lcl_WriteValue( const sax_fastparser::FSHelperPtr& rStream, sal_Int32 nElement, const char* pValue )
{
if( !pValue )
diff --git a/sc/source/filter/inc/xestream.hxx b/sc/source/filter/inc/xestream.hxx
index 72239ef829a7..36e1543f5269 100644
--- a/sc/source/filter/inc/xestream.hxx
+++ b/sc/source/filter/inc/xestream.hxx
@@ -265,9 +265,15 @@ public:
static OUString ToOUString( sc::CompileFormulaContext& rCtx, const ScAddress& rAddress, const ScTokenArray* pTokenArray );
static OUString ToOUString( const XclExpString& s );
- static sax_fastparser::FSHelperPtr WriteElement( sax_fastparser::FSHelperPtr pStream, sal_Int32 nElement, sal_Int32 nValue );
- static sax_fastparser::FSHelperPtr WriteElement( sax_fastparser::FSHelperPtr pStream, sal_Int32 nElement, sal_Int64 nValue );
- static sax_fastparser::FSHelperPtr WriteElement( sax_fastparser::FSHelperPtr pStream, sal_Int32 nElement, const char* sValue );
+ template <class T>
+ static sax_fastparser::FSHelperPtr WriteElement(sax_fastparser::FSHelperPtr pStream, sal_Int32 nElement, const T& value)
+ {
+ pStream->startElement(nElement);
+ pStream->write(value);
+ pStream->endElement(nElement);
+
+ return pStream;
+ }
static sax_fastparser::FSHelperPtr WriteFontData( sax_fastparser::FSHelperPtr pStream, const XclFontData& rFontData, sal_Int32 nNameId );
};