use FormulaTypedDoubleToken in PushDouble() for temporary interim results
... and extract type information in PopDouble()
Change-Id: Ib184a8d893bf1072d051a80259b44f6e28fc9271
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 5b1c2fe..629c6c0 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -354,6 +354,8 @@ ScMatrixRef PopMatrix();
sc::RangeMatrix PopRangeMatrix();
void QueryMatrixType(ScMatrixRef& xMat, short& rRetTypeExpr, sal_uLong& rRetIndexExpr);
formula::FormulaToken* CreateDoubleOrTypedToken( double fVal );
void PushDouble(double nVal);
void PushInt( int nVal );
void PushStringBuffer( const sal_Unicode* pString );
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index a9363a7..f846cef 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -812,7 +812,12 @@ double ScInterpreter::PopDouble()
nGlobalError = p->GetError();
break;
case svDouble:
return p->GetDouble();
{
short nType = p->GetDoubleType();
if (nType && nType != css::util::NumberFormat::UNDEFINED)
nCurFmtType = nType;
return p->GetDouble();
}
case svEmptyCell:
case svMissing:
return 0.0;
@@ -1650,17 +1655,27 @@ void ScInterpreter::QueryMatrixType(ScMatrixRef& xMat, short& rRetTypeExpr, sal_
SetError( errUnknownStackVariable);
}
formula::FormulaToken* ScInterpreter::CreateDoubleOrTypedToken( double fVal )
{
// NumberFormat::NUMBER is the default untyped double.
if (nFuncFmtType && nFuncFmtType != css::util::NumberFormat::NUMBER &&
nFuncFmtType != css::util::NumberFormat::UNDEFINED)
return new FormulaTypedDoubleToken( fVal, nFuncFmtType);
else
return new FormulaDoubleToken( fVal);
}
void ScInterpreter::PushDouble(double nVal)
{
TreatDoubleError( nVal );
if (!IfErrorPushError())
PushTempTokenWithoutError( new FormulaDoubleToken( nVal ) );
PushTempTokenWithoutError( CreateDoubleOrTypedToken( nVal));
}
void ScInterpreter::PushInt(int nVal)
{
if (!IfErrorPushError())
PushTempTokenWithoutError( new FormulaDoubleToken( nVal ) );
PushTempTokenWithoutError( CreateDoubleOrTypedToken( nVal));
}
void ScInterpreter::PushStringBuffer( const sal_Unicode* pString )