diff options
author | Eike Rathke <erack@redhat.com> | 2016-06-08 13:32:37 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-06-08 13:35:18 +0200 |
commit | 6b6e82c555c7c10c9af73119ce25ad69867f49d2 (patch) | |
tree | ce1249cafdb98044501d5ab9b5a14aa73ce9d953 | |
parent | a59c4e26abbdd0720d24d3ddc0d6a05a67a31aaf (diff) |
convert the final double result to FormulaDoubleToken
... if it was a FormulaTypedDoubleToken, and set type information.
Change-Id: I2debcda4650d621311d5d7670ffdedecb2e25a04
-rw-r--r-- | sc/source/core/tool/interpr4.cxx | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index f846cefd41e7..a660f66dfb93 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -4299,10 +4299,24 @@ StackVar ScInterpreter::Interpret() nGlobalError = pCur->GetError(); break; case svDouble : - if ( nFuncFmtType == css::util::NumberFormat::UNDEFINED ) { - nRetTypeExpr = css::util::NumberFormat::NUMBER; - nRetIndexExpr = 0; + // If typed, pop token to obtain type information and + // push a plain untyped double so the result token to + // be transfered to the formula cell result does not + // unnecessarily duplicate the information. + if (pCur->GetDoubleType()) + { + const double fVal = PopDouble(); + if (nCurFmtType != nFuncFmtType) + nRetIndexExpr = 0; // carry format index only for matching type + nRetTypeExpr = nFuncFmtType = nCurFmtType; + PushTempToken( new FormulaDoubleToken( fVal)); + } + if ( nFuncFmtType == css::util::NumberFormat::UNDEFINED ) + { + nRetTypeExpr = css::util::NumberFormat::NUMBER; + nRetIndexExpr = 0; + } } break; case svString : |