[Libreoffice-commits] core.git: sc/source

Eike Rathke erack at redhat.com
Wed Jun 8 11:35:41 UTC 2016


 sc/source/core/tool/interpr4.cxx |   20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

New commits:
commit 6b6e82c555c7c10c9af73119ce25ad69867f49d2
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Jun 8 13:32:37 2016 +0200

    convert the final double result to FormulaDoubleToken
    
    ... if it was a FormulaTypedDoubleToken, and set type information.
    
    Change-Id: I2debcda4650d621311d5d7670ffdedecb2e25a04

diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index f846cef..a660f66 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 :


More information about the Libreoffice-commits mailing list