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:42:59 +0200 |
commit | d5bd0ff8450985d0adadfdb13b4d97249b1b4bf4 (patch) | |
tree | 7db4887d24a9a554d5646673375adb8400e03d91 | |
parent | fcc90b132168405e5a862fa4db8cfdcdcf632f65 (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
-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 de4d1ad7e72b..5d750d88eaa4 100644 --- a/sc/inc/cell.hxx +++ b/sc/inc/cell.hxx @@ -503,6 +503,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 ); |