diff options
author | Eike Rathke <erack@redhat.com> | 2016-06-08 14:18:24 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-06-08 14:19:41 +0200 |
commit | d1b6149415a07e8de86d955df2f5d9693b3b8408 (patch) | |
tree | d06cdca85b5e3c9e0e094171ce03269ff50b1841 /sc/source/core | |
parent | a106165e7fd39215c4717e1486aef05f6af9180f (diff) |
PushCellResultToken() with final FormulaDoubleToken
Change-Id: I3c628527c3e5bb676be791e3a31d617c4cc917ae
Diffstat (limited to 'sc/source/core')
-rw-r--r-- | sc/source/core/inc/interpre.hxx | 19 | ||||
-rw-r--r-- | sc/source/core/tool/interpr4.cxx | 19 |
2 files changed, 28 insertions, 10 deletions
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx index 629c6c0738e9..bd0a2698cff2 100644 --- a/sc/source/core/inc/interpre.hxx +++ b/sc/source/core/inc/interpre.hxx @@ -299,11 +299,22 @@ inline bool IfErrorPushError() } /** Obtain cell result / content from address and push as temp token. - bDisplayEmptyAsString is passed to ScEmptyCell in case of an empty cell - result. Also obtain number format and type if _both_, type and index - pointer, are not NULL. */ + + @param bDisplayEmptyAsString + is passed to ScEmptyCell in case of an empty cell result. + + @param pRetTypeExpr + @param pRetIndexExpr + Obtain number format and type if _both_, type and index pointer, + are not NULL. + + @param bFinalResult + If TRUE, only a standard FormulaDoubleToken is pushed. + If FALSE, PushDouble() is used that may push either a + FormulaDoubleToken or a FormulaTypedDoubleToken. + */ void PushCellResultToken( bool bDisplayEmptyAsString, const ScAddress & rAddress, - short * pRetTypeExpr, sal_uLong * pRetIndexExpr ); + short * pRetTypeExpr, sal_uLong * pRetIndexExpr, bool bFinalResult = false ); formula::FormulaTokenRef PopToken(); void Pop(); diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index a660f66dfb93..343cb90e923b 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -714,7 +714,7 @@ void ScInterpreter::PushTempToken( const FormulaToken& r ) } void ScInterpreter::PushCellResultToken( bool bDisplayEmptyAsString, - const ScAddress & rAddress, short * pRetTypeExpr, sal_uLong * pRetIndexExpr ) + const ScAddress & rAddress, short * pRetTypeExpr, sal_uLong * pRetIndexExpr, bool bFinalResult ) { ScRefCellValue aCell(*pDok, rAddress); if (aCell.hasEmptyValue()) @@ -751,7 +751,16 @@ void ScInterpreter::PushCellResultToken( bool bDisplayEmptyAsString, else { double fVal = GetCellValue(rAddress, aCell); - PushDouble( fVal); + if (bFinalResult) + { + TreatDoubleError( fVal); + if (!IfErrorPushError()) + PushTempTokenWithoutError( new FormulaDoubleToken( fVal)); + } + else + { + PushDouble( fVal); + } if (pRetTypeExpr) *pRetTypeExpr = nCurFmtType; if (pRetIndexExpr) @@ -4328,8 +4337,7 @@ StackVar ScInterpreter::Interpret() ScAddress aAdr; PopSingleRef( aAdr ); if( !nGlobalError ) - PushCellResultToken( false, aAdr, - &nRetTypeExpr, &nRetIndexExpr); + PushCellResultToken( false, aAdr, &nRetTypeExpr, &nRetIndexExpr, true); } break; case svRefList : @@ -4350,8 +4358,7 @@ StackVar ScInterpreter::Interpret() PopDoubleRef( aRange ); ScAddress aAdr; if ( !nGlobalError && DoubleRefToPosSingleRef( aRange, aAdr)) - PushCellResultToken( false, aAdr, - &nRetTypeExpr, &nRetIndexExpr); + PushCellResultToken( false, aAdr, &nRetTypeExpr, &nRetIndexExpr, true); } } break; |