[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sw/source

Julien Nabet serval2412 at yahoo.fr
Thu Nov 26 04:27:11 PST 2015


 sw/source/core/bastyp/calc.cxx |   23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

New commits:
commit 238a02cb567768ff0d7338ddab87441ec5e5d470
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sun Nov 22 17:42:08 2015 +0100

    tdf#61228: Wrong function names in Formula Writer are considered as SUM
    
    Unknown names make the formula fail
    PythonTest_sw_python, especially set_expression is ok
    Variables are taken into account
    
    Thanks to Mike Kaganski for his help on this patch.
    
    Change-Id: Ia6f9c54d90ce88138fd9c9df9422b34ce8223ca2
    Reviewed-on: https://gerrit.libreoffice.org/20122
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Mike Kaganski <mikekaganski at hotmail.com>
    (cherry picked from commit d667e3210b12c7ce3b3727e2a0e369a520fbaaa4)
    Reviewed-on: https://gerrit.libreoffice.org/20159
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index 1eb97f3..4e82bb4 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -1317,16 +1317,21 @@ SwSbxValue SwCalc::Prim()
         break;
 
     case CALC_NAME:
-        if( GetToken() == CALC_ASSIGN )
+        switch(SwCalcOper nOper = GetToken())
         {
-            SwCalcExp* n = VarInsert( aVarName );
-            GetToken();
-            nErg = n->nValue = Expr();
-        }
-        else
-        {
-            nErg = VarLook( aVarName )->nValue;
-            bChkPow = true;
+            case CALC_ASSIGN:
+            {
+                SwCalcExp* n = VarInsert(aVarName);
+                GetToken();
+                nErg = n->nValue = Expr();
+            }
+            break;
+            default:
+                nErg = VarLook(aVarName)->nValue;
+                if (nErg.IsVoidValue() && (nOper == CALC_LP))
+                    eError = CALC_SYNTAX;
+                else
+                    bChkPow = true;
         }
         break;
 


More information about the Libreoffice-commits mailing list