sc/source/core/inc/interpre.hxx | 19 +++++++++++++++---- sc/source/core/tool/interpr4.cxx | 19 +++++++++++++------ 2 files changed, 28 insertions(+), 10 deletions(-)
New commits: commit d1b6149415a07e8de86d955df2f5d9693b3b8408 Author: Eike Rathke <er...@redhat.com> Date: Wed Jun 8 14:18:24 2016 +0200 PushCellResultToken() with final FormulaDoubleToken Change-Id: I3c628527c3e5bb676be791e3a31d617c4cc917ae diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx index 629c6c0..bd0a269 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 a660f66..343cb90 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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits