diff options
author | László Németh <nemeth@numbertext.org> | 2020-08-26 12:41:02 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-08-27 09:18:30 +0200 |
commit | 305c8993788b32685a1e6bfc8999fd8a43fcfdaf (patch) | |
tree | 88cdd7feb1267283dd2c0fdf9b4ebf623ee58854 /sw/source/core/bastyp/calc.cxx | |
parent | a2b48254e4ce731edcdbd2f3fa9f6720ae676ae8 (diff) |
tdf#123390 sw: add table formula SIGN
for DOCX interoperability.
See also commit 4d9b72d1c3929eca04c7a2e363ab6214676b0f64
(tdf#123390 DOCX import: fix SIGN formula).
Change-Id: I60896e2bf8fb96b8a71d426d50fdea3d212854b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101398
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/source/core/bastyp/calc.cxx')
-rw-r--r-- | sw/source/core/bastyp/calc.cxx | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index 9e206144e13e..3750aead867c 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -86,6 +86,7 @@ const char sCalc_Date[] = "date"; const char sCalc_Product[] = "product"; const char sCalc_Average[] = "average"; const char sCalc_Count[]= "count"; +const char sCalc_Sign[]= "sign"; // ATTENTION: sorted list of all operators struct CalcOp @@ -124,6 +125,7 @@ CalcOp const aOpTable[] = { /* POW */ {{sCalc_Pow}, CALC_POW}, // Exponentiation /* PRODUCT */ {{sCalc_Product}, CALC_PRODUCT}, // Product (since LibreOffice 7.1) /* ROUND */ {{sCalc_Round}, CALC_ROUND}, // Rounding +/* SIGN */ {{sCalc_Sign}, CALC_SIGN}, // Sign (since LibreOffice 7.1) /* SIN */ {{sCalc_Sin}, CALC_SIN}, // Sine /* SQRT */ {{sCalc_Sqrt}, CALC_SQRT}, // Square root /* SUB */ {{sCalc_Sub}, CALC_MINUS}, // Subtraction @@ -1070,6 +1072,16 @@ SwSbxValue SwCalc::PrimFunc(bool &rChkPow) SAL_INFO("sw.calc", "acos"); return StdFunc(&acos, true); break; + case CALC_SIGN: + { + SAL_INFO("sw.calc", "sign"); + SwSbxValue nErg; + GetToken(); + double nVal = Prim().GetDouble(); + nErg.PutDouble( int(0 < nVal) - int(nVal < 0) ); + return nErg; + break; + } case CALC_NOT: { SAL_INFO("sw.calc", "not"); |