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

László Németh laszlo.nemeth at collabora.com
Tue Jan 27 06:25:08 PST 2015


 sc/source/filter/excel/xestream.cxx |   10 ++++++----
 sc/source/filter/excel/xetable.cxx  |    9 +++------
 sc/source/filter/inc/xestream.hxx   |    4 ++--
 3 files changed, 11 insertions(+), 12 deletions(-)

New commits:
commit cc724c37232b721537d66c997a66c0d7866948ea
Author: László Németh <laszlo.nemeth at collabora.com>
Date:   Tue Jan 27 15:14:30 2015 +0100

    tdf#88810 XSLT address export: cleanup and more optimization
    
    Change-Id: I5994bf129960863a081b0e263241b62848ad153c

diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index 04dbb5f..57792ea 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -718,9 +718,11 @@ OString XclXmlUtils::ToOString( const OUString& s )
     return OUStringToOString( s, RTL_TEXTENCODING_UTF8  );
 }
 
-bool XclXmlUtils::TryToOString( OStringBuffer& s, const ScAddress& rAddress )
+OStringBuffer& XclXmlUtils::ToOString( OStringBuffer& s, const ScAddress& rAddress )
 {
-    return rAddress.TryFormat(s, SCA_VALID, NULL, ScAddress::Details( FormulaGrammar::CONV_XL_A1));
+    if (!rAddress.TryFormat(s, SCA_VALID, NULL, ScAddress::Details( FormulaGrammar::CONV_XL_A1)))
+        s.append(ToOString(rAddress));
+    return s;
 }
 
 OString XclXmlUtils::ToOString( const ScAddress& rAddress )
@@ -765,9 +767,9 @@ static ScAddress lcl_ToAddress( const XclAddress& rAddress )
     return aAddress;
 }
 
-bool XclXmlUtils::TryToOString( OStringBuffer& s, const XclAddress& rAddress )
+OStringBuffer& XclXmlUtils::ToOString( OStringBuffer& s, const XclAddress& rAddress )
 {
-    return TryToOString( s, lcl_ToAddress( rAddress ));
+    return ToOString( s, lcl_ToAddress( rAddress ));
 }
 
 OString XclXmlUtils::ToOString( const XclAddress& rAddress )
diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index 5919c61..6f01de7 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -631,9 +631,8 @@ static OString lcl_GetStyleId( XclExpXmlStream& rStrm, const XclExpCellBase& rCe
 void XclExpNumberCell::SaveXml( XclExpXmlStream& rStrm )
 {
     sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
-    OStringBuffer rBuf = rStrm.GetRoot().GetStringBuf();
     rWorksheet->startElement( XML_c,
-            XML_r,      XclXmlUtils::TryToOString( rBuf, GetXclPos() ) ? rBuf.getStr() : XclXmlUtils::ToOString( GetXclPos() ).getStr(),
+            XML_r,      XclXmlUtils::ToOString( rStrm.GetRoot().GetStringBuf(), GetXclPos() ).getStr(),
             XML_s,      lcl_GetStyleId( rStrm, *this ).getStr(),
             XML_t,      "n",
             // OOXTODO: XML_cm, XML_vm, XML_ph
@@ -926,9 +925,8 @@ void XclExpFormulaCell::SaveXml( XclExpXmlStream& rStrm )
     OUString    sValue;
     XclXmlUtils::GetFormulaTypeAndValue( mrScFmlaCell, sType, sValue );
     sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
-    OStringBuffer rBuf = rStrm.GetRoot().GetStringBuf();
     rWorksheet->startElement( XML_c,
-            XML_r,      XclXmlUtils::TryToOString( rBuf, GetXclPos() ) ? rBuf.getStr() : XclXmlUtils::ToOString( GetXclPos() ).getStr(),
+            XML_r,      XclXmlUtils::ToOString( rStrm.GetRoot().GetStringBuf(), GetXclPos() ).getStr(),
             XML_s,      lcl_GetStyleId( rStrm, *this ).getStr(),
             XML_t,      sType,
             // OOXTODO: XML_cm, XML_vm, XML_ph
@@ -1309,9 +1307,8 @@ bool XclExpRkCell::TryMerge( const XclExpCellBase& rCell )
 void XclExpRkCell::WriteXmlContents( XclExpXmlStream& rStrm, const XclAddress& rAddress, sal_uInt32 nXFId, sal_uInt16 nRelCol )
 {
     sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
-    OStringBuffer rBuf = rStrm.GetRoot().GetStringBuf();
     rWorksheet->startElement( XML_c,
-            XML_r,      XclXmlUtils::TryToOString( rBuf, rAddress ) ? rBuf.getStr() : XclXmlUtils::ToOString( rAddress ).getStr(),
+            XML_r,      XclXmlUtils::ToOString( rStrm.GetRoot().GetStringBuf(), rAddress ).getStr(),
             XML_s,      lcl_GetStyleId( rStrm, nXFId ).getStr(),
             XML_t,      "n",
             // OOXTODO: XML_cm, XML_vm, XML_ph
diff --git a/sc/source/filter/inc/xestream.hxx b/sc/source/filter/inc/xestream.hxx
index 0b10e48..71aea1d 100644
--- a/sc/source/filter/inc/xestream.hxx
+++ b/sc/source/filter/inc/xestream.hxx
@@ -267,11 +267,11 @@ public:
     static OString ToOString( const Color& rColor );
     static OString ToOString( const OUString& s );
     static OString ToOString( const ScfUInt16Vec& rBuffer );
-    static bool TryToOString( OStringBuffer& s, const ScAddress& rRange );
+    static OStringBuffer& ToOString( OStringBuffer& s, const ScAddress& rRange );
     static OString ToOString( const ScAddress& rRange );
     static OString ToOString( const ScRange& rRange );
     static OString ToOString( const ScRangeList& rRangeList );
-    static bool TryToOString( OStringBuffer& s, const XclAddress& rAddress );
+    static OStringBuffer& ToOString( OStringBuffer& s, const XclAddress& rAddress );
     static OString ToOString( const XclAddress& rAddress );
     static OString ToOString( const XclExpString& s );
     static OString ToOString( const XclRange& rRange );


More information about the Libreoffice-commits mailing list