summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorLászló Németh <laszlo.nemeth@collabora.com>2015-01-26 19:40:17 +0100
committerLászló Németh <laszlo.nemeth@collabora.com>2015-01-26 19:40:17 +0100
commit06c752f405ec95c85045632aa41664cc8f34d493 (patch)
treeb2feaf034e9af4d3aa6e3693e6024f96f37f4355 /sc
parent92fd7a6b029e6ebad651a0e4636fa9c9229c931c (diff)
Revert "fdo#88810 avoid unnecessary massive O(U)String allocations in XLSX export"
Build problem on Android-ARM platform... This reverts commit 0d2ce71afe0cb2657a6919e641e54c8fc9ba288c.
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/address.hxx3
-rw-r--r--sc/source/core/tool/address.cxx45
-rw-r--r--sc/source/filter/excel/xestream.cxx10
-rw-r--r--sc/source/filter/excel/xetable.cxx14
-rw-r--r--sc/source/filter/inc/xestream.hxx2
5 files changed, 3 insertions, 71 deletions
diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index aa05a586b2a8..06c450b8eb27 100644
--- a/sc/inc/address.hxx
+++ b/sc/inc/address.hxx
@@ -325,9 +325,6 @@ public:
ExternalInfo* pExtInfo = NULL,
const css::uno::Sequence<css::sheet::ExternalLinkInfo>* pExternalLinks = NULL );
- SC_DLLPUBLIC bool TryFormat( char * s, sal_uInt16 nFlags = 0,
- const ScDocument* pDocument = NULL,
- const Details& rDetails = detailsOOOa1) const;
SC_DLLPUBLIC OUString Format( sal_uInt16 nFlags = 0,
const ScDocument* pDocument = NULL,
const Details& rDetails = detailsOOOa1) const;
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index 886b8665c636..39fc9a4dd253 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -1745,51 +1745,6 @@ static OUString getFileNameFromDoc( const ScDocument* pDoc )
return sFileName;
}
-/** Tries to obtain a simple address without OUString/OString allocation
- *
- * @returns TRUE at success (it is enough to call OUString Format() at FALSE)
- *
- */
-
-bool ScAddress::TryFormat(char * s, sal_uInt16 nFlags, const ScDocument* pDoc,
- const Details& rDetails) const
-{
- if( nFlags & SCA_VALID )
- nFlags |= ( SCA_VALID_ROW | SCA_VALID_COL | SCA_VALID_TAB );
- if(( pDoc && (nFlags & SCA_VALID_TAB ) && ( nTab >= pDoc->GetTableCount() || ( nFlags & SCA_TAB_3D ))) ||
- ! (nFlags & SCA_VALID_COL) || ! (nFlags & SCA_VALID_ROW) ||
- (nFlags & SCA_COL_ABSOLUTE) != 0 || (nFlags & SCA_ROW_ABSOLUTE) != 0 )
- {
- return false;
- }
-
- switch( rDetails.eConv )
- {
- default :
- // Note: length of s (defined by SIMPLEADDRESSLEN) supports the following simple addresses
- case formula::FormulaGrammar::CONV_OOO:
- case formula::FormulaGrammar::CONV_XL_A1:
- case formula::FormulaGrammar::CONV_XL_OOX:
- if (nCol >= 26 * 26)
- // TODO: extend it for full column range
- return false;
- if( nCol < 26 )
- *s = 'A' + nCol;
- else
- {
- *s = 'A' + nCol / 26 - 1;
- s++;
- *s = 'A' + nCol % 26;
- }
- sprintf(s + 1, "%d", nRow + 1);
- break;
- case formula::FormulaGrammar::CONV_XL_R1C1:
- // not used in XLSX export
- return false;
- }
- return true;
-}
-
OUString ScAddress::Format(sal_uInt16 nFlags, const ScDocument* pDoc,
const Details& rDetails) const
{
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index 188fcd668250..e5ff50c431c7 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -718,11 +718,6 @@ OString XclXmlUtils::ToOString( const OUString& s )
return OUStringToOString( s, RTL_TEXTENCODING_UTF8 );
}
-bool XclXmlUtils::TryToChar( char * s, const ScAddress& rAddress )
-{
- return rAddress.TryFormat(s, SCA_VALID, NULL, ScAddress::Details( FormulaGrammar::CONV_XL_A1));
-}
-
OString XclXmlUtils::ToOString( const ScAddress& rAddress )
{
OUString sAddress(rAddress.Format(SCA_VALID, NULL, ScAddress::Details( FormulaGrammar::CONV_XL_A1)));
@@ -765,11 +760,6 @@ static ScAddress lcl_ToAddress( const XclAddress& rAddress )
return aAddress;
}
-bool XclXmlUtils::TryToChar( sal_Char * s, const XclAddress& rAddress )
-{
- return TryToChar( s, lcl_ToAddress( rAddress ));
-}
-
OString XclXmlUtils::ToOString( const XclAddress& rAddress )
{
return ToOString( lcl_ToAddress( rAddress ) );
diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index dd527d357044..70f3373771b4 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -41,11 +41,6 @@ using namespace ::oox;
namespace ApiScriptType = ::com::sun::star::i18n::ScriptType;
-// max string length of simple addresses (eg. ABC1000000\0)
-#if MAXROWCOUNT_DEFINE < 9999999
-#define SIMPLEADDRESSLEN 11
-#endif
-
// Helper records for cell records
XclExpStringRec::XclExpStringRec( const XclExpRoot& rRoot, const OUString& rResult ) :
@@ -635,10 +630,9 @@ static OString lcl_GetStyleId( XclExpXmlStream& rStrm, const XclExpCellBase& rCe
void XclExpNumberCell::SaveXml( XclExpXmlStream& rStrm )
{
- char fastAdr[SIMPLEADDRESSLEN];
sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
rWorksheet->startElement( XML_c,
- XML_r, XclXmlUtils::TryToChar( fastAdr, GetXclPos() ) ? fastAdr : XclXmlUtils::ToOString( GetXclPos() ).getStr(),
+ XML_r, XclXmlUtils::ToOString( GetXclPos() ).getStr(),
XML_s, lcl_GetStyleId( rStrm, *this ).getStr(),
XML_t, "n",
// OOXTODO: XML_cm, XML_vm, XML_ph
@@ -929,12 +923,11 @@ void XclExpFormulaCell::SaveXml( XclExpXmlStream& rStrm )
{
const char* sType = NULL;
OUString sValue;
- char fastAdr[SIMPLEADDRESSLEN];
XclXmlUtils::GetFormulaTypeAndValue( mrScFmlaCell, sType, sValue );
sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
rWorksheet->startElement( XML_c,
- XML_r, XclXmlUtils::TryToChar( fastAdr, GetXclPos() ) ? fastAdr : XclXmlUtils::ToOString( GetXclPos() ).getStr(),
+ XML_r, XclXmlUtils::ToOString( GetXclPos() ).getStr(),
XML_s, lcl_GetStyleId( rStrm, *this ).getStr(),
XML_t, sType,
// OOXTODO: XML_cm, XML_vm, XML_ph
@@ -1314,10 +1307,9 @@ bool XclExpRkCell::TryMerge( const XclExpCellBase& rCell )
void XclExpRkCell::WriteXmlContents( XclExpXmlStream& rStrm, const XclAddress& rAddress, sal_uInt32 nXFId, sal_uInt16 nRelCol )
{
- char fastAdr[SIMPLEADDRESSLEN];
sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
rWorksheet->startElement( XML_c,
- XML_r, XclXmlUtils::TryToChar( fastAdr, rAddress ) ? fastAdr : XclXmlUtils::ToOString( rAddress ).getStr(),
+ XML_r, XclXmlUtils::ToOString( 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 8454b2e2b2b8..df1f7a30a17a 100644
--- a/sc/source/filter/inc/xestream.hxx
+++ b/sc/source/filter/inc/xestream.hxx
@@ -266,11 +266,9 @@ public:
static OString ToOString( const Color& rColor );
static OString ToOString( const OUString& s );
static OString ToOString( const ScfUInt16Vec& rBuffer );
- static bool TryToChar( char * s, const ScAddress& rRange );
static OString ToOString( const ScAddress& rRange );
static OString ToOString( const ScRange& rRange );
static OString ToOString( const ScRangeList& rRangeList );
- static bool TryToChar( char * s, const XclAddress& rAddress );
static OString ToOString( const XclAddress& rAddress );
static OString ToOString( const XclExpString& s );
static OString ToOString( const XclRange& rRange );