diff options
author | Eike Rathke <erack@redhat.com> | 2012-07-05 20:26:20 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2012-07-05 20:39:14 +0200 |
commit | 757a346159dd51ae65767bce98a12826fef179b6 (patch) | |
tree | a7a0eca3dacc292063e7b98bc236ddc981fe6fed /sc | |
parent | 0996c0d3193352fe65414ea5577f804dbad8d07b (diff) |
resolved fdo#51664 some matrix cases broken in binary Excel import
Import (ab)used ScFormulaCell::SetHybridDouble() in the sense that
actually it is not a hybrid (no formula string, the token array is
present in binary import) and during interpretation a matrix was
expected but instead the hybrid encountered.
Introduced ScFormulaCell::SetResultDouble() for exactly this case as a
workaround.
Change-Id: I4da3812ef4974380224b5a2bf42d0b62c14d121b
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/cell.hxx | 8 | ||||
-rw-r--r-- | sc/inc/formularesult.hxx | 12 | ||||
-rw-r--r-- | sc/source/filter/excel/excform.cxx | 2 |
3 files changed, 16 insertions, 6 deletions
diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx index 1717d8dfb2be..f609a4642109 100644 --- a/sc/inc/cell.hxx +++ b/sc/inc/cell.hxx @@ -500,6 +500,14 @@ public: void SetHybridFormula( const rtl::OUString& r, const formula::FormulaGrammar::Grammar eGrammar ) { aResult.SetHybridFormula( r); eTempGrammar = eGrammar; } + + /** For import only: set a double result. + Use this instead of SetHybridDouble() if there is no (temporary) + formula string because the formula is present as a token array, as it + is the case for binary Excel import. + */ + void SetResultDouble( double n ) { aResult.SetDouble( n); } + void SetErrCode( sal_uInt16 n ); inline bool IsHyperLinkCell() const { return pCode && pCode->IsHyperLink(); } EditTextObject* CreateURLObject() ; diff --git a/sc/inc/formularesult.hxx b/sc/inc/formularesult.hxx index 2983176281a3..e0f586ce66c3 100644 --- a/sc/inc/formularesult.hxx +++ b/sc/inc/formularesult.hxx @@ -151,11 +151,13 @@ public: void SetResultError( sal_uInt16 nErr ); /** Set direct double. Shouldn't be used externally except in - ScFormulaCell for rounded CalcAsShown or SetErrCode(). If - ScMatrixFormulaCellToken the token isn't replaced but upper left result - is modified instead, but only if it was of type formula::svDouble before or not - set at all. */ - void SetDouble( double f ); + ScFormulaCell for rounded CalcAsShown or SetErrCode() or + SetResultDouble(), see there for condition. If + ScMatrixFormulaCellToken the token isn't replaced but upper + left result is modified instead, but only if it was of type + formula::svDouble before or not set at all. + */ + SC_DLLPUBLIC void SetDouble( double f ); /** Return value if type formula::svDouble or formula::svHybridCell or formula::svMatrixCell and upper left formula::svDouble, else 0.0 */ diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx index 4fcf97665b83..416d46f63314 100644 --- a/sc/source/filter/excel/excform.cxx +++ b/sc/source/filter/excel/excform.cxx @@ -160,7 +160,7 @@ void ImportExcel::Formula( ExcelToSc::SetError( *pCell, eErr ); if (!rtl::math::isNan(fCurVal)) - pCell->SetHybridDouble(fCurVal); + pCell->SetResultDouble(fCurVal); } GetXFRangeBuffer().SetXF( aScPos, nXF ); |