summaryrefslogtreecommitdiff
path: root/sw/source/core/bastyp/calc.cxx
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2020-08-26 10:59:10 +0200
committerLászló Németh <nemeth@numbertext.org>2020-08-27 09:17:17 +0200
commit79681f6a35ebf70293136034d675d312c5b6cdee (patch)
tree60efd46a0ffbc10ccf47d9cdd6fb1cb3b7c58af0 /sw/source/core/bastyp/calc.cxx
parent894a0f77c12f3ac4029bdeb671943f32bcad875c (diff)
tdf#123356 sw: add table formula COUNT
for DOCX interoperability. See also commit f1f27b2487ccfb7a03190ff68eadbfb611dd9749 (tdf#123356 DOCX import: fix COUNT formula). Change-Id: I951944ed92bcbed3388f5d7e364e7ff104f37d1d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101395 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.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index 6e06fbd52e53..9e206144e13e 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -85,6 +85,7 @@ const char sCalc_Round[]= "round";
const char sCalc_Date[] = "date";
const char sCalc_Product[] = "product";
const char sCalc_Average[] = "average";
+const char sCalc_Count[]= "count";
// ATTENTION: sorted list of all operators
struct CalcOp
@@ -104,6 +105,7 @@ CalcOp const aOpTable[] = {
/* ATAN */ {{sCalc_Atan}, CALC_ATAN}, // Arc tangent
/* AVERAGE */ {{sCalc_Average}, CALC_MEAN}, // Mean (since LibreOffice 7.1)
/* COS */ {{sCalc_Cos}, CALC_COS}, // Cosine
+/* COUNT */ {{sCalc_Count}, CALC_COUNT}, // Count (since LibreOffice 7.1)
/* DATE */ {{sCalc_Date}, CALC_DATE}, // Date
/* DIV */ {{sCalc_Div}, CALC_DIV}, // Division
/* EQ */ {{sCalc_Eq}, CALC_EQ}, // Equality
@@ -668,6 +670,7 @@ SwCalcOper SwCalc::GetToken()
{
case CALC_SUM:
case CALC_MEAN:
+ case CALC_COUNT:
m_eCurrListOper = CALC_PLUS;
break;
case CALC_MIN:
@@ -1186,6 +1189,16 @@ SwSbxValue SwCalc::PrimFunc(bool &rChkPow)
return nErg;
break;
}
+ case CALC_COUNT:
+ {
+ SAL_INFO("sw.calc", "count");
+ m_nListPor = 1;
+ GetToken();
+ SwSbxValue nErg = Expr();
+ nErg.PutDouble( m_nListPor );
+ return nErg;
+ break;
+ }
case CALC_SQRT:
{
SAL_INFO("sw.calc", "sqrt");