diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2015-11-22 17:42:08 +0100 |
---|---|---|
committer | Mike Kaganski <mikekaganski@hotmail.com> | 2015-11-24 22:03:10 +0000 |
commit | d667e3210b12c7ce3b3727e2a0e369a520fbaaa4 (patch) | |
tree | dbceb51cdab2c9205e483a859a34f1a838cbc9e6 /sw | |
parent | 994d80fd53bc264cef92017dba5cbab1241e5a5b (diff) |
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@libreoffice.org>
Reviewed-by: Mike Kaganski <mikekaganski@hotmail.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/bastyp/calc.cxx | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index 1317ec2bb204..8b12d87e7bb4 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; |