LibreOffice Module sc (master)  1
interpre.hxx
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 #pragma once
21 
22 #include <rtl/math.hxx>
23 #include <rtl/ustring.hxx>
24 #include <unotools/textsearch.hxx>
25 #include <formula/errorcodes.hxx>
26 #include <formula/tokenarray.hxx>
27 #include <types.hxx>
28 #include <externalrefmgr.hxx>
29 #include <calcconfig.hxx>
30 #include <token.hxx>
31 #include <math.hxx>
32 #include "parclass.hxx"
33 
34 #include <map>
35 #include <memory>
36 #include <vector>
37 #include <limits>
38 #include <ostream>
39 
40 namespace sfx2 { class LinkManager; }
41 
42 class ScDocument;
43 class SbxVariable;
44 class ScFormulaCell;
45 class ScDBRangeBase;
46 struct ScQueryParam;
47 struct ScDBQueryParamBase;
48 struct ScQueryEntry;
49 
50 struct ScSingleRefData;
51 struct ScComplexRefData;
53 
54 class ScJumpMatrix;
55 struct ScRefCellValue;
56 
57 namespace sc {
58 
59 struct CompareOptions;
60 
62 {
63  KahanSum mfSum = 0.0;
64  double mfCount = 0.0;
65  double mfMin = std::numeric_limits<double>::max();
66  double mfMax = std::numeric_limits<double>::lowest();
67 };
68 
69 template<typename charT, typename traits>
70 inline std::basic_ostream<charT, traits> & operator <<(std::basic_ostream<charT, traits> & stream, const ParamIfsResult& rRes)
71 {
72  stream << "{" <<
73  "sum=" << rRes.mfSum.get() << "," <<
74  "count=" << rRes.mfCount << "," <<
75  "min=" << rRes.mfMin << "," <<
76  "max=" << rRes.mfMax << "," <<
77  "}";
78 
79  return stream;
80 }
81 
82 }
83 
84 namespace svl {
85 
86 class SharedStringPool;
87 
88 }
89 
91 constexpr sal_Int32 kScInterpreterMaxStrLen = SAL_MAX_INT32 / 8;
92 
93 #define MAXSTACK (4096 / sizeof(formula::FormulaToken*))
94 
96 {
97 public:
99 };
100 
102  ifSUM, // Add up
103  ifSUMSQ, // Sums of squares
104  ifPRODUCT, // Product
105  ifAVERAGE, // Average
106  ifCOUNT, // Count Values
107  ifCOUNT2, // Count Values (not empty)
108  ifMIN, // Minimum
109  ifMAX // Maximum
110 };
111 
113 {
114  ifSUMIF, // Conditional sum
115  ifAVERAGEIF // Conditional average
116 };
117 
119 {
127 };
128 
130 {
132  { return r1.get() < r2.get(); }
133 };
134 typedef ::std::map< const formula::FormulaConstTokenRef, formula::FormulaConstTokenRef, FormulaTokenRef_less> ScTokenMatrixMap;
135 
137 {
138  // distribution function objects need the GetxxxDist methods
139  friend class ScGammaDistFunction;
140  friend class ScBetaDistFunction;
141  friend class ScTDistFunction;
142  friend class ScFDistFunction;
143  friend class ScChiDistFunction;
144  friend class ScChiSqDistFunction;
145 
146 public:
147  static void SetGlobalConfig(const ScCalcConfig& rConfig);
148  static const ScCalcConfig& GetGlobalConfig();
149 
150  static void GlobalExit(); // called by ScGlobal::Clear()
151 
155  static bool MayBeRegExp( const OUString& rStr );
156 
161  static bool MayBeWildcard( const OUString& rStr );
162 
166  static utl::SearchParam::SearchType DetectSearchType( const OUString& rStr, const ScDocument& rDoc );
167 
170  static inline double div( const double& fNumerator, const double& fDenominator );
171 
172  ScMatrixRef GetNewMat(SCSIZE nC, SCSIZE nR, bool bEmpty = false);
173 
174  ScMatrixRef GetNewMat(SCSIZE nC, SCSIZE nR, const std::vector<double>& rValues);
175 
180  };
181 
183 
184 private:
187 
188  static thread_local std::unique_ptr<ScTokenStack> pGlobalStack;
189  static thread_local bool bGlobalStackInUse;
190 
200  ScJumpMatrix* pJumpMatrix; // currently active array condition, if any
201  ScTokenMatrixMap maTokenMatrixMap; // map FormulaToken* to formula::FormulaTokenRef if in array condition
202  ScFormulaCell* pMyFormulaCell; // the cell of this formula expression
204 
205  const formula::FormulaToken* pCur; // current token
206  ScTokenStack* pStackObj; // contains the stacks
207  const formula::FormulaToken ** pStack; // the current stack
208  FormulaError nGlobalError; // global (local to this formula expression) error
209  sal_uInt16 sp; // stack pointer
210  sal_uInt16 maxsp; // the maximal used stack pointer
211  sal_uInt32 nFuncFmtIndex; // NumberFormatIndex of a function
212  sal_uInt32 nCurFmtIndex; // current NumberFormatIndex
213  sal_uInt32 nRetFmtIndex; // NumberFormatIndex of an expression, if any
214  SvNumFormatType nFuncFmtType; // NumberFormatType of a function
215  SvNumFormatType nCurFmtType; // current NumberFormatType
216  SvNumFormatType nRetFmtType; // NumberFormatType of an expression
217  FormulaError mnStringNoValueError; // the error set in ConvertStringToValue() if no value
218  SubtotalFlags mnSubTotalFlags; // flags for subtotal and aggregate functions
219  sal_uInt8 cPar; // current count of parameters
220  bool bCalcAsShown; // precision as shown
221  bool bMatrixFormula; // formula cell is a matrix formula
222 
224 
225  void MakeMatNew(ScMatrixRef& rMat, SCSIZE nC, SCSIZE nR);
226 
228  void MergeCalcConfig();
229 
230  // nMust <= nAct <= nMax ? ok : PushError
231  inline bool MustHaveParamCount( short nAct, short nMust );
232  inline bool MustHaveParamCount( short nAct, short nMust, short nMax );
233  inline bool MustHaveParamCountMin( short nAct, short nMin );
234  void PushParameterExpected();
235  void PushIllegalParameter();
236  void PushIllegalArgument();
237  void PushNoValue();
238  void PushNA();
239 
240  // Functions for accessing a document
241 
242  void ReplaceCell( ScAddress& ); // for TableOp
243  bool IsTableOpInRange( const ScRange& );
244  sal_uInt32 GetCellNumberFormat( const ScAddress& rPos, ScRefCellValue& rCell );
245  double ConvertStringToValue( const OUString& );
246 public:
247  static double ScGetGCD(double fx, double fy);
250  double ConvertStringToValue( const OUString&, FormulaError& rError, SvNumFormatType& rCurFmtType );
251 private:
252  double GetCellValue( const ScAddress&, ScRefCellValue& rCell );
253  double GetCellValueOrZero( const ScAddress&, ScRefCellValue& rCell );
254  double GetValueCellValue( const ScAddress&, double fOrig );
255  void GetCellString( svl::SharedString& rStr, ScRefCellValue& rCell );
256  static FormulaError GetCellErrCode( const ScRefCellValue& rCell );
257 
258  bool CreateDoubleArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
259  SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt8* pCellArr);
260  bool CreateStringArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
261  SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt8* pCellArr);
262  bool CreateCellArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
263  SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt8* pCellArr);
264 
265  // Stack operations
266 
270  void Push( const formula::FormulaToken& r );
271 
275  void PushWithoutError( const formula::FormulaToken& r );
276 
284 
289 
297 
303  {
304  if (nGlobalError != FormulaError::NONE)
305  {
307  return true;
308  }
309  return false;
310  }
311 
327  void PushCellResultToken( bool bDisplayEmptyAsString, const ScAddress & rAddress,
328  SvNumFormatType * pRetTypeExpr, sal_uInt32 * pRetIndexExpr, bool bFinalResult = false );
329 
331  void Pop();
332  void PopError();
333  double PopDouble();
335  void ValidateRef( const ScSingleRefData & rRef );
336  void ValidateRef( const ScComplexRefData & rRef );
337  void ValidateRef( const ScRefList & rRefList );
338  void SingleRefToVars( const ScSingleRefData & rRef, SCCOL & rCol, SCROW & rRow, SCTAB & rTab );
339  void PopSingleRef( ScAddress& );
340  void PopSingleRef(SCCOL& rCol, SCROW &rRow, SCTAB& rTab);
341  void DoubleRefToRange( const ScComplexRefData&, ScRange&, bool bDontCheckForTableOp = false );
350  void PopDoubleRef( ScRange & rRange, short & rParam, size_t & rRefInList );
351  void PopDoubleRef( ScRange&, bool bDontCheckForTableOp = false );
352  void DoubleRefToVars( const formula::FormulaToken* p,
353  SCCOL& rCol1, SCROW &rRow1, SCTAB& rTab1,
354  SCCOL& rCol2, SCROW &rRow2, SCTAB& rTab2 );
356  void PopDoubleRef(SCCOL& rCol1, SCROW &rRow1, SCTAB& rTab1,
357  SCCOL& rCol2, SCROW &rRow2, SCTAB& rTab2 );
358 
359  void PopExternalSingleRef(sal_uInt16& rFileId, OUString& rTabName, ScSingleRefData& rRef);
360 
363 
365  void PopExternalSingleRef(sal_uInt16& rFileId, OUString& rTabName, ScSingleRefData& rRef,
367 
368  void PopExternalDoubleRef(sal_uInt16& rFileId, OUString& rTabName, ScComplexRefData& rRef);
370  void PopExternalDoubleRef(ScMatrixRef& rMat);
371  void GetExternalDoubleRef(sal_uInt16 nFileId, const OUString& rTabName, const ScComplexRefData& aData, ScExternalRefCache::TokenArrayRef& rArray);
372  bool PopDoubleRefOrSingleRef( ScAddress& rAdr );
373  void PopDoubleRefPushMatrix();
375  // If MatrixFormula: convert svDoubleRef to svMatrix, create JumpMatrix.
376  // Else convert area reference parameters marked as ForceArray to array.
377  // Returns true if JumpMatrix created.
379  // If MatrixFormula: ConvertMatrixJumpConditionToMatrix()
380  inline void MatrixJumpConditionToMatrix();
381  // For MatrixFormula (preconditions already checked by
382  // MatrixJumpConditionToMatrix()): convert svDoubleRef to svMatrix, or if
383  // JumpMatrix currently in effect convert also other types to svMatrix so
384  // another JumpMatrix will be created by jump commands.
386  // If MatrixFormula or ForceArray: ConvertMatrixParameters()
387  inline bool MatrixParameterConversion();
388  // If MatrixFormula or ForceArray. Can be used within spreadsheet functions
389  // that do not depend on the formula cell's matrix size, for which only
390  // bMatrixFormula can be used.
391  inline bool IsInArrayContext() const;
394  void QueryMatrixType(const ScMatrixRef& xMat, SvNumFormatType& rRetTypeExpr, sal_uInt32& rRetIndexExpr);
395 
396  formula::FormulaToken* CreateFormulaDoubleToken( double fVal, SvNumFormatType nFmt = SvNumFormatType::NUMBER );
398 
399  void PushDouble(double nVal);
400  void PushInt( int nVal );
401  void PushStringBuffer( const sal_Unicode* pString );
402  void PushString( const OUString& rStr );
403  void PushString( const svl::SharedString& rString );
404  void PushSingleRef(SCCOL nCol, SCROW nRow, SCTAB nTab);
405  void PushDoubleRef(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
406  SCCOL nCol2, SCROW nRow2, SCTAB nTab2);
407  void PushExternalSingleRef(sal_uInt16 nFileId, const OUString& rTabName,
408  SCCOL nCol, SCROW nRow, SCTAB nTab);
409  void PushExternalDoubleRef(sal_uInt16 nFileId, const OUString& rTabName,
410  SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
411  SCCOL nCol2, SCROW nRow2, SCTAB nTab2);
412  void PushSingleRef( const ScRefAddress& rRef );
413  void PushDoubleRef( const ScRefAddress& rRef1, const ScRefAddress& rRef2 );
414  void PushMatrix( const sc::RangeMatrix& rMat );
415  void PushMatrix(const ScMatrixRef& pMat);
416  void PushError( FormulaError nError );
421  // peek StackType of Parameter, Parameter 1 == TOS, 2 == TOS-1, ...
423  sal_uInt8 GetByte() const { return cPar; }
424  // reverse order of stack
426  // generates a position-dependent SingleRef out of a DoubleRef
427  bool DoubleRefToPosSingleRef( const ScRange& rRange, ScAddress& rAdr );
428  double GetDoubleFromMatrix(const ScMatrixRef& pMat);
429  double GetDouble();
430  double GetDoubleWithDefault(double nDefault);
431  bool IsMissing() const;
432  sal_Int32 double_to_int32(double fVal);
434  sal_Int32 GetInt32();
436  sal_Int32 GetInt32WithDefault( sal_Int32 nDefault );
438  sal_Int16 GetInt16();
440  sal_uInt32 GetUInt32();
441  bool GetBool() { return GetDouble() != 0.0; }
443  bool GetDoubleOrString( double& rValue, svl::SharedString& rString );
446  svl::SharedString GetStringFromDouble( const double fVal);
447  // pop matrix and obtain one element, upper left or according to jump matrix
448  ScMatValType GetDoubleOrStringFromMatrix( double& rDouble, svl::SharedString& rString );
450  SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
451  SCCOL nCol2, SCROW nRow2, SCTAB nTab2 );
454  ScMatrixRef GetMatrix( short & rParam, size_t & rInRefList );
456 
457  void ScTableOp(); // repeated operations
458 
459  // common helper functions
460 
462  { nFuncFmtType = nCurFmtType; nFuncFmtIndex = nCurFmtIndex; }
463 
474  static inline bool CheckStringPositionArgument( double & fVal );
475 
480  inline sal_Int32 GetStringPositionArgument();
481 
482  // Check for String overflow of rResult+rAdd and set error and erase rResult
483  // if so. Return true if ok, false if overflow
484  inline bool CheckStringResultLen( OUString& rResult, const OUString& rAdd );
485 
486  // Check for String overflow of rResult+rAdd and set error and erase rResult
487  // if so. Return true if ok, false if overflow
488  inline bool CheckStringResultLen( OUStringBuffer& rResult, const OUString& rAdd );
489 
490  // Set error according to rVal, and set rVal to 0.0 if there was an error.
491  inline void TreatDoubleError( double& rVal );
492  // Lookup using ScLookupCache, @returns true if found and result address
493  bool LookupQueryWithCache( ScAddress & o_rResultPos,
494  const ScQueryParam & rParam ) const;
495 
496  void ScIfJump();
497  void ScIfError( bool bNAonly );
498  void ScChooseJump();
499 
500  // Be sure to only call this if pStack[sp-nStackLevel] really contains a
501  // ScJumpMatrixToken, no further checks are applied!
502  // Returns true if last jump was executed and result matrix pushed.
503  bool JumpMatrix( short nStackLevel );
504 
505  double Compare( ScQueryOp eOp );
509  sc::RangeMatrix CompareMat( ScQueryOp eOp, sc::CompareOptions* pOptions = nullptr );
510  ScMatrixRef QueryMat( const ScMatrixRef& pMat, sc::CompareOptions& rOptions );
511  void ScEqual();
512  void ScNotEqual();
513  void ScLess();
514  void ScGreater();
515  void ScLessEqual();
516  void ScGreaterEqual();
517  void ScAnd();
518  void ScOr();
519  void ScXor();
520  void ScNot();
521  void ScNeg();
522  void ScPercentSign();
523  void ScIntersect();
524  void ScRangeFunc();
525  void ScUnionFunc();
526  void ScPi();
527  void ScRandom();
528  void ScRandbetween();
529  void ScRandomImpl( const std::function<double( double fFirst, double fLast )>& RandomFunc,
530  double fFirst, double fLast );
531  void ScTrue();
532  void ScFalse();
533  void ScDeg();
534  void ScRad();
535  void ScSin();
536  void ScCos();
537  void ScTan();
538  void ScCot();
539  void ScArcSin();
540  void ScArcCos();
541  void ScArcTan();
542  void ScArcCot();
543  void ScSinHyp();
544  void ScCosHyp();
545  void ScTanHyp();
546  void ScCotHyp();
547  void ScArcSinHyp();
548  void ScArcCosHyp();
549  void ScArcTanHyp();
550  void ScArcCotHyp();
551  void ScCosecant();
552  void ScSecant();
553  void ScCosecantHyp();
554  void ScSecantHyp();
555  void ScExp();
556  void ScLn();
557  void ScLog10();
558  void ScSqrt();
559  void ScIsEmpty();
560  bool IsString();
561  void ScIsString();
562  void ScIsNonString();
563  void ScIsLogical();
564  void ScType();
565  void ScCell();
566  void ScCellExternal();
567  void ScIsRef();
568  void ScIsValue();
569  void ScIsFormula();
570  void ScFormula();
571  void ScRoman();
572  void ScArabic();
573  void ScIsNV();
574  void ScIsErr();
575  void ScIsError();
576  bool IsEven();
577  void ScIsEven();
578  void ScIsOdd();
579  void ScN();
580  void ScCode();
581  void ScTrim();
582  void ScUpper();
583  void ScProper();
584  void ScLower();
585  void ScLen();
586  void ScT();
587  void ScValue();
588  void ScNumberValue();
589  void ScClean();
590  void ScChar();
591  void ScJis();
592  void ScAsc();
593  void ScUnicode();
594  void ScUnichar();
595  void ScMin( bool bTextAsZero = false );
596  void ScMax( bool bTextAsZero = false );
599  size_t GetRefListArrayMaxSize( short nParamCount );
602  bool SwitchToArrayRefList( ScMatrixRef& xResMat, SCSIZE nMatRows, double fCurrent,
603  const std::function<void( SCSIZE i, double fCurrent )>& MatOpFunc, bool bDoMatOp );
604  void IterateParameters( ScIterFunc, bool bTextAsZero = false );
605  void ScSumSQ();
606  void ScSum();
607  void ScProduct();
608  void ScAverage( bool bTextAsZero = false );
609  void ScCount();
610  void ScCount2();
611  void GetStVarParams( bool bTextAsZero, double(*VarResult)( double fVal, size_t nValCount ) );
612  void ScVar( bool bTextAsZero = false );
613  void ScVarP( bool bTextAsZero = false );
614  void ScStDev( bool bTextAsZero = false );
615  void ScStDevP( bool bTextAsZero = false );
616  void ScRawSubtract();
617  void ScColumns();
618  void ScRows();
619  void ScSheets();
620  void ScColumn();
621  void ScRow();
622  void ScSheet();
623  void ScMatch();
625  void ScCountIf();
626  void ScSumIf();
627  void ScAverageIf();
628  void IterateParametersIfs( double(*ResultFunc)( const sc::ParamIfsResult& rRes ) );
629  void ScSumIfs();
630  void ScAverageIfs();
631  void ScCountIfs();
632  void ScCountEmptyCells();
633  void ScLookup();
634  void ScHLookup();
635  void ScVLookup();
636  void ScSubTotal();
637 
638  // If upon call rMissingField==true then the database field parameter may be
639  // missing (Xcl DCOUNT() syntax), or may be faked as missing by having the
640  // value 0.0 or being exactly the entire database range reference (old SO
641  // compatibility). If this was the case then rMissingField is set to true upon
642  // return. If rMissingField==false upon call all "missing cases" are considered
643  // to be an error.
644  std::unique_ptr<ScDBQueryParamBase> GetDBParams( bool& rMissingField );
645 
646  void DBIterator( ScIterFunc );
647  void ScDBSum();
648  void ScDBCount();
649  void ScDBCount2();
650  void ScDBAverage();
651  void ScDBGet();
652  void ScDBMax();
653  void ScDBMin();
654  void ScDBProduct();
655  void GetDBStVarParams( double& rVal, double& rValCount );
656  void ScDBStdDev();
657  void ScDBStdDevP();
658  void ScDBVar();
659  void ScDBVarP();
660  void ScIndirect();
661  void ScAddressFunc();
662  void ScOffset();
663  void ScIndex();
664  void ScMultiArea();
665  void ScAreas();
666  void ScCurrency();
667  void ScReplace();
668  void ScFixed();
669  void ScFind();
670  void ScExact();
671  void ScLeft();
672  void ScRight();
673  void ScSearch();
674  void ScMid();
675  void ScText();
676  void ScSubstitute();
677  void ScRept();
678  void ScRegex();
679  void ScConcat();
680  void ScConcat_MS();
681  void ScTextJoin_MS();
682  void ScIfs_MS();
683  void ScSwitch_MS();
684  void ScMinIfs_MS();
685  void ScMaxIfs_MS();
686  void ScExternal();
687  void ScMissing();
688  void ScMacro();
689  bool SetSbxVariable( SbxVariable* pVar, const ScAddress& );
691  void ScErrorType();
692  void ScErrorType_ODF();
693  void ScDBArea();
694  void ScColRowNameAuto();
695  void ScGetPivotData();
696  void ScHyperLink();
697  void ScBahtText();
698  void ScBitAnd();
699  void ScBitOr();
700  void ScBitXor();
701  void ScBitRshift();
702  void ScBitLshift();
703  void ScTTT();
704  void ScDebugVar();
705 
716  double GetDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, bool bStrict );
717 
718  void ScGetActDate();
719  void ScGetActTime();
720  void ScGetYear();
721  void ScGetMonth();
722  void ScGetDay();
723  void ScGetDayOfWeek();
724  void ScGetWeekOfYear();
725  void ScGetIsoWeekOfYear();
726  void ScWeeknumOOo();
727  void ScEasterSunday();
728  FormulaError GetWeekendAndHolidayMasks( const sal_uInt8 nParamCount, const sal_uInt32 nNullDate,
729  ::std::vector<double>& rSortArray, bool bWeekendMask[ 7 ] );
730  FormulaError GetWeekendAndHolidayMasks_MS( const sal_uInt8 nParamCount, const sal_uInt32 nNullDate,
731  ::std::vector<double>& rSortArray, bool bWeekendMask[ 7 ], bool bWorkdayFunction );
732  static inline sal_Int16 GetDayOfWeek( sal_Int32 n );
733  void ScNetWorkdays( bool bOOXML_Version );
734  void ScWorkday_MS();
735  void ScGetHour();
736  void ScGetMin();
737  void ScGetSec();
738  void ScPlusMinus();
739  void ScAbs();
740  void ScInt();
741  void ScEven();
742  void ScOdd();
743  void ScCeil( bool bODFF );
744  void ScCeil_MS();
745  void ScCeil_Precise();
746  void ScFloor( bool bODFF );
747  void ScFloor_MS();
748  void ScFloor_Precise();
749  void RoundNumber( rtl_math_RoundingMode eMode );
750  void ScRound();
751  void ScRoundUp();
752  void ScRoundDown();
753  void ScGetDateValue();
754  void ScGetTimeValue();
755  void ScArcTan2();
756  void ScLog();
757  void ScGetDate();
758  void ScGetTime();
759  void ScGetDiffDate();
760  void ScGetDiffDate360();
761  void ScGetDateDif();
762  void ScPower();
763  void ScAmpersand();
764  void ScAdd();
765  void ScSub();
766  void ScMul();
767  void ScDiv();
768  void ScPow();
769  void ScCurrent();
770  void ScStyle();
771  void ScDde();
772  void ScBase();
773  void ScDecimal();
774  void ScConvertOOo();
775  void ScEuroConvert();
776  void ScRoundSignificant();
777  static void RoundSignificant( double fX, double fDigits, double &fRes );
778 
779  // financial functions
780  void ScNPV();
781  void ScIRR();
782  void ScMIRR();
783  void ScISPMT();
784 
785  static double ScGetPV(double fRate, double fNper, double fPmt,
786  double fFv, bool bPayInAdvance);
787  void ScPV();
788  void ScSYD();
789  static double ScGetDDB(double fCost, double fSalvage, double fLife,
790  double fPeriod, double fFactor);
791  void ScDDB();
792  void ScDB();
793  static double ScInterVDB(double fCost, double fSalvage, double fLife, double fLife1,
794  double fPeriod, double fFactor);
795  void ScVDB();
796  void ScPDuration();
797  void ScSLN();
798  static double ScGetPMT(double fRate, double fNper, double fPv,
799  double fFv, bool bPayInAdvance);
800  void ScPMT();
801  void ScRRI();
802  static double ScGetFV(double fRate, double fNper, double fPmt,
803  double fPv, bool bPayInAdvance);
804  void ScFV();
805  void ScNper();
806  static bool RateIteration(double fNper, double fPayment, double fPv,
807  double fFv, bool bPayType, double& fGuess);
808  void ScRate();
809  double ScGetIpmt(double fRate, double fPer, double fNper, double fPv,
810  double fFv, bool bPayInAdvance, double& fPmt);
811  void ScIpmt();
812  void ScPpmt();
813  void ScCumIpmt();
814  void ScCumPrinc();
815  void ScEffect();
816  void ScNominal();
817  void ScMod();
818  void ScIntercept();
819  void ScGCD();
820  void ScLCM();
821 
822  // matrix functions
823  void ScMatValue();
824  static void MEMat(const ScMatrixRef& mM, SCSIZE n);
825  void ScMatDet();
826  void ScMatInv();
827  void ScMatMult();
828  void ScMatTrans();
829  void ScEMat();
830  void ScMatRef();
831  ScMatrixRef MatConcat(const ScMatrixRef& pMat1, const ScMatrixRef& pMat2);
832  void ScSumProduct();
833  void ScSumX2MY2();
834  void ScSumX2DY2();
835  void ScSumXMY2();
836  void ScGrowth();
837  bool CalculateSkew(KahanSum& fSum, double& fCount, std::vector<double>& values);
838  void CalculateSkewOrSkewp( bool bSkewp );
839  void CalculateSlopeIntercept(bool bSlope);
840  void CalculateSmallLarge(bool bSmall);
841  void CalculatePearsonCovar( bool _bPearson, bool _bStexy, bool _bSample ); //fdo#70000 argument _bSample is ignored if _bPearson == true
842  bool CalculateTest( bool _bTemplin
843  ,const SCSIZE nC1, const SCSIZE nC2,const SCSIZE nR1,const SCSIZE nR2
844  ,const ScMatrixRef& pMat1,const ScMatrixRef& pMat2
845  ,double& fT,double& fF);
846  void CalculateLookup(bool bHLookup);
847  bool FillEntry(ScQueryEntry& rEntry);
848  void CalculateAddSub(bool _bSub);
849  void CalculateTrendGrowth(bool _bGrowth);
850  void CalculateRGPRKP(bool _bRKP);
851  void CalculateSumX2MY2SumX2DY2(bool _bSumX2DY2);
852  void CalculateMatrixValue(const ScMatrix* pMat,SCSIZE nC,SCSIZE nR);
853  bool CheckMatrix(bool _bLOG,sal_uInt8& nCase,SCSIZE& nCX,SCSIZE& nCY,SCSIZE& nRX,SCSIZE& nRY,SCSIZE& M,SCSIZE& N,ScMatrixRef& pMatX,ScMatrixRef& pMatY);
854  void ScLinest();
855  void ScLogest();
856  void ScForecast();
857  void ScForecast_Ets( ScETSType eETSType );
858  void ScFourier();
859  void ScNoName();
860  void ScBadName();
861  // Statistics:
862  static double taylor(const double* pPolynom, sal_uInt16 nMax, double x);
863  static double gauss(double x);
864 
865 public:
866  static double phi(double x);
867  static double integralPhi(double x);
868  static double gaussinv(double x);
869  static double GetPercentile( ::std::vector<double> & rArray, double fPercentile );
870 
871 
872 private:
873  double GetBetaDist(double x, double alpha, double beta); //cumulative distribution function
874  double GetBetaDistPDF(double fX, double fA, double fB); //probability density function)
875  double GetChiDist(double fChi, double fDF); // for LEGACY.CHIDIST, returns right tail
876  double GetChiSqDistCDF(double fX, double fDF); // for CHISQDIST, returns left tail
877  static double GetChiSqDistPDF(double fX, double fDF); // probability density function
878  double GetFDist(double x, double fF1, double fF2);
879  double GetTDist( double T, double fDF, int nType );
880  double Fakultaet(double x);
881  static double BinomKoeff(double n, double k);
882  double GetGamma(double x);
883  static double GetLogGamma(double x);
884  double GetBeta(double fAlpha, double fBeta);
885  static double GetLogBeta(double fAlpha, double fBeta);
886  double GetBinomDistPMF(double x, double n, double p); //probability mass function
887  double GetHypGeomDist( double x, double n, double M, double N );
888  void ScLogGamma();
889  void ScGamma();
890  void ScPhi();
891  void ScGauss();
892  void ScStdNormDist();
893  void ScStdNormDist_MS();
894  void ScFisher();
895  void ScFisherInv();
896  void ScFact();
897  void ScNormDist( int nMinParamCount );
898  void ScGammaDist( bool bODFF );
899  void ScGammaInv();
900  void ScExpDist();
901  void ScBinomDist();
902  void ScPoissonDist( bool bODFF );
903  void ScCombin();
904  void ScCombinA();
905  void ScPermut();
906  void ScPermutationA();
907  void ScB();
908  void ScHypGeomDist( int nMinParamCount );
909  void ScLogNormDist( int nMinParamCount );
910  void ScLogNormInv();
911  void ScTDist();
912  void ScTDist_MS();
913  void ScTDist_T( int nTails );
914  void ScFDist();
915  void ScFDist_LT();
916  void ScChiDist( bool bODFF); // for LEGACY.CHIDIST, returns right tail
917  void ScChiSqDist(); // returns left tail or density
918  void ScChiSqDist_MS();
919  void ScChiSqInv(); // inverse to CHISQDIST
920  void ScWeibull();
921  void ScBetaDist();
922  void ScBetaDist_MS();
923  void ScFInv();
924  void ScFInv_LT();
925  void ScTInv( int nType );
926  void ScChiInv();
927  void ScBetaInv();
928  void ScCritBinom();
929  void ScNegBinomDist();
930  void ScNegBinomDist_MS();
931  void ScKurt();
932  void ScHarMean();
933  void ScGeoMean();
934  void ScStandard();
935  void ScSkew();
936  void ScSkewp();
937  void ScMedian();
938  double GetMedian( ::std::vector<double> & rArray );
939  double GetPercentileExclusive( ::std::vector<double> & rArray, double fPercentile );
940  std::vector<double> GetTopNumberArray( SCSIZE& rCol, SCSIZE& rRow );
941  void GetNumberSequenceArray( sal_uInt8 nParamCount, ::std::vector<double>& rArray, bool bConvertTextInArray );
942  void GetSortArray( sal_uInt8 nParamCount, ::std::vector<double>& rSortArray, ::std::vector<tools::Long>* pIndexOrder, bool bConvertTextInArray, bool bAllowEmptyArray );
943  static void QuickSort(::std::vector<double>& rSortArray, ::std::vector<tools::Long>* pIndexOrder);
944  void ScModalValue();
945  void ScModalValue_MS( bool bSingle );
946  void ScAveDev();
947  void ScAggregate();
948  void ScDevSq();
949  void ScZTest();
950  void ScTTest();
951  void ScFTest();
952  void ScChiTest();
953  void ScRank( bool bAverage );
954  void ScPercentile( bool bInclusive );
955  void ScPercentrank( bool bInclusive );
956  static double GetPercentrank( ::std::vector<double> & rArray, double fVal, bool bInclusive );
957  void ScLarge();
958  void ScSmall();
959  void ScFrequency();
960  void ScQuartile( bool bInclusive );
961  void ScNormInv();
962  void ScSNormInv();
963  void ScConfidence();
964  void ScConfidenceT();
965  void ScTrimMean();
966  void ScProbability();
967  void ScCorrel();
968  void ScCovarianceP();
969  void ScCovarianceS();
970  void ScPearson();
971  void ScRSQ();
972  void ScSTEYX();
973  void ScSlope();
974  void ScTrend();
975  void ScInfo();
976  void ScLenB();
977  void ScRightB();
978  void ScLeftB();
979  void ScMidB();
980  void ScReplaceB();
981  void ScFindB();
982  void ScSearchB();
983 
984  void ScFilterXML();
985  void ScWebservice();
986  void ScEncodeURL();
987  void ScColor();
988  void ScErf();
989  void ScErfc();
990 
991  static const double fMaxGammaArgument;
992 
993  double GetGammaContFraction(double fA,double fX);
994  double GetGammaSeries(double fA,double fX);
995  double GetLowRegIGamma(double fA,double fX); // lower regularized incomplete gamma function, GAMMAQ
996  double GetUpRegIGamma(double fA,double fX); // upper regularized incomplete gamma function, GAMMAP
997  // probability density function; fLambda is "scale" parameter
998  double GetGammaDistPDF(double fX, double fAlpha, double fLambda);
999  // cumulative distribution function; fLambda is "scale" parameter
1000  double GetGammaDist(double fX, double fAlpha, double fLambda);
1001  double GetTInv( double fAlpha, double fSize, int nType );
1002 
1003 public:
1004  ScInterpreter( ScFormulaCell* pCell, ScDocument& rDoc, ScInterpreterContext& rContext,
1005  const ScAddress&, ScTokenArray&, bool bForGroupThreading = false );
1006  ~ScInterpreter();
1007 
1008  // Used only for threaded formula-groups.
1009  // Resets the interpreter object, allowing reuse of interpreter object for each cell
1010  // in the group.
1011  void Init( ScFormulaCell* pCell, const ScAddress& rPos, ScTokenArray& rTokArray );
1012 
1014 
1015  void SetError(FormulaError nError)
1016  { if (nError != FormulaError::NONE && nGlobalError == FormulaError::NONE) nGlobalError = nError; }
1017  void AssertFormulaMatrix();
1018 
1020  { mpLinkManager = pLinkMgr; }
1021 
1022  FormulaError GetError() const { return nGlobalError; }
1023  formula::StackVar GetResultType() const { return xResult->GetType(); }
1024  const svl::SharedString & GetStringResult() const;
1025  double GetNumResult() const { return xResult->GetDouble(); }
1029 };
1030 
1032 {
1033  return bMatrixFormula || pCur->IsInForceArray();
1034 }
1035 
1037 {
1038  if (IsInArrayContext())
1040 }
1041 
1043 {
1045  !pJumpMatrix && sp > 0 )
1046  return ConvertMatrixParameters();
1047  return false;
1048 }
1049 
1051 {
1052  return maTokenMatrixMap;
1053 }
1054 
1055 inline bool ScInterpreter::MustHaveParamCount( short nAct, short nMust )
1056 {
1057  if ( nAct == nMust )
1058  return true;
1059  if ( nAct < nMust )
1061  else
1063  return false;
1064 }
1065 
1066 inline bool ScInterpreter::MustHaveParamCount( short nAct, short nMust, short nMax )
1067 {
1068  if ( nMust <= nAct && nAct <= nMax )
1069  return true;
1070  if ( nAct < nMust )
1072  else
1074  return false;
1075 }
1076 
1077 inline bool ScInterpreter::MustHaveParamCountMin( short nAct, short nMin )
1078 {
1079  if ( nAct >= nMin )
1080  return true;
1082  return false;
1083 }
1084 
1086 {
1087  if (!std::isfinite( fVal))
1088  {
1089  fVal = -1.0;
1090  return false;
1091  }
1092  else if (fVal < 0.0)
1093  {
1094  fVal = 0.0;
1095  return false;
1096  }
1097  else if (fVal > SAL_MAX_INT32)
1098  {
1099  fVal = static_cast<double>(SAL_MAX_INT32);
1100  return false;
1101  }
1102  return true;
1103 }
1104 
1106 {
1107  double fVal = rtl::math::approxFloor( GetDouble());
1108  if (!CheckStringPositionArgument( fVal))
1109  {
1110  fVal = -1.0;
1111  SetError( FormulaError::IllegalArgument);
1112  }
1113  return static_cast<sal_Int32>(fVal);
1114 }
1115 
1116 inline bool ScInterpreter::CheckStringResultLen( OUString& rResult, const OUString& rAdd )
1117 {
1118  if (rAdd.getLength() > kScInterpreterMaxStrLen - rResult.getLength())
1119  {
1120  SetError( FormulaError::StringOverflow );
1121  rResult.clear();
1122  return false;
1123  }
1124  return true;
1125 }
1126 
1127 inline bool ScInterpreter::CheckStringResultLen( OUStringBuffer& rResult, const OUString& rAdd )
1128 {
1129  if (rAdd.getLength() > kScInterpreterMaxStrLen - rResult.getLength())
1130  {
1131  SetError( FormulaError::StringOverflow );
1132  rResult = OUStringBuffer();
1133  return false;
1134  }
1135  return true;
1136 }
1137 
1138 inline void ScInterpreter::TreatDoubleError( double& rVal )
1139 {
1140  if ( !std::isfinite( rVal ) )
1141  {
1142  FormulaError nErr = GetDoubleErrorValue( rVal );
1143  if ( nErr != FormulaError::NONE )
1144  SetError( nErr );
1145  else
1146  SetError( FormulaError::NoValue );
1147  rVal = 0.0;
1148  }
1149 }
1150 
1151 inline double ScInterpreter::div( const double& fNumerator, const double& fDenominator )
1152 {
1153  return sc::div(fNumerator, fDenominator);
1154 }
1155 
1156 inline sal_Int16 ScInterpreter::GetDayOfWeek( sal_Int32 n )
1157 { // monday = 0, ..., sunday = 6
1158  return static_cast< sal_Int16 >( ( n - 1 ) % 7 );
1159 }
1160 
1161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Matrix data type that can store values of mixed types.
Definition: scmatrix.hxx:112
void ScErf()
Definition: interpr7.cxx:496
void ScFDist_LT()
Definition: interpr3.cxx:1705
void ScGCD()
Definition: interpr5.cxx:128
void ScDecimal()
Definition: interpr2.cxx:2902
double GetLowRegIGamma(double fA, double fX)
You must ensure fA>0.0 && fX>0.0)
Definition: interpr6.cxx:119
void ScRoundSignificant()
Definition: interpr2.cxx:1012
void ScFormula()
Definition: interpr1.cxx:2753
void ScGetDiffDate()
Definition: interpr2.cxx:664
::boost::intrusive_ptr< const FormulaToken > FormulaConstTokenRef
void ScFrequency()
Definition: interpr5.cxx:1860
void ScDBArea()
Definition: interpr4.cxx:3654
void ScBadName()
Definition: interpr3.cxx:186
void ScIndirect()
Definition: interpr1.cxx:8038
void ScArcTan2()
Definition: interpr2.cxx:1232
void GetExternalDoubleRef(sal_uInt16 nFileId, const OUString &rTabName, const ScComplexRefData &aData, ScExternalRefCache::TokenArrayRef &rArray)
Definition: interpr4.cxx:1259
void ScLessEqual()
Definition: interpr1.cxx:1226
void ScPearson()
Definition: interpr3.cxx:4518
void ScSumIfs()
Definition: interpr1.cxx:6447
ScIterFunc
Definition: interpre.hxx:101
sal_uInt32 nRetFmtIndex
Definition: interpre.hxx:213
sal_Int32 GetInt32()
if GetDouble() not within int32 limits sets nGlobalError and returns SAL_MAX_INT32 ...
Definition: interpr4.cxx:2179
void CalculateMatrixValue(const ScMatrix *pMat, SCSIZE nC, SCSIZE nR)
Definition: interpr5.cxx:706
void ScEasterSunday()
Definition: interpr2.cxx:302
static void RoundSignificant(double fX, double fDigits, double &fRes)
Definition: interpr2.cxx:1005
void ScVarP(bool bTextAsZero=false)
Definition: interpr1.cxx:4156
formula::FormulaTokenIterator aCode
Definition: interpre.hxx:192
bool CalculateSkew(KahanSum &fSum, double &fCount, std::vector< double > &values)
Definition: interpr3.cxx:3212
SvNumFormatType nFuncFmtType
Definition: interpre.hxx:214
void ScGetTimeValue()
Definition: interpr2.cxx:914
void ScSwitch_MS()
Definition: interpr8.cxx:1903
void ScUnichar()
Definition: interpr1.cxx:3566
void ScErfc()
Definition: interpr7.cxx:503
void ScUnicode()
Definition: interpr1.cxx:3552
void ScDebugVar()
Definition: interpr7.cxx:450
void ScBetaInv()
Definition: interpr3.cxx:2213
void ScRank(bool bAverage)
Definition: interpr3.cxx:4207
void CalculateAddSub(bool _bSub)
Definition: interpr5.cxx:1278
void ScMacro()
Definition: interpr4.cxx:3184
static double GetPercentile(::std::vector< double > &rArray, double fPercentile)
Definition: interpr3.cxx:3401
void PushIllegalParameter()
Definition: interpr4.cxx:1902
void ScGauss()
Definition: interpr3.cxx:1146
void ScGetDay()
Definition: interpr2.cxx:133
void PushTempToken(formula::FormulaToken *)
Does substitute with formula::FormulaErrorToken in case nGlobalError is set and the token passed is n...
Definition: interpr4.cxx:613
void ScLCM()
Definition: interpr5.cxx:202
void ScCritBinom()
Definition: interpr3.cxx:1411
void ScEMat()
Definition: interpr5.cxx:729
void ScFloor_Precise()
Definition: interpr2.cxx:1191
static double phi(double x)
Definition: interpr3.cxx:196
FormulaError GetError() const
Definition: interpre.hxx:1022
Single reference (one address) into the sheet.
Definition: refdata.hxx:29
ScTokenMatrixMap maTokenMatrixMap
Definition: interpre.hxx:201
static double GetChiSqDistPDF(double fX, double fDF)
Definition: interpr3.cxx:690
void ScRangeFunc()
Definition: interpr2.cxx:2491
SvNumFormatType nRetFmtType
Definition: interpre.hxx:216
void CalculateSumX2MY2SumX2DY2(bool _bSumX2DY2)
Definition: interpr5.cxx:1782
void ScLog10()
Definition: interpr2.cxx:1265
void ScPDuration()
Definition: interpr2.cxx:1864
formula::StackVar Interpret()
Definition: interpr4.cxx:3938
void ScIntersect()
Definition: interpr2.cxx:2344
void ScStdNormDist_MS()
Definition: interpr3.cxx:1602
void PushSingleRef(SCCOL nCol, SCROW nRow, SCTAB nTab)
Definition: interpr4.cxx:1800
void ScNumberValue()
Definition: interpr1.cxx:3342
void ScLogest()
Definition: interpr5.cxx:2383
double GetFDist(double x, double fF1, double fF2)
Definition: interpr3.cxx:641
void ScChiTest()
Definition: interpr3.cxx:2781
void ScTDist_MS()
Definition: interpr3.cxx:1675
void ScTextJoin_MS()
Definition: interpr8.cxx:1509
formula::FormulaConstTokenRef xResult
Definition: interpre.hxx:199
SubtotalFlags mnSubTotalFlags
Definition: interpre.hxx:218
void ScRound()
Definition: interpr2.cxx:990
void ScOffset()
Definition: interpr1.cxx:8359
void ReverseStack(sal_uInt8 nParamCount)
Definition: interpr4.cxx:1973
void SetLinkManager(sfx2::LinkManager *pLinkMgr)
Definition: interpre.hxx:1019
void ScEffect()
Definition: interpr2.cxx:2287
void ScStandard()
Definition: interpr3.cxx:3197
void AssertFormulaMatrix()
Definition: interpr4.cxx:4743
double GetCellValueOrZero(const ScAddress &, ScRefCellValue &rCell)
Definition: interpr4.cxx:186
void ScHypGeomDist(int nMinParamCount)
Calculates a value of the hypergeometric distribution.
Definition: interpr3.cxx:1857
void ScRoman()
Definition: interpr2.cxx:2981
void GetSortArray(sal_uInt8 nParamCount,::std::vector< double > &rSortArray,::std::vector< tools::Long > *pIndexOrder, bool bConvertTextInArray, bool bAllowEmptyArray)
Definition: interpr3.cxx:4113
void ScLogNormInv()
Definition: interpr3.cxx:2144
void ScFourier()
Definition: interpr3.cxx:5475
ScMatrixRef GetMatrix()
Definition: interpr5.cxx:477
sal_uIntPtr sal_uLong
double GetPercentileExclusive(::std::vector< double > &rArray, double fPercentile)
Definition: interpr3.cxx:3425
bool IsMissing() const
Definition: interpr4.cxx:1922
void ScDBMin()
Definition: interpr1.cxx:7959
ScCalcConfig maCalcConfig
Definition: interpre.hxx:191
sal_Int32 GetInt32WithDefault(sal_Int32 nDefault)
if GetDoubleWithDefault() not within int32 limits sets nGlobalError and returns SAL_MAX_INT32 ...
Definition: interpr4.cxx:2184
const formula::FormulaToken * pCur
Definition: interpre.hxx:205
void ScRightB()
Definition: interpr1.cxx:9084
bool DoubleRefToPosSingleRef(const ScRange &rRange, ScAddress &rAdr)
Definition: interpr4.cxx:1981
void ScMax(bool bTextAsZero=false)
Definition: interpr1.cxx:3765
FormulaError GetWeekendAndHolidayMasks_MS(const sal_uInt8 nParamCount, const sal_uInt32 nNullDate,::std::vector< double > &rSortArray, bool bWeekendMask[7], bool bWorkdayFunction)
Definition: interpr2.cxx:382
void ConvertMatrixJumpConditionToMatrix()
Definition: interpr4.cxx:1413
double GetGamma(double x)
You must ensure non integer arguments for fZ<1.
Definition: interpr3.cxx:586
void ScIsEven()
Definition: interpr1.cxx:3104
void ScGreater()
Definition: interpr1.cxx:1209
void ScDBVar()
Definition: interpr1.cxx:8024
void ScCeil_MS()
Definition: interpr2.cxx:1082
void ScHLookup()
Definition: interpr1.cxx:7186
static thread_local bool bGlobalStackInUse
Definition: interpre.hxx:189
void GetNumberSequenceArray(sal_uInt8 nParamCount,::std::vector< double > &rArray, bool bConvertTextInArray)
Definition: interpr3.cxx:3930
void ScColumn()
Definition: interpr1.cxx:4368
void ScCeil(bool bODFF)
tdf69552 ODFF1.2 function CEILING and Excel function CEILING.MATH In essence, the difference between ...
Definition: interpr2.cxx:1042
void PopSingleRef(ScAddress &)
Definition: interpr4.cxx:902
bool FillEntry(ScQueryEntry &rEntry)
Definition: interpr1.cxx:7444
void ScConcat_MS()
Definition: interpr8.cxx:1382
void ScIfs_MS()
Definition: interpr8.cxx:1836
void ScGetActDate()
Definition: interpr2.cxx:99
void ScDevSq()
Definition: interpr3.cxx:4428
void PushDoubleRef(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2)
Definition: interpr4.cxx:1810
void ScBitAnd()
Definition: interpr1.cxx:1635
double GetChiDist(double fChi, double fDF)
You must ensure fDF>0.0.
Definition: interpr3.cxx:670
OpCode GetOpCode() const
void ScIsEmpty()
Definition: interpr1.cxx:1961
formula::StackVar GetRawStackType()
Raw stack type without default replacements.
Definition: interpr4.cxx:1927
void ScChiSqDist_MS()
Definition: interpr3.cxx:751
void CalculateRGPRKP(bool _bRKP)
Definition: interpr5.cxx:2388
void ScIntercept()
Definition: interpr3.cxx:4712
This is very similar to ScCellValue, except that it references the original value instead of copying ...
Definition: cellvalue.hxx:103
double GetCellValue(const ScAddress &, ScRefCellValue &rCell)
Definition: interpr4.cxx:176
void ScChiSqDist()
Definition: interpr3.cxx:728
void ScStdNormDist()
Definition: interpr3.cxx:1597
void ScGetDiffDate360()
Definition: interpr2.cxx:674
void ScConcat()
Definition: interpr1.cxx:9746
void ScSumProduct()
Definition: interpr5.cxx:1717
void ScBitLshift()
Definition: interpr1.cxx:1680
void ScModalValue_MS(bool bSingle)
Definition: interpr3.cxx:3545
sal_uLong GetRetFormatIndex() const
Definition: interpre.hxx:1028
void ScDBCount2()
Definition: interpr1.cxx:7919
void ScGetMin()
Definition: interpr2.cxx:140
constexpr double get() const
Returns the final sum.
Definition: kahan.hxx:207
void ScArcCotHyp()
Definition: interpr1.cxx:1918
bool IsString()
Definition: interpr1.cxx:2015
void ScPermut()
Definition: interpr3.cxx:1200
void ScRawSubtract()
The purpose of RAWSUBTRACT() is exactly to not apply any error correction, approximation etc...
Definition: interpr6.cxx:990
void ScGammaInv()
Definition: interpr3.cxx:2173
void ScPoissonDist(bool bODFF)
Definition: interpr3.cxx:1782
std::vector< double > GetTopNumberArray(SCSIZE &rCol, SCSIZE &rRow)
Definition: interpr3.cxx:3845
void ScEqual()
Definition: interpr1.cxx:1158
void ScFilterXML()
Definition: interpr7.cxx:39
double GetDoubleWithDefault(double nDefault)
Definition: interpr4.cxx:2142
void ScGammaDist(bool bODFF)
Definition: interpr3.cxx:2092
bool IfErrorPushError()
If nGlobalError is set push formula::FormulaErrorToken.
Definition: interpre.hxx:302
bool ConvertMatrixParameters()
Definition: interpr4.cxx:1432
bool PopDoubleRefOrSingleRef(ScAddress &rAdr)
Definition: interpr4.cxx:1317
void ScRight()
Definition: interpr1.cxx:9276
void ScGetActTime()
Definition: interpr2.cxx:107
ScTokenMatrixMap & GetTokenMatrixMap()
Definition: interpre.hxx:1050
SvNumberFormatter * pFormatter
Definition: interpre.hxx:203
void PushCellResultToken(bool bDisplayEmptyAsString, const ScAddress &rAddress, SvNumFormatType *pRetTypeExpr, sal_uInt32 *pRetIndexExpr, bool bFinalResult=false)
Obtain cell result / content from address and push as temp token.
Definition: interpr4.cxx:682
void ScNoName()
Definition: interpr3.cxx:181
void CurFmtToFuncFmt()
Definition: interpre.hxx:461
void ScCount2()
Definition: interpr6.cxx:980
constexpr sal_Int32 kScInterpreterMaxStrLen
Arbitrary 256MB result string length limit.
Definition: interpre.hxx:91
void PushTempTokenWithoutError(const formula::FormulaToken *)
Does not substitute with formula::FormulaErrorToken in case nGlobalError is set.
Definition: interpr4.cxx:642
void PushParameterExpected()
Definition: interpr4.cxx:1897
void ScRandbetween()
Definition: interpr1.cxx:1791
SubtotalFlags
Definition: global.hxx:250
void ScCellExternal()
Definition: interpr1.cxx:2420
bool SwitchToArrayRefList(ScMatrixRef &xResMat, SCSIZE nMatRows, double fCurrent, const std::function< void(SCSIZE i, double fCurrent)> &MatOpFunc, bool bDoMatOp)
Switch to array reference list if current TOS is one and create/init or update matrix and return true...
Definition: interpr1.cxx:3581
sal_uInt16 sal_Unicode
void ScSumSQ()
Definition: interpr6.cxx:955
sal_uInt32 GetCellNumberFormat(const ScAddress &rPos, ScRefCellValue &rCell)
Definition: interpr4.cxx:123
void ScReplaceB()
Definition: interpr1.cxx:9174
void ScCeil_Precise()
Definition: interpr2.cxx:1100
double PopDouble()
Definition: interpr4.cxx:776
ScInterpreter(ScFormulaCell *pCell, ScDocument &rDoc, ScInterpreterContext &rContext, const ScAddress &, ScTokenArray &, bool bForGroupThreading=false)
Definition: interpr4.cxx:3769
double GetBeta(double fAlpha, double fBeta)
Definition: interpr3.cxx:801
char sal_uInt16 & nParamCount
Definition: callform.cxx:53
void ScGetHour()
Definition: interpr2.cxx:159
void ScSearchB()
Definition: interpr1.cxx:9231
void ScUnionFunc()
Definition: interpr2.cxx:2511
double Fakultaet(double x)
Definition: interpr3.cxx:440
This class provides LO with Kahan summation algorithm About this algorithm: https://en.wikipedia.org/wiki/Kahan_summation_algorithm For general purpose software we assume first order error is enough.
Definition: kahan.hxx:23
void ScCorrel()
Definition: interpr3.cxx:4502
sal_Int16 GetInt16()
if GetDouble() not within int16 limits sets nGlobalError and returns SAL_MAX_INT16 ...
Definition: interpr4.cxx:2193
void ScDBAverage()
Definition: interpr1.cxx:7949
void PushInt(int nVal)
Definition: interpr4.cxx:1772
void ScAverage(bool bTextAsZero=false)
Definition: interpr6.cxx:970
SvNumFormatType nCurFmtType
Definition: interpre.hxx:215
sal_Int32 GetStringPositionArgument()
Obtain a sal_Int32 suitable as string position or length argument.
Definition: interpre.hxx:1105
size_t SCSIZE
size_t typedef to be able to find places where code was changed from USHORT to size_t and is used to ...
Definition: address.hxx:44
void ScNegBinomDist_MS()
Definition: interpr3.cxx:1521
ScMatrixRef GetNewMat(SCSIZE nC, SCSIZE nR, bool bEmpty=false)
Definition: interpr5.cxx:297
static ScCalcConfig * mpGlobalConfig
Definition: interpre.hxx:186
void ScMatTrans()
Definition: interpr5.cxx:1126
void ScSinHyp()
Definition: interpr1.cxx:1875
void ScGetDateValue()
Definition: interpr2.cxx:167
void ScExpDist()
Definition: interpr3.cxx:1616
void PushExternalDoubleRef(sal_uInt16 nFileId, const OUString &rTabName, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2)
Definition: interpr4.cxx:1833
void ScFisher()
Definition: interpr3.cxx:1151
static double ScGetPMT(double fRate, double fNper, double fPv, double fFv, bool bPayInAdvance)
Definition: interpr2.cxx:1890
void CalculateSlopeIntercept(bool bSlope)
Definition: interpr3.cxx:4637
void ScNormInv()
Definition: interpr3.cxx:2117
static double ScGetFV(double fRate, double fNper, double fPmt, double fPv, bool bPayInAdvance)
Definition: interpr2.cxx:1937
ScIterFuncIf
Definition: interpre.hxx:112
void MatrixJumpConditionToMatrix()
Definition: interpre.hxx:1036
ScMatrixRef QueryMat(const ScMatrixRef &pMat, sc::CompareOptions &rOptions)
Definition: interpr1.cxx:1136
static double gaussinv(double x)
Definition: interpr3.cxx:269
ScETSType
Definition: interpre.hxx:118
void ScProper()
Definition: interpr1.cxx:3153
static const double fMaxGammaArgument
Definition: interpre.hxx:991
void ScFindB()
Definition: interpr1.cxx:9197
sal_Int32 double_to_int32(double fVal)
Definition: interpr4.cxx:2151
::boost::intrusive_ptr< ScMatrix > ScMatrixRef
Definition: types.hxx:25
void ScWebservice()
Definition: interpr7.cxx:272
void ScColumns()
Definition: interpr1.cxx:4207
void PushString(const OUString &rStr)
Definition: interpr4.cxx:1789
ScFormulaCell * pMyFormulaCell
Definition: interpre.hxx:202
FormulaError mnStringNoValueError
Definition: interpre.hxx:217
void ScArcSinHyp()
Definition: interpr1.cxx:1895
void ScSecantHyp()
Definition: interpr1.cxx:1942
FormulaError GetDoubleErrorValue(double fVal)
void ScMatDet()
Definition: interpr5.cxx:918
void ScRandomImpl(const std::function< double(double fFirst, double fLast)> &RandomFunc, double fFirst, double fLast)
Definition: interpr1.cxx:1731
void ScLinest()
Definition: interpr5.cxx:2377
const formula::FormulaToken ** pStack
Definition: interpre.hxx:207
void ScDBCount()
Definition: interpr1.cxx:7861
void ScConvertOOo()
Definition: interpr2.cxx:2958
void ScChooseJump()
Definition: interpr1.cxx:408
void ScIsString()
Definition: interpr1.cxx:2083
void PushError(FormulaError nError)
Definition: interpr4.cxx:1891
sc::RangeMatrix CompareMat(ScQueryOp eOp, sc::CompareOptions *pOptions=nullptr)
Definition: interpr1.cxx:974
void ScCount()
Definition: interpr6.cxx:975
void ScChiSqInv()
Definition: interpr3.cxx:2404
void ScSumIf()
Definition: interpr1.cxx:5590
void ScGetWeekOfYear()
Definition: interpr2.cxx:246
double GetTDist(double T, double fDF, int nType)
Definition: interpr3.cxx:649
void ScSheet()
Definition: interpr1.cxx:4575
void ScFalse()
Definition: interpr1.cxx:1819
void ScGreaterEqual()
Definition: interpr1.cxx:1243
void ScNetWorkdays(bool bOOXML_Version)
Definition: interpr2.cxx:499
void ScColRowNameAuto()
Definition: interpr4.cxx:3671
void IterateParametersIf(ScIterFuncIf)
Definition: interpr1.cxx:5185
void ScFisherInv()
Definition: interpr3.cxx:1160
void MakeMatNew(ScMatrixRef &rMat, SCSIZE nC, SCSIZE nR)
Definition: interpr5.cxx:282
sc::RangeMatrix PopRangeMatrix()
Definition: interpr4.cxx:1638
void ScIsOdd()
Definition: interpr1.cxx:3109
double GetDouble()
Definition: interpr4.cxx:2061
std::unique_ptr< ScDBQueryParamBase > GetDBParams(bool &rMissingField)
Definition: interpr1.cxx:7651
static double gauss(double x)
Definition: interpr3.cxx:216
bool CreateCellArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt8 *pCellArr)
Definition: interpr4.cxx:457
ScInterpreterContext & mrContext
Definition: interpre.hxx:195
void ScInt()
Definition: interpr2.cxx:952
void ScEuroConvert()
Definition: interpr2.cxx:3253
bool LookupQueryWithCache(ScAddress &o_rResultPos, const ScQueryParam &rParam) const
Definition: interpr1.cxx:10017
bool MustHaveParamCount(short nAct, short nMust)
Definition: interpre.hxx:1055
static void SetGlobalConfig(const ScCalcConfig &rConfig)
Definition: interpr4.cxx:3863
void ScSkewp()
Definition: interpr3.cxx:3362
ScMatrixRef PopMatrix()
Definition: interpr4.cxx:1606
void ScFloor_MS()
Definition: interpr2.cxx:1170
void Push(const formula::FormulaToken &r)
Does substitute with formula::FormulaErrorToken in case nGlobalError is set and the token passed is n...
Definition: interpr4.cxx:595
formula::FormulaConstTokenRef PopToken()
Definition: interpr4.cxx:761
void ScGeoMean()
Definition: interpr3.cxx:3025
void DoubleRefToRange(const ScComplexRefData &, ScRange &, bool bDontCheckForTableOp=false)
Definition: interpr4.cxx:1024
void CalculateSmallLarge(bool bSmall)
Definition: interpr3.cxx:3631
::std::map< const formula::FormulaConstTokenRef, formula::FormulaConstTokenRef, FormulaTokenRef_less > ScTokenMatrixMap
Definition: interpre.hxx:134
void ScAddressFunc()
Definition: interpr1.cxx:8257
static void GlobalExit()
Definition: interpr4.cxx:3879
ScMatValType GetDoubleOrStringFromMatrix(double &rDouble, svl::SharedString &rString)
Definition: interpr4.cxx:2399
#define SAL_MAX_INT32
void ScTInv(int nType)
Definition: interpr3.cxx:2265
static double div(const double &fNumerator, const double &fDenominator)
Fail safe division, returning a FormulaError::DivisionByZero coded into a double if denominator is 0...
Definition: interpre.hxx:1151
double ConvertStringToValue(const OUString &)
Definition: interpr4.cxx:161
const svl::SharedString & GetStringResult() const
Definition: interpr4.cxx:4748
sal_uInt16 sp
Definition: interpre.hxx:209
void ScLookup()
Definition: interpr1.cxx:6534
void ScTrimMean()
Definition: interpr3.cxx:3816
void ScVar(bool bTextAsZero=false)
Definition: interpr1.cxx:4144
void ScCountEmptyCells()
Definition: interpr1.cxx:5105
sfx2::LinkManager * mpLinkManager
Definition: interpre.hxx:197
void ScGetIsoWeekOfYear()
Definition: interpr2.cxx:292
bool IsTableOpInRange(const ScRange &)
Definition: interpr4.cxx:105
void ScLogGamma()
Definition: interpr3.cxx:792
void ScGetDateDif()
Definition: interpr2.cxx:765
svl::SharedString PopString()
Definition: interpr4.cxx:808
void CalculatePearsonCovar(bool _bPearson, bool _bStexy, bool _bSample)
Definition: interpr3.cxx:4523
void PushDouble(double nVal)
Definition: interpr4.cxx:1765
void ScIsRef()
Definition: interpr1.cxx:2561
void ScBinomDist()
Definition: interpr3.cxx:1347
sal_Int16 SCCOL
Definition: types.hxx:21
double ScGetIpmt(double fRate, double fPer, double fNper, double fPv, double fFv, bool bPayInAdvance, double &fPmt)
Definition: interpr2.cxx:2146
void ScErrorType()
Definition: interpr1.cxx:9833
void ScPercentile(bool bInclusive)
Definition: interpr3.cxx:3455
double GetGammaDist(double fX, double fAlpha, double fLambda)
Gamma distribution, cumulative distribution function.
Definition: interpr6.cxx:198
size_t GetRefListArrayMaxSize(short nParamCount)
Check for array of references to determine the maximum size of a return column vector if in array con...
Definition: interpr6.cxx:421
static double GetLogGamma(double x)
You must ensure fZ>0.
Definition: interpr3.cxx:630
void ScAbs()
Definition: interpr2.cxx:947
sal_uInt16 & nParam
Definition: callform.cxx:57
void ScMaxIfs_MS()
Definition: interpr1.cxx:6517
Base class for abstracting range data backends for database functions.
Definition: doubleref.hxx:37
ScMatrixRef CreateMatrixFromDoubleRef(const formula::FormulaToken *pToken, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2)
Definition: interpr5.cxx:315
void PopDoubleRef(ScRange &rRange, short &rParam, size_t &rRefInList)
If formula::StackVar formula::svDoubleRef pop ScDoubleRefToken and return values of ScComplexRefData...
Definition: interpr4.cxx:1042
bool IsInForceArray() const
void ScMedian()
Definition: interpr3.cxx:3391
void ScArcCos()
Definition: interpr1.cxx:1860
void ScMatValue()
Definition: interpr5.cxx:628
void ScAmpersand()
Definition: interpr5.cxx:1406
void ScSlope()
Definition: interpr3.cxx:4707
void ScSum()
Definition: interpr6.cxx:960
void ScArcTan()
Definition: interpr1.cxx:1865
void ScDBGet()
Definition: interpr4.cxx:2470
static ScCalcConfig & GetOrCreateGlobalConfig()
Definition: interpr4.cxx:3856
void ScIsFormula()
Definition: interpr1.cxx:2684
static void QuickSort(::std::vector< double > &rSortArray,::std::vector< tools::Long > *pIndexOrder)
Definition: interpr3.cxx:4180
double GetDoubleFromMatrix(const ScMatrixRef &pMat)
Definition: interpr4.cxx:2020
formula::FormulaToken * CreateFormulaDoubleToken(double fVal, SvNumFormatType nFmt=SvNumFormatType::NUMBER)
Definition: interpr4.cxx:1730
bool MustHaveParamCountMin(short nAct, short nMin)
Definition: interpre.hxx:1077
SvNumFormatType GetRetFormatType() const
Definition: interpre.hxx:1027
void PushMatrix(const sc::RangeMatrix &rMat)
Definition: interpr4.cxx:1866
void ScTDist_T(int nTails)
Definition: interpr3.cxx:1657
ScTokenArray * pArr
Definition: interpre.hxx:194
void ScErrorType_ODF()
Definition: interpr1.cxx:9847
void ScIfJump()
Definition: interpr1.cxx:85
static FormulaError GetCellErrCode(const ScRefCellValue &rCell)
Definition: interpr4.cxx:156
VolatileType meVolatileType
Definition: interpre.hxx:223
void PushExternalSingleRef(sal_uInt16 nFileId, const OUString &rTabName, SCCOL nCol, SCROW nRow, SCTAB nTab)
Definition: interpr4.cxx:1821
void ScConfidence()
Definition: interpr3.cxx:2424
void QueryMatrixType(const ScMatrixRef &xMat, SvNumFormatType &rRetTypeExpr, sal_uInt32 &rRetIndexExpr)
Definition: interpr4.cxx:1678
SvNumFormatType
void GetCellString(svl::SharedString &rStr, ScRefCellValue &rCell)
Definition: interpr4.cxx:243
void ScCotHyp()
Definition: interpr1.cxx:1890
void ScCountIfs()
Definition: interpr1.cxx:6482
void ScGetYear()
Definition: interpr2.cxx:119
void ScAverageIfs()
Definition: interpr1.cxx:6465
sal_uInt8 cPar
Definition: interpre.hxx:219
void ScAreas()
Definition: interpr1.cxx:8739
FormulaError nGlobalError
Definition: interpre.hxx:208
void ScFTest()
Definition: interpr3.cxx:2731
void ScGetTime()
Definition: interpr2.cxx:648
bool CreateStringArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt8 *pCellArr)
Definition: interpr4.cxx:360
svl::SharedString GetStringFromMatrix(const ScMatrixRef &pMat)
Definition: interpr4.cxx:2377
double GetUpRegIGamma(double fA, double fX)
You must ensure fA>0.0 && fX>0.0)
Definition: interpr6.cxx:130
static bool HasForceArray(OpCode eOp)
Whether OpCode has a parameter of type ForceArray or ReferenceOrForceArray.
Definition: parclass.hxx:63
void ScDBStdDev()
Definition: interpr1.cxx:8010
bool JumpMatrix(short nStackLevel)
Definition: interpr1.cxx:537
static double taylor(const double *pPolynom, sal_uInt16 nMax, double x)
Definition: interpr3.cxx:206
void ScIsLogical()
Definition: interpr1.cxx:2093
void ScChiDist(bool bODFF)
Definition: interpr3.cxx:1742
double GetDateSerial(sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, bool bStrict)
Obtain the date serial number for a given date.
Definition: interpr2.cxx:59
void PopRefListPushMatrixOrRef()
Definition: interpr4.cxx:1353
formula::StackVar GetResultType() const
Definition: interpre.hxx:1023
void ScNotEqual()
Definition: interpr1.cxx:1175
void ScRoundDown()
Definition: interpr2.cxx:995
void ScCumPrinc()
Definition: interpr2.cxx:2248
void ScCosecantHyp()
Definition: interpr1.cxx:1937
sal_uInt32 nFuncFmtIndex
Definition: interpre.hxx:211
void ScSheets()
Definition: interpr1.cxx:4321
formula::StackVar GetStackType()
Stack type with replacement of defaults, e.g. svMissing and formula::svEmptyCell will result in formu...
Definition: interpr4.cxx:1942
bool CheckMatrix(bool _bLOG, sal_uInt8 &nCase, SCSIZE &nCX, SCSIZE &nCY, SCSIZE &nRX, SCSIZE &nRY, SCSIZE &M, SCSIZE &N, ScMatrixRef &pMatX, ScMatrixRef &pMatY)
Definition: interpr5.cxx:2271
void ScDBStdDevP()
Definition: interpr1.cxx:8017
void ReplaceCell(ScAddress &)
Definition: interpr4.cxx:86
void ScConfidenceT()
Definition: interpr3.cxx:2438
static thread_local std::unique_ptr< ScTokenStack > pGlobalStack
Definition: interpre.hxx:188
void ScFloor(bool bODFF)
tdf69552 ODFF1.2 function FLOOR and Excel function FLOOR.MATH In essence, the difference between the ...
Definition: interpr2.cxx:1130
double GetValueCellValue(const ScAddress &, double fOrig)
Only ValueCell, formula cells already store the result rounded.
Definition: interpr4.cxx:146
void ScMissing()
Definition: interpr4.cxx:3086
void ScDBVarP()
Definition: interpr1.cxx:8031
FormulaError
sal_uInt8 GetByte() const
Definition: interpre.hxx:423
void ScGetSec()
Definition: interpr2.cxx:148
bool SetSbxVariable(SbxVariable *pVar, const ScAddress &)
static const ScCalcConfig & GetGlobalConfig()
Definition: interpr4.cxx:3868
void ScCosHyp()
Definition: interpr1.cxx:1880
void ScIndex()
Definition: interpr1.cxx:8521
void ValidateRef(const ScSingleRefData &rRef)
Definition: interpr4.cxx:836
void CalculateTrendGrowth(bool _bGrowth)
Definition: interpr5.cxx:2912
Reference< XOutputStream > stream
svl::SharedStringPool & mrStrPool
Definition: interpre.hxx:198
bool bCalcAsShown
Definition: interpre.hxx:220
double GetBinomDistPMF(double x, double n, double p)
Definition: interpr3.cxx:1233
double GetGammaContFraction(double fA, double fX)
You must ensure fA>0.0 && fX>0.0 valid results only if fX > fA+1.0 uses continued fraction with odd i...
Definition: interpr6.cxx:44
void Init(ScFormulaCell *pCell, const ScAddress &rPos, ScTokenArray &rTokArray)
Definition: interpr4.cxx:3832
ScDBRangeBase * PopDBDoubleRef()
Definition: interpr4.cxx:960
FormulaError GetWeekendAndHolidayMasks(const sal_uInt8 nParamCount, const sal_uInt32 nNullDate,::std::vector< double > &rSortArray, bool bWeekendMask[7])
Definition: interpr2.cxx:342
void IterateParameters(ScIterFunc, bool bTextAsZero=false)
Definition: interpr6.cxx:460
Configuration options for formula interpreter.
Definition: calcconfig.hxx:43
void ScTanHyp()
Definition: interpr1.cxx:1885
void CalculateSkewOrSkewp(bool bSkewp)
Definition: interpr3.cxx:3317
void ScUpper()
Definition: interpr1.cxx:3147
void ScSmall()
Definition: interpr3.cxx:3716
void ScMatRef()
Definition: interpr5.cxx:3210
sal_uInt16 maxsp
Definition: interpre.hxx:210
void PushIllegalArgument()
Definition: interpr4.cxx:1907
void ScEncodeURL()
Returns a string in which all non-alphanumeric characters except stroke and underscore (-_) have been...
Definition: interpr7.cxx:413
sal_uInt32 GetUInt32()
if GetDouble() not within uint32 limits sets nGlobalError and returns SAL_MAX_UINT32 ...
Definition: interpr4.cxx:2222
void ScReplace()
Definition: interpr1.cxx:8832
::formula::FormulaTokenRef TokenRef
void ScGetDate()
Definition: interpr2.cxx:631
void ScWeeknumOOo()
Definition: interpr2.cxx:234
void ScCumIpmt()
Definition: interpr2.cxx:2207
sal_Int32 SCROW
Definition: types.hxx:17
void ScLower()
Definition: interpr1.cxx:3177
void ScIsNonString()
Definition: interpr1.cxx:2088
void ScModalValue()
Definition: interpr3.cxx:3501
void ScISPMT()
Definition: interpr2.cxx:1598
void ScBitRshift()
Definition: interpr1.cxx:1703
void PushWithoutError(const formula::FormulaToken &r)
Does not substitute with formula::FormulaErrorToken in case nGlobalError is set.
Definition: interpr4.cxx:579
void ScMinIfs_MS()
Definition: interpr1.cxx:6499
static double GetLogBeta(double fAlpha, double fBeta)
Definition: interpr3.cxx:834
void ScArcCot()
Definition: interpr1.cxx:1870
static bool RateIteration(double fNper, double fPayment, double fPv, double fFv, bool bPayType, double &fGuess)
Definition: interpr2.cxx:1991
void ScStyle()
Definition: interpr2.cxx:2596
void ScAggregate()
Definition: interpr1.cxx:7555
void ScStDevP(bool bTextAsZero=false)
Definition: interpr1.cxx:4178
void ScLarge()
Definition: interpr3.cxx:3711
static sal_Int16 GetDayOfWeek(sal_Int32 n)
Definition: interpre.hxx:1156
static double BinomKoeff(double n, double k)
Definition: interpr3.cxx:461
void ScPlusMinus()
Definition: interpr2.cxx:936
static double ScGetDDB(double fCost, double fSalvage, double fLife, double fPeriod, double fFactor)
Definition: interpr2.cxx:1664
double GetChiSqDistCDF(double fX, double fDF)
You must ensure fDF>0.0.
Definition: interpr3.cxx:682
void ScBetaDist()
Definition: interpr3.cxx:1037
void ScSumX2DY2()
Definition: interpr5.cxx:1823
void ScDBMax()
Definition: interpr1.cxx:7954
static utl::SearchParam::SearchType DetectSearchType(const OUString &rStr, const ScDocument &rDoc)
Detect if string should be used as regular expression or wildcard expression or literal string...
Definition: interpr1.cxx:9943
void ScArabic()
Definition: interpr2.cxx:3067
unsigned char sal_uInt8
void ScForecast_Ets(ScETSType eETSType)
Definition: interpr8.cxx:1175
void ScRandom()
Definition: interpr1.cxx:1782
bool CreateDoubleArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt8 *pCellArr)
Definition: interpr4.cxx:278
void ScMatInv()
Definition: interpr5.cxx:965
bool bMatrixFormula
Definition: interpre.hxx:221
void PopDoubleRefPushMatrix()
Definition: interpr4.cxx:1339
FormulaError GetErrorType()
Definition: interpr1.cxx:9761
void ScIsError()
Definition: interpr1.cxx:2951
static bool MayBeRegExp(const OUString &rStr)
Could string be a regular expression? if regularExpressions are disabled the function returns false r...
Definition: interpr1.cxx:9903
ScDocument & mrDoc
Definition: interpre.hxx:196
void ScTrend()
Definition: interpr5.cxx:2902
void CalculateLookup(bool bHLookup)
Definition: interpr1.cxx:7191
void ScCurrency()
Definition: interpr1.cxx:8775
void ScLeftB()
Definition: interpr1.cxx:9133
std::shared_ptr< ScTokenArray > TokenArrayRef
void ScCurrent()
Definition: interpr2.cxx:2584
void GetStVarParams(bool bTextAsZero, double(*VarResult)(double fVal, size_t nValCount))
Definition: interpr1.cxx:3923
static double ScInterVDB(double fCost, double fSalvage, double fLife, double fLife1, double fPeriod, double fFactor)
Definition: interpr2.cxx:1742
ScJumpMatrix * pJumpMatrix
Definition: interpre.hxx:200
void ScNegBinomDist()
Definition: interpr3.cxx:1501
void ScLogNormDist(int nMinParamCount)
Definition: interpr3.cxx:1567
double GetTInv(double fAlpha, double fSize, int nType)
Definition: interpr3.cxx:2289
void ScDBSum()
Definition: interpr1.cxx:7856
ScAddress aPos
Definition: interpre.hxx:193
ScMatValType
Definition: types.hxx:31
void ScWorkday_MS()
Definition: interpr2.cxx:559
ScMatrixRef MatConcat(const ScMatrixRef &pMat1, const ScMatrixRef &pMat2)
Definition: interpr5.cxx:1229
void ScBetaDist_MS()
Microsoft version has parameters in different order Also, upper and lowerbound are optional and have ...
Definition: interpr3.cxx:1101
void SingleRefToVars(const ScSingleRefData &rRef, SCCOL &rCol, SCROW &rRow, SCTAB &rTab)
Definition: interpr4.cxx:858
svl::SharedString GetStringFromDouble(const double fVal)
Definition: interpr4.cxx:2460
void ScCosecant()
Definition: interpr1.cxx:1927
void ScNormDist(int nMinParamCount)
Definition: interpr3.cxx:1547
void ScSubTotal()
Definition: interpr1.cxx:7508
void RoundNumber(rtl_math_RoundingMode eMode)
Definition: interpr2.cxx:957
void ScBahtText()
Definition: interpr2.cxx:3424
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:398
svl::SharedString GetString()
Definition: interpr4.cxx:2298
These need to be in global namespace just like their respective types are.
double GetNumResult() const
Definition: interpre.hxx:1025
void ScVLookup()
Definition: interpr1.cxx:7503
double GetGammaSeries(double fA, double fX)
You must ensure fA>0.0 && fX>0.0 valid results only if fX <= fA+1.0 uses power series.
Definition: interpr6.cxx:96
void PushNoValue()
Definition: interpr4.cxx:1917
void ScNominal()
Definition: interpr2.cxx:2306
void ScPower()
Definition: interpr5.cxx:1657
bool MatrixParameterConversion()
Definition: interpre.hxx:1042
void ScSumX2MY2()
Definition: interpr5.cxx:1778
void ScGetPivotData()
Definition: interpr2.cxx:3491
void ScPermutationA()
Definition: interpr3.cxx:1220
ScQueryOp
Definition: global.hxx:824
void ScSTEYX()
Definition: interpr3.cxx:4633
void PopExternalSingleRef(sal_uInt16 &rFileId, OUString &rTabName, ScSingleRefData &rRef)
Definition: interpr4.cxx:1116
void ScSumXMY2()
Definition: interpr5.cxx:1828
void MergeCalcConfig()
Merge global and document specific settings.
Definition: interpr4.cxx:3873
void ScSecant()
Definition: interpr1.cxx:1932
Complex reference (a range) into the sheet.
Definition: refdata.hxx:122
void ScRoundUp()
Definition: interpr2.cxx:1000
void ScChiInv()
Definition: interpr3.cxx:2369
bool CalculateTest(bool _bTemplin, const SCSIZE nC1, const SCSIZE nC2, const SCSIZE nR1, const SCSIZE nR2, const ScMatrixRef &pMat1, const ScMatrixRef &pMat2, double &fT, double &fF)
Definition: interpr3.cxx:2581
double GetHypGeomDist(double x, double n, double M, double N)
Calculates a value of the hypergeometric distribution.
Definition: interpr3.cxx:1896
void ScCovarianceS()
Definition: interpr3.cxx:4513
void DBIterator(ScIterFunc)
Definition: interpr1.cxx:7789
void ScMatch()
Definition: interpr1.cxx:4763
void ScRegex()
Definition: interpr1.cxx:9358
void GetDBStVarParams(double &rVal, double &rValCount)
Definition: interpr1.cxx:7969
void ScAverageIf()
Definition: interpr1.cxx:5595
void PopError()
Definition: interpr4.cxx:749
void ScWeibull()
Definition: interpr3.cxx:1764
ScTokenStack * pStackObj
Definition: interpre.hxx:206
static bool MayBeWildcard(const OUString &rStr)
Could string be a wildcard (*,?,~) expression? If wildcards are disabled the function returns false r...
Definition: interpr1.cxx:9923
sc::RangeMatrix GetRangeMatrix()
Definition: interpr5.cxx:614
void ScBitXor()
Definition: interpr1.cxx:1665
void ScBitOr()
Definition: interpr1.cxx:1650
void ScTDist()
Definition: interpr3.cxx:1642
void ScFInv_LT()
Definition: interpr3.cxx:2334
void ScMin(bool bTextAsZero=false)
Definition: interpr1.cxx:3607
void ScGetMonth()
Definition: interpr2.cxx:126
void ScProbability()
Definition: interpr3.cxx:4437
void PopExternalDoubleRef(sal_uInt16 &rFileId, OUString &rTabName, ScComplexRefData &rRef)
Definition: interpr4.cxx:1195
void ScPercentrank(bool bInclusive)
Definition: interpr3.cxx:3721
void ScIsErr()
Definition: interpr1.cxx:2888
formula::FormulaToken * CreateDoubleOrTypedToken(double fVal)
Definition: interpr4.cxx:1755
void ScClean()
Definition: interpr1.cxx:3443
void ScGetDayOfWeek()
Definition: interpr2.cxx:187
bool CheckStringResultLen(OUString &rResult, const OUString &rAdd)
Definition: interpre.hxx:1116
void ScExternal()
Definition: interpr4.cxx:2505
const formula::FormulaConstTokenRef & GetResultToken() const
Definition: interpre.hxx:1026
void ScExact()
Definition: interpr1.cxx:8959
void ScFDist()
Definition: interpr3.cxx:1690
void ScForecast()
Definition: interpr3.cxx:4717
void ScMultiArea()
Definition: interpr1.cxx:8726
void ScSearch()
Definition: interpr1.cxx:9312
void ScArcSin()
Definition: interpr1.cxx:1855
void ScGrowth()
Definition: interpr5.cxx:2907
void TreatDoubleError(double &rVal)
Definition: interpre.hxx:1138
const formula::FormulaToken * pPointer[MAXSTACK]
Definition: interpre.hxx:98
void PushTokenRef(const formula::FormulaConstTokenRef &)
Pushes the token or substitutes with formula::FormulaErrorToken in case nGlobalError is set and the t...
Definition: interpr4.cxx:662
static void MEMat(const ScMatrixRef &mM, SCSIZE n)
Definition: interpr5.cxx:752
::std::vector< ScComplexRefData > ScRefList
Definition: token.hxx:37
double Compare(ScQueryOp eOp)
Definition: interpr1.cxx:877
void ScCombin()
Definition: interpr3.cxx:1174
void ScArcTanHyp()
Definition: interpr1.cxx:1909
static double ScGetPV(double fRate, double fNper, double fPmt, double fFv, bool bPayInAdvance)
Definition: interpr2.cxx:1615
void PushStringBuffer(const sal_Unicode *pString)
Definition: interpr4.cxx:1778
double GetBetaDistPDF(double fX, double fA, double fB)
Definition: interpr3.cxx:863
void ScSubstitute()
Definition: interpr1.cxx:9670
void ScQuartile(bool bInclusive)
Definition: interpr3.cxx:3478
void IterateParametersIfs(double(*ResultFunc)(const sc::ParamIfsResult &rRes))
Definition: interpr1.cxx:5797
void ScValue()
Definition: interpr1.cxx:3263
void ScProduct()
Definition: interpr6.cxx:965
void ScIsValue()
Definition: interpr1.cxx:2613
double GetGammaDistPDF(double fX, double fAlpha, double fLambda)
Gamma distribution, probability density function.
Definition: interpr6.cxx:144
void ScArcCosHyp()
Definition: interpr1.cxx:1900
void ScZTest()
Definition: interpr3.cxx:2454
void ScCombinA()
Definition: interpr3.cxx:1187
void ScCountIf()
Definition: interpr1.cxx:5600
void SetError(FormulaError nError)
Definition: interpre.hxx:1015
double GetMedian(::std::vector< double > &rArray)
Definition: interpr3.cxx:3367
bool GetBool()
Definition: interpre.hxx:441
static bool CheckStringPositionArgument(double &fVal)
Check if a double is suitable as string position or length argument.
Definition: interpre.hxx:1085
Each instance of this struct represents a single filtering criteria.
Definition: queryentry.hxx:33
VolatileType GetVolatileType() const
Definition: interpre.hxx:182
void ScTableOp()
Definition: interpr4.cxx:3563
void ScFixed()
Definition: interpr1.cxx:8870
void DoubleRefToVars(const formula::FormulaToken *p, SCCOL &rCol1, SCROW &rRow1, SCTAB &rTab1, SCCOL &rCol2, SCROW &rRow2, SCTAB &rTab2)
Definition: interpr4.cxx:939
void ScStDev(bool bTextAsZero=false)
Definition: interpr1.cxx:4166
double div(const double &fNumerator, const double &fDenominator)
Return fNumerator/fDenominator if fDenominator!=0 else #DIV/0! error coded into double.
Definition: math.hxx:31
static double GetPercentrank(::std::vector< double > &rArray, double fVal, bool bInclusive)
Definition: interpr3.cxx:3759
static double ScGetGCD(double fx, double fy)
Definition: interpr5.cxx:107
void ScHyperLink()
Definition: interpr2.cxx:3124
bool GetDoubleOrString(double &rValue, svl::SharedString &rString)
returns TRUE if double (or error, check nGlobalError), else FALSE
Definition: interpr4.cxx:2238
sal_Int16 SCTAB
Definition: types.hxx:22
void ScTTest()
Definition: interpr3.cxx:2648
void ScHarMean()
Definition: interpr3.cxx:2904
void ScIfError(bool bNAonly)
Definition: interpr1.cxx:241
void ScPercentSign()
Definition: interpr1.cxx:1591
void ScSNormInv()
Definition: interpr3.cxx:2133
void ScColor()
Definition: interpr7.cxx:510
void ScMatMult()
Definition: interpr5.cxx:1077
bool IsInArrayContext() const
Definition: interpre.hxx:1031
void ScDBProduct()
Definition: interpr1.cxx:7964
double GetBetaDist(double x, double alpha, double beta)
Definition: interpr3.cxx:986
void ScAveDev()
Definition: interpr3.cxx:4270
#define MAXSTACK
Definition: interpre.hxx:93
static double integralPhi(double x)
Definition: interpr3.cxx:201
bool operator()(const formula::FormulaConstTokenRef &r1, const formula::FormulaConstTokenRef &r2) const
Definition: interpre.hxx:131
sal_uInt32 nCurFmtIndex
Definition: interpre.hxx:212
void ScGamma()
Definition: interpr3.cxx:775
void ScCovarianceP()
Definition: interpr3.cxx:4508