1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef FORMULA_OPCODE_HXX 29 #define FORMULA_OPCODE_HXX 30 31 #include "formula/compiler.hrc" // OpCodes 32 #include <tools/solar.h> 33 34 enum OpCodeEnum 35 { 36 // Special commands 37 ocPush = SC_OPCODE_PUSH, 38 ocCall = SC_OPCODE_CALL, 39 ocStop = SC_OPCODE_STOP, 40 ocExternal = SC_OPCODE_EXTERNAL, 41 ocName = SC_OPCODE_NAME, 42 ocExternalRef = SC_OPCODE_EXTERNAL_REF, 43 // Jump commands 44 ocIf = SC_OPCODE_IF, 45 ocChose = SC_OPCODE_CHOSE, 46 // Parentheses and separators 47 ocOpen = SC_OPCODE_OPEN, 48 ocClose = SC_OPCODE_CLOSE, 49 ocSep = SC_OPCODE_SEP, 50 ocArrayOpen = SC_OPCODE_ARRAY_OPEN, 51 ocArrayClose = SC_OPCODE_ARRAY_CLOSE, 52 ocArrayRowSep = SC_OPCODE_ARRAY_ROW_SEP, 53 ocArrayColSep = SC_OPCODE_ARRAY_COL_SEP, 54 // Special OpCodes 55 ocMissing = SC_OPCODE_MISSING, 56 ocBad = SC_OPCODE_BAD, 57 ocSpaces = SC_OPCODE_SPACES, 58 ocMatRef = SC_OPCODE_MAT_REF, 59 // Access commands 60 ocDBArea = SC_OPCODE_DB_AREA, 61 ocMacro = SC_OPCODE_MACRO, 62 ocColRowName = SC_OPCODE_COL_ROW_NAME, 63 ocColRowNameAuto = SC_OPCODE_COL_ROW_NAME_AUTO, 64 // Percent operator _follows_ value 65 ocPercentSign = SC_OPCODE_PERCENT_SIGN, 66 // Error constants 67 ocErrNull = SC_OPCODE_ERROR_NULL, 68 ocErrDivZero = SC_OPCODE_ERROR_DIVZERO, 69 ocErrValue = SC_OPCODE_ERROR_VALUE, 70 ocErrRef = SC_OPCODE_ERROR_REF, 71 ocErrName = SC_OPCODE_ERROR_NAME, 72 ocErrNum = SC_OPCODE_ERROR_NUM, 73 ocErrNA = SC_OPCODE_ERROR_NA, 74 // Binary operators 75 ocAdd = SC_OPCODE_ADD, 76 ocSub = SC_OPCODE_SUB, 77 ocMul = SC_OPCODE_MUL, 78 ocDiv = SC_OPCODE_DIV, 79 ocAmpersand = SC_OPCODE_AMPERSAND, 80 ocPow = SC_OPCODE_POW, 81 ocEqual = SC_OPCODE_EQUAL, 82 ocNotEqual = SC_OPCODE_NOT_EQUAL, 83 ocLess = SC_OPCODE_LESS, 84 ocGreater = SC_OPCODE_GREATER, 85 ocLessEqual = SC_OPCODE_LESS_EQUAL, 86 ocGreaterEqual = SC_OPCODE_GREATER_EQUAL, 87 ocAnd = SC_OPCODE_AND, 88 ocOr = SC_OPCODE_OR, 89 ocIntersect = SC_OPCODE_INTERSECT, 90 ocUnion = SC_OPCODE_UNION, 91 ocRange = SC_OPCODE_RANGE, 92 // Unary operators 93 ocNot = SC_OPCODE_NOT, 94 ocNeg = SC_OPCODE_NEG, 95 ocNegSub = SC_OPCODE_NEG_SUB, 96 // Functions with no parameters 97 ocPi = SC_OPCODE_PI, 98 ocRandom = SC_OPCODE_RANDOM, 99 ocTrue = SC_OPCODE_TRUE, 100 ocFalse = SC_OPCODE_FALSE, 101 ocGetActDate = SC_OPCODE_GET_ACT_DATE, 102 ocGetActTime = SC_OPCODE_GET_ACT_TIME, 103 ocNotAvail = SC_OPCODE_NO_VALUE, 104 ocCurrent = SC_OPCODE_CURRENT, 105 // Functions with one parameter 106 ocDeg = SC_OPCODE_DEG, 107 ocRad = SC_OPCODE_RAD, 108 ocSin = SC_OPCODE_SIN, 109 ocCos = SC_OPCODE_COS, 110 ocTan = SC_OPCODE_TAN, 111 ocCot = SC_OPCODE_COT, 112 ocArcSin = SC_OPCODE_ARC_SIN, 113 ocArcCos = SC_OPCODE_ARC_COS, 114 ocArcTan = SC_OPCODE_ARC_TAN, 115 ocArcCot = SC_OPCODE_ARC_COT, 116 ocSinHyp = SC_OPCODE_SIN_HYP, 117 ocCosHyp = SC_OPCODE_COS_HYP, 118 ocTanHyp = SC_OPCODE_TAN_HYP, 119 ocCotHyp = SC_OPCODE_COT_HYP, 120 ocArcSinHyp = SC_OPCODE_ARC_SIN_HYP, 121 ocArcCosHyp = SC_OPCODE_ARC_COS_HYP, 122 ocArcTanHyp = SC_OPCODE_ARC_TAN_HYP, 123 ocArcCotHyp = SC_OPCODE_ARC_COT_HYP, 124 ocCosecant = SC_OPCODE_COSECANT, 125 ocSecant = SC_OPCODE_SECANT, 126 ocCosecantHyp = SC_OPCODE_COSECANT_HYP, 127 ocSecantHyp = SC_OPCODE_SECANT_HYP, 128 ocExp = SC_OPCODE_EXP, 129 ocLn = SC_OPCODE_LN, 130 ocSqrt = SC_OPCODE_SQRT, 131 ocFact = SC_OPCODE_FACT, 132 ocGetYear = SC_OPCODE_GET_YEAR, 133 ocGetMonth = SC_OPCODE_GET_MONTH, 134 ocGetDay = SC_OPCODE_GET_DAY, 135 ocGetHour = SC_OPCODE_GET_HOUR, 136 ocGetMin = SC_OPCODE_GET_MIN, 137 ocGetSec = SC_OPCODE_GET_SEC, 138 ocPlusMinus = SC_OPCODE_PLUS_MINUS, 139 ocAbs = SC_OPCODE_ABS, 140 ocInt = SC_OPCODE_INT, 141 ocPhi = SC_OPCODE_PHI, 142 ocGauss = SC_OPCODE_GAUSS, 143 ocIsEmpty = SC_OPCODE_IS_EMPTY, 144 ocIsString = SC_OPCODE_IS_STRING, 145 ocIsNonString = SC_OPCODE_IS_NON_STRING, 146 ocIsLogical = SC_OPCODE_IS_LOGICAL, 147 ocType = SC_OPCODE_TYPE, 148 ocCell = SC_OPCODE_CELL, 149 ocIsRef = SC_OPCODE_IS_REF, 150 ocIsValue = SC_OPCODE_IS_VALUE, 151 ocIsFormula = SC_OPCODE_IS_FORMULA, 152 ocIsNA = SC_OPCODE_IS_NV, 153 ocIsErr = SC_OPCODE_IS_ERR, 154 ocIsError = SC_OPCODE_IS_ERROR, 155 ocIsEven = SC_OPCODE_IS_EVEN, 156 ocIsOdd = SC_OPCODE_IS_ODD, 157 ocN = SC_OPCODE_N, 158 // String functions 159 ocGetDateValue = SC_OPCODE_GET_DATE_VALUE, 160 ocGetTimeValue = SC_OPCODE_GET_TIME_VALUE, 161 ocCode = SC_OPCODE_CODE, 162 ocTrim = SC_OPCODE_TRIM, 163 ocUpper = SC_OPCODE_UPPER, 164 ocPropper = SC_OPCODE_PROPPER, 165 ocLower = SC_OPCODE_LOWER, 166 ocLen = SC_OPCODE_LEN, 167 ocT = SC_OPCODE_T, 168 ocValue = SC_OPCODE_VALUE, 169 ocClean = SC_OPCODE_CLEAN, 170 ocChar = SC_OPCODE_CHAR, 171 ocLog10 = SC_OPCODE_LOG10, 172 ocEven = SC_OPCODE_EVEN, 173 ocOdd = SC_OPCODE_ODD, 174 ocStdNormDist = SC_OPCODE_STD_NORM_DIST, 175 ocFisher = SC_OPCODE_FISHER, 176 ocFisherInv = SC_OPCODE_FISHER_INV, 177 ocSNormInv = SC_OPCODE_S_NORM_INV, 178 ocGammaLn = SC_OPCODE_GAMMA_LN, 179 ocGamma = SC_OPCODE_GAMMA, 180 ocErrorType = SC_OPCODE_ERROR_TYPE, 181 ocErrCell = SC_OPCODE_ERR_CELL, 182 ocFormula = SC_OPCODE_FORMULA, 183 ocArabic = SC_OPCODE_ARABIC, 184 ocInfo = SC_OPCODE_INFO, 185 ocBahtText = SC_OPCODE_BAHTTEXT, 186 ocJis = SC_OPCODE_JIS, 187 ocAsc = SC_OPCODE_ASC, 188 ocUnicode = SC_OPCODE_UNICODE, 189 ocUnichar = SC_OPCODE_UNICHAR, 190 // Functions with more than one parameters 191 ocArcTan2 = SC_OPCODE_ARC_TAN_2, 192 ocCeil = SC_OPCODE_CEIL, 193 ocFloor = SC_OPCODE_FLOOR, 194 ocRound = SC_OPCODE_ROUND, 195 ocRoundUp = SC_OPCODE_ROUND_UP, 196 ocRoundDown = SC_OPCODE_ROUND_DOWN, 197 ocTrunc = SC_OPCODE_TRUNC, 198 ocLog = SC_OPCODE_LOG, 199 ocPower = SC_OPCODE_POWER, 200 ocGCD = SC_OPCODE_GGT, 201 ocLCM = SC_OPCODE_KGV, 202 ocMod = SC_OPCODE_MOD, 203 ocSumProduct = SC_OPCODE_SUM_PRODUCT, 204 ocSumSQ = SC_OPCODE_SUM_SQ, 205 ocSumX2MY2 = SC_OPCODE_SUM_X2MY2, 206 ocSumX2DY2 = SC_OPCODE_SUM_X2DY2, 207 ocSumXMY2 = SC_OPCODE_SUM_XMY2, 208 ocGetDate = SC_OPCODE_GET_DATE, 209 ocGetTime = SC_OPCODE_GET_TIME, 210 ocGetDiffDate = SC_OPCODE_GET_DIFF_DATE, 211 ocGetDiffDate360 = SC_OPCODE_GET_DIFF_DATE_360, 212 ocMin = SC_OPCODE_MIN, 213 ocMax = SC_OPCODE_MAX, 214 ocSum = SC_OPCODE_SUM, 215 ocProduct = SC_OPCODE_PRODUCT, 216 ocAverage = SC_OPCODE_AVERAGE, 217 ocCount = SC_OPCODE_COUNT, 218 ocCount2 = SC_OPCODE_COUNT_2, 219 ocNPV = SC_OPCODE_NBW, 220 ocIRR = SC_OPCODE_IKV, 221 ocMIRR = SC_OPCODE_MIRR, 222 ocISPMT = SC_OPCODE_ISPMT, 223 ocVar = SC_OPCODE_VAR, 224 ocVarP = SC_OPCODE_VAR_P, 225 ocStDev = SC_OPCODE_ST_DEV, 226 ocStDevP = SC_OPCODE_ST_DEV_P, 227 ocB = SC_OPCODE_B, 228 ocNormDist = SC_OPCODE_NORM_DIST, 229 ocExpDist = SC_OPCODE_EXP_DIST, 230 ocBinomDist = SC_OPCODE_BINOM_DIST, 231 ocPoissonDist = SC_OPCODE_POISSON_DIST, 232 ocKombin = SC_OPCODE_KOMBIN, 233 ocKombin2 = SC_OPCODE_KOMBIN_2, 234 ocVariationen = SC_OPCODE_VARIATIONEN, 235 ocVariationen2 = SC_OPCODE_VARIATIONEN_2, 236 ocBW = SC_OPCODE_BW, 237 ocDIA = SC_OPCODE_DIA, 238 ocGDA = SC_OPCODE_GDA, 239 ocGDA2 = SC_OPCODE_GDA_2, 240 ocVBD = SC_OPCODE_VBD, 241 ocLaufz = SC_OPCODE_LAUFZ, 242 ocLIA = SC_OPCODE_LIA, 243 ocRMZ = SC_OPCODE_RMZ, 244 ocColumns = SC_OPCODE_COLUMNS, 245 ocRows = SC_OPCODE_ROWS, 246 ocColumn = SC_OPCODE_COLUMN, 247 ocRow = SC_OPCODE_ROW, 248 ocZGZ = SC_OPCODE_ZGZ, 249 ocZW = SC_OPCODE_ZW, 250 ocZZR = SC_OPCODE_ZZR, 251 ocZins = SC_OPCODE_ZINS, 252 ocZinsZ = SC_OPCODE_ZINS_Z, 253 ocKapz = SC_OPCODE_KAPZ, 254 ocKumZinsZ = SC_OPCODE_KUM_ZINS_Z, 255 ocKumKapZ = SC_OPCODE_KUM_KAP_Z, 256 ocEffektiv = SC_OPCODE_EFFEKTIV, 257 ocNominal = SC_OPCODE_NOMINAL, 258 ocSubTotal = SC_OPCODE_SUB_TOTAL, 259 // Database functions 260 ocDBSum = SC_OPCODE_DB_SUM, 261 ocDBCount = SC_OPCODE_DB_COUNT, 262 ocDBCount2 = SC_OPCODE_DB_COUNT_2, 263 ocDBAverage = SC_OPCODE_DB_AVERAGE, 264 ocDBGet = SC_OPCODE_DB_GET, 265 ocDBMax = SC_OPCODE_DB_MAX, 266 ocDBMin = SC_OPCODE_DB_MIN, 267 ocDBProduct = SC_OPCODE_DB_PRODUCT, 268 ocDBStdDev = SC_OPCODE_DB_STD_DEV, 269 ocDBStdDevP = SC_OPCODE_DB_STD_DEV_P, 270 ocDBVar = SC_OPCODE_DB_VAR, 271 ocDBVarP = SC_OPCODE_DB_VAR_P, 272 // Management functions 273 ocIndirect = SC_OPCODE_INDIRECT, 274 ocIndirectXL = SC_OPCODE_INDIRECT_XL, 275 ocAddress = SC_OPCODE_ADDRESS, 276 ocAddressXL = SC_OPCODE_ADDRESS_XL, 277 ocMatch = SC_OPCODE_MATCH, 278 ocCountEmptyCells = SC_OPCODE_COUNT_EMPTY_CELLS, 279 ocCountIf = SC_OPCODE_COUNT_IF, 280 ocSumIf = SC_OPCODE_SUM_IF, 281 ocLookup = SC_OPCODE_LOOKUP, 282 ocVLookup = SC_OPCODE_V_LOOKUP, 283 ocHLookup = SC_OPCODE_H_LOOKUP, 284 ocMultiArea = SC_OPCODE_MULTI_AREA, 285 ocOffset = SC_OPCODE_OFFSET, 286 ocIndex = SC_OPCODE_INDEX, 287 ocAreas = SC_OPCODE_AREAS, 288 // String functions 289 ocCurrency = SC_OPCODE_CURRENCY, 290 ocReplace = SC_OPCODE_REPLACE, 291 ocFixed = SC_OPCODE_FIXED, 292 ocFind = SC_OPCODE_FIND, 293 ocExact = SC_OPCODE_EXACT, 294 ocLeft = SC_OPCODE_LEFT, 295 ocRight = SC_OPCODE_RIGHT, 296 ocSearch = SC_OPCODE_SEARCH, 297 ocMid = SC_OPCODE_MID, 298 ocText = SC_OPCODE_TEXT, 299 ocSubstitute = SC_OPCODE_SUBSTITUTE, 300 ocRept = SC_OPCODE_REPT, 301 ocConcat = SC_OPCODE_CONCAT, 302 // Matrix functions 303 ocMatValue = SC_OPCODE_MAT_VALUE, 304 ocMatDet = SC_OPCODE_MAT_DET, 305 ocMatInv = SC_OPCODE_MAT_INV, 306 ocMatMult = SC_OPCODE_MAT_MULT, 307 ocMatTrans = SC_OPCODE_MAT_TRANS, 308 ocMatrixUnit = SC_OPCODE_MATRIX_UNIT, 309 // BackSolver 310 ocBackSolver = SC_OPCODE_BACK_SOLVER, 311 // Statistical functions 312 ocHypGeomDist = SC_OPCODE_HYP_GEOM_DIST, 313 ocLogNormDist = SC_OPCODE_LOG_NORM_DIST, 314 ocTDist = SC_OPCODE_T_DIST, 315 ocFDist = SC_OPCODE_F_DIST, 316 ocChiDist = SC_OPCODE_CHI_DIST, 317 ocChiSqDist = SC_OPCODE_CHISQ_DIST, 318 ocChiSqInv = SC_OPCODE_CHISQ_INV, 319 ocWeibull = SC_OPCODE_WEIBULL, 320 ocNegBinomVert = SC_OPCODE_NEG_BINOM_VERT, 321 ocKritBinom = SC_OPCODE_KRIT_BINOM, 322 ocKurt = SC_OPCODE_KURT, 323 ocHarMean = SC_OPCODE_HAR_MEAN, 324 ocGeoMean = SC_OPCODE_GEO_MEAN, 325 ocStandard = SC_OPCODE_STANDARD, 326 ocAveDev = SC_OPCODE_AVE_DEV, 327 ocSchiefe = SC_OPCODE_SCHIEFE, 328 ocDevSq = SC_OPCODE_DEV_SQ, 329 ocMedian = SC_OPCODE_MEDIAN, 330 ocModalValue = SC_OPCODE_MODAL_VALUE, 331 ocZTest = SC_OPCODE_Z_TEST, 332 ocTTest = SC_OPCODE_T_TEST, 333 ocRank = SC_OPCODE_RANK, 334 ocPercentile = SC_OPCODE_PERCENTILE, 335 ocPercentrank = SC_OPCODE_PERCENT_RANK, 336 ocLarge = SC_OPCODE_LARGE, 337 ocSmall = SC_OPCODE_SMALL, 338 ocFrequency = SC_OPCODE_FREQUENCY, 339 ocQuartile = SC_OPCODE_QUARTILE, 340 ocNormInv = SC_OPCODE_NORM_INV, 341 ocConfidence = SC_OPCODE_CONFIDENCE, 342 ocFTest = SC_OPCODE_F_TEST, 343 ocTrimMean = SC_OPCODE_TRIM_MEAN, 344 ocProb = SC_OPCODE_PROB, 345 ocCorrel = SC_OPCODE_CORREL, 346 ocCovar = SC_OPCODE_COVAR, 347 ocPearson = SC_OPCODE_PEARSON, 348 ocRSQ = SC_OPCODE_RSQ, 349 ocSTEYX = SC_OPCODE_STEYX, 350 ocSlope = SC_OPCODE_SLOPE, 351 ocIntercept = SC_OPCODE_INTERCEPT, 352 ocTrend = SC_OPCODE_TREND, 353 ocGrowth = SC_OPCODE_GROWTH, 354 ocRGP = SC_OPCODE_RGP, 355 ocRKP = SC_OPCODE_RKP, 356 ocForecast = SC_OPCODE_FORECAST, 357 ocChiInv = SC_OPCODE_CHI_INV, 358 ocGammaDist = SC_OPCODE_GAMMA_DIST, 359 ocGammaInv = SC_OPCODE_GAMMA_INV, 360 ocTInv = SC_OPCODE_T_INV, 361 ocFInv = SC_OPCODE_F_INV, 362 ocChiTest = SC_OPCODE_CHI_TEST, 363 ocLogInv = SC_OPCODE_LOG_INV, 364 ocTableOp = SC_OPCODE_TABLE_OP, 365 ocBetaDist = SC_OPCODE_BETA_DIST, 366 ocBetaInv = SC_OPCODE_BETA_INV, 367 // miscellaneous 368 ocWeek = SC_OPCODE_WEEK, 369 ocGetDayOfWeek = SC_OPCODE_GET_DAY_OF_WEEK, 370 ocNoName = SC_OPCODE_NO_NAME, 371 ocStyle = SC_OPCODE_STYLE, 372 ocDde = SC_OPCODE_DDE, 373 ocBase = SC_OPCODE_BASE, 374 ocTable = SC_OPCODE_TABLE, 375 ocTables = SC_OPCODE_TABLES, 376 ocMinA = SC_OPCODE_MIN_A, 377 ocMaxA = SC_OPCODE_MAX_A, 378 ocAverageA = SC_OPCODE_AVERAGE_A, 379 ocStDevA = SC_OPCODE_ST_DEV_A, 380 ocStDevPA = SC_OPCODE_ST_DEV_P_A, 381 ocVarA = SC_OPCODE_VAR_A, 382 ocVarPA = SC_OPCODE_VAR_P_A, 383 ocEasterSunday = SC_OPCODE_EASTERSUNDAY, 384 ocDecimal = SC_OPCODE_DECIMAL, 385 ocConvert = SC_OPCODE_CONVERT, 386 ocRoman = SC_OPCODE_ROMAN, 387 ocHyperLink = SC_OPCODE_HYPERLINK, 388 ocGetPivotData = SC_OPCODE_GET_PIVOT_DATA, 389 ocEuroConvert = SC_OPCODE_EUROCONVERT, 390 ocNumberValue = SC_OPCODE_NUMBERVALUE, 391 // internal stuff 392 ocInternalBegin = SC_OPCODE_INTERNAL_BEGIN, 393 ocTTT = SC_OPCODE_TTT, 394 ocInternalEnd = SC_OPCODE_INTERNAL_END, 395 // from here on ExtraData 396 ocDataToken1 = SC_OPCODE_DATA_TOKEN_1, 397 // no OpCode 398 ocNone = SC_OPCODE_NONE 399 }; 400 401 #ifndef DBG_UTIL 402 // save memory since compilers tend to int an enum 403 typedef sal_uInt16 OpCode; 404 #else 405 // have enum names in debugger 406 typedef OpCodeEnum OpCode; 407 #endif 408 409 #endif 410