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>
30
31using 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
68const sal_uInt16 NOID = SAL_MAX_UINT16;
69const 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{
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" ) },
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, std::end(saFuncTable_2));
660 if( eBiff >= EXC_BIFF3 )
661 (this->*pFillFunc)(saFuncTable_3, std::end(saFuncTable_3));
662 if( eBiff >= EXC_BIFF4 )
663 (this->*pFillFunc)(saFuncTable_4, std::end(saFuncTable_4));
664 if( eBiff >= EXC_BIFF5 )
665 (this->*pFillFunc)(saFuncTable_5, std::end(saFuncTable_5));
666 if( eBiff >= EXC_BIFF8 )
667 (this->*pFillFunc)(saFuncTable_8, std::end(saFuncTable_8));
668 (this->*pFillFunc)(saFuncTable_Oox, std::end(saFuncTable_Oox));
669 (this->*pFillFunc)(saFuncTable_2010, std::end(saFuncTable_2010));
670 (this->*pFillFunc)(saFuncTable_2013, std::end(saFuncTable_2013));
671 (this->*pFillFunc)(saFuncTable_2016, std::end(saFuncTable_2016));
672 (this->*pFillFunc)(saFuncTable_Odf, std::end(saFuncTable_Odf));
673 (this->*pFillFunc)(saFuncTable_OOoLO, std::end(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
684const 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
724 mbVolatile( bVolatile )
725{
726}
727
728XclTokenArray::XclTokenArray( ScfUInt8Vec& rTokVec, ScfUInt8Vec& rExtDataVec, bool bVolatile ) :
729 mbVolatile( bVolatile )
730{
731 maTokVec.swap( rTokVec );
732 maExtDataVec.swap( rExtDataVec );
733}
734
735sal_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 return rStrm.ReaduInt16();
744}
745
746void XclTokenArray::ReadArray(sal_uInt16 nSize, XclImpStream& rStrm)
747{
748 maTokVec.resize(0);
749
750 const std::size_t nMaxBuffer = 4096;
751 std::size_t nBytesLeft = nSize;
752 std::size_t nTotalRead = 0;
753
754 while (true)
755 {
756 if (!nBytesLeft)
757 break;
758 std::size_t nReadRequest = o3tl::sanitizing_min(nBytesLeft, nMaxBuffer);
759 maTokVec.resize(maTokVec.size() + nReadRequest);
760 auto nRead = rStrm.Read(maTokVec.data() + nTotalRead, nReadRequest);
761 nTotalRead += nRead;
762 if (nRead != nReadRequest)
763 {
764 maTokVec.resize(nTotalRead);
765 break;
766 }
767 nBytesLeft -= nRead;
768 }
769}
770
772{
774}
775
777{
778 rStrm << GetSize();
779}
780
782{
783 if( !maTokVec.empty() )
784 rStrm.Write(maTokVec.data(), GetSize());
785 if( !maExtDataVec.empty() )
786 rStrm.Write(maExtDataVec.data(), maExtDataVec.size());
787}
788
790{
791 WriteSize( rStrm );
792 WriteArray( rStrm );
793}
794
795bool XclTokenArray::operator==( const XclTokenArray& rTokArr ) const
796{
797 return (mbVolatile == rTokArr.mbVolatile) && (maTokVec == rTokArr.maTokVec) && (maExtDataVec == rTokArr.maExtDataVec);
798}
799
801{
802 rTokArr.Read( rStrm );
803 return rStrm;
804}
805
807{
808 rTokArr.Write( rStrm );
809 return rStrm;
810}
811
813{
814 if( rxTokArr )
815 rxTokArr->Write( rStrm );
816 else
817 rStrm << sal_uInt16( 0 );
818 return rStrm;
819}
820
822 mppScTokenBeg( nullptr ),
823 mppScTokenEnd( nullptr ),
824 mppScToken( nullptr ),
825 mbSkipSpaces( false )
826{
827}
828
830{
831 Init( rScTokArr, bSkipSpaces );
832}
833
835 mppScTokenBeg( rTokArrIt.mppScTokenBeg ),
836 mppScTokenEnd( rTokArrIt.mppScTokenEnd ),
837 mppScToken( rTokArrIt.mppScToken ),
838 mbSkipSpaces( bSkipSpaces )
839{
840 SkipSpaces();
841}
842
843void XclTokenArrayIterator::Init( const ScTokenArray& rScTokArr, bool bSkipSpaces )
844{
845 sal_uInt16 nTokArrLen = rScTokArr.GetLen();
846 mppScTokenBeg = static_cast< const FormulaToken* const* >( nTokArrLen ? rScTokArr.GetArray() : nullptr );
847 mppScTokenEnd = mppScTokenBeg ? (mppScTokenBeg + nTokArrLen) : nullptr;
849 mbSkipSpaces = bSkipSpaces;
850 SkipSpaces();
851}
852
854{
855 NextRawToken();
856 SkipSpaces();
857 return *this;
858}
859
861{
862 if( mppScToken )
863 if( (++mppScToken == mppScTokenEnd) || !*mppScToken )
864 mppScToken = nullptr;
865}
866
868{
869 if( mbSkipSpaces )
870 {
871 OpCode eOp;
872 while( Is() && (((eOp = (*this)->GetOpCode()) == ocSpaces) || eOp == ocWhitespace) )
873 NextRawToken();
874 }
875}
876
877// strings and string lists ---------------------------------------------------
878
879bool XclTokenArrayHelper::GetTokenString( OUString& rString, const FormulaToken& rScToken )
880{
881 bool bIsStr = (rScToken.GetType() == svString) && (rScToken.GetOpCode() == ocPush);
882 if( bIsStr ) rString = rScToken.GetString().getString();
883 return bIsStr;
884}
885
886bool XclTokenArrayHelper::GetString( OUString& rString, const ScTokenArray& rScTokArr )
887{
888 XclTokenArrayIterator aIt( rScTokArr, true );
889 // something is following the string token -> error
890 return aIt.Is() && GetTokenString( rString, *aIt ) && !++aIt;
891}
892
893bool XclTokenArrayHelper::GetStringList( OUString& rStringList, const ScTokenArray& rScTokArr, sal_Unicode cSep )
894{
895 bool bRet = true;
896 XclTokenArrayIterator aIt( rScTokArr, true );
897 enum { STATE_START, STATE_STR, STATE_SEP, STATE_END } eState = STATE_START;
898 while( eState != STATE_END ) switch( eState )
899 {
900 case STATE_START:
901 eState = aIt.Is() ? STATE_STR : STATE_END;
902 break;
903 case STATE_STR:
904 {
905 OUString aString;
906 bRet = GetTokenString( aString, *aIt );
907 if( bRet ) rStringList += aString ;
908 eState = (bRet && (++aIt).Is()) ? STATE_SEP : STATE_END;
909 break;
910 }
911 case STATE_SEP:
912 bRet = aIt->GetOpCode() == ocSep;
913 if( bRet ) rStringList += OUStringChar(cSep);
914 eState = (bRet && (++aIt).Is()) ? STATE_STR : STATE_END;
915 break;
916 default:;
917 }
918 return bRet;
919}
920
922 ScTokenArray& rScTokArr, svl::SharedStringPool& rSPool, sal_Unicode cStringSep )
923{
924 OUString aString;
925 if( !GetString( aString, rScTokArr ) )
926 return;
927
928 rScTokArr.Clear();
929 if (aString.isEmpty())
930 return;
931 sal_Int32 nStringIx = 0;
932 for (;;)
933 {
934 OUString aToken( aString.getToken( 0, cStringSep, nStringIx ) );
935 rScTokArr.AddString(rSPool.intern(comphelper::string::stripStart(aToken, ' ')));
936 if (nStringIx<0)
937 break;
938 rScTokArr.AddOpCode( ocSep );
939 }
940}
941
942// multiple operations --------------------------------------------------------
943
944namespace {
945
946bool lclGetAddress( const ScDocument& rDoc, ScAddress& rAddress, const FormulaToken& rToken, const ScAddress& rPos )
947{
948 OpCode eOpCode = rToken.GetOpCode();
949 bool bIsSingleRef = (eOpCode == ocPush) && (rToken.GetType() == svSingleRef);
950 if( bIsSingleRef )
951 {
952 const ScSingleRefData& rRef = *rToken.GetSingleRef();
953 rAddress = rRef.toAbs(rDoc, rPos);
954 bIsSingleRef = !rRef.IsDeleted();
955 }
956 return bIsSingleRef;
957}
958
959} // namespace
960
962 const ScDocument& rDoc,
963 XclMultipleOpRefs& rRefs, const ScTokenArray& rScTokArr, const ScAddress& rScPos )
964{
965 rRefs.mbDblRefMode = false;
966 enum
967 {
968 stBegin, stTableOp, stOpen, stFormula, stFormulaSep,
969 stColFirst, stColFirstSep, stColRel, stColRelSep,
970 stRowFirst, stRowFirstSep, stRowRel, stClose, stError
971 } eState = stBegin; // last read token
972 for( XclTokenArrayIterator aIt( rScTokArr, true ); aIt.Is() && (eState != stError); ++aIt )
973 {
974 OpCode eOpCode = aIt->GetOpCode();
975 bool bIsSep = eOpCode == ocSep;
976 switch( eState )
977 {
978 case stBegin:
979 eState = (eOpCode == ocTableOp) ? stTableOp : stError;
980 break;
981 case stTableOp:
982 eState = (eOpCode == ocOpen) ? stOpen : stError;
983 break;
984 case stOpen:
985 eState = lclGetAddress(rDoc, rRefs.maFmlaScPos, *aIt, rScPos) ? stFormula : stError;
986 break;
987 case stFormula:
988 eState = bIsSep ? stFormulaSep : stError;
989 break;
990 case stFormulaSep:
991 eState = lclGetAddress(rDoc, rRefs.maColFirstScPos, *aIt, rScPos) ? stColFirst : stError;
992 break;
993 case stColFirst:
994 eState = bIsSep ? stColFirstSep : stError;
995 break;
996 case stColFirstSep:
997 eState = lclGetAddress(rDoc, rRefs.maColRelScPos, *aIt, rScPos) ? stColRel : stError;
998 break;
999 case stColRel:
1000 eState = bIsSep ? stColRelSep : ((eOpCode == ocClose) ? stClose : stError);
1001 break;
1002 case stColRelSep:
1003 eState = lclGetAddress(rDoc, rRefs.maRowFirstScPos, *aIt, rScPos) ? stRowFirst : stError;
1004 rRefs.mbDblRefMode = true;
1005 break;
1006 case stRowFirst:
1007 eState = bIsSep ? stRowFirstSep : stError;
1008 break;
1009 case stRowFirstSep:
1010 eState = lclGetAddress(rDoc, rRefs.maRowRelScPos, *aIt, rScPos) ? stRowRel : stError;
1011 break;
1012 case stRowRel:
1013 eState = (eOpCode == ocClose) ? stClose : stError;
1014 break;
1015 default:
1016 eState = stError;
1017 }
1018 }
1019 return eState == stClose;
1020}
1021
1022/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual formula::FormulaToken * AddOpCode(OpCode eCode) override
Definition: token.cxx:2265
virtual void Clear() override
Definition: token.cxx:1924
This class is used to export Excel record streams.
Definition: xestream.hxx:73
std::size_t Write(const void *pData, std::size_t nBytes)
Writes nBytes bytes from memory.
Definition: xestream.cxx:224
Provides access to function info structs for all available functions.
Definition: xlformula.hxx:345
void FillScFuncMap(const XclFunctionInfo *pBeg, const XclFunctionInfo *pEnd)
Definition: xlformula.cxx:714
XclFuncMap maXclFuncMap
Definition: xlformula.hxx:365
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
const XclFunctionInfo * GetFuncInfoFromXclFunc(sal_uInt16 nXclFunc) const
Returns the function data for an Excel function index, or 0 on error.
Definition: xlformula.cxx:676
void FillXclFuncMap(const XclFunctionInfo *pBeg, const XclFunctionInfo *pEnd)
Definition: xlformula.cxx:700
ScFuncMap maScFuncMap
Maps macro function names to function data.
Definition: xlformula.hxx:367
const XclFunctionInfo * GetFuncInfoFromOpCode(OpCode eOpCode) const
Returns the function data for a Calc opcode, or 0 on error.
Definition: xlformula.cxx:692
XclMacroNameMap maXclMacroNameMap
Maps Excel function indexes to function data.
Definition: xlformula.hxx:366
XclFunctionProvider(const XclRoot &rRoot)
Definition: xlformula.cxx:649
This class is used to import record oriented streams.
Definition: xistream.hxx:278
Access to global data for a filter object (imported or exported document) from other classes.
Definition: xlroot.hxx:128
bool IsImport() const
Returns true, if currently a document is imported.
Definition: xlroot.hxx:145
XclBiff GetBiff() const
Returns the current BIFF version of the importer/exporter.
Definition: xlroot.hxx:141
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:961
static bool GetTokenString(OUString &rString, const ::formula::FormulaToken &rScToken)
Tries to extract a string from the passed token.
Definition: xlformula.cxx:879
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:886
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:921
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:893
Special token array iterator for the Excel filters.
Definition: xlformula.hxx:439
const ::formula::FormulaToken *const * mppScToken
Pointer behind last token pointer of token array.
Definition: xlformula.hxx:463
const ::formula::FormulaToken *const * mppScTokenEnd
Pointer to first token pointer of token array.
Definition: xlformula.hxx:462
bool mbSkipSpaces
Pointer to current token pointer of token array.
Definition: xlformula.hxx:464
void Init(const ScTokenArray &rScTokArr, bool bSkipSpaces)
Definition: xlformula.cxx:843
const ::formula::FormulaToken *const * mppScTokenBeg
Definition: xlformula.hxx:461
XclTokenArrayIterator & operator++()
Definition: xlformula.cxx:853
Binary representation of an Excel token array.
Definition: xlformula.hxx:377
void ReadArray(sal_uInt16 nSize, XclImpStream &rStrm)
Reads the tokens of the token array (without size field).
Definition: xlformula.cxx:746
bool operator==(const XclTokenArray &rTokArr) const
Compares this token array with the passed.
Definition: xlformula.cxx:795
XclTokenArray(bool bVolatile=false)
Creates an empty token array.
Definition: xlformula.cxx:723
sal_uInt16 GetSize() const
Returns the size of the token array in bytes.
Definition: xlformula.cxx:735
void WriteSize(XclExpStream &rStrm) const
Writes the size field of the token array.
Definition: xlformula.cxx:776
void Write(XclExpStream &rStrm) const
Writes size field and the tokens.
Definition: xlformula.cxx:789
ScfUInt8Vec maExtDataVec
Byte vector containing token data.
Definition: xlformula.hxx:412
bool mbVolatile
Byte vector containing extended data (arrays, stacked NLRs).
Definition: xlformula.hxx:413
static sal_uInt16 ReadSize(XclImpStream &rStrm)
Reads the size field of the token array.
Definition: xlformula.cxx:741
void WriteArray(XclExpStream &rStrm) const
Writes the tokens of the token array (without size field).
Definition: xlformula.cxx:781
ScfUInt8Vec maTokVec
Definition: xlformula.hxx:411
void Read(XclImpStream &rStrm)
Reads size field and the tokens.
Definition: xlformula.cxx:771
sal_uInt16 GetLen() const
FormulaToken ** GetArray() const
FormulaToken * AddString(const svl::SharedString &rStr)
OpCode GetOpCode() const
SharedString intern(const OUString &rStr)
::std::vector< sal_uInt8 > ScfUInt8Vec
Definition: ftools.hxx:253
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:75
OString stripStart(const OString &rIn, char c)
svString
svSingleRef
void SvStream & rStrm
T sanitizing_min(T a, T b)
OpCode
ocSumProduct
ocGetTimeValue
ocModalValue
ocCurrent
ocNot
ocBase
ocCosHyp
ocCombinA
ocCountIfs
ocEasterSunday
ocChar
ocLen
ocSkew
ocQuartile_Exc
ocRank_Avg
ocPercentile_Exc
ocTanHyp
ocIsEven
ocSqrt
ocMatrixUnit
ocChiDist
ocB
ocNetWorkdays
ocBetaDist_MS
ocForecast_ETS_PIA
ocAsc
ocCeil_MS
ocChiSqInv_MS
ocBackSolver
ocAggregate
ocSmall
ocColumns
ocConcat
ocSumIf
ocMod
ocTTest
ocCot
ocChiInv_MS
ocIRR
ocValue
ocDBCount
ocDBMax
ocArcCosHyp
ocCountIf
ocReplaceB
ocHypGeomDist
ocFalse
ocRoundUp
ocStyle
ocTrimMean
ocGauss
ocInfo
ocNPV
ocExpDist_MS
ocPercentrank_Inc
ocChiSqDist
ocSecant
ocFInv_LT
ocIsEmpty
ocEven
ocDDB
ocWebservice
ocRSQ
ocUnichar
ocBetaInv_MS
ocUnicode
ocIsRef
ocTrunc
ocPermut
ocIndex
ocTDist_MS
ocPearson
ocFind
ocStDev
ocAreas
ocGrowth
ocCell
ocMultiArea
ocGetYear
ocWeibull
ocConvertOOo
ocCosecantHyp
ocOr
ocFisherInv
ocAbs
ocPoissonDist_MS
ocAddress
ocSin
ocAverageIfs
ocArcTan2
ocLeftB
ocIntercept
ocDBVarP
ocClose
ocDeg
ocPMT
ocBetaInv
ocIsNA
ocFloor
ocCumIpmt
ocMatInv
ocN
ocSumSQ
ocHypGeomDist_MS
ocRegex
ocNormDist
ocIndirect
ocHLookup
ocSubTotal
ocChiSqInv
ocGeoMean
ocFV
ocBahtText
ocRound
ocLCM
ocVarS
ocFDist_LT
ocPpmt
ocRow
ocGetActTime
ocMacro
ocQuartile
ocRandomNV
ocNominal
ocProduct
ocForecast_ETS_ADD
ocGammaLn
ocSYD
ocGetMonth
ocChiSqDist_MS
ocExp
ocNegBinomDist_MS
ocAverageA
ocCode
ocRad
ocCountEmptyCells
ocCovarianceS
ocIsNonString
ocSLN
ocRept
ocAverage
ocStDevP_MS
ocMinA
ocSkewp
ocErrorType_ODF
ocTDist_RT
ocOffset
ocFixed
ocZTest_MS
ocWeibull_MS
ocNormDist_MS
ocIfNA
ocBetaDist
ocPermutationA
ocTrim
ocEncodeURL
ocXor
ocChiInv
ocStandard
ocMinIfs_MS
ocMatTrans
ocIsString
ocForecast_ETS_PIM
ocCeil_Precise
ocGetDate
ocPercentile_Inc
ocArcSin
ocSNormInv
ocPercentrank_Exc
ocPercentrank
ocColor
ocUpper
ocGCD
ocWeek
ocLower
ocNormInv
ocCeil_ISO
ocCeil_Math
ocDBVar
ocFloor_Math
ocZTest
ocSecantHyp
ocHyperLink
ocSTEYX
ocRank
ocArcTan
ocChiTest_MS
ocLogest
ocQuartile_Inc
ocBinomInv
ocGammaLn_MS
ocFrequency
ocTextJoin_MS
ocTan
ocModalValue_Multi
ocSearch
ocForecast_ETS_STM
ocCosecant
ocSubstitute
ocNper
ocBitOr
ocGammaInv_MS
ocFInv
ocErrorType
ocDBGet
ocSlope
ocCumPrinc
ocMatMult
ocMatDet
ocIpmt
ocTInv_MS
ocLarge
ocRRI
ocGetActDate
ocFact
ocOpen
ocMIRR
ocDecimal
ocTrend
ocAverageIf
ocErf_MS
ocGetDay
ocDBMin
ocVarPA
ocReplace
ocWeeknumOOo
ocLookup
ocFilterXML
ocFInv_RT
ocBinomDist_MS
ocHarMean
ocFloor_MS
ocRandom
ocStdNormDist
ocConfidence_T
ocCeil
ocTrue
ocLinest
ocRows
ocArcCot
ocISPMT
ocGetHour
ocCorrel
ocArcTanHyp
ocExternal
ocNegBinomVert
ocSpaces
ocLogInv_MS
ocBitAnd
ocAnd
ocPercentile
ocInt
ocCount2
ocArcSinHyp
ocTDist
ocLogNormDist_MS
ocForecast_ETS_MUL
ocSep
ocConfidence_N
ocRandbetweenNV
ocTInv
ocMedian
ocBinomDist
ocVarP_MS
ocFloor_Precise
ocVarP
ocDBCount2
ocLn
ocDevSq
ocForecast_LIN
ocVBD
ocTInv_2T
ocStDevS
ocRoundSig
ocPlusMinus
ocNormInv_MS
ocPush
ocCotHyp
ocNumberValue
ocArcCotHyp
ocForecast_ETS_SEA
ocIsError
ocFTest
ocPDuration
ocRawSubtract
ocRate
ocStDevP
ocType
ocForecast_ETS_STA
ocIfError
ocFDist_RT
ocKurt
ocRightB
ocPower
ocJis
ocMid
ocSumXMY2
ocSheets
ocGetDateValue
ocWhitespace
ocConfidence
ocRoundDown
ocForecast
ocMin
ocFindB
ocLenB
ocCurrency
ocSumX2MY2
ocFourier
ocPoissonDist
ocLogInv
ocIfs_MS
ocTTest_MS
ocRight
ocNoName
ocGetSec
ocCovarianceP
ocDB
ocIsFormula
ocArcCos
ocDBProduct
ocEuroConvert
ocLeft
ocDBAverage
ocBitLshift
ocGetPivotData
ocFisher
ocCombin
ocRoman
ocPV
ocMatch
ocVLookup
ocStDevA
ocGetTime
ocSumIfs
ocChiDist_MS
ocPhi
ocMaxIfs_MS
ocArabic
ocNetWorkdays_MS
ocTableOp
ocDBSum
ocChoose
ocErfc_MS
ocWorkday_MS
ocVarA
ocBitXor
ocVar
ocSwitch_MS
ocCovar
ocColumn
ocGammaDist_MS
ocGetMin
ocGetDiffDate
ocGetDateDif
ocGetDayOfWeek
ocNotAvail
ocRank_Eq
ocGamma
ocSNormInv_MS
ocOdd
ocGammaInv
ocModalValue_MS
ocDBStdDev
ocStdNormDist_MS
ocT
ocExact
ocIf
ocFTest_MS
ocBitRshift
ocIsValue
ocSumX2DY2
ocLog10
ocSheet
ocText
ocMidB
ocProb
ocGetDiffDate360
ocFormula
ocChiTest
ocTDist_2T
ocConcat_MS
ocDBStdDevP
ocIsOdd
ocIsErr
ocExpDist
ocGammaDist
ocIsoWeeknum
ocClean
ocLog
ocMaxA
ocFDist
ocStDevPA
ocLogNormDist
ocSearchB
ocIsLogical
ocSinHyp
ocEffect
ocSum
ocAveDev
ocPi
ocCount
ocCritBinom
ocProper
ocCos
ocMax
Single reference (one address) into the sheet.
Definition: refdata.hxx:30
bool IsDeleted() const
Definition: refdata.cxx:125
ScAddress toAbs(const ScSheetLimits &rLimits, const ScAddress &rPos) const
Definition: refdata.cxx:193
Represents information for a spreadsheet function for import and export.
Definition: xlformula.hxx:311
OUString GetMacroFuncName() const
Returns the name of the external function as string.
Definition: xlformula.cxx:35
OUString GetAddInEquivalentFuncName() const
Returns the programmatical name of the Add-In function as string.
Definition: xlformula.cxx:42
const char * mpcMacroName
Additional flags (EXC_FUNCFLAG_* constants).
Definition: xlformula.hxx:319
bool IsMacroFunc() const
Returns true, if the function is simulated by a macro call.
Definition: xlformula.hxx:332
bool IsAddInEquivalent() const
Returns true, if the function is stored as an add-in call.
Definition: xlformula.hxx:334
Contains all cell references that can be extracted from a multiple operations formula.
Definition: xlformula.hxx:469
ScAddress maColRelScPos
Definition: xlformula.hxx:472
ScAddress maRowRelScPos
Definition: xlformula.hxx:474
ScAddress maRowFirstScPos
Definition: xlformula.hxx:473
ScAddress maFmlaScPos
Definition: xlformula.hxx:470
ScAddress maColFirstScPos
Position of the (first) formula cell.
Definition: xlformula.hxx:471
unsigned char sal_uInt8
#define SAL_MAX_UINT16
sal_uInt16 sal_Unicode
XclBiff
An enumeration for all Excel file format types (BIFF types).
Definition: xlconst.hxx:30
@ EXC_BIFF5
MS Excel 4.0.
Definition: xlconst.hxx:34
@ EXC_BIFF4
MS Excel 3.0.
Definition: xlconst.hxx:33
@ EXC_BIFF2
Definition: xlconst.hxx:31
@ EXC_BIFF8
MS Excel 5.0, MS Excel 7.0 (95)
Definition: xlconst.hxx:35
@ EXC_BIFF3
MS Excel 2.1.
Definition: xlconst.hxx:32
const XclFunctionInfo saFuncTable_2013[]
Functions new in Excel 2013.
Definition: xlformula.cxx:517
#define EXC_FUNCNAME_ADDIN(ascii)
Definition: xlformula.cxx:73
const sal_uInt8 V
Definition: xlformula.cxx:51
const XclFunctionInfo saFuncTable_3[]
Functions new in BIFF3.
Definition: xlformula.cxx:226
#define RA
Definition: xlformula.cxx:56
#define EXC_FUNCENTRY_V_RO_EXPORT(opcode, minparam, maxparam, flags, asciiname)
Definition: xlformula.cxx:411
#define EXC_FUNCNAME(ascii)
Maximum parameter count.
Definition: xlformula.cxx:71
#define EXC_FUNCENTRY_ODF(opcode, minparam, maxparam, flags, asciiname)
Definition: xlformula.cxx:596
#define VO
Definition: xlformula.cxx:59
#define RX
Definition: xlformula.cxx:58
XclExpStream & operator<<(XclExpStream &rStrm, const XclTokenArray &rTokArr)
Calls the Write() function at the passed token array.
Definition: xlformula.cxx:806
const XclFunctionInfo saFuncTable_2016[]
Functions new in Excel 2016.
Definition: xlformula.cxx:581
const XclFunctionInfo saFuncTable_5[]
Functions new in BIFF5/BIFF7.
Definition: xlformula.cxx:343
#define VV
Definition: xlformula.cxx:60
const XclFunctionInfo saFuncTable_4[]
Functions new in BIFF4.
Definition: xlformula.cxx:254
#define RO
Definition: xlformula.cxx:55
#define RR
Definition: xlformula.cxx:57
#define EXC_FUNCENTRY_V_VA(opcode, minparam, maxparam, flags, asciiname)
Definition: xlformula.cxx:427
const XclFunctionInfo saFuncTable_OOoLO[]
Functions defined by Calc, but not in OpenFormula nor supported by Excel.
Definition: xlformula.cxx:618
const XclFunctionInfo saFuncTable_Odf[]
Functions defined by OpenFormula, but not supported by Calc (ocNoName) or by Excel (defined op-code).
Definition: xlformula.cxx:601
#define EXC_FUNCENTRY_OOO_IBR(opcode, minparam, maxparam, flags, asciiname)
Definition: xlformula.cxx:614
#define RO_E
Definition: xlformula.cxx:64
#define EXC_FUNCENTRY_V_VR(opcode, minparam, maxparam, flags, asciiname)
Definition: xlformula.cxx:384
#define EXC_FUNCENTRY_V_VR_IMPORT(opcode, minparam, maxparam, flags, asciiname)
Definition: xlformula.cxx:408
const sal_uInt16 NOID
Definition: xlformula.cxx:68
const XclFunctionInfo saFuncTable_2[]
Functions new in BIFF2.
Definition: xlformula.cxx:76
#define VA
Definition: xlformula.cxx:61
#define EXC_FUNCENTRY_OOO(opcode, minparam, maxparam, flags, asciiname)
Definition: xlformula.cxx:609
const XclFunctionInfo saFuncTable_2010[]
Functions new in Excel 2010.
Definition: xlformula.cxx:438
#define VX
Definition: xlformula.cxx:63
const sal_uInt8 A
Definition: xlformula.cxx:52
const sal_uInt8 R
Definition: xlformula.cxx:50
const sal_uInt8 MX
No BIFF/OOBIN function identifier available.
Definition: xlformula.cxx:69
#define C
Definition: xlformula.cxx:66
const XclFunctionInfo saFuncTable_8[]
Functions new in BIFF8.
Definition: xlformula.cxx:367
#define EXC_FUNCENTRY_V_RO(opcode, minparam, maxparam, flags, asciiname)
Definition: xlformula.cxx:418
#define EXC_FUNCENTRY_A_VR(opcode, minparam, maxparam, flags, asciiname)
Definition: xlformula.cxx:414
const XclFunctionInfo saFuncTable_Oox[]
Functions new in OOXML.
Definition: xlformula.cxx:389
#define EXC_FUNCENTRY_V_RX(opcode, minparam, maxparam, flags, asciiname)
Definition: xlformula.cxx:423
#define VR_E
Definition: xlformula.cxx:65
#define VR
Definition: xlformula.cxx:62
XclImpStream & operator>>(XclImpStream &rStrm, XclTokenArray &rTokArr)
Calls the Read() function at the passed token array.
Definition: xlformula.cxx:800
const sal_uInt8 EXC_TOKCLASS_VAL
20-3F: Reference class tokens.
Definition: xlformula.hxx:44
const sal_uInt8 EXC_FUNCFLAG_EXPORTONLY
Only used in import filter.
Definition: xlformula.hxx:290
const sal_uInt8 EXC_FUNCFLAG_IMPORTONLY
Result is volatile (e.g. NOW() function).
Definition: xlformula.hxx:289
const sal_uInt8 EXC_FUNCFLAG_VOLATILE
Number of parameter info entries.
Definition: xlformula.hxx:288
const sal_uInt8 EXC_TOKCLASS_ARR
40-5F: Value class tokens.
Definition: xlformula.hxx:45
const sal_uInt8 EXC_FUNCFLAG_PARAMPAIRS
Only used in export filter.
Definition: xlformula.hxx:291
const sal_uInt8 EXC_FUNCFLAG_ADDINEQUIV
Optional parameters are expected to appear in pairs.
Definition: xlformula.hxx:292
std::shared_ptr< XclTokenArray > XclTokenArrayRef
Definition: xlformula.hxx:416
const sal_uInt8 EXC_TOKCLASS_REF
00-1F: Base tokens.
Definition: xlformula.hxx:43