25#include <com/sun/star/beans/XPropertySet.hpp>
26#include <com/sun/star/lang/XMultiServiceFactory.hpp>
27#include <com/sun/star/sheet/AddressConvention.hpp>
28#include <com/sun/star/sheet/ReferenceFlags.hpp>
29#include <com/sun/star/sheet/SingleReference.hpp>
30#include <com/sun/star/sheet/ComplexReference.hpp>
31#include <com/sun/star/sheet/FormulaLanguage.hpp>
32#include <com/sun/star/sheet/FormulaMapGroup.hpp>
33#include <com/sun/star/sheet/FormulaMapGroupSpecialOffset.hpp>
34#include <com/sun/star/sheet/XFormulaOpCodeMapper.hpp>
35#include <com/sun/star/sheet/XFormulaParser.hpp>
38#include <rtl/strbuf.hxx>
39#include <rtl/ustrbuf.hxx>
40#include <osl/diagnose.h>
45#include <oox/token/properties.hxx>
51enum class FuncFlags : sal_uInt16 {
57 MACROCALLODF = 0x0010,
63 MACROCALL_FN = 0x0400,
65 MACROCALL_NEW = MACROCALL | MACROCALL_FN,
68 BIFFEXPORTONLY = 0x1000,
112 nRow =
rStrm.readInt32();
113 nCol =
rStrm.readuInt16();
119 sal_Int32 nRow1, nRow2;
120 sal_uInt16 nCol1, nCol2;
121 nRow1 =
rStrm.readInt32();
122 nRow2 =
rStrm.readInt32();
123 nCol1 =
rStrm.readuInt16();
124 nCol2 =
rStrm.readuInt16();
150 mpToken( rTokens.getConstArray() ),
151 mpTokenEnd( rTokens.getConstArray() + rTokens.
getLength() ),
152 mnSpacesOpCode( nSpacesOpCode )
177const size_t FUNCINFO_PARAMINFOCOUNT = 5;
179typedef std::shared_ptr< FunctionInfo > FunctionInfoRef;
193 bool isSupported(
bool bImportFilter)
const;
196bool FunctionData::isSupported(
bool bImportFilter)
const
203 return !(
mnFlags & ( FuncFlags::EXPORTONLY | FuncFlags::BIFFEXPORTONLY));
205 return !(
mnFlags & ( FuncFlags::IMPORTONLY | FuncFlags::BIFFEXPORTONLY));
217#define RO { FuncParamValidity::Regular }
218#define RA { FuncParamValidity::Regular }
219#define RR { FuncParamValidity::Regular }
220#define RX { FuncParamValidity::Regular }
221#define VO { FuncParamValidity::Regular }
222#define VV { FuncParamValidity::Regular }
223#define VA { FuncParamValidity::Regular }
224#define VR { FuncParamValidity::Regular }
225#define VX { FuncParamValidity::Regular }
226#define RO_E { FuncParamValidity::ExcelOnly }
227#define VR_E { FuncParamValidity::ExcelOnly }
228#define C { FuncParamValidity::CalcOnly }
233const FunctionData saFuncTableBiff2[] =
236 {
"IF",
"IF", 1, 1, 2, 3,
R, {
VO,
RO },
FuncFlags::NONE },
246 {
"NPV",
"NPV", 11, 11, 2,
MX,
V, {
VR,
RX },
FuncFlags::NONE },
249 {
"FIXED",
"FIXED", 14, 14, 1, 2,
V, {
VR,
VR,
C },
FuncFlags::NONE },
251 {
"CSC",
"SIN", 15, 15, 1, 1,
V, {
VR }, FuncFlags::BIFFEXPORTONLY },
253 {
"SEC",
"COS", 16, 16, 1, 1,
V, {
VR }, FuncFlags::BIFFEXPORTONLY },
255 {
"COT",
"TAN", 17, 17, 1, 1,
V, {
VR }, FuncFlags::BIFFEXPORTONLY },
257 {
"ACOT",
"ATAN", 18, 18, 1, 1,
V, {
VR }, FuncFlags::BIFFEXPORTONLY },
267 {
"LOOKUP",
"LOOKUP", 28, 28, 2, 3,
V, {
VR,
RA },
FuncFlags::NONE },
268 {
"INDEX",
"INDEX", 29, 29, 2, 4,
R, {
RA,
VV },
FuncFlags::NONE },
279 {
"DCOUNT",
"DCOUNT", 40, 40, 3, 3,
V, {
RO,
RR },
FuncFlags::NONE },
280 {
"DSUM",
"DSUM", 41, 41, 3, 3,
V, {
RO,
RR },
FuncFlags::NONE },
281 {
"DAVERAGE",
"DAVERAGE", 42, 42, 3, 3,
V, {
RO,
RR },
FuncFlags::NONE },
282 {
"DMIN",
"DMIN", 43, 43, 3, 3,
V, {
RO,
RR },
FuncFlags::NONE },
283 {
"DMAX",
"DMAX", 44, 44, 3, 3,
V, {
RO,
RR },
FuncFlags::NONE },
284 {
"DSTDEV",
"DSTDEV", 45, 45, 3, 3,
V, {
RO,
RR },
FuncFlags::NONE },
286 {
"DVAR",
"DVAR", 47, 47, 3, 3,
V, {
RO,
RR },
FuncFlags::NONE },
288 {
"LINEST",
"LINEST", 49, 49, 1, 2,
A, {
RA,
RA,
C,
C },
FuncFlags::NONE },
289 {
"TREND",
"TREND", 50, 50, 1, 3,
A, {
RA,
RA,
RA,
C },
FuncFlags::NONE },
290 {
"LOGEST",
"LOGEST", 51, 51, 1, 2,
A, {
RA,
RA,
C,
C },
FuncFlags::NONE },
291 {
"GROWTH",
"GROWTH", 52, 52, 1, 3,
A, {
RA,
RA,
RA,
C },
FuncFlags::NONE },
297 {
"MIRR",
"MIRR", 61, 61, 3, 3,
V, {
RA,
VR },
FuncFlags::NONE },
298 {
"IRR",
"IRR", 62, 62, 1, 2,
V, {
RA,
VR },
FuncFlags::NONE },
299 {
"RAND",
"RAND", 63, 63, 0, 0,
V, {}, FuncFlags::VOLATILE },
300 {
"MATCH",
"MATCH", 64, 64, 2, 3,
V, {
VR,
RX,
RR },
FuncFlags::NONE },
306 {
"WEEKDAY",
"WEEKDAY", 70, 70, 1, 1,
V, {
VR,
C },
FuncFlags::NONE },
310 {
"NOW",
"NOW", 74, 74, 0, 0,
V, {}, FuncFlags::VOLATILE },
314 {
"OFFSET",
"OFFSET", 78, 78, 3, 5,
R, {
RO,
VR }, FuncFlags::VOLATILE },
321 {
"CHOOSE",
"CHOOSE", 100, 100, 2,
MX,
R, {
VO,
RO },
FuncFlags::NONE },
322 {
"HLOOKUP",
"HLOOKUP", 101, 101, 3, 3,
V, {
VV,
RO,
RO,
C },
FuncFlags::NONE },
323 {
"VLOOKUP",
"VLOOKUP", 102, 102, 3, 3,
V, {
VV,
RO,
RO,
C },
FuncFlags::NONE },
338 {
"CELL",
"CELL", 125, 125, 1, 2,
V, {
VV,
RO }, FuncFlags::VOLATILE },
350 {
"INDIRECT",
"INDIRECT", 148, 148, 1, 2,
R, {
VR }, FuncFlags::VOLATILE },
360 {
"DPRODUCT",
"DPRODUCT", 189, 189, 3, 3,
V, {
RO,
RR },
FuncFlags::NONE },
364 {
"DSTDEVP",
"DSTDEVP", 195, 195, 3, 3,
V, {
RO,
RR },
FuncFlags::NONE },
365 {
"DVARP",
"DVARP", 196, 196, 3, 3,
V, {
RO,
RR },
FuncFlags::NONE },
366 {
"TRUNC",
"TRUNC", 197, 197, 1, 1,
V, {
VR,
C },
FuncFlags::NONE },
368 {
"DCOUNTA",
"DCOUNTA", 199, 199, 3, 3,
V, {
RO,
RR },
FuncFlags::NONE },
369 {
nullptr,
"EXTERN.CALL", 255, 255, 1,
MX,
R, {
RO_E,
RO }, FuncFlags::IMPORTONLY },
373 {
nullptr,
"A1.R1C1", 30, 30, 0, 1,
V, {
VR }, FuncFlags::MACROCMD },
374 {
nullptr,
"RETURN", 55, 55, 0, 1,
R, {
RO }, FuncFlags::MACROFUNC },
375 {
nullptr,
"ABSREF", 79, 79, 2, 2,
R, {
VR,
RO }, FuncFlags::MACROFUNC },
376 {
nullptr,
"ADD.ARROW", 81, 81, 0, 0,
V, {}, FuncFlags::MACROCMD },
377 {
nullptr,
"ACTIVE.CELL", 94, 94, 0, 0,
R, {}, FuncFlags::MACROFUNC },
378 {
nullptr,
"ACTIVATE", 103, 103, 0, 2,
V, {
VR }, FuncFlags::MACROCMD },
379 {
nullptr,
"ACTIVATE.NEXT", 104, 104, 0, 0,
V, {}, FuncFlags::MACROCMD },
380 {
nullptr,
"ACTIVATE.PREV", 105, 105, 0, 0,
V, {}, FuncFlags::MACROCMD },
381 {
nullptr,
"ADD.BAR", 151, 151, 0, 0,
V, {}, FuncFlags::MACROFUNC | FuncFlags::ALWAYSVAR },
382 {
nullptr,
"ADD.MENU", 152, 152, 2, 2,
V, {
VR,
RO }, FuncFlags::MACROFUNC | FuncFlags::ALWAYSVAR },
383 {
nullptr,
"ADD.COMMAND", 153, 153, 3, 3,
V, {
VR,
RO }, FuncFlags::MACROFUNC | FuncFlags::ALWAYSVAR }
387const FunctionData saFuncTableBiff3[] =
389 {
"LINEST",
"LINEST", 49, 49, 1, 4,
A, {
RA,
RA,
VV },
FuncFlags::NONE },
390 {
"TREND",
"TREND", 50, 50, 1, 4,
A, {
RA,
RA,
RA,
VV },
FuncFlags::NONE },
391 {
"LOGEST",
"LOGEST", 51, 51, 1, 4,
A, {
RA,
RA,
VV },
FuncFlags::NONE },
392 {
"GROWTH",
"GROWTH", 52, 52, 1, 4,
A, {
RA,
RA,
RA,
VV },
FuncFlags::NONE },
394 {
"DOLLAR",
"USDOLLAR", 204, 204, 1, 2,
V, {
VR }, FuncFlags::IMPORTONLY },
407 {
"DAYS360",
"DAYS360", 220, 220, 2, 2,
V, {
VR,
VR,
C },
FuncFlags::NONE },
408 {
"TODAY",
"TODAY", 221, 221, 0, 0,
V, {}, FuncFlags::VOLATILE },
413 {
"CSCH",
"SINH", 229, 229, 1, 1,
V, {
VR }, FuncFlags::BIFFEXPORTONLY },
415 {
"SECH",
"COSH", 230, 230, 1, 1,
V, {
VR }, FuncFlags::BIFFEXPORTONLY },
417 {
"COTH",
"TANH", 231, 231, 1, 1,
V, {
VR }, FuncFlags::BIFFEXPORTONLY },
421 {
"ACOTH",
"ATANH", 234, 234, 1, 1,
V, {
VR }, FuncFlags::BIFFEXPORTONLY },
422 {
"DGET",
"DGET", 235, 235, 3, 3,
V, {
RO,
RR },
FuncFlags::NONE },
423 {
"INFO",
"INFO", 244, 244, 1, 1,
V, {
VR }, FuncFlags::VOLATILE },
427 {
nullptr,
"ADD.BAR", 151, 151, 0, 1,
V, {
VR }, FuncFlags::MACROFUNC },
428 {
nullptr,
"ADD.MENU", 152, 152, 2, 3,
V, {
VR,
RO }, FuncFlags::MACROFUNC },
429 {
nullptr,
"ADD.COMMAND", 153, 153, 3, 4,
V, {
VR,
RO }, FuncFlags::MACROFUNC }
433const FunctionData saFuncTableBiff4[] =
436 {
"RANK",
"RANK", 216, 216, 2, 3,
V, {
VR,
RO,
VR },
FuncFlags::NONE },
480 {
"FORECAST",
"FORECAST", 309, 309, 3, 3,
V, {
VR,
VA },
FuncFlags::NONE },
487 {
"TTEST",
"TTEST", 316, 316, 4, 4,
V, {
VA,
VA,
VR },
FuncFlags::NONE },
488 {
"PROB",
"PROB", 317, 317, 3, 4,
V, {
VA,
VA,
VR },
FuncFlags::NONE },
495 {
"ZTEST",
"ZTEST", 324, 324, 2, 3,
V, {
RX,
VR },
FuncFlags::NONE },
496 {
"LARGE",
"LARGE", 325, 325, 2, 2,
V, {
RX,
VR },
FuncFlags::NONE },
497 {
"SMALL",
"SMALL", 326, 326, 2, 2,
V, {
RX,
VR },
FuncFlags::NONE },
498 {
"QUARTILE",
"QUARTILE", 327, 327, 2, 2,
V, {
RX,
VR },
FuncFlags::NONE },
499 {
"PERCENTILE",
"PERCENTILE", 328, 328, 2, 2,
V, {
RX,
VR },
FuncFlags::NONE },
500 {
"PERCENTRANK",
"PERCENTRANK", 329, 329, 2, 3,
V, {
RX,
VR,
VR_E },
FuncFlags::NONE },
502 {
"TRIMMEAN",
"TRIMMEAN", 331, 331, 2, 2,
V, {
RX,
VR },
FuncFlags::NONE },
507 {
"HEX2BIN",
"HEX2BIN", 384,
NOID, 1, 2,
V, {
RR }, FuncFlags::EXTERNAL },
508 {
"HEX2DEC",
"HEX2DEC", 385,
NOID, 1, 1,
V, {
RR }, FuncFlags::EXTERNAL },
509 {
"HEX2OCT",
"HEX2OCT", 386,
NOID, 1, 2,
V, {
RR }, FuncFlags::EXTERNAL },
510 {
"DEC2BIN",
"DEC2BIN", 387,
NOID, 1, 2,
V, {
RR }, FuncFlags::EXTERNAL },
511 {
"DEC2HEX",
"DEC2HEX", 388,
NOID, 1, 2,
V, {
RR }, FuncFlags::EXTERNAL },
512 {
"DEC2OCT",
"DEC2OCT", 389,
NOID, 1, 2,
V, {
RR }, FuncFlags::EXTERNAL },
513 {
"OCT2BIN",
"OCT2BIN", 390,
NOID, 1, 2,
V, {
RR }, FuncFlags::EXTERNAL },
514 {
"OCT2HEX",
"OCT2HEX", 391,
NOID, 1, 2,
V, {
RR }, FuncFlags::EXTERNAL },
515 {
"OCT2DEC",
"OCT2DEC", 392,
NOID, 1, 1,
V, {
RR }, FuncFlags::EXTERNAL },
516 {
"BIN2DEC",
"BIN2DEC", 393,
NOID, 1, 1,
V, {
RR }, FuncFlags::EXTERNAL },
517 {
"BIN2OCT",
"BIN2OCT", 394,
NOID, 1, 2,
V, {
RR }, FuncFlags::EXTERNAL },
518 {
"BIN2HEX",
"BIN2HEX", 395,
NOID, 1, 2,
V, {
RR }, FuncFlags::EXTERNAL },
519 {
"IMSUB",
"IMSUB", 396,
NOID, 2, 2,
V, {
RR }, FuncFlags::EXTERNAL },
520 {
"IMDIV",
"IMDIV", 397,
NOID, 2, 2,
V, {
RR }, FuncFlags::EXTERNAL },
521 {
"IMPOWER",
"IMPOWER", 398,
NOID, 2, 2,
V, {
RR }, FuncFlags::EXTERNAL },
522 {
"IMABS",
"IMABS", 399,
NOID, 1, 1,
V, {
RR }, FuncFlags::EXTERNAL },
523 {
"IMSQRT",
"IMSQRT", 400,
NOID, 1, 1,
V, {
RR }, FuncFlags::EXTERNAL },
524 {
"IMLN",
"IMLN", 401,
NOID, 1, 1,
V, {
RR }, FuncFlags::EXTERNAL },
525 {
"IMLOG2",
"IMLOG2", 402,
NOID, 1, 1,
V, {
RR }, FuncFlags::EXTERNAL },
526 {
"IMLOG10",
"IMLOG10", 403,
NOID, 1, 1,
V, {
RR }, FuncFlags::EXTERNAL },
527 {
"IMSIN",
"IMSIN", 404,
NOID, 1, 1,
V, {
RR }, FuncFlags::EXTERNAL },
528 {
"IMCOS",
"IMCOS", 405,
NOID, 1, 1,
V, {
RR }, FuncFlags::EXTERNAL },
529 {
"IMEXP",
"IMEXP", 406,
NOID, 1, 1,
V, {
RR }, FuncFlags::EXTERNAL },
530 {
"IMARGUMENT",
"IMARGUMENT", 407,
NOID, 1, 1,
V, {
RR }, FuncFlags::EXTERNAL },
531 {
"IMCONJUGATE",
"IMCONJUGATE", 408,
NOID, 1, 1,
V, {
RR }, FuncFlags::EXTERNAL },
532 {
"IMAGINARY",
"IMAGINARY", 409,
NOID, 1, 1,
V, {
RR }, FuncFlags::EXTERNAL },
533 {
"IMREAL",
"IMREAL", 410,
NOID, 1, 1,
V, {
RR }, FuncFlags::EXTERNAL },
534 {
"COMPLEX",
"COMPLEX", 411,
NOID, 2, 3,
V, {
RR }, FuncFlags::EXTERNAL },
535 {
"IMSUM",
"IMSUM", 412,
NOID, 1,
MX,
V, {
RX }, FuncFlags::EXTERNAL },
536 {
"IMPRODUCT",
"IMPRODUCT", 413,
NOID, 1,
MX,
V, {
RX }, FuncFlags::EXTERNAL },
537 {
"SERIESSUM",
"SERIESSUM", 414,
NOID, 4, 4,
V, {
RR,
RR,
RR,
RX }, FuncFlags::EXTERNAL },
538 {
"FACTDOUBLE",
"FACTDOUBLE", 415,
NOID, 1, 1,
V, {
RR }, FuncFlags::EXTERNAL },
539 {
"SQRTPI",
"SQRTPI", 416,
NOID, 1, 1,
V, {
RR }, FuncFlags::EXTERNAL },
540 {
"QUOTIENT",
"QUOTIENT", 417,
NOID, 2, 2,
V, {
RR }, FuncFlags::EXTERNAL },
541 {
"DELTA",
"DELTA", 418,
NOID, 1, 2,
V, {
RR }, FuncFlags::EXTERNAL },
542 {
"GESTEP",
"GESTEP", 419,
NOID, 1, 2,
V, {
RR }, FuncFlags::EXTERNAL },
543 {
"ISEVEN",
"ISEVEN", 420,
NOID, 1, 1,
V, {
RR }, FuncFlags::EXTERNAL | FuncFlags::INTERNAL },
544 {
"ISODD",
"ISODD", 421,
NOID, 1, 1,
V, {
RR }, FuncFlags::EXTERNAL | FuncFlags::INTERNAL },
545 {
"MROUND",
"MROUND", 422,
NOID, 2, 2,
V, {
RR }, FuncFlags::EXTERNAL },
546 {
"ERF",
"ERF", 423,
NOID, 1, 2,
V, {
RR }, FuncFlags::EXTERNAL },
547 {
"ERFC",
"ERFC", 424,
NOID, 1, 1,
V, {
RR }, FuncFlags::EXTERNAL },
548 {
"BESSELJ",
"BESSELJ", 425,
NOID, 2, 2,
V, {
RR }, FuncFlags::EXTERNAL },
549 {
"BESSELK",
"BESSELK", 426,
NOID, 2, 2,
V, {
RR }, FuncFlags::EXTERNAL },
550 {
"BESSELY",
"BESSELY", 427,
NOID, 2, 2,
V, {
RR }, FuncFlags::EXTERNAL },
551 {
"BESSELI",
"BESSELI", 428,
NOID, 2, 2,
V, {
RR }, FuncFlags::EXTERNAL },
552 {
"XIRR",
"XIRR", 429,
NOID, 2, 3,
V, {
RX,
RX,
RR }, FuncFlags::EXTERNAL },
553 {
"XNPV",
"XNPV", 430,
NOID, 3, 3,
V, {
RR,
RX,
RX }, FuncFlags::EXTERNAL },
554 {
"PRICEMAT",
"PRICEMAT", 431,
NOID, 5, 6,
V, {
RR }, FuncFlags::EXTERNAL },
555 {
"YIELDMAT",
"YIELDMAT", 432,
NOID, 5, 6,
V, {
RR }, FuncFlags::EXTERNAL },
556 {
"INTRATE",
"INTRATE", 433,
NOID, 4, 5,
V, {
RR }, FuncFlags::EXTERNAL },
557 {
"RECEIVED",
"RECEIVED", 434,
NOID, 4, 5,
V, {
RR }, FuncFlags::EXTERNAL },
558 {
"DISC",
"DISC", 435,
NOID, 4, 5,
V, {
RR }, FuncFlags::EXTERNAL },
559 {
"PRICEDISC",
"PRICEDISC", 436,
NOID, 4, 5,
V, {
RR }, FuncFlags::EXTERNAL },
560 {
"YIELDDISC",
"YIELDDISC", 437,
NOID, 4, 5,
V, {
RR }, FuncFlags::EXTERNAL },
561 {
"TBILLEQ",
"TBILLEQ", 438,
NOID, 3, 3,
V, {
RR }, FuncFlags::EXTERNAL },
562 {
"TBILLPRICE",
"TBILLPRICE", 439,
NOID, 3, 3,
V, {
RR }, FuncFlags::EXTERNAL },
563 {
"TBILLYIELD",
"TBILLYIELD", 440,
NOID, 3, 3,
V, {
RR }, FuncFlags::EXTERNAL },
564 {
"PRICE",
"PRICE", 441,
NOID, 6, 7,
V, {
RR }, FuncFlags::EXTERNAL },
565 {
"YIELD",
"YIELD", 442,
NOID, 6, 7,
V, {
RR }, FuncFlags::EXTERNAL },
566 {
"DOLLARDE",
"DOLLARDE", 443,
NOID, 2, 2,
V, {
RR }, FuncFlags::EXTERNAL },
567 {
"DOLLARFR",
"DOLLARFR", 444,
NOID, 2, 2,
V, {
RR }, FuncFlags::EXTERNAL },
568 {
"NOMINAL",
"NOMINAL", 445,
NOID, 2, 2,
V, {
RR }, FuncFlags::EXTERNAL | FuncFlags::INTERNAL },
569 {
"EFFECT",
"EFFECT", 446,
NOID, 2, 2,
V, {
RR }, FuncFlags::EXTERNAL | FuncFlags::INTERNAL },
570 {
"CUMPRINC",
"CUMPRINC", 447,
NOID, 6, 6,
V, {
RR }, FuncFlags::EXTERNAL | FuncFlags::INTERNAL },
571 {
"CUMIPMT",
"CUMIPMT", 448,
NOID, 6, 6,
V, {
RR }, FuncFlags::EXTERNAL | FuncFlags::INTERNAL },
572 {
"EDATE",
"EDATE", 449,
NOID, 2, 2,
V, {
RR }, FuncFlags::EXTERNAL },
573 {
"EOMONTH",
"EOMONTH", 450,
NOID, 2, 2,
V, {
RR }, FuncFlags::EXTERNAL },
574 {
"YEARFRAC",
"YEARFRAC", 451,
NOID, 2, 3,
V, {
RR }, FuncFlags::EXTERNAL },
575 {
"COUPDAYBS",
"COUPDAYBS", 452,
NOID, 3, 4,
V, {
RR }, FuncFlags::EXTERNAL },
576 {
"COUPDAYS",
"COUPDAYS", 453,
NOID, 3, 4,
V, {
RR }, FuncFlags::EXTERNAL },
577 {
"COUPDAYSNC",
"COUPDAYSNC", 454,
NOID, 3, 4,
V, {
RR }, FuncFlags::EXTERNAL },
578 {
"COUPNCD",
"COUPNCD", 455,
NOID, 3, 4,
V, {
RR }, FuncFlags::EXTERNAL },
579 {
"COUPNUM",
"COUPNUM", 456,
NOID, 3, 4,
V, {
RR }, FuncFlags::EXTERNAL },
580 {
"COUPPCD",
"COUPPCD", 457,
NOID, 3, 4,
V, {
RR }, FuncFlags::EXTERNAL },
581 {
"DURATION",
"DURATION", 458,
NOID, 5, 6,
V, {
RR }, FuncFlags::EXTERNAL },
582 {
"MDURATION",
"MDURATION", 459,
NOID, 5, 6,
V, {
RR }, FuncFlags::EXTERNAL },
583 {
"ODDLPRICE",
"ODDLPRICE", 460,
NOID, 7, 8,
V, {
RR }, FuncFlags::EXTERNAL },
584 {
"ODDLYIELD",
"ODDLYIELD", 461,
NOID, 8, 9,
V, {
RR }, FuncFlags::EXTERNAL },
585 {
"ODDFPRICE",
"ODDFPRICE", 462,
NOID, 8, 9,
V, {
RR }, FuncFlags::EXTERNAL },
586 {
"ODDFYIELD",
"ODDFYIELD", 463,
NOID, 8, 9,
V, {
RR }, FuncFlags::EXTERNAL },
587 {
"RANDBETWEEN",
"RANDBETWEEN", 464,
NOID, 2, 2,
V, {
RR }, FuncFlags::VOLATILE | FuncFlags::EXTERNAL },
588 {
"WEEKNUM",
"WEEKNUM", 465,
NOID, 1, 2,
V, {
RR }, FuncFlags::EXTERNAL },
589 {
"AMORDEGRC",
"AMORDEGRC", 466,
NOID, 6, 7,
V, {
RR }, FuncFlags::EXTERNAL },
590 {
"AMORLINC",
"AMORLINC", 467,
NOID, 6, 7,
V, {
RR }, FuncFlags::EXTERNAL },
591 {
"CONVERT",
"CONVERT", 468,
NOID, 3, 3,
V, {
RR }, FuncFlags::EXTERNAL },
592 {
"ACCRINT",
"ACCRINT", 469,
NOID, 6, 7,
V, {
RR }, FuncFlags::EXTERNAL },
593 {
"ACCRINTM",
"ACCRINTM", 470,
NOID, 4, 5,
V, {
RR }, FuncFlags::EXTERNAL },
594 {
"WORKDAY",
"WORKDAY", 471,
NOID, 2, 3,
V, {
RR,
RR,
RX,
C }, FuncFlags::EXTERNAL },
595 {
"NETWORKDAYS",
"NETWORKDAYS", 472,
NOID, 2, 3,
V, {
RR,
RR,
RX,
C }, FuncFlags::EXTERNAL | FuncFlags::INTERNAL },
596 {
"GCD",
"GCD", 473,
NOID, 1,
MX,
V, {
RX }, FuncFlags::EXTERNAL | FuncFlags::INTERNAL },
597 {
"MULTINOMIAL",
"MULTINOMIAL", 474,
NOID, 1,
MX,
V, {
RX }, FuncFlags::EXTERNAL },
598 {
"LCM",
"LCM", 475,
NOID, 1,
MX,
V, {
RX }, FuncFlags::EXTERNAL | FuncFlags::INTERNAL },
599 {
"FVSCHEDULE",
"FVSCHEDULE", 476,
NOID, 2, 2,
V, {
RR,
RX }, FuncFlags::EXTERNAL },
603 {
nullptr,
"ACTIVATE.NEXT", 104, 104, 0, 1,
V, {
VR }, FuncFlags::MACROCMD },
604 {
nullptr,
"ACTIVATE.PREV", 105, 105, 0, 1,
V, {
VR }, FuncFlags::MACROCMD }
608const FunctionData saFuncTableBiff5[] =
611 {
"HLOOKUP",
"HLOOKUP", 101, 101, 3, 4,
V, {
VV,
RO,
RO,
VV },
FuncFlags::NONE },
612 {
"VLOOKUP",
"VLOOKUP", 102, 102, 3, 4,
V, {
VV,
RO,
RO,
VV },
FuncFlags::NONE },
614 {
nullptr,
"EXTERN.CALL", 255, 255, 1,
MX,
R, {
RO_E,
RO }, FuncFlags::EXPORTONLY },
619 {
"SUBTOTAL",
"SUBTOTAL", 344, 344, 2,
MX,
V, {
VR,
RO },
FuncFlags::NONE },
620 {
"SUMIF",
"SUMIF", 345, 345, 2, 3,
V, {
RO,
VR,
RO },
FuncFlags::NONE },
621 {
"COUNTIF",
"COUNTIF", 346, 346, 2, 2,
V, {
RO,
VR },
FuncFlags::NONE },
625 {
nullptr,
"DATESTRING", 352, 352, 1, 1,
V, {
VR }, FuncFlags::IMPORTONLY },
626 {
nullptr,
"NUMBERSTRING", 353, 353, 2, 2,
V, {
VR }, FuncFlags::IMPORTONLY },
630 {
"EUROCONVERT",
"EUROCONVERT",
NOID,
NOID, 3, 5,
V, {
VR }, FuncFlags::EUROTOOL },
634 {
nullptr,
"ADD.MENU", 152, 152, 2, 4,
V, {
VR,
RO,
RO,
VR }, FuncFlags::MACROFUNC },
635 {
nullptr,
"ADD.COMMAND", 153, 153, 3, 5,
V, {
VR,
RO,
RO,
RO,
VR }, FuncFlags::MACROFUNC },
636 {
nullptr,
"ADD.CHART.AUTOFORMAT", 390, 390, 0, 2,
V, {
VR }, FuncFlags::MACROCMD },
637 {
nullptr,
"ADD.LIST.ITEM", 451, 451, 0, 2,
V, {
VR }, FuncFlags::MACROCMD },
638 {
nullptr,
"ACTIVE.CELL.FONT", 476, 476, 0, 14,
V, {
VR }, FuncFlags::MACROCMD }
642const FunctionData saFuncTableBiff8[] =
644 {
"GETPIVOTDATA",
"GETPIVOTDATA", 358, 358, 2,
MX,
V, {
RR,
RR,
VR,
VR }, FuncFlags::IMPORTONLY | FuncFlags::PARAMPAIRS },
645 {
"HYPERLINK",
"HYPERLINK", 359, 359, 1, 2,
V, {
VV,
VO },
FuncFlags::NONE },
646 {
nullptr,
"PHONETIC", 360, 360, 1, 1,
V, {
RO }, FuncFlags::IMPORTONLY },
654 {
"COM.MICROSOFT.BAHTTEXT",
"BAHTTEXT", 368, 368, 1, 1,
V, {
VR }, FuncFlags::MACROCALL },
655 {
nullptr,
"THAIDAYOFWEEK", 369, 369, 1, 1,
V, {
VR }, FuncFlags::MACROCALL },
656 {
nullptr,
"THAIDIGIT", 370, 370, 1, 1,
V, {
VR }, FuncFlags::MACROCALL },
657 {
nullptr,
"THAIMONTHOFYEAR", 371, 371, 1, 1,
V, {
VR }, FuncFlags::MACROCALL },
658 {
nullptr,
"THAINUMSOUND", 372, 372, 1, 1,
V, {
VR }, FuncFlags::MACROCALL },
659 {
nullptr,
"THAINUMSTRING", 373, 373, 1, 1,
V, {
VR }, FuncFlags::MACROCALL },
660 {
nullptr,
"THAISTRINGLENGTH", 374, 374, 1, 1,
V, {
VR }, FuncFlags::MACROCALL },
661 {
nullptr,
"ISTHAIDIGIT", 375, 375, 1, 1,
V, {
VR }, FuncFlags::MACROCALL },
662 {
nullptr,
"ROUNDBAHTDOWN", 376, 376, 1, 1,
V, {
VR }, FuncFlags::MACROCALL },
663 {
nullptr,
"ROUNDBAHTUP", 377, 377, 1, 1,
V, {
VR }, FuncFlags::MACROCALL },
664 {
nullptr,
"THAIYEAR", 378, 378, 1, 1,
V, {
VR }, FuncFlags::MACROCALL },
665 {
nullptr,
"RTD", 379, 379, 3, 3,
A, {
VR,
VR,
RO },
FuncFlags::NONE }
669const FunctionData saFuncTableOox[] =
671 {
nullptr,
"CUBEVALUE", 380,
NOID, 1,
MX,
V, {
VR,
RX },
FuncFlags::NONE },
672 {
nullptr,
"CUBEMEMBER", 381,
NOID, 2, 3,
V, {
VR,
RX,
VR },
FuncFlags::NONE },
676 {
nullptr,
"CUBESET", 478,
NOID, 2, 5,
V, {
VR,
RX,
VR },
FuncFlags::NONE },
678 {
"IFERROR",
"IFERROR", 480,
NOID, 2, 2,
V, {
VO,
RO }, FuncFlags::MACROCALL },
679 {
"COUNTIFS",
"COUNTIFS", 481,
NOID, 2,
MX,
V, {
RO,
VR }, FuncFlags::MACROCALL | FuncFlags::PARAMPAIRS },
680 {
"SUMIFS",
"SUMIFS", 482,
NOID, 3,
MX,
V, {
RO,
RO,
VR }, FuncFlags::MACROCALL | FuncFlags::PARAMPAIRS },
681 {
"AVERAGEIF",
"AVERAGEIF", 483,
NOID, 2, 3,
V, {
RO,
VR,
RO }, FuncFlags::MACROCALL },
682 {
"AVERAGEIFS",
"AVERAGEIFS", 484,
NOID, 3,
MX,
V, {
RO,
RO,
VR }, FuncFlags::MACROCALL | FuncFlags::PARAMPAIRS },
683 {
"COM.MICROSOFT.ISO.CEILING",
"ISO.CEILING",
NOID,
NOID, 1, 2,
V, {
VR }, FuncFlags::MACROCALL },
684 {
"COM.MICROSOFT.NETWORKDAYS.INTL",
"NETWORKDAYS.INTL",
NOID,
NOID, 2, 4,
V, {
VR,
VR,
VR,
RX }, FuncFlags::MACROCALL },
685 {
"COM.MICROSOFT.WORKDAY.INTL",
"WORKDAY.INTL",
NOID,
NOID, 2, 4,
V, {
VR,
VR,
VR,
RX }, FuncFlags::MACROCALL }
705const FunctionData saFuncTable2010[] =
707 {
"COM.MICROSOFT.COVARIANCE.P",
"COVARIANCE.P",
NOID,
NOID, 2, 2,
V, {
VA }, FuncFlags::MACROCALL_NEW },
708 {
"COM.MICROSOFT.COVARIANCE.S",
"COVARIANCE.S",
NOID,
NOID, 2, 2,
V, {
VA }, FuncFlags::MACROCALL_NEW },
709 {
"COM.MICROSOFT.STDEV.P",
"STDEV.P",
NOID,
NOID, 1,
MX,
V, {
RX }, FuncFlags::MACROCALL_NEW },
710 {
"COM.MICROSOFT.STDEV.S",
"STDEV.S",
NOID,
NOID, 1,
MX,
V, {
RX }, FuncFlags::MACROCALL_NEW },
711 {
"COM.MICROSOFT.VAR.P",
"VAR.P" ,
NOID,
NOID, 1,
MX,
V, {
RX }, FuncFlags::MACROCALL_NEW },
712 {
"COM.MICROSOFT.VAR.S",
"VAR.S",
NOID,
NOID, 1,
MX,
V, {
RX }, FuncFlags::MACROCALL_NEW },
713 {
"COM.MICROSOFT.BETA.DIST",
"BETA.DIST" ,
NOID,
NOID, 4, 6,
V, {
VR }, FuncFlags::MACROCALL_NEW },
714 {
"COM.MICROSOFT.BETA.INV",
"BETA.INV",
NOID,
NOID, 3, 5,
V, {
VR }, FuncFlags::MACROCALL_NEW },
715 {
"COM.MICROSOFT.BINOM.DIST",
"BINOM.DIST",
NOID,
NOID, 4, 4,
V, {
VR }, FuncFlags::MACROCALL_NEW },
716 {
"COM.MICROSOFT.BINOM.INV",
"BINOM.INV",
NOID,
NOID, 3, 3,
V, {
VR }, FuncFlags::MACROCALL_NEW },
717 {
"COM.MICROSOFT.CHISQ.DIST",
"CHISQ.DIST",
NOID,
NOID, 3, 3,
V, {
VR }, FuncFlags::MACROCALL_NEW },
718 {
"COM.MICROSOFT.CHISQ.INV",
"CHISQ.INV",
NOID,
NOID, 2, 2,
V, {
VR }, FuncFlags::MACROCALL_NEW },
719 {
"COM.MICROSOFT.CHISQ.DIST.RT",
"CHISQ.DIST.RT",
NOID,
NOID, 2, 2,
V, {
VR }, FuncFlags::MACROCALL_NEW },
720 {
"COM.MICROSOFT.CHISQ.INV.RT",
"CHISQ.INV.RT",
NOID,
NOID, 2, 2,
V, {
VR }, FuncFlags::MACROCALL_NEW },
721 {
"COM.MICROSOFT.CHISQ.TEST",
"CHISQ.TEST",
NOID,
NOID, 2, 2,
V, {
VA }, FuncFlags::MACROCALL_NEW },
722 {
"COM.MICROSOFT.CONFIDENCE.NORM",
"CONFIDENCE.NORM",
NOID,
NOID, 3, 3,
V, {
VR }, FuncFlags::MACROCALL_NEW },
723 {
"COM.MICROSOFT.CONFIDENCE.T",
"CONFIDENCE.T",
NOID,
NOID, 3, 3,
V, {
VR }, FuncFlags::MACROCALL_NEW },
724 {
"FDIST",
"F.DIST",
NOID,
NOID, 4, 4,
V, {
VR }, FuncFlags::MACROCALL_NEW },
725 {
"COM.MICROSOFT.F.DIST.RT",
"F.DIST.RT",
NOID,
NOID, 3, 3,
V, {
VR }, FuncFlags::MACROCALL_NEW },
726 {
"FINV",
"F.INV",
NOID,
NOID, 3, 3,
V, {
VR }, FuncFlags::MACROCALL_NEW },
727 {
"COM.MICROSOFT.F.INV.RT",
"F.INV.RT",
NOID,
NOID, 3, 3,
V, {
VR }, FuncFlags::MACROCALL_NEW },
728 {
"COM.MICROSOFT.F.TEST",
"F.TEST",
NOID,
NOID, 2, 2,
V, {
VA }, FuncFlags::MACROCALL_NEW },
729 {
"COM.MICROSOFT.EXPON.DIST",
"EXPON.DIST",
NOID,
NOID, 3, 3,
V, {
VR }, FuncFlags::MACROCALL_NEW },
730 {
"COM.MICROSOFT.HYPGEOM.DIST",
"HYPGEOM.DIST",
NOID,
NOID, 5, 5,
V, {
VR }, FuncFlags::MACROCALL_NEW },
731 {
"COM.MICROSOFT.POISSON.DIST",
"POISSON.DIST",
NOID,
NOID, 3, 3,
V, {
VR }, FuncFlags::MACROCALL_NEW },
732 {
"COM.MICROSOFT.WEIBULL.DIST",
"WEIBULL.DIST",
NOID,
NOID, 4, 4,
V, {
VR }, FuncFlags::MACROCALL_NEW },
733 {
"COM.MICROSOFT.GAMMA.DIST",
"GAMMA.DIST",
NOID,
NOID, 4, 4,
V, {
VR }, FuncFlags::MACROCALL_NEW },
734 {
"COM.MICROSOFT.GAMMA.INV",
"GAMMA.INV",
NOID,
NOID, 3, 3,
V, {
VR }, FuncFlags::MACROCALL_NEW },
735 {
"COM.MICROSOFT.GAMMALN.PRECISE",
"GAMMALN.PRECISE",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW },
736 {
"COM.MICROSOFT.LOGNORM.DIST",
"LOGNORM.DIST",
NOID,
NOID, 4, 4,
V, {
VR }, FuncFlags::MACROCALL_NEW },
737 {
"COM.MICROSOFT.LOGNORM.INV",
"LOGNORM.INV",
NOID,
NOID, 3, 3,
V, {
VR }, FuncFlags::MACROCALL_NEW },
738 {
"COM.MICROSOFT.NORM.DIST",
"NORM.DIST",
NOID,
NOID, 4, 4,
V, {
VR }, FuncFlags::MACROCALL_NEW },
739 {
"COM.MICROSOFT.NORM.INV",
"NORM.INV",
NOID,
NOID, 3, 3,
V, {
VR }, FuncFlags::MACROCALL_NEW },
740 {
"COM.MICROSOFT.NORM.S.DIST",
"NORM.S.DIST",
NOID,
NOID, 2, 2,
V, {
VR }, FuncFlags::MACROCALL_NEW },
741 {
"COM.MICROSOFT.NORM.S.INV",
"NORM.S.INV",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW },
742 {
"COM.MICROSOFT.T.DIST",
"T.DIST",
NOID,
NOID, 3, 3,
V, {
VR }, FuncFlags::MACROCALL_NEW },
743 {
"COM.MICROSOFT.T.DIST.2T",
"T.DIST.2T",
NOID,
NOID, 2, 2,
V, {
VR }, FuncFlags::MACROCALL_NEW },
744 {
"COM.MICROSOFT.T.DIST.RT",
"T.DIST.RT",
NOID,
NOID, 2, 2,
V, {
VR }, FuncFlags::MACROCALL_NEW },
745 {
"COM.MICROSOFT.T.INV",
"T.INV",
NOID,
NOID, 2, 2,
V, {
VR }, FuncFlags::MACROCALL_NEW },
746 {
"COM.MICROSOFT.T.INV.2T",
"T.INV.2T",
NOID,
NOID, 2, 2,
V, {
VR }, FuncFlags::MACROCALL_NEW },
747 {
"COM.MICROSOFT.T.TEST",
"T.TEST",
NOID,
NOID, 4, 4,
V, {
VA,
VA,
VR }, FuncFlags::MACROCALL_NEW },
748 {
"COM.MICROSOFT.PERCENTILE.INC",
"PERCENTILE.INC",
NOID,
NOID, 2, 2,
V, {
RX,
VR }, FuncFlags::MACROCALL_NEW },
749 {
"COM.MICROSOFT.PERCENTRANK.INC",
"PERCENTRANK.INC",
NOID,
NOID, 2, 3,
V, {
RX,
VR,
VR_E }, FuncFlags::MACROCALL_NEW },
750 {
"COM.MICROSOFT.QUARTILE.INC",
"QUARTILE.INC",
NOID,
NOID, 2, 2,
V, {
RX,
VR }, FuncFlags::MACROCALL_NEW },
751 {
"COM.MICROSOFT.RANK.EQ",
"RANK.EQ",
NOID,
NOID, 2, 3,
V, {
VR,
RO,
VR }, FuncFlags::MACROCALL_NEW },
752 {
"COM.MICROSOFT.PERCENTILE.EXC",
"PERCENTILE.EXC",
NOID,
NOID, 2, 2,
V, {
RX,
VR }, FuncFlags::MACROCALL_NEW },
753 {
"COM.MICROSOFT.PERCENTRANK.EXC",
"PERCENTRANK.EXC",
NOID,
NOID, 2, 3,
V, {
RX,
VR,
VR_E }, FuncFlags::MACROCALL_NEW },
754 {
"COM.MICROSOFT.QUARTILE.EXC",
"QUARTILE.EXC",
NOID,
NOID, 2, 2,
V, {
RX,
VR }, FuncFlags::MACROCALL_NEW },
755 {
"COM.MICROSOFT.RANK.AVG",
"RANK.AVG",
NOID,
NOID, 2, 3,
V, {
VR,
RO,
VR }, FuncFlags::MACROCALL_NEW },
756 {
"COM.MICROSOFT.MODE.SNGL",
"MODE.SNGL",
NOID,
NOID, 1,
MX,
V, {
VA }, FuncFlags::MACROCALL_NEW },
757 {
"COM.MICROSOFT.MODE.MULT",
"MODE.MULT",
NOID,
NOID, 1,
MX,
V, {
VA }, FuncFlags::MACROCALL_NEW },
758 {
"COM.MICROSOFT.NEGBINOM.DIST",
"NEGBINOM.DIST",
NOID,
NOID, 4, 4,
V, {
VR }, FuncFlags::MACROCALL_NEW },
759 {
"COM.MICROSOFT.Z.TEST",
"Z.TEST",
NOID,
NOID, 2, 3,
V, {
RX,
VR }, FuncFlags::MACROCALL_NEW },
760 {
"COM.MICROSOFT.CEILING.PRECISE",
"CEILING.PRECISE",
NOID,
NOID, 1, 2,
V, {
VR }, FuncFlags::MACROCALL_NEW },
761 {
"COM.MICROSOFT.FLOOR.PRECISE",
"FLOOR.PRECISE",
NOID,
NOID, 1, 2,
V, {
VR }, FuncFlags::MACROCALL_NEW },
762 {
"COM.MICROSOFT.ERF.PRECISE",
"ERF.PRECISE",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW },
763 {
"COM.MICROSOFT.ERFC.PRECISE",
"ERFC.PRECISE",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW },
764 {
"COM.MICROSOFT.AGGREGATE",
"AGGREGATE",
NOID,
NOID, 3,
MX,
V, {
VR,
RO }, FuncFlags::MACROCALL_NEW }
785const FunctionData saFuncTable2013[] =
787 {
"ACOT",
"ACOT",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW },
788 {
"ACOTH",
"ACOTH",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW },
789 {
"ARABIC",
"ARABIC",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW },
790 {
"BASE",
"BASE",
NOID,
NOID, 2, 3,
V, {
VR }, FuncFlags::MACROCALL_NEW },
791 {
"BINOM.DIST.RANGE",
"BINOM.DIST.RANGE",
NOID,
NOID, 3, 4,
V, {
VR }, FuncFlags::MACROCALL_NEW },
792 {
"BITAND",
"BITAND",
NOID,
NOID, 2, 2,
V, {
VR }, FuncFlags::MACROCALL_NEW },
793 {
"BITLSHIFT",
"BITLSHIFT",
NOID,
NOID, 2, 2,
V, {
VR }, FuncFlags::MACROCALL_NEW },
794 {
"BITOR",
"BITOR",
NOID,
NOID, 2, 2,
V, {
VR }, FuncFlags::MACROCALL_NEW },
795 {
"BITRSHIFT",
"BITRSHIFT",
NOID,
NOID, 2, 2,
V, {
VR }, FuncFlags::MACROCALL_NEW },
796 {
"BITXOR",
"BITXOR",
NOID,
NOID, 2, 2,
V, {
VR }, FuncFlags::MACROCALL_NEW },
797 {
"COM.MICROSOFT.CEILING.MATH",
"CEILING.MATH",
NOID,
NOID, 1, 3,
V, {
VR }, FuncFlags::MACROCALL_NEW },
798 {
"CEILING",
"CEILING.MATH",
NOID,
NOID, 1, 3,
V, {
VR }, FuncFlags::EXPORTONLY | FuncFlags::MACROCALL_NEW },
799 {
"COMBINA",
"COMBINA",
NOID,
NOID, 2, 2,
V, {
VR }, FuncFlags::MACROCALL_NEW },
800 {
"COT",
"COT",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW },
801 {
"COTH",
"COTH",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW },
802 {
"CSC",
"CSC",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW },
803 {
"CSCH",
"CSCH",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW },
804 {
"DAYS",
"DAYS",
NOID,
NOID, 2, 2,
V, {
VR }, FuncFlags::MACROCALL_NEW },
805 {
"DECIMAL",
"DECIMAL",
NOID,
NOID, 2, 2,
V, {
VR }, FuncFlags::MACROCALL_NEW },
806 {
"COM.MICROSOFT.ENCODEURL",
"ENCODEURL",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW },
807 {
"COM.MICROSOFT.FILTERXML",
"FILTERXML",
NOID,
NOID, 2, 2,
V, {
VR }, FuncFlags::MACROCALL_NEW },
808 {
"COM.MICROSOFT.FLOOR.MATH",
"FLOOR.MATH",
NOID,
NOID, 1, 3,
V, {
VR }, FuncFlags::MACROCALL_NEW },
809 {
"FLOOR",
"FLOOR.MATH",
NOID,
NOID, 1, 3,
V, {
VR }, FuncFlags::EXPORTONLY | FuncFlags::MACROCALL_NEW },
811 {
nullptr,
"FDIST",
NOID,
NOID, 3, 4,
V, {
VR }, FuncFlags::MACROCALL_NEW },
813 {
nullptr,
"FINV",
NOID,
NOID, 3, 3,
V, {
VR }, FuncFlags::MACROCALL_NEW },
814 {
"FORMULA",
"FORMULATEXT",
NOID,
NOID, 1, 1,
V, {
RO }, FuncFlags::MACROCALL_NEW },
815 {
"GAMMA",
"GAMMA",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW },
816 {
"GAUSS",
"GAUSS",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW },
817 {
"IFNA",
"IFNA",
NOID,
NOID, 2, 2,
V, {
VO,
RO }, FuncFlags::MACROCALL_NEW },
818 {
"IMCOSH",
"IMCOSH",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW | FuncFlags::EXTERNAL },
819 {
"IMCOT",
"IMCOT",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW | FuncFlags::EXTERNAL },
820 {
"IMCSC",
"IMCSC",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW | FuncFlags::EXTERNAL },
821 {
"IMCSCH",
"IMCSCH",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW | FuncFlags::EXTERNAL },
822 {
"IMSEC",
"IMSEC",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW | FuncFlags::EXTERNAL },
823 {
"IMSECH",
"IMSECH",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW | FuncFlags::EXTERNAL },
824 {
"IMSINH",
"IMSINH",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW | FuncFlags::EXTERNAL },
825 {
"IMTAN",
"IMTAN",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW | FuncFlags::EXTERNAL },
826 {
"ISFORMULA",
"ISFORMULA",
NOID,
NOID, 1, 1,
V, {
RO }, FuncFlags::MACROCALL_NEW },
827 {
"ISOWEEKNUM",
"ISOWEEKNUM",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW },
828 {
"MUNIT",
"MUNIT",
NOID,
NOID, 1, 1,
A, {
VR }, FuncFlags::MACROCALL_NEW },
829 {
"NUMBERVALUE",
"NUMBERVALUE",
NOID,
NOID, 1, 3,
V, {
VR }, FuncFlags::MACROCALL_NEW },
830 {
"PDURATION",
"PDURATION",
NOID,
NOID, 3, 3,
V, {
VR }, FuncFlags::MACROCALL_NEW },
831 {
"PERMUTATIONA",
"PERMUTATIONA",
NOID,
NOID, 2, 2,
V, {
VR }, FuncFlags::MACROCALL_NEW },
832 {
"PHI",
"PHI",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW },
833 {
"RRI",
"RRI",
NOID,
NOID, 3, 3,
V, {
VR }, FuncFlags::MACROCALL_NEW },
834 {
"SEC",
"SEC",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW },
835 {
"SECH",
"SECH",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW },
836 {
"SHEET",
"SHEET",
NOID,
NOID, 0, 1,
V, {
RO }, FuncFlags::MACROCALL_NEW },
837 {
"SHEETS",
"SHEETS",
NOID,
NOID, 0, 1,
V, {
RO }, FuncFlags::MACROCALL_NEW },
838 {
"SKEWP",
"SKEW.P",
NOID,
NOID, 1,
MX,
V, {
RX }, FuncFlags::MACROCALL_NEW },
839 {
"UNICHAR",
"UNICHAR",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW },
840 {
"UNICODE",
"UNICODE",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW },
841 {
"COM.MICROSOFT.WEBSERVICE",
"WEBSERVICE",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW },
842 {
"XOR",
"XOR",
NOID,
NOID, 1,
MX,
V, {
RX }, FuncFlags::MACROCALL_NEW }
853const FunctionData saFuncTable2016[] =
855 {
"COM.MICROSOFT.FORECAST.ETS",
"FORECAST.ETS",
NOID,
NOID, 3, 6,
V, {
VR,
VA,
VR }, FuncFlags::MACROCALL_NEW },
856 {
"COM.MICROSOFT.FORECAST.ETS.CONFINT",
"FORECAST.ETS.CONFINT",
NOID,
NOID, 4, 7,
V, {
VR,
VA,
VR }, FuncFlags::MACROCALL_NEW },
857 {
"COM.MICROSOFT.FORECAST.ETS.SEASONALITY",
"FORECAST.ETS.SEASONALITY",
NOID,
NOID, 2, 4,
V, {
VR,
VA,
VR }, FuncFlags::MACROCALL_NEW },
858 {
"COM.MICROSOFT.FORECAST.ETS.STAT",
"FORECAST.ETS.STAT",
NOID,
NOID, 3, 6,
V, {
VR,
VA,
VR }, FuncFlags::MACROCALL_NEW },
859 {
"COM.MICROSOFT.FORECAST.LINEAR",
"FORECAST.LINEAR",
NOID,
NOID, 3, 3,
V, {
VR,
VA }, FuncFlags::MACROCALL_NEW },
860 {
"COM.MICROSOFT.CONCAT",
"CONCAT",
NOID,
NOID, 1,
MX,
V, {
VR }, FuncFlags::MACROCALL_NEW },
861 {
"COM.MICROSOFT.TEXTJOIN",
"TEXTJOIN",
NOID,
NOID, 3,
MX,
V, {
VR }, FuncFlags::MACROCALL_NEW },
862 {
"COM.MICROSOFT.IFS",
"IFS",
NOID,
NOID, 2,
MX,
R, {
VO,
RO }, FuncFlags::MACROCALL_NEW },
863 {
"COM.MICROSOFT.SWITCH",
"SWITCH",
NOID,
NOID, 3,
MX,
R, {
VO,
RO }, FuncFlags::MACROCALL_NEW },
864 {
"COM.MICROSOFT.MINIFS",
"MINIFS",
NOID,
NOID, 3,
MX,
R, {
VO,
RO }, FuncFlags::MACROCALL_NEW },
865 {
"COM.MICROSOFT.MAXIFS",
"MAXIFS",
NOID,
NOID, 3,
MX,
R, {
VO,
RO }, FuncFlags::MACROCALL_NEW }
870const FunctionData saFuncTableOdf[] =
872 {
"CHISQDIST",
nullptr,
NOID,
NOID, 2, 3,
V, {
VR }, FuncFlags::MACROCALLODF },
873 {
"CHISQINV",
nullptr,
NOID,
NOID, 2, 2,
V, {
VR }, FuncFlags::MACROCALLODF }
877const FunctionData saFuncTableOOoLO[] =
879 {
"ORG.OPENOFFICE.WEEKS",
"ORG.OPENOFFICE.WEEKS",
NOID,
NOID, 3, 3,
V, {
VR }, FuncFlags::MACROCALL_NEW | FuncFlags::EXTERNAL },
880 {
"ORG.OPENOFFICE.MONTHS",
"ORG.OPENOFFICE.MONTHS",
NOID,
NOID, 3, 3,
V, {
VR }, FuncFlags::MACROCALL_NEW | FuncFlags::EXTERNAL },
881 {
"ORG.OPENOFFICE.YEARS",
"ORG.OPENOFFICE.YEARS",
NOID,
NOID, 3, 3,
V, {
VR }, FuncFlags::MACROCALL_NEW | FuncFlags::EXTERNAL },
882 {
"ORG.OPENOFFICE.ISLEAPYEAR",
"ORG.OPENOFFICE.ISLEAPYEAR",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW | FuncFlags::EXTERNAL },
883 {
"ORG.OPENOFFICE.DAYSINMONTH",
"ORG.OPENOFFICE.DAYSINMONTH",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW | FuncFlags::EXTERNAL },
884 {
"ORG.OPENOFFICE.DAYSINYEAR",
"ORG.OPENOFFICE.DAYSINYEAR",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW | FuncFlags::EXTERNAL },
885 {
"ORG.OPENOFFICE.WEEKSINYEAR",
"ORG.OPENOFFICE.WEEKSINYEAR",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW | FuncFlags::EXTERNAL },
886 {
"ORG.OPENOFFICE.ROT13",
"ORG.OPENOFFICE.ROT13",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW | FuncFlags::EXTERNAL },
889 {
"ORG.OPENOFFICE.WEEKS",
"COM.SUN.STAR.SHEET.ADDIN.DATEFUNCTIONS.GETDIFFWEEKS",
NOID,
NOID, 3, 3,
V, {
VR }, FuncFlags::IMPORTONLY | FuncFlags::EXTERNAL },
890 {
"ORG.OPENOFFICE.MONTHS",
"COM.SUN.STAR.SHEET.ADDIN.DATEFUNCTIONS.GETDIFFMONTHS",
NOID,
NOID, 3, 3,
V, {
VR }, FuncFlags::IMPORTONLY | FuncFlags::EXTERNAL },
891 {
"ORG.OPENOFFICE.YEARS",
"COM.SUN.STAR.SHEET.ADDIN.DATEFUNCTIONS.GETDIFFYEARS",
NOID,
NOID, 3, 3,
V, {
VR }, FuncFlags::IMPORTONLY | FuncFlags::EXTERNAL },
892 {
"ORG.OPENOFFICE.ISLEAPYEAR",
"COM.SUN.STAR.SHEET.ADDIN.DATEFUNCTIONS.GETISLEAPYEAR",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::IMPORTONLY | FuncFlags::EXTERNAL },
893 {
"ORG.OPENOFFICE.DAYSINMONTH",
"COM.SUN.STAR.SHEET.ADDIN.DATEFUNCTIONS.GETDAYSINMONTH",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::IMPORTONLY | FuncFlags::EXTERNAL },
894 {
"ORG.OPENOFFICE.DAYSINYEAR",
"COM.SUN.STAR.SHEET.ADDIN.DATEFUNCTIONS.GETDAYSINYEAR",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::IMPORTONLY | FuncFlags::EXTERNAL },
895 {
"ORG.OPENOFFICE.WEEKSINYEAR",
"COM.SUN.STAR.SHEET.ADDIN.DATEFUNCTIONS.GETWEEKSINYEAR",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::IMPORTONLY | FuncFlags::EXTERNAL },
896 {
"ORG.OPENOFFICE.ROT13",
"COM.SUN.STAR.SHEET.ADDIN.DATEFUNCTIONS.GETROT13",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::IMPORTONLY | FuncFlags::EXTERNAL },
898 {
"ORG.OPENOFFICE.ERRORTYPE",
"ORG.OPENOFFICE.ERRORTYPE",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW },
899 {
"ORG.OPENOFFICE.MULTIRANGE",
"ORG.OPENOFFICE.MULTIRANGE",
NOID,
NOID, 1,
MX,
V, {
RX }, FuncFlags::MACROCALL_NEW },
900 {
"ORG.OPENOFFICE.GOALSEEK",
"ORG.OPENOFFICE.GOALSEEK",
NOID,
NOID, 3, 3,
V, {
VR }, FuncFlags::MACROCALL_NEW },
901 {
"ORG.OPENOFFICE.EASTERSUNDAY",
"ORG.OPENOFFICE.EASTERSUNDAY",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::MACROCALL_NEW },
902 {
"ORG.OPENOFFICE.CURRENT",
"ORG.OPENOFFICE.CURRENT",
NOID,
NOID, 0, 0,
V, {
VR }, FuncFlags::MACROCALL_NEW },
903 {
"ORG.OPENOFFICE.STYLE",
"ORG.OPENOFFICE.STYLE",
NOID,
NOID, 1, 3,
V, {
VR }, FuncFlags::MACROCALL_NEW },
905 {
"ORG.OPENOFFICE.ERRORTYPE",
"ERRORTYPE",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::IMPORTONLY },
906 {
"ORG.OPENOFFICE.MULTIRANGE",
"MULTIRANGE",
NOID,
NOID, 1,
MX,
V, {
RX }, FuncFlags::IMPORTONLY },
907 {
"ORG.OPENOFFICE.GOALSEEK",
"GOALSEEK",
NOID,
NOID, 3, 3,
V, {
VR }, FuncFlags::IMPORTONLY },
908 {
"ORG.OPENOFFICE.EASTERSUNDAY",
"EASTERSUNDAY",
NOID,
NOID, 1, 1,
V, {
VR }, FuncFlags::IMPORTONLY },
909 {
"ORG.OPENOFFICE.CURRENT",
"CURRENT",
NOID,
NOID, 0, 0,
V, {
VR }, FuncFlags::IMPORTONLY },
910 {
"ORG.OPENOFFICE.STYLE",
"STYLE",
NOID,
NOID, 1, 3,
V, {
VR }, FuncFlags::IMPORTONLY },
912 {
"ORG.OPENOFFICE.CONVERT",
"ORG.OPENOFFICE.CONVERT",
NOID,
NOID, 3, 3,
V, {
VR }, FuncFlags::MACROCALL_NEW },
913 {
"ORG.LIBREOFFICE.COLOR",
"ORG.LIBREOFFICE.COLOR",
NOID,
NOID, 3, 4,
V, {
VR }, FuncFlags::MACROCALL_NEW },
914 {
"ORG.LIBREOFFICE.RAWSUBTRACT",
"ORG.LIBREOFFICE.RAWSUBTRACT",
NOID,
NOID, 1,
MX,
V, {
RX }, FuncFlags::MACROCALL_NEW },
915 {
"ORG.LIBREOFFICE.FORECAST.ETS.MULT",
"ORG.LIBREOFFICE.FORECAST.ETS.MULT",
NOID,
NOID, 3, 6,
V, {
VR,
VA,
VR }, FuncFlags::MACROCALL_NEW },
916 {
"ORG.LIBREOFFICE.FORECAST.ETS.PI.MULT",
"ORG.LIBREOFFICE.FORECAST.ETS.PI.MULT",
NOID,
NOID, 4, 7,
V, {
VR,
VA,
VR }, FuncFlags::MACROCALL_NEW },
917 {
"ORG.LIBREOFFICE.FORECAST.ETS.STAT.MULT",
"ORG.LIBREOFFICE.FORECAST.ETS.STAT.MULT",
NOID,
NOID, 3, 6,
V, {
VR,
VA,
VR }, FuncFlags::MACROCALL_NEW },
918 {
"ORG.LIBREOFFICE.ROUNDSIG",
"ORG.LIBREOFFICE.ROUNDSIG",
NOID,
NOID, 2, 2,
V, {
RX }, FuncFlags::MACROCALL_NEW },
919 {
"ORG.LIBREOFFICE.REGEX",
"ORG.LIBREOFFICE.REGEX",
NOID,
NOID, 2, 4,
V, {
RX }, FuncFlags::MACROCALL_NEW },
920 {
"ORG.LIBREOFFICE.FOURIER",
"ORG.LIBREOFFICE.FOURIER",
NOID,
NOID, 2, 5,
A, {
RX }, FuncFlags::MACROCALL_NEW },
921 {
"ORG.LIBREOFFICE.RAND.NV",
"ORG.LIBREOFFICE.RAND.NV",
NOID,
NOID, 0, 0,
V, {}, FuncFlags::MACROCALL_NEW },
922 {
"ORG.LIBREOFFICE.RANDBETWEEN.NV",
"ORG.LIBREOFFICE.RANDBETWEEN.NV",
NOID,
NOID, 2, 2,
V, {
VR }, FuncFlags::MACROCALL_NEW }
941 mpParamInfoEnd( rFuncInfo.
mpParamInfos + FUNCINFO_PARAMINFOCOUNT ),
942 mbParamPairs( rFuncInfo.mbParamPairs )
991 void initFunc(
const FunctionData& rFuncData);
994 void initFuncs(
const FunctionData* pBeg,
const FunctionData* pEnd,
bool bImportFilter);
1002 initFuncs(saFuncTableBiff2, std::end(saFuncTableBiff2), bImportFilter);
1003 initFuncs(saFuncTableBiff3, std::end(saFuncTableBiff3), bImportFilter);
1004 initFuncs(saFuncTableBiff4, std::end(saFuncTableBiff4), bImportFilter);
1005 initFuncs(saFuncTableBiff5, std::end(saFuncTableBiff5), bImportFilter);
1006 initFuncs(saFuncTableBiff8, std::end(saFuncTableBiff8), bImportFilter);
1007 initFuncs(saFuncTableOox , std::end(saFuncTableOox) , bImportFilter);
1008 initFuncs(saFuncTable2010 , std::end(saFuncTable2010) , bImportFilter);
1009 initFuncs(saFuncTable2013 , std::end(saFuncTable2013) , bImportFilter);
1010 initFuncs(saFuncTable2016 , std::end(saFuncTable2016) , bImportFilter);
1011 initFuncs(saFuncTableOdf , std::end(saFuncTableOdf) , bImportFilter);
1012 initFuncs(saFuncTableOOoLO, std::end(saFuncTableOOoLO), bImportFilter);
1018 FunctionInfoRef xFuncInfo = std::make_shared<FunctionInfo>();
1019 if( rFuncData.mpcOdfFuncName )
1020 xFuncInfo->maOdfFuncName = OUString::createFromAscii( rFuncData.mpcOdfFuncName );
1021 if( rFuncData.mpcOoxFuncName )
1022 xFuncInfo->maOoxFuncName = OUString::createFromAscii( rFuncData.mpcOoxFuncName );
1024 if( rFuncData.mnFlags & FuncFlags::MACROCALL )
1026 OSL_ENSURE( !xFuncInfo->maOoxFuncName.isEmpty(),
"FunctionProviderImpl::initFunc - missing OOXML function name" );
1027 OSL_ENSURE( !(rFuncData.mnFlags & FuncFlags::MACROCALLODF ),
"FunctionProviderImpl::initFunc - unexpected flag FuncFlags::MACROCALLODF" );
1028 xFuncInfo->maBiffMacroName =
"_xlfn." + xFuncInfo->maOoxFuncName;
1029 if( rFuncData.mnFlags & FuncFlags::MACROCALL_FN )
1031 xFuncInfo->maOoxFuncName =
"_xlfn." + xFuncInfo->maOoxFuncName;
1035 else if( rFuncData.mnFlags & FuncFlags::MACROCALLODF )
1037 OSL_ENSURE( !xFuncInfo->maOdfFuncName.isEmpty(),
"FunctionProviderImpl::initFunc - missing ODF function name" );
1038 xFuncInfo->maBiffMacroName =
"_xlfnodf." + xFuncInfo->maOdfFuncName;
1041 xFuncInfo->mnApiOpCode = -1;
1042 xFuncInfo->mnBiff12FuncId = rFuncData.mnBiff12FuncId;
1043 xFuncInfo->mnBiffFuncId = rFuncData.mnBiffFuncId;
1044 xFuncInfo->mnMinParamCount = rFuncData.mnMinParamCount;
1045 xFuncInfo->mnMaxParamCount = (rFuncData.mnMaxParamCount ==
MX) ?
OOX_MAX_PARAMCOUNT : rFuncData.mnMaxParamCount;
1046 xFuncInfo->mnRetClass = rFuncData.mnRetClass;
1047 xFuncInfo->mpParamInfos = rFuncData.mpParamInfos;
1048 xFuncInfo->mbParamPairs =
bool(rFuncData.mnFlags & FuncFlags::PARAMPAIRS);
1049 xFuncInfo->mbVolatile = bool(rFuncData.mnFlags & FuncFlags::VOLATILE);
1050 xFuncInfo->mbExternal = bool(rFuncData.mnFlags & FuncFlags::EXTERNAL);
1051 xFuncInfo->mbInternal = !xFuncInfo->mbExternal || ( rFuncData.mnFlags & FuncFlags::INTERNAL );
1052 bool bMacroCmd(rFuncData.mnFlags & FuncFlags::MACROCMD);
1053 xFuncInfo->mbMacroFunc = bMacroCmd || ( rFuncData.mnFlags & FuncFlags::MACROFUNC );
1054 xFuncInfo->mbVarParam = bMacroCmd || (rFuncData.mnMinParamCount != rFuncData.mnMaxParamCount) || ( rFuncData.mnFlags & FuncFlags::ALWAYSVAR );
1060 maFuncs.push_back( xFuncInfo );
1061 if( !xFuncInfo->maOoxFuncName.isEmpty() )
1062 maOoxFuncs[ xFuncInfo->maOoxFuncName ] = xFuncInfo;
1063 if( xFuncInfo->mnBiff12FuncId !=
NOID )
1065 if( xFuncInfo->mnBiffFuncId !=
NOID )
1066 maBiffFuncs[ xFuncInfo->mnBiffFuncId ] = xFuncInfo;
1067 if( !xFuncInfo->maBiffMacroName.isEmpty() )
1068 maMacroFuncs[ xFuncInfo->maBiffMacroName ] = xFuncInfo;
1073 for(
const FunctionData* pIt = pBeg; pIt != pEnd; ++pIt )
1074 if( pIt->isSupported(bImportFilter) )
1089 return mxFuncImpl->maOoxFuncs.get( rFuncName ).get();
1094 return mxFuncImpl->maBiff12Funcs.get( nFuncId ).get();
1099 return mxFuncImpl->maMacroFuncs.get( rFuncName ).get();
1132 const Reference< XMultiServiceFactory >& rxModelFactory );
1143 bool initOpCode( sal_Int32& ornOpCode,
const ApiTokenMap& rTokenMap,
const OUString& rOdfName,
const OUString& rOoxName );
1144 bool initOpCode( sal_Int32& ornOpCode,
const ApiTokenMap& rTokenMap,
const char* pcOdfName,
const char* pcOoxName );
1152 const Reference< XMultiServiceFactory >& rxModelFactory )
1154 if( !rxModelFactory.is() )
1159 Reference< XFormulaOpCodeMapper > xMapper( rxModelFactory->createInstance(
1160 "com.sun.star.sheet.FormulaOpCodeMapper" ), UNO_QUERY_THROW );
1166 using namespace ::com::sun::star::sheet::FormulaMapGroup;
1167 using namespace ::com::sun::star::sheet::FormulaMapGroupSpecialOffset;
1221 OSL_ENSURE( bIsValid,
"OpCodeProviderImpl::OpCodeProviderImpl - opcodes not initialized" );
1224 OSL_ENSURE(
OPCODE_PLUS_SIGN ==
OPCODE_ADD,
"OpCodeProviderImpl::OpCodeProviderImpl - need opcode mapping for OPCODE_PLUS_SIGN" );
1228 OSL_FAIL(
"OpCodeProviderImpl::OpCodeProviderImpl - cannot receive formula opcode mapper" );
1233 const Reference< XFormulaOpCodeMapper >& rxMapper, sal_Int32 nMapGroup )
1237 orEntrySeq = rxMapper->getAvailableMappings( css::sheet::FormulaLanguage::ODFF, nMapGroup );
1238 return orEntrySeq.hasElements();
1247 const Reference< XFormulaOpCodeMapper >& rxMapper, sal_Int32 nMapGroup )
1252 for(
const FormulaOpCodeMapEntry& rEntry : std::as_const(orEntrySeq) )
1253 orTokenMap[ rEntry.Name ] = rEntry.Token;
1255 return orEntrySeq.hasElements();
1260 orIntFuncTokenMap.clear();
1261 orExtFuncTokenMap.clear();
1262 if(
fillEntrySeq( orEntrySeq, rxMapper, css::sheet::FormulaMapGroup::FUNCTIONS ) )
1264 for(
const FormulaOpCodeMapEntry& rEntry : std::as_const(orEntrySeq) )
1265 ((rEntry.Token.OpCode ==
OPCODE_EXTERNAL) ? orExtFuncTokenMap : orIntFuncTokenMap)[ rEntry.Name ] = rEntry.Token;
1267 return orEntrySeq.hasElements();
1272 if( (0 <= nSpecialId) && (nSpecialId < rEntrySeq.getLength()) )
1274 ornOpCode = rEntrySeq[ nSpecialId ].Token.OpCode;
1277 OSL_FAIL( OString( OString::Concat(
"OpCodeProviderImpl::initOpCode - opcode for special offset ") +
1278 OString::number( nSpecialId ) +
" not found" ).getStr() );
1284 ApiTokenMap::const_iterator aIt = rTokenMap.find( rOdfName );
1285 if( aIt != rTokenMap.end() )
1287 ornOpCode = aIt->second.OpCode;
1288 if( !rOoxName.isEmpty() )
1290 FormulaOpCodeMapEntry aEntry;
1291 aEntry.Name = rOoxName;
1292 aEntry.Token.OpCode = ornOpCode;
1297 OSL_FAIL( OStringBuffer(
"OpCodeProviderImpl::initOpCode - opcode for \"" +
1299 "\" not found" ).getStr() );
1306 if( pcOoxName ) aOoxName = OUString::createFromAscii( pcOoxName );
1307 return initOpCode( ornOpCode, rTokenMap, OUString::createFromAscii( pcOdfName ), aOoxName );
1313 if( cOoxName ) aOoxName = OUString( cOoxName );
1314 return initOpCode( ornOpCode, rTokenMap, OUString( cOdfName ), aOoxName );
1319 bool bIsValid =
false;
1322 ApiTokenMap::const_iterator aIt = rFuncTokenMap.find( orFuncInfo.
maOdfFuncName );
1323 if( aIt != rFuncTokenMap.end() )
1330 OSL_ENSURE( bIsValid,
1331 OStringBuffer(
"OpCodeProviderImpl::initFuncOpCode - no valid opcode for ODF function \""
1333 +
"\"" ).getStr() );
1338 OSL_ENSURE( bIsValid,
1339 OStringBuffer(
"OpCodeProviderImpl::initFuncOpCode - no programmatical name for external function \""
1341 +
"\"" ).getStr() );
1348 FormulaOpCodeMapEntry aEntry;
1350 aEntry.Token = aIt->second;
1359 "OpCodeProviderImpl::initFuncOpCode - no opcode mapping for function ODF '" <<
1381 bool bIsValid =
true;
1382 for(
const FunctionInfoRef& xFuncInfo : rFuncInfos )
1385 if (xFuncInfo->mbExternal)
1387 if (xFuncInfo->mbInternal)
1392 if( (xFuncInfo->mnApiOpCode ==
OPCODE_EXTERNAL) && !xFuncInfo->maExtProgName.isEmpty() )
1402 bool bImportFilter ) :
1420 if( (rToken.OpCode ==
mxOpCodeImpl->OPCODE_EXTERNAL) && rToken.Data.has< OUString >() )
1421 pFuncInfo =
mxOpCodeImpl->maExtProgFuncs.get( rToken.Data.get< OUString >() ).get();
1422 else if( (rToken.OpCode ==
mxOpCodeImpl->OPCODE_MACRO) && rToken.Data.has< OUString >() )
1424 else if( (rToken.OpCode ==
mxOpCodeImpl->OPCODE_BAD) && rToken.Data.has< OUString >() )
1427 pFuncInfo =
mxOpCodeImpl->maOpCodeFuncs.get( rToken.OpCode ).get();
1439 const Reference< XMultiServiceFactory >& rxModelFactory,
const OpCodeProvider& rOpCodeProv ) :
1442 if( rxModelFactory.is() )
try
1444 mxParser.set( rxModelFactory->createInstance(
"com.sun.star.sheet.FormulaParser" ), UNO_QUERY_THROW );
1449 OSL_ENSURE(
mxParser.is(),
"ApiParserWrapper::ApiParserWrapper - cannot create API formula parser object" );
1462 aTokenSeq =
mxParser->parseFormula( rFormula,
1463 CellAddress(rRefPos.
Tab(), rRefPos.
Col(), rRefPos.
Row()) );
1475bool lclConvertToCellAddress(
ScAddress& orAddress,
const SingleReference& rSingleRef, sal_Int32 nForbiddenFlags, sal_Int32 nFilterBySheet )
1477 orAddress =
ScAddress( rSingleRef.Column, rSingleRef.Row, rSingleRef.Sheet );
1479 !
getFlag( rSingleRef.Flags, nForbiddenFlags ) &&
1480 ((nFilterBySheet < 0) || (nFilterBySheet == rSingleRef.Sheet));
1483bool lclConvertToCellRange(
ScRange& orRange,
const ComplexReference& rComplexRef, sal_Int32 nForbiddenFlags, sal_Int32 nFilterBySheet )
1485 orRange =
ScRange( rComplexRef.Reference1.Column, rComplexRef.Reference1.Row, rComplexRef.Reference1.Sheet,
1486 rComplexRef.Reference2.Column, rComplexRef.Reference2.Row, rComplexRef.Reference2.Sheet );
1488 !
getFlag( rComplexRef.Reference1.Flags, nForbiddenFlags ) &&
1489 !
getFlag( rComplexRef.Reference2.Flags, nForbiddenFlags ) &&
1490 (rComplexRef.Reference1.Sheet == rComplexRef.Reference2.Sheet) &&
1491 ((nFilterBySheet < 0) || (nFilterBySheet == rComplexRef.Reference1.Sheet));
1494enum TokenToRangeListState { STATE_REF, STATE_SEP, STATE_OPEN, STATE_CLOSE, STATE_ERROR };
1496TokenToRangeListState lclProcessRef(
ScRangeList& orRanges,
const Any& rData, sal_Int32 nFilterBySheet )
1498 using namespace ::com::sun::star::sheet::ReferenceFlags;
1499 const sal_Int32 FORBIDDEN_FLAGS_REL = COLUMN_DELETED | ROW_DELETED | SHEET_DELETED |
1500 COLUMN_RELATIVE | ROW_RELATIVE | SHEET_RELATIVE | RELATIVE_NAME;
1502 sal_Int32 nForbiddenFlags = FORBIDDEN_FLAGS_REL;
1503 SingleReference aSingleRef;
1504 if( rData >>= aSingleRef )
1508 if( lclConvertToCellAddress( aAddress, aSingleRef, nForbiddenFlags, nFilterBySheet ) )
1512 ComplexReference aComplexRef;
1513 if( rData >>= aComplexRef )
1517 if( lclConvertToCellRange( aRange, aComplexRef, nForbiddenFlags, nFilterBySheet ) )
1524TokenToRangeListState lclProcessOpen( sal_Int32& ornParenLevel )
1530TokenToRangeListState lclProcessClose( sal_Int32& ornParenLevel )
1533 return (ornParenLevel >= 0) ? STATE_CLOSE : STATE_ERROR;
1539 OpCodeProvider( rHelper.getBaseFilter().getModelFactory(), rHelper.getBaseFilter().isImportFilter() ),
1554 for( sal_Int32 nTemp = rAddress.
mnCol; nTemp >= 0; nTemp = (nTemp / 26) - 1 )
1561 aBuffer.append(
static_cast< sal_Int32
>( rAddress.
mnRow + 1 ) );
1562 return aBuffer.makeStringAndClear();
1567 OSL_ENSURE( !rMatrix.
empty(),
"FormulaProcessorBase::generateApiArray - missing matrix values" );
1569 for(
size_t nRow = 0, nHeight = rMatrix.
height(); nRow < nHeight; ++nRow )
1572 aBuffer.append( API_TOKEN_ARRAY_ROWSEP );
1575 double fValue = 0.0;
1579 if( *aIt >>= fValue )
1581 else if( *aIt >>= aString )
1584 aBuffer.append(
"\"" + aString.replaceAll(
u"\"",
u"\"\"") +
"\"" );
1591 return aBuffer.makeStringAndClear();
1599 Any aRefAny = aTokenIt->Data;
1600 if( !(++aTokenIt).is() && (aRefAny.has< SingleReference >() || aRefAny.has< ComplexReference >()) )
1611 if( !aRanges.
empty() )
1613 orRange = aRanges.
front();
1623 TokenToRangeListState eState = STATE_OPEN;
1624 sal_Int32 nParenLevel = 0;
1627 sal_Int32 nOpCode = aIt->OpCode;
1632 if( nOpCode ==
OPCODE_SEP ) eState = STATE_SEP;
1633 else if( nOpCode ==
OPCODE_LIST ) eState = STATE_SEP;
1634 else if( nOpCode ==
OPCODE_CLOSE ) eState = lclProcessClose( nParenLevel );
1635 else eState = STATE_ERROR;
1638 if( nOpCode ==
OPCODE_PUSH ) eState = lclProcessRef( orRanges, aIt->Data, nFilterBySheet );
1639 else if( nOpCode ==
OPCODE_SEP ) eState = STATE_SEP;
1640 else if( nOpCode ==
OPCODE_LIST ) eState = STATE_SEP;
1641 else if( nOpCode ==
OPCODE_OPEN ) eState = lclProcessOpen( nParenLevel );
1642 else if( nOpCode ==
OPCODE_CLOSE ) eState = lclProcessClose( nParenLevel );
1643 else eState = STATE_ERROR;
1646 if( nOpCode ==
OPCODE_PUSH ) eState = lclProcessRef( orRanges, aIt->Data, nFilterBySheet );
1647 else if( nOpCode ==
OPCODE_SEP ) eState = STATE_SEP;
1648 else if( nOpCode ==
OPCODE_LIST ) eState = STATE_SEP;
1649 else if( nOpCode ==
OPCODE_OPEN ) eState = lclProcessOpen( nParenLevel );
1650 else if( nOpCode ==
OPCODE_CLOSE ) eState = lclProcessClose( nParenLevel );
1651 else eState = STATE_ERROR;
1654 if( nOpCode ==
OPCODE_SEP ) eState = STATE_SEP;
1655 else if( nOpCode ==
OPCODE_LIST ) eState = STATE_SEP;
1656 else if( nOpCode ==
OPCODE_CLOSE ) eState = lclProcessClose( nParenLevel );
1657 else eState = STATE_ERROR;
1663 if( eState == STATE_ERROR )
1672 return aTokenIt.
is() && (aTokenIt->OpCode ==
OPCODE_PUSH) && (aTokenIt->Data >>= orString) && !(++aTokenIt).is();
1678 return aTokenIt.
is() && (aTokenIt->OpCode ==
OPCODE_BAD) && (aTokenIt->Data >>= orTokenInfo);
1685 if( !
extractString( aString, orTokens ) || aString.isEmpty() )
1688 ::std::vector< ApiToken > aNewTokens;
1689 for( sal_Int32
nPos{ 0 };
nPos>=0; )
1691 OUString aEntry = aString.getToken( 0, cStringSep,
nPos );
1692 if( bTrimLeadingSpaces )
1694 sal_Int32 nStart = 0;
1695 while( (nStart < aEntry.getLength()) && (aEntry[ nStart ] ==
' ') ) ++nStart;
1696 aEntry = aEntry.copy( nStart );
1698 if( !aNewTokens.empty() )
XMLTokenEnum const aTokenMap[]
void push_back(const ScRange &rRange)
iterator row_end(size_type nY)
container_type::const_iterator const_iterator
iterator row_begin(size_type nY)
void set(const css::uno::Reference< css::beans::XPropertySet > &rxPropSet)
bool setProperty(sal_Int32 nPropId, const Type &rValue)
void validateCellRangeList(ScRangeList &orRanges, bool bTrackOverflow)
Tries to restrict the passed cell range list to current sheet limits.
css::uno::Reference< css::sheet::XFormulaParser > mxParser
PropertySet maParserProps
ApiParserWrapper(const css::uno::Reference< css::lang::XMultiServiceFactory > &rxModelFactory, const OpCodeProvider &rOpCodeProv)
ApiTokenSequence parseFormula(const OUString &rFormula, const ScAddress &rRefPos)
Calls the XFormulaParser::parseFormula() function of the API parser.
Token sequence iterator that is able to skip space tokens.
const sal_Int32 mnSpacesOpCode
Pointer behind last token of the token sequence.
ApiTokenIterator & operator++()
ApiTokenIterator(const ApiTokenSequence &rTokens, sal_Int32 nSpacesOpCode)
ApiTokenSequence toSequence() const
Converts to a sequence.
::std::vector< ApiToken > mvTokens
css::uno::Any & append(sal_Int32 nOpCode)
Appends a new token with the passed op-code, returns its data field.
Iterator working on the mpParamInfos member of the FunctionInfo struct.
const FunctionParamInfo * mpParamInfo
bool isCalcOnlyParam() const
const FunctionParamInfo * mpParamInfoEnd
FunctionParamInfoIterator & operator++()
FunctionParamInfoIterator(const FunctionInfo &rFuncInfo)
bool isExcelOnlyParam() const
Provides access to function info structs for all available sheet functions.
const FunctionInfo * getFuncInfoFromMacroName(const OUString &rFuncName) const
Returns the function info for a macro function referred by the EXTERN.CALL function,...
const FunctionInfo * getFuncInfoFromBiff12FuncId(sal_uInt16 nFuncId) const
Returns the function info for a BIFF12 function index, or 0 on error.
FunctionProviderImplRef mxFuncImpl
static FunctionLibraryType getFuncLibTypeFromLibraryName(std::u16string_view rLibraryName)
Returns the library type associated with the passed URL of a function library (function add-in).
virtual ~FunctionProvider()
FunctionProvider(bool bImportFilter)
const FunctionInfo * getFuncInfoFromOoxFuncName(const OUString &rFuncName) const
Returns the function info for an OOXML function name, or 0 on error.
const FunctionInfoVector & getFuncs() const
Returns the list of all function infos.
Provides access to API op-codes for all available formula tokens and to function info structs for all...
const ApiOpCodes & getOpCodes() const
Returns the structure containing all token op-codes for operators and special tokens used by the Calc...
OpCodeProvider(const css::uno::Reference< css::lang::XMultiServiceFactory > &rxModelFactory, bool bImportFilter)
css::uno::Sequence< css::sheet::FormulaOpCodeMapEntry > getOoxParserMap() const
Returns the op-code map that is used by the OOXML formula parser.
virtual ~OpCodeProvider() override
OpCodeProviderImplRef mxOpCodeImpl
const FunctionInfo * getFuncInfoFromApiToken(const ApiToken &rToken) const
Returns the function info for an API token, or 0 on error.
Helper class to provide access to global workbook data.
AddressConverter & getAddressConverter() const
Returns the converter for string to cell address/range conversion.
#define SAL_WARN_IF(condition, area, stream)
double getLength(const B2DPolygon &rCandidate)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
std::shared_ptr< T > make_shared(Args &&... args)
bool equalsIgnoreAsciiCase(std::u16string_view s1, std::u16string_view s2)
const sal_Unicode API_TOKEN_ARRAY_OPEN
const sal_Unicode API_TOKEN_ARRAY_CLOSE
const sal_Unicode API_TOKEN_ARRAY_COLSEP
const sal_uInt16 BIFF_FUNC_EXTERNCALL
Function identifier of the OFFSET function.
const sal_Int32 BIFF12_TOK_REF_ROWMASK
Mask to extract column from reference (BIFF12).
css::sheet::FormulaToken ApiToken
const sal_uInt8 BIFF_TOKCLASS_REF
00-1F: Base tokens.
css::uno::Sequence< ApiToken > ApiTokenSequence
const sal_uInt16 BIFF12_TOK_REF_COLREL
Mask to extract row from reference (BIFF12).
css::beans::Pair< css::table::CellAddress, sal_Bool > ApiSpecialTokenInfo
Contains the base address and type of a special token representing an array formula or a shared formu...
const sal_uInt16 BIFF12_TOK_REF_ROWREL
True = column is relative (BIFF12).
const sal_uInt8 BIFF_TOKCLASS_ARR
40-5F: Value class tokens.
const sal_uInt8 OOX_MAX_PARAMCOUNT
Mask for number of appended ranges.
const sal_uInt8 BIFF_TOKCLASS_VAL
20-3F: Reference class tokens.
FunctionLibraryType
This enumeration contains constants for all known external libraries containing supported sheet funct...
@ FUNCLIB_EUROTOOL
Unknown library (must be zero).
@ CalcOnly
Parameter supported by Calc and Excel.
@ ExcelOnly
Parameter supported by Calc only.
const sal_uInt16 BIFF_TOK_FUNCVAR_CMD
Spaces before formula (BIFF3).
const sal_uInt16 BIFF12_TOK_REF_COLMASK
Mask for parameter count.
void setFlag(Type &ornBitField, Type nMask, bool bSet=true)
bool getFlag(Type nBitField, Type nMask)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
Contains all API op-codes needed to build formulas with tokens.
sal_Int32 OPCODE_PLUS_SIGN
Column separator in constant arrays.
sal_Int32 OPCODE_MISSING
Op-code for common value operands.
sal_Int32 OPCODE_GREATER_EQUAL
Compare greater operator.
sal_Int32 OPCODE_POWER
Division operator.
sal_Int32 OPCODE_NAME
Spaces between other formula tokens.
sal_Int32 OPCODE_DBAREA
Index of a defined name.
sal_Int32 OPCODE_LESS_EQUAL
Compare less operator.
sal_Int32 OPCODE_ARRAY_OPEN
Function parameter separator.
sal_Int32 OPCODE_DDE
Natural language reference.
sal_Int32 OPCODE_ARRAY_COLSEP
Row separator in constant arrays.
sal_Int32 OPCODE_SEP
Closing parenthesis.
sal_Int32 OPCODE_PERCENT
Unary minus sign.
sal_Int32 OPCODE_LESS
Compare not equal operator.
sal_Int32 OPCODE_CLOSE
Opening parenthesis.
sal_Int32 OPCODE_LIST
Range intersection operator.
sal_Int32 OPCODE_INTERSECT
Compare greater or equal operator.
sal_Int32 OPCODE_ADD
Percent sign.
sal_Int32 OPCODE_BAD
Macro function call.
sal_Int32 OPCODE_OPEN
Function style #NAME? error.
sal_Int32 OPCODE_NLR
Index of a database area.
sal_Int32 OPCODE_MACRO
DDE link function.
sal_Int32 OPCODE_SUB
Addition operator.
sal_Int32 OPCODE_RANGE
Range list operator.
sal_Int32 OPCODE_NOT_EQUAL
Compare equal operator.
sal_Int32 OPCODE_MULT
Subtraction operator.
sal_Int32 OPCODE_NONAME
Bad token (unknown name, formula error).
sal_Int32 OPCODE_ARRAY_ROWSEP
Closing brace for constant arrays.
sal_Int32 OPCODE_SPACES
Placeholder for a missing function parameter.
sal_Int32 OPCODE_ARRAY_CLOSE
Opening brace for constant arrays.
sal_Int32 OPCODE_EXTERNAL
Internal: function name unknown to mapper.
sal_Int32 OPCODE_CONCAT
Power operator.
sal_Int32 OPCODE_EQUAL
String concatenation operator.
sal_Int32 OPCODE_PUSH
External function call (e.g. add-ins).
sal_Int32 OPCODE_MINUS_SIGN
Unary plus sign.
sal_Int32 OPCODE_GREATER
Compare less or equal operator.
sal_Int32 OPCODE_DIV
Multiplication operator.
A 2D cell address struct for binary filters.
BinSingleRef2d maRef2
Start (top-left) cell address.
void readBiff12Data(SequenceInputStream &rStrm, bool bRelativeAsOffset)
End (bottom-right) cell address.
BinSingleRef2d()
True = relative row reference.
void setBiff12Data(sal_uInt16 nCol, sal_Int32 nRow, bool bRelativeAsOffset)
bool mbRowRel
True = relative column reference.
sal_Int32 mnRow
Column index.
void readBiff12Data(SequenceInputStream &rStrm, bool bRelativeAsOffset)
Represents information for a spreadsheet function.
sal_uInt16 mnBiffFuncId
BIFF12 function identifier.
OUString maExtProgName
Expected macro name in EXTERN.CALL function.
sal_Int32 mnApiOpCode
The external library this function is part of.
OUString maOoxFuncName
ODF function name.
FuncParamValidity meValid
FuncIdMap maBiffFuncs
Maps BIFF12 function indexes to function data.
void initFunc(const FunctionData &rFuncData)
Creates and inserts a function info struct from the passed function data.
FuncNameMap maOoxFuncs
All function infos in one list.
FunctionInfoVector maFuncs
RefMap< sal_uInt16, FunctionInfo > FuncIdMap
FunctionProviderImpl(bool bImportFilter)
Maps macro function names to function data.
FuncIdMap maBiff12Funcs
Maps OOXML function names to function data.
void initFuncs(const FunctionData *pBeg, const FunctionData *pEnd, bool bImportFilter)
Initializes the members from the passed function data list.
FuncNameMap maMacroFuncs
Maps BIFF2-BIFF8 function indexes to function data.
RefMap< OUString, FunctionInfo > FuncNameMap
::std::map< OUString, ApiToken > ApiTokenMap
Sequence< FormulaOpCodeMapEntry > OpCodeEntrySequence
OpCodeProviderImpl(const FunctionInfoVector &rFuncInfos, const Reference< XMultiServiceFactory > &rxModelFactory)
OOXML token mapping for formula parser service.
RefMap< OUString, FunctionInfo > FuncNameMap
static bool fillEntrySeq(OpCodeEntrySequence &orEntrySeq, const Reference< XFormulaOpCodeMapper > &rxMapper, sal_Int32 nMapGroup)
bool initFuncOpCodes(const ApiTokenMap &rIntFuncTokenMap, const ApiTokenMap &rExtFuncTokenMap, const FunctionInfoVector &rFuncInfos)
FuncNameMap maExtProgFuncs
Maps API function op-codes to function data.
bool fillFuncTokenMaps(ApiTokenMap &orIntFuncTokenMap, ApiTokenMap &orExtFuncTokenMap, OpCodeEntrySequence &orEntrySeq, const Reference< XFormulaOpCodeMapper > &rxMapper) const
OpCodeEntryVector maParserMap
Maps programmatical API function names to function data.
RefMap< sal_Int32, FunctionInfo > OpCodeFuncMap
OpCodeFuncMap maOpCodeFuncs
static bool initOpCode(sal_Int32 &ornOpCode, const OpCodeEntrySequence &rEntrySeq, sal_Int32 nSpecialId)
::std::vector< FormulaOpCodeMapEntry > OpCodeEntryVector
static bool fillTokenMap(ApiTokenMap &orTokenMap, OpCodeEntrySequence &orEntrySeq, const Reference< XFormulaOpCodeMapper > &rxMapper, sal_Int32 nMapGroup)
bool initFuncOpCode(FunctionInfo &orFuncInfo, const ApiTokenMap &rFuncTokenMap)
std::unique_ptr< char[]> aBuffer