LibreOffice Module sc (master)  1
xlformula.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <xlformula.hxx>
21 
22 #include <refdata.hxx>
23 #include <tokenarray.hxx>
24 #include <xestream.hxx>
25 #include <xistream.hxx>
26 #include <xlroot.hxx>
27 
28 #include <comphelper/string.hxx>
29 #include <svl/sharedstringpool.hxx>
30 
31 using namespace ::formula;
32 
33 // Function data ==============================================================
34 
36 {
37  if( IsMacroFunc() )
38  return OUString( mpcMacroName, strlen(mpcMacroName), RTL_TEXTENCODING_UTF8 );
39  return OUString();
40 }
41 
43 {
44  if( IsAddInEquivalent() )
45  return OUString( mpcMacroName, strlen(mpcMacroName), RTL_TEXTENCODING_UTF8 );
46  return OUString();
47 }
48 
49 // abbreviations for function return token class
53 
54 // abbreviations for parameter infos
55 #define RO { EXC_PARAM_REGULAR, EXC_PARAMCONV_ORG, false }
56 #define RA { EXC_PARAM_REGULAR, EXC_PARAMCONV_ARR, false }
57 #define RR { EXC_PARAM_REGULAR, EXC_PARAMCONV_RPT, false }
58 #define RX { EXC_PARAM_REGULAR, EXC_PARAMCONV_RPX, false }
59 #define VO { EXC_PARAM_REGULAR, EXC_PARAMCONV_ORG, true }
60 #define VV { EXC_PARAM_REGULAR, EXC_PARAMCONV_VAL, true }
61 #define VA { EXC_PARAM_REGULAR, EXC_PARAMCONV_ARR, true }
62 #define VR { EXC_PARAM_REGULAR, EXC_PARAMCONV_RPT, true }
63 #define VX { EXC_PARAM_REGULAR, EXC_PARAMCONV_RPX, true }
64 #define RO_E { EXC_PARAM_EXCELONLY, EXC_PARAMCONV_ORG, false }
65 #define VR_E { EXC_PARAM_EXCELONLY, EXC_PARAMCONV_RPT, true }
66 #define C { EXC_PARAM_CALCONLY, EXC_PARAMCONV_ORG, false }
67 
68 const sal_uInt16 NOID = SAL_MAX_UINT16;
69 const sal_uInt8 MX = 30;
70 
71 #define EXC_FUNCNAME( ascii ) "_xlfn." ascii
72 #define EXC_FUNCNAME_ODF( ascii ) "_xlfnodf." ascii
73 #define EXC_FUNCNAME_ADDIN( ascii ) "com.sun.star.sheet.addin." ascii
74 
77 {
78  { ocCount, 0, 0, MX, V, { RX }, 0, nullptr },
79  { ocIf, 1, 2, 3, R, { VO, RO }, 0, nullptr },
80  { ocIsNA, 2, 1, 1, V, { VR }, 0, nullptr },
81  { ocIsError, 3, 1, 1, V, { VR }, 0, nullptr },
82  { ocSum, 4, 0, MX, V, { RX }, 0, nullptr },
83  { ocAverage, 5, 1, MX, V, { RX }, 0, nullptr },
84  { ocMin, 6, 1, MX, V, { RX }, 0, nullptr },
85  { ocMax, 7, 1, MX, V, { RX }, 0, nullptr },
86  { ocRow, 8, 0, 1, V, { RO }, 0, nullptr },
87  { ocColumn, 9, 0, 1, V, { RO }, 0, nullptr },
88  { ocNotAvail, 10, 0, 0, V, {}, 0, nullptr },
89  { ocNPV, 11, 2, MX, V, { VR, RX }, 0, nullptr },
90  { ocStDev, 12, 1, MX, V, { RX }, 0, nullptr },
91  { ocCurrency, 13, 1, 2, V, { VR }, 0, nullptr },
92  { ocFixed, 14, 1, 2, V, { VR, VR, C }, 0, nullptr },
93  { ocSin, 15, 1, 1, V, { VR }, 0, nullptr },
94  { ocCosecant, 15, 1, 1, V, { VR }, EXC_FUNCFLAG_EXPORTONLY, nullptr },
95  { ocCos, 16, 1, 1, V, { VR }, 0, nullptr },
96  { ocSecant, 16, 1, 1, V, { VR }, EXC_FUNCFLAG_EXPORTONLY, nullptr },
97  { ocTan, 17, 1, 1, V, { VR }, 0, nullptr },
98  { ocCot, 17, 1, 1, V, { VR }, EXC_FUNCFLAG_EXPORTONLY, nullptr },
99  { ocArcTan, 18, 1, 1, V, { VR }, 0, nullptr },
100  { ocArcCot, 18, 1, 1, V, { VR }, EXC_FUNCFLAG_EXPORTONLY, nullptr },
101  { ocPi, 19, 0, 0, V, {}, 0, nullptr },
102  { ocSqrt, 20, 1, 1, V, { VR }, 0, nullptr },
103  { ocExp, 21, 1, 1, V, { VR }, 0, nullptr },
104  { ocLn, 22, 1, 1, V, { VR }, 0, nullptr },
105  { ocLog10, 23, 1, 1, V, { VR }, 0, nullptr },
106  { ocAbs, 24, 1, 1, V, { VR }, 0, nullptr },
107  { ocInt, 25, 1, 1, V, { VR }, 0, nullptr },
108  { ocPlusMinus, 26, 1, 1, V, { VR }, 0, nullptr },
109  { ocRound, 27, 2, 2, V, { VR }, 0, nullptr },
110  { ocLookup, 28, 2, 3, V, { VR, RA }, 0, nullptr },
111  { ocIndex, 29, 2, 4, R, { RA, VV }, 0, nullptr },
112  { ocRept, 30, 2, 2, V, { VR }, 0, nullptr },
113  { ocMid, 31, 3, 3, V, { VR }, 0, nullptr },
114  { ocLen, 32, 1, 1, V, { VR }, 0, nullptr },
115  { ocValue, 33, 1, 1, V, { VR }, 0, nullptr },
116  { ocTrue, 34, 0, 0, V, {}, 0, nullptr },
117  { ocFalse, 35, 0, 0, V, {}, 0, nullptr },
118  { ocAnd, 36, 1, MX, V, { RX }, 0, nullptr },
119  { ocOr, 37, 1, MX, V, { RX }, 0, nullptr },
120  { ocNot, 38, 1, 1, V, { VR }, 0, nullptr },
121  { ocMod, 39, 2, 2, V, { VR }, 0, nullptr },
122  { ocDBCount, 40, 3, 3, V, { RO, RR }, 0, nullptr },
123  { ocDBSum, 41, 3, 3, V, { RO, RR }, 0, nullptr },
124  { ocDBAverage, 42, 3, 3, V, { RO, RR }, 0, nullptr },
125  { ocDBMin, 43, 3, 3, V, { RO, RR }, 0, nullptr },
126  { ocDBMax, 44, 3, 3, V, { RO, RR }, 0, nullptr },
127  { ocDBStdDev, 45, 3, 3, V, { RO, RR }, 0, nullptr },
128  { ocVar, 46, 1, MX, V, { RX }, 0, nullptr },
129  { ocDBVar, 47, 3, 3, V, { RO, RR }, 0, nullptr },
130  { ocText, 48, 2, 2, V, { VR }, 0, nullptr },
131  { ocLinest, 49, 1, 2, A, { RA, RA, C, C }, 0, nullptr },
132  { ocTrend, 50, 1, 3, A, { RA, RA, RA, C }, 0, nullptr },
133  { ocLogest, 51, 1, 2, A, { RA, RA, C, C }, 0, nullptr },
134  { ocGrowth, 52, 1, 3, A, { RA, RA, RA, C }, 0, nullptr },
135  { ocPV, 56, 3, 5, V, { VR }, 0, nullptr },
136  { ocFV, 57, 3, 5, V, { VR }, 0, nullptr },
137  { ocNper, 58, 3, 5, V, { VR }, 0, nullptr },
138  { ocPMT, 59, 3, 5, V, { VR }, 0, nullptr },
139  { ocRate, 60, 3, 6, V, { VR }, 0, nullptr },
140  { ocMIRR, 61, 3, 3, V, { RA, VR }, 0, nullptr },
141  { ocIRR, 62, 1, 2, V, { RA, VR }, 0, nullptr },
142  { ocRandom, 63, 0, 0, V, {}, EXC_FUNCFLAG_VOLATILE, nullptr },
143  { ocMatch, 64, 2, 3, V, { VR, RX, RR }, 0, nullptr },
144  { ocGetDate, 65, 3, 3, V, { VR }, 0, nullptr },
145  { ocGetTime, 66, 3, 3, V, { VR }, 0, nullptr },
146  { ocGetDay, 67, 1, 1, V, { VR }, 0, nullptr },
147  { ocGetMonth, 68, 1, 1, V, { VR }, 0, nullptr },
148  { ocGetYear, 69, 1, 1, V, { VR }, 0, nullptr },
149  { ocGetDayOfWeek, 70, 1, 1, V, { VR, C }, 0, nullptr },
150  { ocGetHour, 71, 1, 1, V, { VR }, 0, nullptr },
151  { ocGetMin, 72, 1, 1, V, { VR }, 0, nullptr },
152  { ocGetSec, 73, 1, 1, V, { VR }, 0, nullptr },
153  { ocGetActTime, 74, 0, 0, V, {}, EXC_FUNCFLAG_VOLATILE, nullptr },
154  { ocAreas, 75, 1, 1, V, { RO }, 0, nullptr },
155  { ocRows, 76, 1, 1, V, { RO }, 0, nullptr },
156  { ocColumns, 77, 1, 1, V, { RO }, 0, nullptr },
157  { ocOffset, 78, 3, 5, R, { RO, VR }, EXC_FUNCFLAG_VOLATILE, nullptr },
158  { ocSearch, 82, 2, 3, V, { VR }, 0, nullptr },
159  { ocMatTrans, 83, 1, 1, A, { VO }, 0, nullptr },
160  { ocType, 86, 1, 1, V, { VX }, 0, nullptr },
161  { ocArcTan2, 97, 2, 2, V, { VR }, 0, nullptr },
162  { ocArcSin, 98, 1, 1, V, { VR }, 0, nullptr },
163  { ocArcCos, 99, 1, 1, V, { VR }, 0, nullptr },
164  { ocChoose, 100, 2, MX, R, { VO, RO }, 0, nullptr },
165  { ocHLookup, 101, 3, 3, V, { VV, RO, RO, C }, 0, nullptr },
166  { ocVLookup, 102, 3, 3, V, { VV, RO, RO, C }, 0, nullptr },
167  { ocIsRef, 105, 1, 1, V, { RX }, 0, nullptr },
168  { ocLog, 109, 1, 2, V, { VR }, 0, nullptr },
169  { ocChar, 111, 1, 1, V, { VR }, 0, nullptr },
170  { ocLower, 112, 1, 1, V, { VR }, 0, nullptr },
171  { ocUpper, 113, 1, 1, V, { VR }, 0, nullptr },
172  { ocProper, 114, 1, 1, V, { VR }, 0, nullptr },
173  { ocLeft, 115, 1, 2, V, { VR }, 0, nullptr },
174  { ocRight, 116, 1, 2, V, { VR }, 0, nullptr },
175  { ocExact, 117, 2, 2, V, { VR }, 0, nullptr },
176  { ocTrim, 118, 1, 1, V, { VR }, 0, nullptr },
177  { ocReplace, 119, 4, 4, V, { VR }, 0, nullptr },
178  { ocSubstitute, 120, 3, 4, V, { VR }, 0, nullptr },
179  { ocCode, 121, 1, 1, V, { VR }, 0, nullptr },
180  { ocFind, 124, 2, 3, V, { VR }, 0, nullptr },
181  { ocCell, 125, 1, 2, V, { VV, RO }, EXC_FUNCFLAG_VOLATILE, nullptr },
182  { ocIsErr, 126, 1, 1, V, { VR }, 0, nullptr },
183  { ocIsString, 127, 1, 1, V, { VR }, 0, nullptr },
184  { ocIsValue, 128, 1, 1, V, { VR }, 0, nullptr },
185  { ocIsEmpty, 129, 1, 1, V, { VR }, 0, nullptr },
186  { ocT, 130, 1, 1, V, { RO }, 0, nullptr },
187  { ocN, 131, 1, 1, V, { RO }, 0, nullptr },
188  { ocGetDateValue, 140, 1, 1, V, { VR }, 0, nullptr },
189  { ocGetTimeValue, 141, 1, 1, V, { VR }, 0, nullptr },
190  { ocSLN, 142, 3, 3, V, { VR }, 0, nullptr },
191  { ocSYD, 143, 4, 4, V, { VR }, 0, nullptr },
192  { ocDDB, 144, 4, 5, V, { VR }, 0, nullptr },
193  { ocIndirect, 148, 1, 2, R, { VR }, EXC_FUNCFLAG_VOLATILE, nullptr },
194  { ocClean, 162, 1, 1, V, { VR }, 0, nullptr },
195  { ocMatDet, 163, 1, 1, V, { VA }, 0, nullptr },
196  { ocMatInv, 164, 1, 1, A, { VA }, 0, nullptr },
197  { ocMatMult, 165, 2, 2, A, { VA }, 0, nullptr },
198  { ocIpmt, 167, 4, 6, V, { VR }, 0, nullptr },
199  { ocPpmt, 168, 4, 6, V, { VR }, 0, nullptr },
200  { ocCount2, 169, 0, MX, V, { RX }, 0, nullptr },
201  { ocProduct, 183, 0, MX, V, { RX }, 0, nullptr },
202  { ocFact, 184, 1, 1, V, { VR }, 0, nullptr },
203  { ocDBProduct, 189, 3, 3, V, { RO, RR }, 0, nullptr },
204  { ocIsNonString, 190, 1, 1, V, { VR }, 0, nullptr },
205  { ocStDevP, 193, 1, MX, V, { RX }, 0, nullptr },
206  { ocVarP, 194, 1, MX, V, { RX }, 0, nullptr },
207  { ocDBStdDevP, 195, 3, 3, V, { RO, RR }, 0, nullptr },
208  { ocDBVarP, 196, 3, 3, V, { RO, RR }, 0, nullptr },
209  { ocTrunc, 197, 1, 1, V, { VR, C }, 0, nullptr },
210  { ocIsLogical, 198, 1, 1, V, { VR }, 0, nullptr },
211  { ocDBCount2, 199, 3, 3, V, { RO, RR }, 0, nullptr },
212  { ocCurrency, 204, 1, 2, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, nullptr },
213  { ocFindB, 205, 2, 3, V, { VR }, 0, nullptr },
214  { ocSearchB, 206, 2, 3, V, { VR }, 0, nullptr },
215  { ocReplaceB, 207, 4, 4, V, { VR }, 0, nullptr },
216  { ocLeftB, 208, 1, 2, V, { VR }, 0, nullptr },
217  { ocRightB, 209, 1, 2, V, { VR }, 0, nullptr },
218  { ocMidB, 210, 3, 3, V, { VR }, 0, nullptr },
219  { ocLenB, 211, 1, 1, V, { VR }, 0, nullptr },
220  { ocRoundUp, 212, 2, 2, V, { VR }, 0, nullptr },
221  { ocRoundDown, 213, 2, 2, V, { VR }, 0, nullptr },
222  { ocExternal, 255, 1, MX, R, { RO_E, RO }, EXC_FUNCFLAG_IMPORTONLY, nullptr }
223 };
224 
227 {
228  { ocLinest, 49, 1, 4, A, { RA, RA, VV }, 0, nullptr }, // BIFF2: 1-2, BIFF3: 1-4
229  { ocTrend, 50, 1, 4, A, { RA, RA, RA, VV }, 0, nullptr }, // BIFF2: 1-3, BIFF3: 1-4
230  { ocLogest, 51, 1, 4, A, { RA, RA, VV }, 0, nullptr }, // BIFF2: 1-2, BIFF3: 1-4
231  { ocGrowth, 52, 1, 4, A, { RA, RA, RA, VV }, 0, nullptr }, // BIFF2: 1-3, BIFF3: 1-4
232  { ocTrunc, 197, 1, 2, V, { VR }, 0, nullptr }, // BIFF2: 1, BIFF3: 1-2
233  { ocAddress, 219, 2, 5, V, { VR }, 0, nullptr },
234  { ocGetDiffDate360, 220, 2, 2, V, { VR, VR, C }, 0, nullptr },
235  { ocGetActDate, 221, 0, 0, V, {}, EXC_FUNCFLAG_VOLATILE, nullptr },
236  { ocVBD, 222, 5, 7, V, { VR }, 0, nullptr },
237  { ocMedian, 227, 1, MX, V, { RX }, 0, nullptr },
238  { ocSumProduct, 228, 1, MX, V, { VA }, 0, nullptr },
239  { ocSinHyp, 229, 1, 1, V, { VR }, 0, nullptr },
240  { ocCosecantHyp, 229, 1, 1, V, { VR }, EXC_FUNCFLAG_EXPORTONLY, nullptr },
241  { ocCosHyp, 230, 1, 1, V, { VR }, 0, nullptr },
242  { ocSecantHyp, 230, 1, 1, V, { VR }, EXC_FUNCFLAG_EXPORTONLY, nullptr },
243  { ocTanHyp, 231, 1, 1, V, { VR }, 0, nullptr },
244  { ocCotHyp, 231, 1, 1, V, { VR }, EXC_FUNCFLAG_EXPORTONLY, nullptr },
245  { ocArcSinHyp, 232, 1, 1, V, { VR }, 0, nullptr },
246  { ocArcCosHyp, 233, 1, 1, V, { VR }, 0, nullptr },
247  { ocArcTanHyp, 234, 1, 1, V, { VR }, 0, nullptr },
248  { ocArcCotHyp, 234, 1, 1, V, { VR }, EXC_FUNCFLAG_EXPORTONLY, nullptr },
249  { ocDBGet, 235, 3, 3, V, { RO, RR }, 0, nullptr },
250  { ocInfo, 244, 1, 1, V, { VR }, EXC_FUNCFLAG_VOLATILE, nullptr }
251 };
252 
255 {
256  { ocFixed, 14, 1, 3, V, { VR }, 0, nullptr }, // BIFF2-3: 1-2, BIFF4: 1-3
257  { ocAsc, 214, 1, 1, V, { VR }, 0, nullptr },
258  { ocJis, 215, 1, 1, V, { VR }, 0, nullptr },
259  { ocRank, 216, 2, 3, V, { VR, RO, VR }, 0, nullptr },
260  { ocDB, 247, 4, 5, V, { VR }, 0, nullptr },
261  { ocFrequency, 252, 2, 2, A, { RA }, 0, nullptr },
262  { ocErrorType_ODF, 261, 1, 1, V, { VR }, 0, nullptr },
263  { ocAveDev, 269, 1, MX, V, { RX }, 0, nullptr },
264  { ocBetaDist, 270, 3, 5, V, { VR }, 0, nullptr },
265  { ocGammaLn, 271, 1, 1, V, { VR }, 0, nullptr },
266  { ocBetaInv, 272, 3, 5, V, { VR }, 0, nullptr },
267  { ocBinomDist, 273, 4, 4, V, { VR }, 0, nullptr },
268  { ocChiDist, 274, 2, 2, V, { VR }, 0, nullptr },
269  { ocChiInv, 275, 2, 2, V, { VR }, 0, nullptr },
270  { ocCombin, 276, 2, 2, V, { VR }, 0, nullptr },
271  { ocConfidence, 277, 3, 3, V, { VR }, 0, nullptr },
272  { ocCritBinom, 278, 3, 3, V, { VR }, 0, nullptr },
273  { ocEven, 279, 1, 1, V, { VR }, 0, nullptr },
274  { ocExpDist, 280, 3, 3, V, { VR }, 0, nullptr },
275  { ocFDist, 281, 3, 3, V, { VR }, 0, nullptr },
276  { ocFInv, 282, 3, 3, V, { VR }, 0, nullptr },
277  { ocFisher, 283, 1, 1, V, { VR }, 0, nullptr },
278  { ocFisherInv, 284, 1, 1, V, { VR }, 0, nullptr },
279  { ocFloor_MS, 285, 2, 2, V, { VR }, 0, nullptr },
280  { ocGammaDist, 286, 4, 4, V, { VR }, 0, nullptr },
281  { ocGammaInv, 287, 3, 3, V, { VR }, 0, nullptr },
282  { ocCeil_MS, 288, 2, 2, V, { VR }, 0, nullptr },
283  { ocHypGeomDist, 289, 4, 4, V, { VR }, 0, nullptr },
284  { ocLogNormDist, 290, 3, 3, V, { VR }, 0, nullptr },
285  { ocLogInv, 291, 3, 3, V, { VR }, 0, nullptr },
286  { ocNegBinomVert, 292, 3, 3, V, { VR }, 0, nullptr },
287  { ocNormDist, 293, 4, 4, V, { VR }, 0, nullptr },
288  { ocStdNormDist, 294, 1, 1, V, { VR }, 0, nullptr },
289  { ocNormInv, 295, 3, 3, V, { VR }, 0, nullptr },
290  { ocSNormInv, 296, 1, 1, V, { VR }, 0, nullptr },
291  { ocStandard, 297, 3, 3, V, { VR }, 0, nullptr },
292  { ocOdd, 298, 1, 1, V, { VR }, 0, nullptr },
293  { ocPermut, 299, 2, 2, V, { VR }, 0, nullptr },
294  { ocPoissonDist, 300, 3, 3, V, { VR }, 0, nullptr },
295  { ocTDist, 301, 3, 3, V, { VR }, 0, nullptr },
296  { ocWeibull, 302, 4, 4, V, { VR }, 0, nullptr },
297  { ocSumXMY2, 303, 2, 2, V, { VA }, 0, nullptr },
298  { ocSumX2MY2, 304, 2, 2, V, { VA }, 0, nullptr },
299  { ocSumX2DY2, 305, 2, 2, V, { VA }, 0, nullptr },
300  { ocChiTest, 306, 2, 2, V, { VA }, 0, nullptr },
301  { ocCorrel, 307, 2, 2, V, { VA }, 0, nullptr },
302  { ocCovar, 308, 2, 2, V, { VA }, 0, nullptr },
303  { ocForecast, 309, 3, 3, V, { VR, VA }, 0, nullptr },
304  { ocFTest, 310, 2, 2, V, { VA }, 0, nullptr },
305  { ocIntercept, 311, 2, 2, V, { VA }, 0, nullptr },
306  { ocPearson, 312, 2, 2, V, { VA }, 0, nullptr },
307  { ocRSQ, 313, 2, 2, V, { VA }, 0, nullptr },
308  { ocSTEYX, 314, 2, 2, V, { VA }, 0, nullptr },
309  { ocSlope, 315, 2, 2, V, { VA }, 0, nullptr },
310  { ocTTest, 316, 4, 4, V, { VA, VA, VR }, 0, nullptr },
311  { ocProb, 317, 3, 4, V, { VA, VA, VR }, 0, nullptr },
312  { ocDevSq, 318, 1, MX, V, { RX }, 0, nullptr },
313  { ocGeoMean, 319, 1, MX, V, { RX }, 0, nullptr },
314  { ocHarMean, 320, 1, MX, V, { RX }, 0, nullptr },
315  { ocSumSQ, 321, 0, MX, V, { RX }, 0, nullptr },
316  { ocKurt, 322, 1, MX, V, { RX }, 0, nullptr },
317  { ocSkew, 323, 1, MX, V, { RX }, 0, nullptr },
318  { ocZTest, 324, 2, 3, V, { RX, VR }, 0, nullptr },
319  { ocLarge, 325, 2, 2, V, { RX, VR }, 0, nullptr },
320  { ocSmall, 326, 2, 2, V, { RX, VR }, 0, nullptr },
321  { ocQuartile, 327, 2, 2, V, { RX, VR }, 0, nullptr },
322  { ocPercentile, 328, 2, 2, V, { RX, VR }, 0, nullptr },
323  { ocPercentrank, 329, 2, 3, V, { RX, VR, VR_E }, 0, nullptr },
324  { ocModalValue, 330, 1, MX, V, { VA }, 0, nullptr },
325  { ocTrimMean, 331, 2, 2, V, { RX, VR }, 0, nullptr },
326  { ocTInv, 332, 2, 2, V, { VR }, 0, nullptr },
327  // Functions equivalent to add-in functions, use same parameters as
328  // ocExternal but add programmatical function name (here without
329  // "com.sun.star.sheet.addin.") so it can be looked up and stored as
330  // add-in, as older Excel versions only know them as add-in.
331  { ocIsEven, 255, 1, MX, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY | EXC_FUNCFLAG_ADDINEQUIV, EXC_FUNCNAME_ADDIN( "Analysis.getIseven" ) },
332  { ocIsOdd, 255, 1, MX, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY | EXC_FUNCFLAG_ADDINEQUIV, EXC_FUNCNAME_ADDIN( "Analysis.getIsodd" ) },
333  { ocGCD, 255, 1, MX, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY | EXC_FUNCFLAG_ADDINEQUIV, EXC_FUNCNAME_ADDIN( "Analysis.getGcd" ) },
334  { ocLCM, 255, 1, MX, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY | EXC_FUNCFLAG_ADDINEQUIV, EXC_FUNCNAME_ADDIN( "Analysis.getLcm" ) },
335  { ocEffect, 255, 1, MX, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY | EXC_FUNCFLAG_ADDINEQUIV, EXC_FUNCNAME_ADDIN( "Analysis.getEffect" ) },
336  { ocCumPrinc, 255, 1, MX, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY | EXC_FUNCFLAG_ADDINEQUIV, EXC_FUNCNAME_ADDIN( "Analysis.getCumprinc" ) },
337  { ocCumIpmt, 255, 1, MX, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY | EXC_FUNCFLAG_ADDINEQUIV, EXC_FUNCNAME_ADDIN( "Analysis.getCumipmt" ) },
338  { ocNominal, 255, 1, MX, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY | EXC_FUNCFLAG_ADDINEQUIV, EXC_FUNCNAME_ADDIN( "Analysis.getNominal" ) },
339  { ocNetWorkdays, 255, 1, MX, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY | EXC_FUNCFLAG_ADDINEQUIV, EXC_FUNCNAME_ADDIN( "Analysis.getNetworkdays" ) }
340 };
341 
344 {
345  { ocGetDayOfWeek, 70, 1, 2, V, { VR }, 0, nullptr }, // BIFF2-4: 1, BIFF5: 1-2
346  { ocHLookup, 101, 3, 4, V, { VV, RO, RO, VV }, 0, nullptr }, // BIFF2-4: 3, BIFF5: 3-4
347  { ocVLookup, 102, 3, 4, V, { VV, RO, RO, VV }, 0, nullptr }, // BIFF2-4: 3, BIFF5: 3-4
348  { ocGetDiffDate360, 220, 2, 3, V, { VR }, 0, nullptr }, // BIFF3-4: 2, BIFF5: 2-3
349  { ocMacro, 255, 1, MX, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY, nullptr },
350  { ocExternal, 255, 1, MX, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY, nullptr },
351  { ocConcat, 336, 0, MX, V, { VR }, 0, nullptr },
352  { ocPower, 337, 2, 2, V, { VR }, 0, nullptr },
353  { ocRad, 342, 1, 1, V, { VR }, 0, nullptr },
354  { ocDeg, 343, 1, 1, V, { VR }, 0, nullptr },
355  { ocSubTotal, 344, 2, MX, V, { VR, RO }, 0, nullptr },
356  { ocSumIf, 345, 2, 3, V, { RO, VR, RO }, 0, nullptr },
357  { ocCountIf, 346, 2, 2, V, { RO, VR }, 0, nullptr },
358  { ocCountEmptyCells, 347, 1, 1, V, { RO }, 0, nullptr },
359  { ocISPMT, 350, 4, 4, V, { VR }, 0, nullptr },
360  { ocGetDateDif, 351, 3, 3, V, { VR }, 0, nullptr },
361  { ocNoName, 352, 1, 1, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, nullptr }, // DATESTRING
362  { ocNoName, 353, 2, 2, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, nullptr }, // NUMBERSTRING
363  { ocRoman, 354, 1, 2, V, { VR }, 0, nullptr }
364 };
365 
368 {
369  { ocGetPivotData, 358, 2, MX, V, { RR, RR, VR }, 0, nullptr },
370  { ocHyperLink, 359, 1, 2, V, { VV, VO }, 0, nullptr },
371  { ocNoName, 360, 1, 1, V, { RO }, EXC_FUNCFLAG_IMPORTONLY, nullptr }, // PHONETIC
372  { ocAverageA, 361, 1, MX, V, { RX }, 0, nullptr },
373  { ocMaxA, 362, 1, MX, V, { RX }, 0, nullptr },
374  { ocMinA, 363, 1, MX, V, { RX }, 0, nullptr },
375  { ocStDevPA, 364, 1, MX, V, { RX }, 0, nullptr },
376  { ocVarPA, 365, 1, MX, V, { RX }, 0, nullptr },
377  { ocStDevA, 366, 1, MX, V, { RX }, 0, nullptr },
378  { ocVarA, 367, 1, MX, V, { RX }, 0, nullptr },
379  { ocBahtText, 368, 1, 1, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, EXC_FUNCNAME( "BAHTTEXT" ) },
380  { ocBahtText, 255, 2, 2, V, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY, EXC_FUNCNAME( "BAHTTEXT" ) },
381  { ocEuroConvert, 255, 4, 6, V, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY, "EUROCONVERT" }
382 };
383 
384 #define EXC_FUNCENTRY_V_VR( opcode, minparam, maxparam, flags, asciiname ) \
385  { opcode, NOID, minparam, maxparam, V, { VR }, EXC_FUNCFLAG_IMPORTONLY|(flags), EXC_FUNCNAME( asciiname ) }, \
386  { opcode, 255, (minparam)+1, (maxparam)+1, V, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY|(flags), EXC_FUNCNAME( asciiname ) }
387 
390 {
392  { ocCountIfs, 255, 3, MX, V, { RO_E, RO, VR }, EXC_FUNCFLAG_EXPORTONLY|EXC_FUNCFLAG_PARAMPAIRS, EXC_FUNCNAME( "COUNTIFS" ) },
394  { ocSumIfs, 255, 4, MX, V, { RO_E, RO, RO, VR }, EXC_FUNCFLAG_EXPORTONLY|EXC_FUNCFLAG_PARAMPAIRS, EXC_FUNCNAME( "SUMIFS" ) },
395  { ocAverageIf, NOID, 2, 3, V, { RO, VR, RO }, EXC_FUNCFLAG_IMPORTONLY, EXC_FUNCNAME( "AVERAGEIF" ) },
396  { ocAverageIf, 255, 3, 4, V, { RO_E, RO, VR, RO }, EXC_FUNCFLAG_EXPORTONLY, EXC_FUNCNAME( "AVERAGEIF" ) },
398  { ocAverageIfs, 255, 4, MX, V, { RO_E, RO, RO, VR }, EXC_FUNCFLAG_EXPORTONLY|EXC_FUNCFLAG_PARAMPAIRS, EXC_FUNCNAME( "AVERAGEIFS" ) },
399  { ocIfError, NOID, 2, 2, V, { VO, RO }, EXC_FUNCFLAG_IMPORTONLY, EXC_FUNCNAME( "IFERROR" ) },
400  { ocIfError, 255, 3, 3, V, { RO_E, VO, RO }, EXC_FUNCFLAG_EXPORTONLY, EXC_FUNCNAME( "IFERROR" ) },
401  { ocNetWorkdays_MS, NOID, 2, 4, V, { VR, VR, RO, RO }, EXC_FUNCFLAG_IMPORTONLY, EXC_FUNCNAME( "NETWORKDAYS.INTL" ) },
402  { ocNetWorkdays_MS, 255, 3, 5, V, { RO_E, VR, VR, RO, RO }, EXC_FUNCFLAG_EXPORTONLY, EXC_FUNCNAME( "NETWORKDAYS.INTL" ) },
403  { ocWorkday_MS, NOID, 2, 4, V, { VR, VR, VR, RO }, EXC_FUNCFLAG_IMPORTONLY, EXC_FUNCNAME( "WORKDAY.INTL" ) },
404  { ocWorkday_MS, 255, 3, 5, V, { RO_E, VR, VR, VR, RO }, EXC_FUNCFLAG_EXPORTONLY, EXC_FUNCNAME( "WORKDAY.INTL" ) },
405  EXC_FUNCENTRY_V_VR( ocCeil_ISO, 1, 2, 0, "ISO.CEILING" )
406 };
407 
408 #define EXC_FUNCENTRY_V_VR_IMPORT( opcode, minparam, maxparam, flags, asciiname ) \
409  { opcode, NOID, minparam, maxparam, V, { VR }, EXC_FUNCFLAG_IMPORTONLY|(flags), EXC_FUNCNAME( asciiname ) }
410 
411 #define EXC_FUNCENTRY_V_RO_EXPORT( opcode, minparam, maxparam, flags, asciiname ) \
412  { opcode, 255, (minparam)+1, (maxparam)+1, V, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY|(flags), EXC_FUNCNAME( asciiname ) }
413 
414 #define EXC_FUNCENTRY_A_VR( opcode, minparam, maxparam, flags, asciiname ) \
415  { opcode, NOID, minparam, maxparam, A, { VR }, EXC_FUNCFLAG_IMPORTONLY|(flags), EXC_FUNCNAME( asciiname ) }, \
416  { opcode, 255, (minparam)+1, (maxparam)+1, A, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY|(flags), EXC_FUNCNAME( asciiname ) }
417 
418 #define EXC_FUNCENTRY_V_RO( opcode, minparam, maxparam, flags, asciiname ) \
419  { opcode, NOID, minparam, maxparam, V, { RO }, EXC_FUNCFLAG_IMPORTONLY|(flags), EXC_FUNCNAME( asciiname ) }, \
420  { opcode, 255, (minparam)+1, (maxparam)+1, V, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY|(flags), EXC_FUNCNAME( asciiname ) }
421 
422 // implicit maxparam=MX
423 #define EXC_FUNCENTRY_V_RX( opcode, minparam, maxparam, flags, asciiname ) \
424  { opcode, NOID, minparam, MX, V, { RX }, EXC_FUNCFLAG_IMPORTONLY|(flags), EXC_FUNCNAME( asciiname ) }, \
425  { opcode, 255, (minparam)+1, MX, V, { RO_E, RX }, EXC_FUNCFLAG_EXPORTONLY|(flags), EXC_FUNCNAME( asciiname ) }
426 
427 #define EXC_FUNCENTRY_V_VA( opcode, minparam, maxparam, flags, asciiname ) \
428  { opcode, NOID, minparam, maxparam, V, { VA }, EXC_FUNCFLAG_IMPORTONLY|(flags), EXC_FUNCNAME( asciiname ) }, \
429  { opcode, 255, (minparam)+1, (maxparam)+1, V, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY|(flags), EXC_FUNCNAME( asciiname ) }
430 
439 {
440  EXC_FUNCENTRY_V_VA( ocCovarianceP, 2, 2, 0, "COVARIANCE.P" ),
441  EXC_FUNCENTRY_V_VA( ocCovarianceS, 2, 2, 0, "COVARIANCE.S" ),
442  EXC_FUNCENTRY_V_RX( ocStDevP_MS, 1, MX, 0, "STDEV.P" ),
443  EXC_FUNCENTRY_V_RX( ocStDevS, 1, MX, 0, "STDEV.S" ),
444  EXC_FUNCENTRY_V_RX( ocVarP_MS, 1, MX, 0, "VAR.P" ),
445  EXC_FUNCENTRY_V_RX( ocVarS, 1, MX, 0, "VAR.S" ),
446  EXC_FUNCENTRY_V_VR( ocBetaDist_MS, 4, 6, 0, "BETA.DIST" ),
447  EXC_FUNCENTRY_V_VR( ocBetaInv_MS, 3, 5, 0, "BETA.INV" ),
448  EXC_FUNCENTRY_V_VR( ocBinomDist_MS, 4, 4, 0, "BINOM.DIST" ),
449  EXC_FUNCENTRY_V_VR( ocBinomInv, 3, 3, 0, "BINOM.INV" ),
450  EXC_FUNCENTRY_V_VR( ocChiSqDist_MS, 3, 3, 0, "CHISQ.DIST" ),
451  EXC_FUNCENTRY_V_VR( ocChiSqInv_MS, 2, 2, 0, "CHISQ.INV" ),
452  EXC_FUNCENTRY_V_VR( ocChiDist_MS, 2, 2, 0, "CHISQ.DIST.RT" ),
453  EXC_FUNCENTRY_V_VR( ocChiInv_MS, 2, 2, 0, "CHISQ.INV.RT" ),
454  EXC_FUNCENTRY_V_VR( ocChiTest_MS, 2, 2, 0, "CHISQ.TEST" ),
455  EXC_FUNCENTRY_V_VR( ocConfidence_N, 3, 3, 0, "CONFIDENCE.NORM" ),
456  EXC_FUNCENTRY_V_VR( ocConfidence_T, 3, 3, 0, "CONFIDENCE.T" ),
457  EXC_FUNCENTRY_V_VR( ocFDist_LT, 4, 4, 0, "F.DIST" ),
458  EXC_FUNCENTRY_V_VR( ocFDist_RT, 3, 3, 0, "F.DIST.RT" ),
459  EXC_FUNCENTRY_V_VR( ocFInv_LT, 3, 3, 0, "F.INV" ),
460  EXC_FUNCENTRY_V_VR( ocFInv_RT, 3, 3, 0, "F.INV.RT" ),
461  EXC_FUNCENTRY_V_VR( ocFTest_MS, 2, 2, 0, "F.TEST" ),
462  EXC_FUNCENTRY_V_VR( ocExpDist_MS, 3, 3, 0, "EXPON.DIST" ),
463  EXC_FUNCENTRY_V_VR( ocHypGeomDist_MS, 5, 5, 0, "HYPGEOM.DIST" ),
464  EXC_FUNCENTRY_V_VR( ocPoissonDist_MS, 3, 3, 0, "POISSON.DIST" ),
465  EXC_FUNCENTRY_V_VR( ocWeibull_MS, 4, 4, 0, "WEIBULL.DIST" ),
466  EXC_FUNCENTRY_V_VR( ocGammaDist_MS, 4, 4, 0, "GAMMA.DIST" ),
467  EXC_FUNCENTRY_V_VR( ocGammaInv_MS, 3, 3, 0, "GAMMA.INV" ),
468  EXC_FUNCENTRY_V_VR( ocGammaLn_MS, 1, 1, 0, "GAMMALN.PRECISE" ),
469  EXC_FUNCENTRY_V_VR( ocLogNormDist_MS, 4, 4, 0, "LOGNORM.DIST" ),
470  EXC_FUNCENTRY_V_VR( ocLogInv_MS, 3, 3, 0, "LOGNORM.INV" ),
471  EXC_FUNCENTRY_V_VR( ocNormDist_MS, 4, 4, 0, "NORM.DIST" ),
472  EXC_FUNCENTRY_V_VR( ocNormInv_MS, 3, 3, 0, "NORM.INV" ),
473  EXC_FUNCENTRY_V_VR( ocStdNormDist_MS, 2, 2, 0, "NORM.S.DIST" ),
474  EXC_FUNCENTRY_V_VR( ocSNormInv_MS, 1, 1, 0, "NORM.S.INV" ),
475  EXC_FUNCENTRY_V_VR( ocTDist_2T, 2, 2, 0, "T.DIST.2T" ),
476  EXC_FUNCENTRY_V_VR( ocTDist_MS, 3, 3, 0, "T.DIST" ),
477  EXC_FUNCENTRY_V_VR( ocTDist_RT, 2, 2, 0, "T.DIST.RT" ),
478  EXC_FUNCENTRY_V_VR( ocTInv_2T, 2, 2, 0, "T.INV.2T" ),
479  EXC_FUNCENTRY_V_VR( ocTInv_MS, 2, 2, 0, "T.INV" ),
480  EXC_FUNCENTRY_V_VR( ocTTest_MS, 4, 4, 0, "T.TEST" ),
481  EXC_FUNCENTRY_V_VR( ocPercentile_Inc, 2, 2, 0, "PERCENTILE.INC" ),
482  EXC_FUNCENTRY_V_VR( ocPercentrank_Inc, 2, 3, 0, "PERCENTRANK.INC" ),
483  EXC_FUNCENTRY_V_VR( ocQuartile_Inc, 2, 2, 0, "QUARTILE.INC" ),
484  EXC_FUNCENTRY_V_VR( ocRank_Eq, 2, 3, 0, "RANK.EQ" ),
485  EXC_FUNCENTRY_V_VR( ocPercentile_Exc, 2, 2, 0, "PERCENTILE.EXC" ),
486  EXC_FUNCENTRY_V_VR( ocPercentrank_Exc, 2, 3, 0, "PERCENTRANK.EXC" ),
487  EXC_FUNCENTRY_V_VR( ocQuartile_Exc, 2, 2, 0, "QUARTILE.EXC" ),
488  EXC_FUNCENTRY_V_VR( ocRank_Avg, 2, 3, 0, "RANK.AVG" ),
489  EXC_FUNCENTRY_V_RX( ocModalValue_MS, 1, MX, 0, "MODE.SNGL" ),
490  EXC_FUNCENTRY_V_RX( ocModalValue_Multi, 1, MX, 0, "MODE.MULT" ),
491  EXC_FUNCENTRY_V_VR( ocNegBinomDist_MS, 4, 4, 0, "NEGBINOM.DIST" ),
492  EXC_FUNCENTRY_V_VR( ocZTest_MS, 2, 3, 0, "Z.TEST" ),
493  EXC_FUNCENTRY_V_VR( ocCeil_Precise, 1, 2, 0, "CEILING.PRECISE" ),
494  EXC_FUNCENTRY_V_VR( ocFloor_Precise, 1, 2, 0, "FLOOR.PRECISE" ),
495  EXC_FUNCENTRY_V_VR( ocErf_MS, 1, 1, 0, "ERF.PRECISE" ),
496  EXC_FUNCENTRY_V_VR( ocErfc_MS, 1, 1, 0, "ERFC.PRECISE" ),
497  EXC_FUNCENTRY_V_RX( ocAggregate, 3, MX, 0, "AGGREGATE" ),
498 };
499 
518 {
519  EXC_FUNCENTRY_V_VR_IMPORT( ocArcCot, 1, 1, 0, "ACOT" ),
520  EXC_FUNCENTRY_V_VR_IMPORT( ocArcCotHyp, 1, 1, 0, "ACOTH" ),
521  EXC_FUNCENTRY_V_VR( ocArabic, 1, 1, 0, "ARABIC" ),
522  EXC_FUNCENTRY_V_VR( ocBase, 2, 3, 0, "BASE" ),
523  EXC_FUNCENTRY_V_VR( ocB, 3, 4, 0, "BINOM.DIST.RANGE" ),
524  EXC_FUNCENTRY_V_VR( ocBitAnd, 2, 2, 0, "BITAND" ),
525  EXC_FUNCENTRY_V_VR( ocBitLshift, 2, 2, 0, "BITLSHIFT" ),
526  EXC_FUNCENTRY_V_VR( ocBitOr, 2, 2, 0, "BITOR" ),
527  EXC_FUNCENTRY_V_VR( ocBitRshift, 2, 2, 0, "BITRSHIFT" ),
528  EXC_FUNCENTRY_V_VR( ocBitXor, 2, 2, 0, "BITXOR" ),
529  EXC_FUNCENTRY_V_VR( ocCeil_Math, 1, 3, 0, "CEILING.MATH" ),
530  EXC_FUNCENTRY_V_RO_EXPORT( ocCeil, 1, 3, 0, "CEILING.MATH" ),
531  EXC_FUNCENTRY_V_VR( ocCombinA, 2, 2, 0, "COMBINA" ),
532  EXC_FUNCENTRY_V_VR_IMPORT( ocCot, 1, 1, 0, "COT" ),
533  EXC_FUNCENTRY_V_VR_IMPORT( ocCotHyp, 1, 1, 0, "COTH" ),
534  EXC_FUNCENTRY_V_VR_IMPORT( ocCosecant, 1, 1, 0, "CSC" ),
535  EXC_FUNCENTRY_V_VR_IMPORT( ocCosecantHyp, 1, 1, 0, "CSCH" ),
536  EXC_FUNCENTRY_V_VR( ocGetDiffDate, 2, 2, 0, "DAYS" ),
537  EXC_FUNCENTRY_V_VR( ocDecimal, 2, 2, 0, "DECIMAL" ),
538  EXC_FUNCENTRY_V_VR( ocEncodeURL, 1, 1, 0, "ENCODEURL" ),
539  // NOTE: this FDIST is not our LEGACY.FDIST
540  EXC_FUNCENTRY_V_VR( ocNoName, 3, 4, 0, "FDIST" ),
541  // NOTE: this FINV is not our LEGACY.FINV
542  EXC_FUNCENTRY_V_VR( ocNoName, 3, 3, 0, "FINV" ),
543  EXC_FUNCENTRY_V_VR( ocFilterXML, 2, 2, 0, "FILTERXML" ),
544  EXC_FUNCENTRY_V_VR( ocFloor_Math, 1, 3, 0, "FLOOR.MATH" ),
545  EXC_FUNCENTRY_V_RO_EXPORT( ocFloor, 1, 3, 0, "FLOOR.MATH" ),
546  EXC_FUNCENTRY_V_RO( ocFormula, 1, 1, 0, "FORMULATEXT" ),
547  EXC_FUNCENTRY_V_VR( ocGamma, 1, 1, 0, "GAMMA" ),
548  EXC_FUNCENTRY_V_VR( ocGauss, 1, 1, 0, "GAUSS" ),
549  { ocIfNA, NOID, 2, 2, V, { VO, RO }, EXC_FUNCFLAG_IMPORTONLY, EXC_FUNCNAME( "IFNA" ) },
550  { ocIfNA, 255, 3, 3, V, { RO_E, VO, RO }, EXC_FUNCFLAG_EXPORTONLY, EXC_FUNCNAME( "IFNA" ) },
551  // IMCOSH, IMCOT, IMCSC, IMCSCH, IMSEC, IMSECH, IMSINH and IMTAN are
552  // implemented in the Analysis Add-In.
553  EXC_FUNCENTRY_V_RO( ocIsFormula, 1, 1, 0, "ISFORMULA" ),
554  EXC_FUNCENTRY_V_VR( ocWeek, 1, 2, 0, "WEEKNUM" ),
555  EXC_FUNCENTRY_V_VR( ocIsoWeeknum, 1, 1, 0, "ISOWEEKNUM" ),
556  EXC_FUNCENTRY_A_VR( ocMatrixUnit, 1, 1, 0, "MUNIT" ),
557  EXC_FUNCENTRY_V_VR( ocNumberValue, 1, 3, 0, "NUMBERVALUE" ),
558  EXC_FUNCENTRY_V_VR( ocPDuration, 3, 3, 0, "PDURATION" ),
559  EXC_FUNCENTRY_V_VR( ocPermutationA, 2, 2, 0, "PERMUTATIONA" ),
560  EXC_FUNCENTRY_V_VR( ocPhi, 1, 1, 0, "PHI" ),
561  EXC_FUNCENTRY_V_VR( ocRRI, 3, 3, 0, "RRI" ),
562  EXC_FUNCENTRY_V_VR_IMPORT( ocSecant, 1, 1, 0, "SEC" ),
563  EXC_FUNCENTRY_V_VR_IMPORT( ocSecantHyp, 1, 1, 0, "SECH" ),
564  EXC_FUNCENTRY_V_RO( ocSheet, 0, 1, 0, "SHEET" ),
565  EXC_FUNCENTRY_V_RO( ocSheets, 0, 1, 0, "SHEETS" ),
566  EXC_FUNCENTRY_V_RX( ocSkewp, 1, MX, 0, "SKEW.P" ),
567  EXC_FUNCENTRY_V_VR( ocUnichar, 1, 1, 0, "UNICHAR" ),
568  EXC_FUNCENTRY_V_VR( ocUnicode, 1, 1, 0, "UNICODE" ),
569  EXC_FUNCENTRY_V_VR( ocWebservice, 1, 1, 0, "WEBSERVICE" ),
570  EXC_FUNCENTRY_V_RX( ocXor, 1, MX, 0, "XOR" ),
571  EXC_FUNCENTRY_V_VR( ocErrorType_ODF, 1, 1, 0, "ERROR.TYPE" )
572 };
573 
582 {
583  EXC_FUNCENTRY_V_VR( ocForecast_ETS_ADD, 3, 6, 0, "FORECAST.ETS" ),
584  EXC_FUNCENTRY_V_VR( ocForecast_ETS_PIA, 3, 7, 0, "FORECAST.ETS.CONFINT" ),
585  EXC_FUNCENTRY_V_VR( ocForecast_ETS_SEA, 2, 4, 0, "FORECAST.ETS.SEASONALITY" ),
586  EXC_FUNCENTRY_V_VR( ocForecast_ETS_STA, 3, 6, 0, "FORECAST.ETS.STAT" ),
587  EXC_FUNCENTRY_V_VR( ocForecast_LIN, 3, 3, 0, "FORECAST.LINEAR" ),
588  EXC_FUNCENTRY_V_VR( ocConcat_MS, 1, MX, 0, "CONCAT" ),
589  EXC_FUNCENTRY_V_VR( ocTextJoin_MS, 3, MX, 0, "TEXTJOIN" ),
590  EXC_FUNCENTRY_V_VR( ocIfs_MS, 2, MX, 0, "IFS" ),
591  EXC_FUNCENTRY_V_VR( ocSwitch_MS, 3, MX, 0, "SWITCH" ),
592  EXC_FUNCENTRY_V_VR( ocMinIfs_MS, 3, MX, 0, "MINIFS" ),
593  EXC_FUNCENTRY_V_VR( ocMaxIfs_MS, 3, MX, 0, "MAXIFS" )
594 };
595 
596 #define EXC_FUNCENTRY_ODF( opcode, minparam, maxparam, flags, asciiname ) \
597  { opcode, NOID, minparam, maxparam, V, { VR }, EXC_FUNCFLAG_IMPORTONLY|(flags), EXC_FUNCNAME_ODF( asciiname ) }, \
598  { opcode, 255, (minparam)+1, (maxparam)+1, V, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY|(flags), EXC_FUNCNAME_ODF( asciiname ) }
599 
602 {
603  EXC_FUNCENTRY_ODF( ocChiSqDist, 2, 3, 0, "CHISQDIST" ),
604  EXC_FUNCENTRY_ODF( ocChiSqInv, 2, 2, 0, "CHISQINV" )
605 };
606 
607 #undef EXC_FUNCENTRY_ODF
608 
609 #define EXC_FUNCENTRY_OOO( opcode, minparam, maxparam, flags, asciiname ) \
610  { opcode, NOID, minparam, maxparam, V, { VR }, EXC_FUNCFLAG_IMPORTONLY|(flags), EXC_FUNCNAME( asciiname ) }, \
611  { opcode, 255, (minparam)+1, (maxparam)+1, V, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY|(flags), EXC_FUNCNAME( asciiname ) }
612 
613 // Import Broken Raw ... even without leading _xlfn.
614 #define EXC_FUNCENTRY_OOO_IBR( opcode, minparam, maxparam, flags, asciiname ) \
615  { opcode, NOID, minparam, maxparam, V, { VR }, EXC_FUNCFLAG_IMPORTONLY|(flags), asciiname }
616 
619 {
620  EXC_FUNCENTRY_OOO( ocErrorType, 1, 1, 0, "ORG.OPENOFFICE.ERRORTYPE" ),
621  EXC_FUNCENTRY_OOO_IBR( ocErrorType, 1, 1, 0, "ERRORTYPE" ), // was written wrongly, read it
622  EXC_FUNCENTRY_OOO( ocMultiArea, 1, MX, 0, "ORG.OPENOFFICE.MULTIRANGE" ),
623  EXC_FUNCENTRY_OOO_IBR( ocMultiArea, 1, MX, 0, "MULTIRANGE" ), // was written wrongly, read it
624  EXC_FUNCENTRY_OOO( ocBackSolver, 3, 3, 0, "ORG.OPENOFFICE.GOALSEEK" ),
625  EXC_FUNCENTRY_OOO_IBR( ocBackSolver,3, 3, 0, "GOALSEEK" ), // was written wrongly, read it
626  EXC_FUNCENTRY_OOO( ocEasterSunday, 1, 1, 0, "ORG.OPENOFFICE.EASTERSUNDAY" ),
627  EXC_FUNCENTRY_OOO_IBR( ocEasterSunday,1,1, 0, "EASTERSUNDAY" ), // was written wrongly, read it
628  EXC_FUNCENTRY_OOO( ocCurrent, 0, 0, 0, "ORG.OPENOFFICE.CURRENT" ),
629  EXC_FUNCENTRY_OOO_IBR( ocCurrent, 0, 0, 0, "CURRENT" ), // was written wrongly, read it
630  EXC_FUNCENTRY_OOO( ocStyle, 1, 3, 0, "ORG.OPENOFFICE.STYLE" ),
631  EXC_FUNCENTRY_OOO_IBR( ocStyle, 1, 3, 0, "STYLE" ), // was written wrongly, read it
632  EXC_FUNCENTRY_OOO( ocConvertOOo, 3, 3, 0, "ORG.OPENOFFICE.CONVERT" ),
633  EXC_FUNCENTRY_OOO( ocColor, 3, 4, 0, "ORG.LIBREOFFICE.COLOR" ),
634  EXC_FUNCENTRY_OOO( ocRawSubtract, 2, MX, 0, "ORG.LIBREOFFICE.RAWSUBTRACT" ),
635  EXC_FUNCENTRY_OOO( ocWeeknumOOo, 2, 2, 0, "ORG.LIBREOFFICE.WEEKNUM_OOO" ),
636  EXC_FUNCENTRY_OOO( ocForecast_ETS_MUL, 3, 6, 0, "ORG.LIBREOFFICE.FORECAST.ETS.MULT" ),
637  EXC_FUNCENTRY_OOO( ocForecast_ETS_PIM, 3, 7, 0, "ORG.LIBREOFFICE.FORECAST.ETS.PI.MULT" ),
638  EXC_FUNCENTRY_OOO( ocForecast_ETS_STM, 3, 6, 0, "ORG.LIBREOFFICE.FORECAST.ETS.STAT.MULT" ),
639  EXC_FUNCENTRY_OOO( ocRoundSig, 2, 2, 0, "ORG.LIBREOFFICE.ROUNDSIG" ),
640  EXC_FUNCENTRY_OOO( ocRegex, 2, 4, 0, "ORG.LIBREOFFICE.REGEX" ),
641  EXC_FUNCENTRY_OOO( ocFourier, 2, 5, 0, "ORG.LIBREOFFICE.FOURIER" ),
642  EXC_FUNCENTRY_OOO( ocRandomNV, 0, 0, 0, "ORG.LIBREOFFICE.RAND.NV" ),
643  EXC_FUNCENTRY_OOO( ocRandbetweenNV, 2, 2, 0, "ORG.LIBREOFFICE.RANDBETWEEN.NV" )
644 };
645 
646 #undef EXC_FUNCENTRY_OOO_IBR
647 #undef EXC_FUNCENTRY_OOO
648 
650 {
651  void (XclFunctionProvider::*pFillFunc)( const XclFunctionInfo*, const XclFunctionInfo* ) =
653 
654  /* Only read/write functions supported in the current BIFF version.
655  Function tables from later BIFF versions may overwrite single functions
656  from earlier tables. */
657  XclBiff eBiff = rRoot.GetBiff();
658  if( eBiff >= EXC_BIFF2 )
659  (this->*pFillFunc)(saFuncTable_2, saFuncTable_2 + SAL_N_ELEMENTS(saFuncTable_2));
660  if( eBiff >= EXC_BIFF3 )
661  (this->*pFillFunc)(saFuncTable_3, saFuncTable_3 + SAL_N_ELEMENTS(saFuncTable_3));
662  if( eBiff >= EXC_BIFF4 )
663  (this->*pFillFunc)(saFuncTable_4, saFuncTable_4 + SAL_N_ELEMENTS(saFuncTable_4));
664  if( eBiff >= EXC_BIFF5 )
665  (this->*pFillFunc)(saFuncTable_5, saFuncTable_5 + SAL_N_ELEMENTS(saFuncTable_5));
666  if( eBiff >= EXC_BIFF8 )
667  (this->*pFillFunc)(saFuncTable_8, saFuncTable_8 + SAL_N_ELEMENTS(saFuncTable_8));
668  (this->*pFillFunc)(saFuncTable_Oox, saFuncTable_Oox + SAL_N_ELEMENTS(saFuncTable_Oox));
669  (this->*pFillFunc)(saFuncTable_2010, saFuncTable_2010 + SAL_N_ELEMENTS(saFuncTable_2010));
670  (this->*pFillFunc)(saFuncTable_2013, saFuncTable_2013 + SAL_N_ELEMENTS(saFuncTable_2013));
671  (this->*pFillFunc)(saFuncTable_2016, saFuncTable_2016 + SAL_N_ELEMENTS(saFuncTable_2016));
672  (this->*pFillFunc)(saFuncTable_Odf, saFuncTable_Odf + SAL_N_ELEMENTS(saFuncTable_Odf));
673  (this->*pFillFunc)(saFuncTable_OOoLO, saFuncTable_OOoLO + SAL_N_ELEMENTS(saFuncTable_OOoLO));
674 }
675 
677 {
678  // only in import filter allowed
679  OSL_ENSURE( !maXclFuncMap.empty(), "XclFunctionProvider::GetFuncInfoFromXclFunc - wrong filter" );
680  XclFuncMap::const_iterator aIt = maXclFuncMap.find( nXclFunc );
681  return (aIt == maXclFuncMap.end()) ? nullptr : aIt->second;
682 }
683 
684 const XclFunctionInfo* XclFunctionProvider::GetFuncInfoFromXclMacroName( const OUString& rXclMacroName ) const
685 {
686  // only in import filter allowed, but do not test maXclMacroNameMap, it may be empty for old BIFF versions
687  OSL_ENSURE( !maXclFuncMap.empty(), "XclFunctionProvider::GetFuncInfoFromXclMacroName - wrong filter" );
688  XclMacroNameMap::const_iterator aIt = maXclMacroNameMap.find( rXclMacroName );
689  return (aIt == maXclMacroNameMap.end()) ? nullptr : aIt->second;
690 }
691 
693 {
694  // only in export filter allowed
695  OSL_ENSURE( !maScFuncMap.empty(), "XclFunctionProvider::GetFuncInfoFromOpCode - wrong filter" );
696  ScFuncMap::const_iterator aIt = maScFuncMap.find( eOpCode );
697  return (aIt == maScFuncMap.end()) ? nullptr : aIt->second;
698 }
699 
701 {
702  for( const XclFunctionInfo* pIt = pBeg; pIt != pEnd; ++pIt )
703  {
704  if( !::get_flag( pIt->mnFlags, EXC_FUNCFLAG_EXPORTONLY ) )
705  {
706  if( pIt->mnXclFunc != NOID )
707  maXclFuncMap[ pIt->mnXclFunc ] = pIt;
708  if( pIt->IsMacroFunc() )
709  maXclMacroNameMap[ pIt->GetMacroFuncName() ] = pIt;
710  }
711  }
712 }
713 
715 {
716  for( const XclFunctionInfo* pIt = pBeg; pIt != pEnd; ++pIt )
717  if( !::get_flag( pIt->mnFlags, EXC_FUNCFLAG_IMPORTONLY ) )
718  maScFuncMap[ pIt->meOpCode ] = pIt;
719 }
720 
721 // Token array ================================================================
722 
723 XclTokenArray::XclTokenArray( bool bVolatile ) :
724  mbVolatile( bVolatile )
725 {
726 }
727 
728 XclTokenArray::XclTokenArray( ScfUInt8Vec& rTokVec, ScfUInt8Vec& rExtDataVec, bool bVolatile ) :
729  mbVolatile( bVolatile )
730 {
731  maTokVec.swap( rTokVec );
732  maExtDataVec.swap( rExtDataVec );
733 }
734 
735 sal_uInt16 XclTokenArray::GetSize() const
736 {
737  OSL_ENSURE( maTokVec.size() <= 0xFFFF, "XclTokenArray::GetSize - array too long" );
738  return limit_cast< sal_uInt16 >( maTokVec.size() );
739 }
740 
742 {
743  sal_uInt16 nSize;
744  nSize = rStrm.ReaduInt16();
745  maTokVec.resize( nSize );
746 }
747 
749 {
750  if( !maTokVec.empty() )
751  rStrm.Read(maTokVec.data(), GetSize());
752 }
753 
755 {
756  ReadSize( rStrm );
757  ReadArray( rStrm );
758 }
759 
761 {
762  rStrm << GetSize();
763 }
764 
766 {
767  if( !maTokVec.empty() )
768  rStrm.Write(maTokVec.data(), GetSize());
769  if( !maExtDataVec.empty() )
770  rStrm.Write(maExtDataVec.data(), maExtDataVec.size());
771 }
772 
773 void XclTokenArray::Write( XclExpStream& rStrm ) const
774 {
775  WriteSize( rStrm );
776  WriteArray( rStrm );
777 }
778 
779 bool XclTokenArray::operator==( const XclTokenArray& rTokArr ) const
780 {
781  return (mbVolatile == rTokArr.mbVolatile) && (maTokVec == rTokArr.maTokVec) && (maExtDataVec == rTokArr.maExtDataVec);
782 }
783 
785 {
786  rTokArr.Read( rStrm );
787  return rStrm;
788 }
789 
791 {
792  rTokArr.Write( rStrm );
793  return rStrm;
794 }
795 
797 {
798  if( rxTokArr )
799  rxTokArr->Write( rStrm );
800  else
801  rStrm << sal_uInt16( 0 );
802  return rStrm;
803 }
804 
806  mppScTokenBeg( nullptr ),
807  mppScTokenEnd( nullptr ),
808  mppScToken( nullptr ),
809  mbSkipSpaces( false )
810 {
811 }
812 
813 XclTokenArrayIterator::XclTokenArrayIterator( const ScTokenArray& rScTokArr, bool bSkipSpaces )
814 {
815  Init( rScTokArr, bSkipSpaces );
816 }
817 
819  mppScTokenBeg( rTokArrIt.mppScTokenBeg ),
820  mppScTokenEnd( rTokArrIt.mppScTokenEnd ),
821  mppScToken( rTokArrIt.mppScToken ),
822  mbSkipSpaces( bSkipSpaces )
823 {
824  SkipSpaces();
825 }
826 
827 void XclTokenArrayIterator::Init( const ScTokenArray& rScTokArr, bool bSkipSpaces )
828 {
829  sal_uInt16 nTokArrLen = rScTokArr.GetLen();
830  mppScTokenBeg = static_cast< const FormulaToken* const* >( nTokArrLen ? rScTokArr.GetArray() : nullptr );
831  mppScTokenEnd = mppScTokenBeg ? (mppScTokenBeg + nTokArrLen) : nullptr;
833  mbSkipSpaces = bSkipSpaces;
834  SkipSpaces();
835 }
836 
838 {
839  NextRawToken();
840  SkipSpaces();
841  return *this;
842 }
843 
845 {
846  if( mppScToken )
847  if( (++mppScToken == mppScTokenEnd) || !*mppScToken )
848  mppScToken = nullptr;
849 }
850 
852 {
853  if( mbSkipSpaces )
854  while( Is() && ((*this)->GetOpCode() == ocSpaces) )
855  NextRawToken();
856 }
857 
858 // strings and string lists ---------------------------------------------------
859 
860 bool XclTokenArrayHelper::GetTokenString( OUString& rString, const FormulaToken& rScToken )
861 {
862  bool bIsStr = (rScToken.GetType() == svString) && (rScToken.GetOpCode() == ocPush);
863  if( bIsStr ) rString = rScToken.GetString().getString();
864  return bIsStr;
865 }
866 
867 bool XclTokenArrayHelper::GetString( OUString& rString, const ScTokenArray& rScTokArr )
868 {
869  XclTokenArrayIterator aIt( rScTokArr, true );
870  // something is following the string token -> error
871  return aIt.Is() && GetTokenString( rString, *aIt ) && !++aIt;
872 }
873 
874 bool XclTokenArrayHelper::GetStringList( OUString& rStringList, const ScTokenArray& rScTokArr, sal_Unicode cSep )
875 {
876  bool bRet = true;
877  XclTokenArrayIterator aIt( rScTokArr, true );
878  enum { STATE_START, STATE_STR, STATE_SEP, STATE_END } eState = STATE_START;
879  while( eState != STATE_END ) switch( eState )
880  {
881  case STATE_START:
882  eState = aIt.Is() ? STATE_STR : STATE_END;
883  break;
884  case STATE_STR:
885  {
886  OUString aString;
887  bRet = GetTokenString( aString, *aIt );
888  if( bRet ) rStringList += aString ;
889  eState = (bRet && (++aIt).Is()) ? STATE_SEP : STATE_END;
890  break;
891  }
892  case STATE_SEP:
893  bRet = aIt->GetOpCode() == ocSep;
894  if( bRet ) rStringList += OUStringChar(cSep);
895  eState = (bRet && (++aIt).Is()) ? STATE_STR : STATE_END;
896  break;
897  default:;
898  }
899  return bRet;
900 }
901 
903  ScTokenArray& rScTokArr, svl::SharedStringPool& rSPool, sal_Unicode cStringSep )
904 {
905  OUString aString;
906  if( !GetString( aString, rScTokArr ) )
907  return;
908 
909  rScTokArr.Clear();
910  if (aString.isEmpty())
911  return;
912  sal_Int32 nStringIx = 0;
913  for (;;)
914  {
915  OUString aToken( aString.getToken( 0, cStringSep, nStringIx ) );
916  rScTokArr.AddString(rSPool.intern(comphelper::string::stripStart(aToken, ' ')));
917  if (nStringIx<0)
918  break;
919  rScTokArr.AddOpCode( ocSep );
920  }
921 }
922 
923 // multiple operations --------------------------------------------------------
924 
925 namespace {
926 
927 bool lclGetAddress( const ScDocument& rDoc, ScAddress& rAddress, const FormulaToken& rToken, const ScAddress& rPos )
928 {
929  OpCode eOpCode = rToken.GetOpCode();
930  bool bIsSingleRef = (eOpCode == ocPush) && (rToken.GetType() == svSingleRef);
931  if( bIsSingleRef )
932  {
933  const ScSingleRefData& rRef = *rToken.GetSingleRef();
934  rAddress = rRef.toAbs(rDoc, rPos);
935  bIsSingleRef = !rRef.IsDeleted();
936  }
937  return bIsSingleRef;
938 }
939 
940 } // namespace
941 
943  const ScDocument& rDoc,
944  XclMultipleOpRefs& rRefs, const ScTokenArray& rScTokArr, const ScAddress& rScPos )
945 {
946  rRefs.mbDblRefMode = false;
947  enum
948  {
949  stBegin, stTableOp, stOpen, stFormula, stFormulaSep,
950  stColFirst, stColFirstSep, stColRel, stColRelSep,
951  stRowFirst, stRowFirstSep, stRowRel, stClose, stError
952  } eState = stBegin; // last read token
953  for( XclTokenArrayIterator aIt( rScTokArr, true ); aIt.Is() && (eState != stError); ++aIt )
954  {
955  OpCode eOpCode = aIt->GetOpCode();
956  bool bIsSep = eOpCode == ocSep;
957  switch( eState )
958  {
959  case stBegin:
960  eState = (eOpCode == ocTableOp) ? stTableOp : stError;
961  break;
962  case stTableOp:
963  eState = (eOpCode == ocOpen) ? stOpen : stError;
964  break;
965  case stOpen:
966  eState = lclGetAddress(rDoc, rRefs.maFmlaScPos, *aIt, rScPos) ? stFormula : stError;
967  break;
968  case stFormula:
969  eState = bIsSep ? stFormulaSep : stError;
970  break;
971  case stFormulaSep:
972  eState = lclGetAddress(rDoc, rRefs.maColFirstScPos, *aIt, rScPos) ? stColFirst : stError;
973  break;
974  case stColFirst:
975  eState = bIsSep ? stColFirstSep : stError;
976  break;
977  case stColFirstSep:
978  eState = lclGetAddress(rDoc, rRefs.maColRelScPos, *aIt, rScPos) ? stColRel : stError;
979  break;
980  case stColRel:
981  eState = bIsSep ? stColRelSep : ((eOpCode == ocClose) ? stClose : stError);
982  break;
983  case stColRelSep:
984  eState = lclGetAddress(rDoc, rRefs.maRowFirstScPos, *aIt, rScPos) ? stRowFirst : stError;
985  rRefs.mbDblRefMode = true;
986  break;
987  case stRowFirst:
988  eState = bIsSep ? stRowFirstSep : stError;
989  break;
990  case stRowFirstSep:
991  eState = lclGetAddress(rDoc, rRefs.maRowRelScPos, *aIt, rScPos) ? stRowRel : stError;
992  break;
993  case stRowRel:
994  eState = (eOpCode == ocClose) ? stClose : stError;
995  break;
996  default:
997  eState = stError;
998  }
999  }
1000  return eState == stClose;
1001 }
1002 
1003 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const XclFunctionInfo * GetFuncInfoFromXclMacroName(const OUString &rXclMacroName) const
Returns the function data for an Excel function simulated by a macro call, or 0 on error...
Definition: xlformula.cxx:684
ocChoose
ocFloor_MS
const sal_uInt8 EXC_FUNCFLAG_VOLATILE
Number of parameter info entries.
Definition: xlformula.hxx:289
ocDBCount
ocProb
ocStDevP
ocN
svString
ocWeeknumOOo
ocVarPA
ocSqrt
::std::vector< sal_uInt8 > ScfUInt8Vec
Definition: ftools.hxx:252
ocBitAnd
ocPermutationA
ocBinomDist
std::size_t Write(const void *pData, std::size_t nBytes)
Writes nBytes bytes from memory.
Definition: xestream.cxx:215
ocLeft
const XclFunctionInfo saFuncTable_Odf[]
Functions defined by OpenFormula, but not supported by Calc (ocNoName) or by Excel (defined op-code)...
Definition: xlformula.cxx:601
const XclFunctionInfo * GetFuncInfoFromXclFunc(sal_uInt16 nXclFunc) const
Returns the function data for an Excel function index, or 0 on error.
Definition: xlformula.cxx:676
ocEven
bool Is() const
Definition: xlformula.hxx:449
XclBiff
An enumeration for all Excel file format types (BIFF types).
Definition: xlconst.hxx:30
ocHypGeomDist_MS
ocCell
SharedString intern(const OUString &rStr)
#define EXC_FUNCENTRY_V_VR(opcode, minparam, maxparam, flags, asciiname)
Definition: xlformula.cxx:384
ocConfidence_T
ScAddress maRowFirstScPos
Definition: xlformula.hxx:474
ocRawSubtract
ocLenB
ocErrorType_ODF
ocSumSQ
const sal_uInt8 V
Definition: xlformula.cxx:51
ocArcCotHyp
This class is used to export Excel record streams.
Definition: xestream.hxx:71
ocCosecantHyp
ocVar
ocNetWorkdays
ocPi
ocCeil_Precise
ocForecast_ETS_ADD
ocDevSq
ocChiSqDist
Single reference (one address) into the sheet.
Definition: refdata.hxx:30
ocFixed
ocRank
ocCos
void FillXclFuncMap(const XclFunctionInfo *pBeg, const XclFunctionInfo *pEnd)
Definition: xlformula.cxx:700
ocPDuration
ocTInv
const sal_uInt8 EXC_TOKCLASS_REF
00-1F: Base tokens.
Definition: xlformula.hxx:44
ocNormInv_MS
ocUpper
ocGrowth
ocCovarianceP
ocWeek
ScAddress toAbs(const ScSheetLimits &rLimits, const ScAddress &rPos) const
Definition: refdata.cxx:193
ocPpmt
ocDBMin
ocErrorType
ocWorkday_MS
ocIntercept
ocGeoMean
const sal_uInt8 EXC_FUNCFLAG_PARAMPAIRS
Only used in export filter.
Definition: xlformula.hxx:292
ocDBAverage
ocCurrent
ocRept
ocOffset
ocB
ocMatch
ocClean
ocSubTotal
ocForecast_ETS_STM
ocOpen
ocEncodeURL
ocCosecant
std::size_t Read(void *pData, std::size_t nBytes)
Reads nBytes bytes to the existing(!) buffer pData.
Definition: xistream.cxx:720
const sal_uInt16 NOID
Definition: xlformula.cxx:68
ocGetActTime
bool IsMacroFunc() const
Returns true, if the function is simulated by a macro call.
Definition: xlformula.hxx:333
ocDBSum
static bool GetStringList(OUString &rStringList, const ScTokenArray &rScTokArr, sal_Unicode cSep)
Parses the passed formula and tries to find a string token list, i.e.
Definition: xlformula.cxx:874
ocExp
ocIfNA
ocBackSolver
ocSLN
ocType
const sal_uInt8 EXC_TOKCLASS_ARR
40-5F: Value class tokens.
Definition: xlformula.hxx:46
static bool GetTokenString(OUString &rString, const ::formula::FormulaToken &rScToken)
Tries to extract a string from the passed token.
Definition: xlformula.cxx:860
ocTrend
ocLogNormDist
ocFInv_LT
ocLogNormDist_MS
ocGetSec
ocPV
ocProduct
ocConvertOOo
sal_uInt16 GetSize() const
Returns the size of the token array in bytes.
Definition: xlformula.cxx:735
OpCode GetOpCode() const
void Write(XclExpStream &rStrm) const
Writes size field and the tokens.
Definition: xlformula.cxx:773
ocPearson
ReturnType limit_cast(Type nValue, ReturnType nMin, ReturnType nMax)
Returns the value, if it is not less than nMin and not greater than nMax, otherwise one of the limits...
Definition: ftools.hxx:62
ocErfc_MS
#define EXC_FUNCENTRY_OOO(opcode, minparam, maxparam, flags, asciiname)
Definition: xlformula.cxx:609
ocChiDist_MS
ocIsString
ocQuartile
ocDBGet
ocSpaces
ocCount
ocChiInv
#define EXC_FUNCENTRY_V_VA(opcode, minparam, maxparam, flags, asciiname)
Definition: xlformula.cxx:427
ocRad
ocMin
ocChiTest_MS
ocVBD
ocGauss
ocModalValue_MS
ocText
ocSinHyp
#define EXC_FUNCENTRY_OOO_IBR(opcode, minparam, maxparam, flags, asciiname)
Definition: xlformula.cxx:614
ocRoman
ocLookup
void WriteSize(XclExpStream &rStrm) const
Writes the size field of the token array.
Definition: xlformula.cxx:760
ocAddress
ocCount2
ocUnichar
const sal_uInt8 EXC_FUNCFLAG_IMPORTONLY
Result is volatile (e.g. NOW() function).
Definition: xlformula.hxx:290
ocRow
ocGetPivotData
ocFInv
ocSTEYX
ocRegex
ocIf
ocLogInv
bool IsDeleted() const
Definition: refdata.cxx:125
ocLogest
ocGetTimeValue
ocGammaDist
ocQuartile_Exc
ocSYD
ocCumIpmt
ocGammaInv
ocFisherInv
ocLower
const sal_uInt8 A
Definition: xlformula.cxx:52
ocHLookup
virtual void Clear() override
Definition: token.cxx:1913
ocStDevS
sal_uInt16 sal_Unicode
ocIndex
ocForecast_ETS_STA
ocPhi
ocGammaInv_MS
ocForecast_LIN
ocDBProduct
#define VR_E
Definition: xlformula.cxx:65
#define VX
Definition: xlformula.cxx:63
ocMaxIfs_MS
const XclFunctionInfo saFuncTable_8[]
Functions new in BIFF8.
Definition: xlformula.cxx:367
ocMinIfs_MS
XclImpStream & operator>>(XclImpStream &rStrm, XclTokenArray &rTokArr)
Calls the Read() function at the passed token array.
Definition: xlformula.cxx:784
ocChiSqDist_MS
ocRSQ
ocCeil_ISO
MS Excel 4.0.
Definition: xlconst.hxx:35
#define SAL_MAX_UINT16
ocBetaDist
ocRound
ScAddress maFmlaScPos
Definition: xlformula.hxx:471
ocGetMin
OpCode
ocSumProduct
ocAbs
ocStDevA
ocForecast
void WriteArray(XclExpStream &rStrm) const
Writes the tokens of the token array (without size field).
Definition: xlformula.cxx:765
ocWeibull
ocIsoWeeknum
ocVarP_MS
ocGetTime
ocSNormInv
ocFInv_RT
ocIsOdd
ocSearch
ocArabic
ocReplace
const sal_uInt8 EXC_FUNCFLAG_ADDINEQUIV
Optional parameters are expected to appear in pairs.
Definition: xlformula.hxx:293
ocIsValue
ocNot
ocSearchB
ocFrequency
Is
#define VV
Definition: xlformula.cxx:60
ScAddress maColRelScPos
Definition: xlformula.hxx:473
ocGetDay
ocMid
ocBinomDist_MS
ocMedian
ocConfidence_N
#define EXC_FUNCNAME(ascii)
Maximum parameter count.
Definition: xlformula.cxx:71
ocTrim
ocCot
ocCorrel
ocCode
ocBitLshift
ocFTest_MS
ocT
ocIfError
ocGammaDist_MS
ocCovarianceS
XclMacroNameMap maXclMacroNameMap
Maps Excel function indexes to function data.
Definition: xlformula.hxx:367
ocDDB
bool mbSkipSpaces
Pointer to current token pointer of token array.
Definition: xlformula.hxx:465
ocColumns
sal_uInt16 GetLen() const
ocLinest
const XclFunctionInfo saFuncTable_OOoLO[]
Functions defined by Calc, but not in OpenFormula nor supported by Excel.
Definition: xlformula.cxx:618
const sal_uInt8 MX
No BIFF/OOBIN function identifier available.
Definition: xlformula.cxx:69
ocFourier
#define RA
Definition: xlformula.cxx:56
const ::formula::FormulaToken *const * mppScTokenEnd
Pointer to first token pointer of token array.
Definition: xlformula.hxx:463
ocSep
#define VO
Definition: xlformula.cxx:59
ocFloor_Math
#define SAL_N_ELEMENTS(arr)
ocVarP
ocCurrency
ocRank_Avg
ocPercentrank_Exc
ocInfo
const sal_uInt8 EXC_FUNCFLAG_EXPORTONLY
Only used in import filter.
Definition: xlformula.hxx:291
ocIsNonString
ocChiTest
ocSumIfs
ocArcTanHyp
ocHypGeomDist
ocPercentile_Inc
ocFisher
void ReadArray(XclImpStream &rStrm)
Reads the tokens of the token array (without size field).
Definition: xlformula.cxx:748
ocSumX2MY2
ocEffect
ocDBMax
ocAverageA
ocPower
ocNormInv
MS Excel 5.0, MS Excel 7.0 (95)
Definition: xlconst.hxx:36
ocChiSqInv_MS
ocBitOr
ocBinomInv
Represents information for a spreadsheet function for import and export.
Definition: xlformula.hxx:311
ocFTest
ocFind
ocArcCos
ocLog
ocFV
OUString GetAddInEquivalentFuncName() const
Returns the programmatical name of the Add-In function as string.
Definition: xlformula.cxx:42
ocPlusMinus
const XclFunctionInfo saFuncTable_3[]
Functions new in BIFF3.
Definition: xlformula.cxx:226
ocWeibull_MS
ocSkew
ocTDist_MS
ocChiInv_MS
ocNPV
ocTableOp
#define EXC_FUNCENTRY_A_VR(opcode, minparam, maxparam, flags, asciiname)
Definition: xlformula.cxx:414
ocMatDet
ocColor
ocCosHyp
ocArcCosHyp
ocPercentile
ocQuartile_Inc
ocPercentrank
const XclFunctionInfo * GetFuncInfoFromOpCode(OpCode eOpCode) const
Returns the function data for a Calc opcode, or 0 on error.
Definition: xlformula.cxx:692
ocMatInv
ocSheet
ScfUInt8Vec maExtDataVec
Byte vector containing token data.
Definition: xlformula.hxx:413
ocGetMonth
ocDBVar
ocErf_MS
ocPush
ocStyle
ScFuncMap maScFuncMap
Maps macro function names to function data.
Definition: xlformula.hxx:368
ocTDist
ocRank_Eq
#define VR
Definition: xlformula.cxx:62
ocForecast_ETS_PIM
ocRoundSig
ocSecantHyp
ocFloor
ocPoissonDist
ocMIRR
XclTokenArray(bool bVolatile=false)
Creates an empty token array.
Definition: xlformula.cxx:723
ocSlope
ocNotAvail
ocExternal
ocAverageIfs
ocMaxA
bool get_flag(Type nBitField, Type nMask)
Returns true, if at least one of the bits set in nMask is set in nBitField.
Definition: ftools.hxx:74
ocIsFormula
ocLog10
ocAreas
MS Excel 3.0.
Definition: xlconst.hxx:34
ocBetaDist_MS
ocSubstitute
FormulaToken ** GetArray() const
ocCeil
ocLCM
ocMax
ocGetDate
ocLogInv_MS
ocInt
ocHyperLink
ocForecast_ETS_PIA
ocExpDist_MS
ocForecast_ETS_MUL
const XclFunctionInfo saFuncTable_2010[]
Functions new in Excel 2010.
Definition: xlformula.cxx:438
ocDBStdDevP
ocSkewp
ocNormDist_MS
ocSin
ocSwitch_MS
ocRows
ocCumPrinc
ocGetDateDif
ocVarS
ocChar
#define EXC_FUNCENTRY_ODF(opcode, minparam, maxparam, flags, asciiname)
Definition: xlformula.cxx:596
ocVLookup
ocCritBinom
ocRate
void FillScFuncMap(const XclFunctionInfo *pBeg, const XclFunctionInfo *pEnd)
Definition: xlformula.cxx:714
const char * mpcMacroName
Additional flags (EXC_FUNCFLAG_* constants).
Definition: xlformula.hxx:320
sal_uInt16 ReaduInt16()
Definition: xistream.cxx:648
ocGetDateValue
std::shared_ptr< XclTokenArray > XclTokenArrayRef
Definition: xlformula.hxx:417
Provides access to function info structs for all available functions.
Definition: xlformula.hxx:345
svSingleRef
ocPoissonDist_MS
ocIsEmpty
ocTTest_MS
ocCountEmptyCells
ocChiDist
ocFalse
ocNegBinomVert
#define RX
Definition: xlformula.cxx:58
ocSumIf
const sal_uInt8 EXC_TOKCLASS_VAL
20-3F: Reference class tokens.
Definition: xlformula.hxx:45
void ReadSize(XclImpStream &rStrm)
Reads the size field of the token array.
Definition: xlformula.cxx:741
ocGetHour
ocWebservice
ocMatMult
ocLarge
ocVarA
ocIsError
ocISPMT
ocDBCount2
ocBetaInv
ocOdd
ocIndirect
ocIsLogical
ocOr
virtual formula::FormulaToken * AddOpCode(OpCode eCode) override
Definition: token.cxx:2195
ocNumberValue
ocBitRshift
ocIsRef
XclTokenArrayIterator & operator++()
Definition: xlformula.cxx:837
Binary representation of an Excel token array.
Definition: xlformula.hxx:377
ocCotHyp
ocFloor_Precise
ocTrue
ocNetWorkdays_MS
ocFact
ocMatrixUnit
ocRandomNV
ocMidB
ocMultiArea
ocCombin
ocSheets
ocRoundUp
Contains all cell references that can be extracted from a multiple operations formula.
Definition: xlformula.hxx:469
ocStDevPA
ocPercentrank_Inc
ocNoName
#define C
Definition: xlformula.cxx:66
ocSumX2DY2
const XclFunctionInfo saFuncTable_4[]
Functions new in BIFF4.
Definition: xlformula.cxx:254
ocArcTan
ocForecast_ETS_SEA
#define RO
Definition: xlformula.cxx:55
ocDB
ocAverage
ocHarMean
ocMod
#define EXC_FUNCENTRY_V_RO_EXPORT(opcode, minparam, maxparam, flags, asciiname)
Definition: xlformula.cxx:411
ocStDevP_MS
FormulaToken * AddString(const svl::SharedString &rStr)
ocAggregate
ocRightB
ocEasterSunday
ocFindB
unsigned char sal_uInt8
ocRandom
ScAddress maRowRelScPos
Definition: xlformula.hxx:475
ocDBVarP
ocEuroConvert
ocArcSin
ocTrimMean
ocNper
const ::formula::FormulaToken *const * mppScToken
Pointer behind last token pointer of token array.
Definition: xlformula.hxx:464
void Read(XclImpStream &rStrm)
Reads size field and the tokens.
Definition: xlformula.cxx:754
const XclFunctionInfo saFuncTable_2[]
Functions new in BIFF2.
Definition: xlformula.cxx:76
ocSNormInv_MS
ocAnd
ocRandbetweenNV
ocConcat_MS
#define RR
Definition: xlformula.cxx:57
ocArcCot
ocJis
ocLn
ocStdNormDist
ocMatTrans
ocPercentile_Exc
ocAsc
ocCountIfs
ocZTest_MS
ocGetActDate
const XclFunctionInfo saFuncTable_2013[]
Functions new in Excel 2013.
Definition: xlformula.cxx:517
ocSmall
ocModalValue_Multi
ocFilterXML
OString stripStart(const OString &rIn, char c)
ocGammaLn
ocRoundDown
#define EXC_FUNCNAME_ADDIN(ascii)
Definition: xlformula.cxx:73
XclBiff GetBiff() const
Returns the current BIFF version of the importer/exporter.
Definition: xlroot.hxx:141
ocRRI
ocBahtText
ocBitXor
ocSumXMY2
ocStandard
#define EXC_FUNCENTRY_V_VR_IMPORT(opcode, minparam, maxparam, flags, asciiname)
Definition: xlformula.cxx:408
ocCeil_MS
ocGammaLn_MS
ocAveDev
ocTextJoin_MS
ocNegBinomDist_MS
ocFDist_LT
bool operator==(const XclTokenArray &rTokArr) const
Compares this token array with the passed.
Definition: xlformula.cxx:779
#define EXC_FUNCENTRY_V_RO(opcode, minparam, maxparam, flags, asciiname)
Definition: xlformula.cxx:418
static void ConvertStringToList(ScTokenArray &rScTokArr, svl::SharedStringPool &rSPool, sal_Unicode cStringSep)
Tries to convert a formula that consists of a single string token to a list of strings.
Definition: xlformula.cxx:902
ocGamma
ocTInv_MS
ocFormula
ocTrunc
ocMacro
static bool GetString(OUString &rString, const ScTokenArray &rScTokArr)
Parses the passed formula and tries to find a single string token, i.e.
Definition: xlformula.cxx:867
ocFDist_RT
#define RO_E
Definition: xlformula.cxx:64
ocIRR
ocCeil_Math
ocNormDist
ocSecant
bool IsImport() const
Returns true, if currently a document is imported.
Definition: xlroot.hxx:145
ocDecimal
ocGetDiffDate360
ocPMT
ocDeg
ocFDist
ocPermut
ocTanHyp
ocBetaInv_MS
ocGetYear
ocBase
ocValue
ocChiSqInv
ocConcat
ocConfidence
MS Excel 2.1.
Definition: xlconst.hxx:33
This class is used to import record oriented streams.
Definition: xistream.hxx:278
void Init(const ScTokenArray &rScTokArr, bool bSkipSpaces)
Definition: xlformula.cxx:827
ocIpmt
ocIfs_MS
#define VA
Definition: xlformula.cxx:61
ocCovar
ocTTest
bool IsAddInEquivalent() const
Returns true, if the function is stored as an add-in call.
Definition: xlformula.hxx:335
ocAverageIf
ocCountIf
ocIsEven
ocRight
XclFuncMap maXclFuncMap
Definition: xlformula.hxx:366
ocTDist_RT
ocTDist_2T
ocGCD
ocIsNA
const XclFunctionInfo saFuncTable_Oox[]
Functions new in OOXML.
Definition: xlformula.cxx:389
ocNominal
ocKurt
ocXor
ocTan
Special token array iterator for the Excel filters.
Definition: xlformula.hxx:439
const ::formula::FormulaToken *const * mppScTokenBeg
Definition: xlformula.hxx:462
const XclFunctionInfo saFuncTable_5[]
Functions new in BIFF5/BIFF7.
Definition: xlformula.cxx:343
ocZTest
Access to global data for a filter object (imported or exported document) from other classes...
Definition: xlroot.hxx:127
ocModalValue
ocDBStdDev
bool mbVolatile
Byte vector containing extended data (arrays, stacked NLRs).
Definition: xlformula.hxx:414
XclFunctionProvider(const XclRoot &rRoot)
Definition: xlformula.cxx:649
ocIsErr
ScfUInt8Vec maTokVec
Definition: xlformula.hxx:412
ocLeftB
ocClose
ocReplaceB
ocCombinA
static bool GetMultipleOpRefs(const ScDocument &rDoc, XclMultipleOpRefs &rRefs, const ScTokenArray &rScTokArr, const ScAddress &rScPos)
Parses the passed formula and tries to extract references of a multiple operation.
Definition: xlformula.cxx:942
ocUnicode
ocLen
const XclFunctionInfo saFuncTable_2016[]
Functions new in Excel 2016.
Definition: xlformula.cxx:581
ocMinA
#define EXC_FUNCENTRY_V_RX(opcode, minparam, maxparam, flags, asciiname)
Definition: xlformula.cxx:423
ScAddress maColFirstScPos
Position of the (first) formula cell.
Definition: xlformula.hxx:472
XclExpStream & operator<<(XclExpStream &rStrm, const XclTokenArray &rTokArr)
Calls the Write() function at the passed token array.
Definition: xlformula.cxx:790
ocExpDist
OUString GetMacroFuncName() const
Returns the name of the external function as string.
Definition: xlformula.cxx:35
ocColumn
ocTInv_2T
ocStDev
const sal_uInt8 R
Definition: xlformula.cxx:50
ocGetDiffDate
ocArcTan2
ocSum
ocExact
ocArcSinHyp
ocGetDayOfWeek
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo
ocStdNormDist_MS
ocProper