From 305c8993788b32685a1e6bfc8999fd8a43fcfdaf Mon Sep 17 00:00:00 2001 From: László Németh Date: Wed, 26 Aug 2020 12:41:02 +0200 Subject: tdf#123390 sw: add table formula SIGN MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- sw/source/core/bastyp/calc.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'sw/source/core/bastyp/calc.cxx') 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"); -- cgit v1.2.3