summaryrefslogtreecommitdiff
path: root/sc/source/filter/excel
diff options
context:
space:
mode:
authorLászló Németh <laszlo.nemeth@collabora.com>2015-02-02 08:52:53 +0100
committerMichael Meeks <michael.meeks@collabora.com>2015-02-02 21:18:49 +0100
commit86df2b436d387ff1282089267e1837f17aff5cda (patch)
treee3b911769664b6293823efb4fc77835e676333c3 /sc/source/filter/excel
parentaafb2fd9c7580a0de98f2d60657576c62175a5ee (diff)
tdf#88810 avoid unnecessary massive O(U)String allocations in XLSX export
ToOString(XclAddress/ScAddress) functions are replaced with ToOString(OStringBuffer&, XclAddress/ScAddress) ones, using the new shared OStringBuffer variable of XclExpRootData Cherry-picked from master: b2df899dbb038acfe3c47eef303345ceaf3725b8 (build fix) 99674f754323ca78ac45499439b9983b31ebd444 (append() for number to string conv.) f0152b737d9a196e83752a546154735efee5c2be (more cleanup) cc724c37232b721537d66c997a66c0d7866948ea (cleanup) 779581feed4886313746a71e9e738d736977be1b (original) Change-Id: I06b705e2159a1ef5990f9eb0ffedd20fe277c616 Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'sc/source/filter/excel')
-rw-r--r--sc/source/filter/excel/xeroot.cxx1
-rw-r--r--sc/source/filter/excel/xestream.cxx10
-rw-r--r--sc/source/filter/excel/xetable.cxx13
-rw-r--r--sc/source/filter/excel/xeview.cxx6
4 files changed, 15 insertions, 15 deletions
diff --git a/sc/source/filter/excel/xeroot.cxx b/sc/source/filter/excel/xeroot.cxx
index 819fe93553db..96f508555503 100644
--- a/sc/source/filter/excel/xeroot.cxx
+++ b/sc/source/filter/excel/xeroot.cxx
@@ -57,6 +57,7 @@ XclExpRootData::XclExpRootData( XclBiff eBiff, SfxMedium& rMedium,
{
SvtSaveOptions aSaveOpt;
mbRelUrl = mrMedium.IsRemote() ? aSaveOpt.IsSaveRelINet() : aSaveOpt.IsSaveRelFSys();
+ maStringBuf = OStringBuffer();
}
XclExpRootData::~XclExpRootData()
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index e5ff50c431c7..48153ebe41e5 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -718,10 +718,10 @@ OString XclXmlUtils::ToOString( const OUString& s )
return OUStringToOString( s, RTL_TEXTENCODING_UTF8 );
}
-OString XclXmlUtils::ToOString( const ScAddress& rAddress )
+OStringBuffer& XclXmlUtils::ToOString( OStringBuffer& s, const ScAddress& rAddress )
{
- OUString sAddress(rAddress.Format(SCA_VALID, NULL, ScAddress::Details( FormulaGrammar::CONV_XL_A1)));
- return ToOString( sAddress );
+ rAddress.Format(s, SCA_VALID, NULL, ScAddress::Details( FormulaGrammar::CONV_XL_A1));
+ return s;
}
OString XclXmlUtils::ToOString( const ScfUInt16Vec& rBuffer )
@@ -760,9 +760,9 @@ static ScAddress lcl_ToAddress( const XclAddress& rAddress )
return aAddress;
}
-OString XclXmlUtils::ToOString( const XclAddress& rAddress )
+OStringBuffer& XclXmlUtils::ToOString( OStringBuffer& s, const XclAddress& rAddress )
{
- return ToOString( lcl_ToAddress( rAddress ) );
+ return ToOString( s, lcl_ToAddress( rAddress ));
}
OString XclXmlUtils::ToOString( const XclExpString& s )
diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index 23adf6e3f0db..53a3c860dc5a 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -632,7 +632,7 @@ void XclExpNumberCell::SaveXml( XclExpXmlStream& rStrm )
{
sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
rWorksheet->startElement( XML_c,
- XML_r, 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
@@ -663,7 +663,7 @@ void XclExpBooleanCell::SaveXml( XclExpXmlStream& rStrm )
{
sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
rWorksheet->startElement( XML_c,
- XML_r, XclXmlUtils::ToOString( GetXclPos() ).getStr(),
+ XML_r, XclXmlUtils::ToOString( rStrm.GetRoot().GetStringBuf(), GetXclPos() ).getStr(),
XML_s, lcl_GetStyleId( rStrm, *this ).getStr(),
XML_t, "b",
// OOXTODO: XML_cm, XML_vm, XML_ph
@@ -766,7 +766,7 @@ void XclExpLabelCell::SaveXml( XclExpXmlStream& rStrm )
{
sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
rWorksheet->startElement( XML_c,
- XML_r, XclXmlUtils::ToOString( GetXclPos() ).getStr(),
+ XML_r, XclXmlUtils::ToOString( rStrm.GetRoot().GetStringBuf(), GetXclPos() ).getStr(),
XML_s, lcl_GetStyleId( rStrm, *this ).getStr(),
XML_t, "s",
// OOXTODO: XML_cm, XML_vm, XML_ph
@@ -923,11 +923,10 @@ void XclExpFormulaCell::SaveXml( XclExpXmlStream& rStrm )
{
const char* sType = NULL;
OUString sValue;
-
XclXmlUtils::GetFormulaTypeAndValue( mrScFmlaCell, sType, sValue );
sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
rWorksheet->startElement( XML_c,
- XML_r, 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
@@ -1277,7 +1276,7 @@ void XclExpBlankCell::WriteXmlContents( XclExpXmlStream& rStrm, const XclAddress
{
sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
rWorksheet->singleElement( XML_c,
- XML_r, XclXmlUtils::ToOString( rAddress ).getStr(),
+ XML_r, XclXmlUtils::ToOString( rStrm.GetRoot().GetStringBuf(), rAddress ).getStr(),
XML_s, lcl_GetStyleId( rStrm, nXFId ).getStr(),
FSEND );
}
@@ -1309,7 +1308,7 @@ void XclExpRkCell::WriteXmlContents( XclExpXmlStream& rStrm, const XclAddress& r
{
sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
rWorksheet->startElement( XML_c,
- XML_r, 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/excel/xeview.cxx b/sc/source/filter/excel/xeview.cxx
index 5e5ded5cb3f7..3cea6ab5e64b 100644
--- a/sc/source/filter/excel/xeview.cxx
+++ b/sc/source/filter/excel/xeview.cxx
@@ -182,7 +182,7 @@ void XclExpPane::SaveXml( XclExpXmlStream& rStrm )
rStrm.GetCurrentStream()->singleElement( XML_pane,
XML_xSplit, OString::number( mnSplitX ).getStr(),
XML_ySplit, OString::number( mnSplitY ).getStr(),
- XML_topLeftCell, XclXmlUtils::ToOString( maSecondXclPos ).getStr(),
+ XML_topLeftCell, XclXmlUtils::ToOString( rStrm.GetRoot().GetStringBuf(), maSecondXclPos ).getStr(),
XML_activePane, lcl_GetActivePane( mnActivePane ),
XML_state, mbFrozenPanes ? "frozen" : "split",
FSEND );
@@ -225,7 +225,7 @@ void XclExpSelection::SaveXml( XclExpXmlStream& rStrm )
{
rStrm.GetCurrentStream()->singleElement( XML_selection,
XML_pane, lcl_GetActivePane( mnPane ),
- XML_activeCell, XclXmlUtils::ToOString( maSelData.maXclCursor ).getStr(),
+ XML_activeCell, XclXmlUtils::ToOString( rStrm.GetRoot().GetStringBuf(), maSelData.maXclCursor ).getStr(),
XML_activeCellId, OString::number( maSelData.mnCursorIdx ).getStr(),
XML_sqref, XclXmlUtils::ToOString( maSelData.maXclSelection ).getStr(),
FSEND );
@@ -426,7 +426,7 @@ void XclExpTabViewSettings::SaveXml( XclExpXmlStream& rStrm )
XML_defaultGridColor, mnGridColorId == XclExpPalette::GetColorIdFromIndex( EXC_COLOR_WINDOWTEXT ) ? "true" : "false",
// OOXTODO: XML_showWhiteSpace,
XML_view, maData.mbPageMode ? "pageBreakPreview" : "normal", // OOXTODO: pageLayout
- XML_topLeftCell, XclXmlUtils::ToOString( maData.maFirstXclPos ).getStr(),
+ XML_topLeftCell, XclXmlUtils::ToOString( rStrm.GetRoot().GetStringBuf(), maData.maFirstXclPos ).getStr(),
XML_colorId, OString::number( rStrm.GetRoot().GetPalette().GetColorIndex( mnGridColorId ) ).getStr(),
XML_zoomScale, lcl_GetZoom( maData.mnCurrentZoom ).getStr(),
XML_zoomScaleNormal, lcl_GetZoom( maData.mnNormalZoom ).getStr(),