diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2015-11-22 17:42:08 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-11-26 12:26:40 +0000 |
commit | 238a02cb567768ff0d7338ddab87441ec5e5d470 (patch) | |
tree | 2171e698b8415f16104efa48257477824aebefd6 | |
parent | f7d1ea37a557d904caecb080deab162bd70e1a87 (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>
(cherry picked from commit d667e3210b12c7ce3b3727e2a0e369a520fbaaa4)
Reviewed-on: https://gerrit.libreoffice.org/20159
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-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 1eb97f33e5e9..4e82bb4004f6 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; |