Kaydet (Commit) cc724c37 authored tarafından László Németh's avatar László Németh

tdf#88810 XSLT address export: cleanup and more optimization

Change-Id: I5994bf129960863a081b0e263241b62848ad153c
üst e5eb6778
...@@ -718,9 +718,11 @@ OString XclXmlUtils::ToOString( const OUString& s ) ...@@ -718,9 +718,11 @@ OString XclXmlUtils::ToOString( const OUString& s )
return OUStringToOString( s, RTL_TEXTENCODING_UTF8 ); 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 ) OString XclXmlUtils::ToOString( const ScAddress& rAddress )
...@@ -765,9 +767,9 @@ static ScAddress lcl_ToAddress( const XclAddress& rAddress ) ...@@ -765,9 +767,9 @@ static ScAddress lcl_ToAddress( const XclAddress& rAddress )
return aAddress; 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 ) OString XclXmlUtils::ToOString( const XclAddress& rAddress )
......
...@@ -631,9 +631,8 @@ static OString lcl_GetStyleId( XclExpXmlStream& rStrm, const XclExpCellBase& rCe ...@@ -631,9 +631,8 @@ static OString lcl_GetStyleId( XclExpXmlStream& rStrm, const XclExpCellBase& rCe
void XclExpNumberCell::SaveXml( XclExpXmlStream& rStrm ) void XclExpNumberCell::SaveXml( XclExpXmlStream& rStrm )
{ {
sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream(); sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
OStringBuffer rBuf = rStrm.GetRoot().GetStringBuf();
rWorksheet->startElement( XML_c, 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_s, lcl_GetStyleId( rStrm, *this ).getStr(),
XML_t, "n", XML_t, "n",
// OOXTODO: XML_cm, XML_vm, XML_ph // OOXTODO: XML_cm, XML_vm, XML_ph
...@@ -926,9 +925,8 @@ void XclExpFormulaCell::SaveXml( XclExpXmlStream& rStrm ) ...@@ -926,9 +925,8 @@ void XclExpFormulaCell::SaveXml( XclExpXmlStream& rStrm )
OUString sValue; OUString sValue;
XclXmlUtils::GetFormulaTypeAndValue( mrScFmlaCell, sType, sValue ); XclXmlUtils::GetFormulaTypeAndValue( mrScFmlaCell, sType, sValue );
sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream(); sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
OStringBuffer rBuf = rStrm.GetRoot().GetStringBuf();
rWorksheet->startElement( XML_c, 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_s, lcl_GetStyleId( rStrm, *this ).getStr(),
XML_t, sType, XML_t, sType,
// OOXTODO: XML_cm, XML_vm, XML_ph // OOXTODO: XML_cm, XML_vm, XML_ph
...@@ -1309,9 +1307,8 @@ bool XclExpRkCell::TryMerge( const XclExpCellBase& rCell ) ...@@ -1309,9 +1307,8 @@ bool XclExpRkCell::TryMerge( const XclExpCellBase& rCell )
void XclExpRkCell::WriteXmlContents( XclExpXmlStream& rStrm, const XclAddress& rAddress, sal_uInt32 nXFId, sal_uInt16 nRelCol ) void XclExpRkCell::WriteXmlContents( XclExpXmlStream& rStrm, const XclAddress& rAddress, sal_uInt32 nXFId, sal_uInt16 nRelCol )
{ {
sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream(); sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
OStringBuffer rBuf = rStrm.GetRoot().GetStringBuf();
rWorksheet->startElement( XML_c, 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_s, lcl_GetStyleId( rStrm, nXFId ).getStr(),
XML_t, "n", XML_t, "n",
// OOXTODO: XML_cm, XML_vm, XML_ph // OOXTODO: XML_cm, XML_vm, XML_ph
......
...@@ -267,11 +267,11 @@ public: ...@@ -267,11 +267,11 @@ public:
static OString ToOString( const Color& rColor ); static OString ToOString( const Color& rColor );
static OString ToOString( const OUString& s ); static OString ToOString( const OUString& s );
static OString ToOString( const ScfUInt16Vec& rBuffer ); 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 ScAddress& rRange );
static OString ToOString( const ScRange& rRange ); static OString ToOString( const ScRange& rRange );
static OString ToOString( const ScRangeList& rRangeList ); 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 XclAddress& rAddress );
static OString ToOString( const XclExpString& s ); static OString ToOString( const XclExpString& s );
static OString ToOString( const XclRange& rRange ); static OString ToOString( const XclRange& rRange );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment