diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-03-10 17:25:34 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-03-10 17:28:54 -0400 |
commit | c1dc7576c18cc534e1934459f5fb210091a5b484 (patch) | |
tree | 12f3efc5487322fc2205a2412bc086ac60b5d687 /sc | |
parent | aa5ad7b8096cd15a55c467b1a23d03849aeb870d (diff) |
fdo#74747: Correctly inspect formula result value for xlsx export.
Change-Id: I757a8eb371b432970885e2fbd6aea9dd965ab5c0
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/excel/xestream.cxx | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index 290bd6dab1cd..6c3aa3ba72d9 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -679,45 +679,27 @@ static const char* lcl_GetErrorString( sal_uInt16 nScErrCode ) void XclXmlUtils::GetFormulaTypeAndValue( ScFormulaCell& rCell, const char*& rsType, OUString& rsValue ) { - sal_uInt16 nScErrCode = rCell.GetErrCode(); - if( nScErrCode ) - { - rsType = "e"; - rsValue = ToOUString( lcl_GetErrorString( nScErrCode ) ); + sc::FormulaResultValue aResValue = rCell.GetResult(); - return; - } - - switch( rCell.GetFormatType() ) + switch (aResValue.meType) { - case NUMBERFORMAT_NUMBER: - { - // either value or error code + case sc::FormulaResultValue::Error: + rsType = "e"; + rsValue = ToOUString(lcl_GetErrorString(aResValue.mnError)); + break; + case sc::FormulaResultValue::Value: rsType = "n"; - rsValue = OUString::number( rCell.GetValue() ); - } + rsValue = OUString::number(aResValue.mfValue); break; - - case NUMBERFORMAT_TEXT: - { + case sc::FormulaResultValue::String: rsType = "str"; rsValue = rCell.GetString().getString(); - } - break; - - case NUMBERFORMAT_LOGICAL: - { - rsType = "b"; - rsValue = ToOUString( rCell.GetValue() == 0.0 ? "0" : "1" ); - } break; - + case sc::FormulaResultValue::Invalid: default: - { + // TODO : double-check this to see if this is correct. rsType = "inlineStr"; rsValue = rCell.GetString().getString(); - } - break; } } |