LibreOffice Module sc (master)  1
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
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 .
18  */
20 #pragma once
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 <kahan.hxx>
33 #include "parclass.hxx"
35 #include <map>
36 #include <memory>
37 #include <vector>
38 #include <limits>
39 #include <ostream>
41 namespace sfx2 { class LinkManager; }
43 class ScDocument;
44 class SbxVariable;
45 class ScFormulaCell;
46 class ScDBRangeBase;
47 struct ScQueryParam;
48 struct ScDBQueryParamBase;
49 struct ScQueryEntry;
51 struct ScSingleRefData;
52 struct ScComplexRefData;
55 class ScJumpMatrix;
56 struct ScRefCellValue;
58 namespace sc {
60 struct CompareOptions;
63 {
64  KahanSum mfSum = 0.0;
65  double mfCount = 0.0;
66  double mfMin = std::numeric_limits<double>::max();
67  double mfMax = std::numeric_limits<double>::lowest();
68 };
70 template<typename charT, typename traits>
71 inline std::basic_ostream<charT, traits> & operator <<(std::basic_ostream<charT, traits> & stream, const ParamIfsResult& rRes)
72 {
73  stream << "{" <<
74  "sum=" << rRes.mfSum.get() << "," <<
75  "count=" << rRes.mfCount << "," <<
76  "min=" << rRes.mfMin << "," <<
77  "max=" << rRes.mfMax << "," <<
78  "}";
80  return stream;
81 }
83 }
85 namespace svl {
87 class SharedStringPool;
89 }
92 constexpr sal_Int32 kScInterpreterMaxStrLen = SAL_MAX_INT32 / 8;
94 #define MAXSTACK (4096 / sizeof(formula::FormulaToken*))
97 {
98 public:
100 };
103  ifSUM, // Add up
104  ifSUMSQ, // Sums of squares
105  ifPRODUCT, // Product
106  ifAVERAGE, // Average
107  ifCOUNT, // Count Values
108  ifCOUNT2, // Count Values (not empty)
109  ifMIN, // Minimum
110  ifMAX // Maximum
111 };
114 {
115  ifSUMIF, // Conditional sum
116  ifAVERAGEIF // Conditional average
117 };
120 {
128 };
131 {
133  { return r1.get() < r2.get(); }
134 };
135 typedef ::std::map< const formula::FormulaConstTokenRef, formula::FormulaConstTokenRef, FormulaTokenRef_less> ScTokenMatrixMap;
138 {
139  // distribution function objects need the GetxxxDist methods
140  friend class ScGammaDistFunction;
141  friend class ScBetaDistFunction;
142  friend class ScTDistFunction;
143  friend class ScFDistFunction;
144  friend class ScChiDistFunction;
145  friend class ScChiSqDistFunction;
147 public:
148  static void SetGlobalConfig(const ScCalcConfig& rConfig);
149  static const ScCalcConfig& GetGlobalConfig();
151  static void GlobalExit(); // called by ScGlobal::Clear()
156  static utl::SearchParam::SearchType DetectSearchType(std::u16string_view rStr, const ScDocument& rDoc );
160  static inline double div( const double& fNumerator, const double& fDenominator );
162  ScMatrixRef GetNewMat(SCSIZE nC, SCSIZE nR, bool bEmpty = false);
164  ScMatrixRef GetNewMat(SCSIZE nC, SCSIZE nR, const std::vector<double>& rValues);
170  };
174 private:
178  static thread_local std::unique_ptr<ScTokenStack> pGlobalStack;
179  static thread_local bool bGlobalStackInUse;
190  ScJumpMatrix* pJumpMatrix; // currently active array condition, if any
191  ScTokenMatrixMap maTokenMatrixMap; // map FormulaToken* to formula::FormulaTokenRef if in array condition
192  ScFormulaCell* pMyFormulaCell; // the cell of this formula expression
195  const formula::FormulaToken* pCur; // current token
196  ScTokenStack* pStackObj; // contains the stacks
197  const formula::FormulaToken ** pStack; // the current stack
198  FormulaError nGlobalError; // global (local to this formula expression) error
199  sal_uInt16 sp; // stack pointer
200  sal_uInt16 maxsp; // the maximal used stack pointer
201  sal_uInt32 nFuncFmtIndex; // NumberFormatIndex of a function
202  sal_uInt32 nCurFmtIndex; // current NumberFormatIndex
203  sal_uInt32 nRetFmtIndex; // NumberFormatIndex of an expression, if any
204  SvNumFormatType nFuncFmtType; // NumberFormatType of a function
205  SvNumFormatType nCurFmtType; // current NumberFormatType
206  SvNumFormatType nRetFmtType; // NumberFormatType of an expression
207  FormulaError mnStringNoValueError; // the error set in ConvertStringToValue() if no value
208  SubtotalFlags mnSubTotalFlags; // flags for subtotal and aggregate functions
209  sal_uInt8 cPar; // current count of parameters
210  bool bCalcAsShown; // precision as shown
211  bool bMatrixFormula; // formula cell is a matrix formula
215  void MakeMatNew(ScMatrixRef& rMat, SCSIZE nC, SCSIZE nR);
218  void MergeCalcConfig();
220  // nMust <= nAct <= nMax ? ok : PushError
221  inline bool MustHaveParamCount( short nAct, short nMust );
222  inline bool MustHaveParamCount( short nAct, short nMust, short nMax );
223  inline bool MustHaveParamCountMin( short nAct, short nMin );
224  void PushParameterExpected();
225  void PushIllegalParameter();
226  void PushIllegalArgument();
227  void PushNoValue();
228  void PushNA();
230  // Functions for accessing a document
232  void ReplaceCell( ScAddress& ); // for TableOp
233  bool IsTableOpInRange( const ScRange& );
234  sal_uInt32 GetCellNumberFormat( const ScAddress& rPos, ScRefCellValue& rCell );
235  double ConvertStringToValue( const OUString& );
236 public:
237  static double ScGetGCD(double fx, double fy);
240  double ConvertStringToValue( const OUString&, FormulaError& rError, SvNumFormatType& rCurFmtType );
241 private:
242  double GetCellValue( const ScAddress&, ScRefCellValue& rCell );
243  double GetCellValueOrZero( const ScAddress&, ScRefCellValue& rCell );
244  double GetValueCellValue( const ScAddress&, double fOrig );
245  void GetCellString( svl::SharedString& rStr, ScRefCellValue& rCell );
246  static FormulaError GetCellErrCode( const ScRefCellValue& rCell );
248  bool CreateDoubleArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
249  SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt8* pCellArr);
250  bool CreateStringArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
251  SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt8* pCellArr);
252  bool CreateCellArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
253  SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt8* pCellArr);
255  // Stack operations
260  void Push( const formula::FormulaToken& r );
265  void PushWithoutError( const formula::FormulaToken& r );
293  {
294  if (nGlobalError != FormulaError::NONE)
295  {
297  return true;
298  }
299  return false;
300  }
317  void PushCellResultToken( bool bDisplayEmptyAsString, const ScAddress & rAddress,
318  SvNumFormatType * pRetTypeExpr, sal_uInt32 * pRetIndexExpr, bool bFinalResult = false );
321  void Pop();
322  void PopError();
323  double PopDouble();
325  void ValidateRef( const ScSingleRefData & rRef );
326  void ValidateRef( const ScComplexRefData & rRef );
327  void ValidateRef( const ScRefList & rRefList );
328  void SingleRefToVars( const ScSingleRefData & rRef, SCCOL & rCol, SCROW & rRow, SCTAB & rTab );
329  void PopSingleRef( ScAddress& );
330  void PopSingleRef(SCCOL& rCol, SCROW &rRow, SCTAB& rTab);
331  void DoubleRefToRange( const ScComplexRefData&, ScRange&, bool bDontCheckForTableOp = false );
340  void PopDoubleRef( ScRange & rRange, short & rParam, size_t & rRefInList );
341  void PopDoubleRef( ScRange&, bool bDontCheckForTableOp = false );
342  void DoubleRefToVars( const formula::FormulaToken* p,
343  SCCOL& rCol1, SCROW &rRow1, SCTAB& rTab1,
344  SCCOL& rCol2, SCROW &rRow2, SCTAB& rTab2 );
346  void PopDoubleRef(SCCOL& rCol1, SCROW &rRow1, SCTAB& rTab1,
347  SCCOL& rCol2, SCROW &rRow2, SCTAB& rTab2 );
348  // peek double ref data
349  const ScComplexRefData* GetStackDoubleRef(size_t rRefInList = 0);
351  void PopExternalSingleRef(sal_uInt16& rFileId, OUString& rTabName, ScSingleRefData& rRef);
357  void PopExternalSingleRef(sal_uInt16& rFileId, OUString& rTabName, ScSingleRefData& rRef,
360  void PopExternalDoubleRef(sal_uInt16& rFileId, OUString& rTabName, ScComplexRefData& rRef);
362  void PopExternalDoubleRef(ScMatrixRef& rMat);
363  void GetExternalDoubleRef(sal_uInt16 nFileId, const OUString& rTabName, const ScComplexRefData& aData, ScExternalRefCache::TokenArrayRef& rArray);
364  bool PopDoubleRefOrSingleRef( ScAddress& rAdr );
365  void PopDoubleRefPushMatrix();
367  // If MatrixFormula: convert svDoubleRef to svMatrix, create JumpMatrix.
368  // Else convert area reference parameters marked as ForceArray to array.
369  // Returns true if JumpMatrix created.
371  // If MatrixFormula: ConvertMatrixJumpConditionToMatrix()
372  inline void MatrixJumpConditionToMatrix();
373  // For MatrixFormula (preconditions already checked by
374  // MatrixJumpConditionToMatrix()): convert svDoubleRef to svMatrix, or if
375  // JumpMatrix currently in effect convert also other types to svMatrix so
376  // another JumpMatrix will be created by jump commands.
378  // If MatrixFormula or ForceArray: ConvertMatrixParameters()
379  inline bool MatrixParameterConversion();
380  // If MatrixFormula or ForceArray. Can be used within spreadsheet functions
381  // that do not depend on the formula cell's matrix size, for which only
382  // bMatrixFormula can be used.
383  inline bool IsInArrayContext() const;
386  void QueryMatrixType(const ScMatrixRef& xMat, SvNumFormatType& rRetTypeExpr, sal_uInt32& rRetIndexExpr);
388  formula::FormulaToken* CreateFormulaDoubleToken( double fVal, SvNumFormatType nFmt = SvNumFormatType::NUMBER );
391  void PushDouble(double nVal);
392  void PushInt( int nVal );
393  void PushStringBuffer( const sal_Unicode* pString );
394  void PushString( const OUString& rStr );
395  void PushString( const svl::SharedString& rString );
396  void PushSingleRef(SCCOL nCol, SCROW nRow, SCTAB nTab);
397  void PushDoubleRef(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
398  SCCOL nCol2, SCROW nRow2, SCTAB nTab2);
399  void PushExternalSingleRef(sal_uInt16 nFileId, const OUString& rTabName,
400  SCCOL nCol, SCROW nRow, SCTAB nTab);
401  void PushExternalDoubleRef(sal_uInt16 nFileId, const OUString& rTabName,
402  SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
403  SCCOL nCol2, SCROW nRow2, SCTAB nTab2);
404  void PushSingleRef( const ScRefAddress& rRef );
405  void PushDoubleRef( const ScRefAddress& rRef1, const ScRefAddress& rRef2 );
406  void PushMatrix( const sc::RangeMatrix& rMat );
407  void PushMatrix(const ScMatrixRef& pMat);
408  void PushError( FormulaError nError );
413  // peek StackType of Parameter, Parameter 1 == TOS, 2 == TOS-1, ...
415  sal_uInt8 GetByte() const { return cPar; }
416  // reverse order of stack
418  // generates a position-dependent SingleRef out of a DoubleRef
419  bool DoubleRefToPosSingleRef( const ScRange& rRange, ScAddress& rAdr );
420  double GetDoubleFromMatrix(const ScMatrixRef& pMat);
421  double GetDouble();
422  double GetDoubleWithDefault(double nDefault);
423  bool IsMissing() const;
424  sal_Int32 double_to_int32(double fVal);
426  sal_Int32 GetInt32();
428  sal_Int32 GetInt32WithDefault( sal_Int32 nDefault );
430  sal_Int16 GetInt16();
432  sal_uInt32 GetUInt32();
433  bool GetBool() { return GetDouble() != 0.0; }
435  bool GetDoubleOrString( double& rValue, svl::SharedString& rString );
438  svl::SharedString GetStringFromDouble( const double fVal);
439  // pop matrix and obtain one element, upper left or according to jump matrix
440  ScMatValType GetDoubleOrStringFromMatrix( double& rDouble, svl::SharedString& rString );
442  SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
443  SCCOL nCol2, SCROW nRow2, SCTAB nTab2 );
446  ScMatrixRef GetMatrix( short & rParam, size_t & rInRefList );
449  void ScTableOp(); // repeated operations
451  // common helper functions
454  { nFuncFmtType = nCurFmtType; nFuncFmtIndex = nCurFmtIndex; }
466  static inline bool CheckStringPositionArgument( double & fVal );
472  inline sal_Int32 GetStringPositionArgument();
474  // Check for String overflow of rResult+rAdd and set error and erase rResult
475  // if so. Return true if ok, false if overflow
476  inline bool CheckStringResultLen( OUString& rResult, sal_Int32 nIncrease );
478  // Check for String overflow of rResult+rAdd and set error and erase rResult
479  // if so. Return true if ok, false if overflow
480  inline bool CheckStringResultLen( OUStringBuffer& rResult, sal_Int32 nIncrease );
482  // Set error according to rVal, and set rVal to 0.0 if there was an error.
483  inline void TreatDoubleError( double& rVal );
484  // Lookup using ScLookupCache, @returns true if found and result address
485  bool LookupQueryWithCache( ScAddress & o_rResultPos,
486  const ScQueryParam & rParam, const ScComplexRefData* refData ) const;
488  void ScIfJump();
489  void ScIfError( bool bNAonly );
490  void ScChooseJump();
492  // Be sure to only call this if pStack[sp-nStackLevel] really contains a
493  // ScJumpMatrixToken, no further checks are applied!
494  // Returns true if last jump was executed and result matrix pushed.
495  bool JumpMatrix( short nStackLevel );
497  double Compare( ScQueryOp eOp );
501  sc::RangeMatrix CompareMat( ScQueryOp eOp, sc::CompareOptions* pOptions = nullptr );
502  ScMatrixRef QueryMat( const ScMatrixRef& pMat, sc::CompareOptions& rOptions );
503  void ScEqual();
504  void ScNotEqual();
505  void ScLess();
506  void ScGreater();
507  void ScLessEqual();
508  void ScGreaterEqual();
509  void ScAnd();
510  void ScOr();
511  void ScXor();
512  void ScNot();
513  void ScNeg();
514  void ScPercentSign();
515  void ScIntersect();
516  void ScRangeFunc();
517  void ScUnionFunc();
518  void ScPi();
519  void ScRandom();
520  void ScRandbetween();
521  void ScRandomImpl( const std::function<double( double fFirst, double fLast )>& RandomFunc,
522  double fFirst, double fLast );
523  void ScTrue();
524  void ScFalse();
525  void ScDeg();
526  void ScRad();
527  void ScSin();
528  void ScCos();
529  void ScTan();
530  void ScCot();
531  void ScArcSin();
532  void ScArcCos();
533  void ScArcTan();
534  void ScArcCot();
535  void ScSinHyp();
536  void ScCosHyp();
537  void ScTanHyp();
538  void ScCotHyp();
539  void ScArcSinHyp();
540  void ScArcCosHyp();
541  void ScArcTanHyp();
542  void ScArcCotHyp();
543  void ScCosecant();
544  void ScSecant();
545  void ScCosecantHyp();
546  void ScSecantHyp();
547  void ScExp();
548  void ScLn();
549  void ScLog10();
550  void ScSqrt();
551  void ScIsEmpty();
552  bool IsString();
553  void ScIsString();
554  void ScIsNonString();
555  void ScIsLogical();
556  void ScType();
557  void ScCell();
558  void ScCellExternal();
559  void ScIsRef();
560  void ScIsValue();
561  void ScIsFormula();
562  void ScFormula();
563  void ScRoman();
564  void ScArabic();
565  void ScIsNV();
566  void ScIsErr();
567  void ScIsError();
568  bool IsEven();
569  void ScIsEven();
570  void ScIsOdd();
571  void ScN();
572  void ScCode();
573  void ScTrim();
574  void ScUpper();
575  void ScProper();
576  void ScLower();
577  void ScLen();
578  void ScT();
579  void ScValue();
580  void ScNumberValue();
581  void ScClean();
582  void ScChar();
583  void ScJis();
584  void ScAsc();
585  void ScUnicode();
586  void ScUnichar();
587  void ScMin( bool bTextAsZero = false );
588  void ScMax( bool bTextAsZero = false );
591  size_t GetRefListArrayMaxSize( short nParamCount );
594  bool SwitchToArrayRefList( ScMatrixRef& xResMat, SCSIZE nMatRows, double fCurrent,
595  const std::function<void( SCSIZE i, double fCurrent )>& MatOpFunc, bool bDoMatOp );
596  void IterateParameters( ScIterFunc, bool bTextAsZero = false );
597  void ScSumSQ();
598  void ScSum();
599  void ScProduct();
600  void ScAverage( bool bTextAsZero = false );
601  void ScCount();
602  void ScCount2();
603  void GetStVarParams( bool bTextAsZero, double(*VarResult)( double fVal, size_t nValCount ) );
604  void ScVar( bool bTextAsZero = false );
605  void ScVarP( bool bTextAsZero = false );
606  void ScStDev( bool bTextAsZero = false );
607  void ScStDevP( bool bTextAsZero = false );
608  void ScRawSubtract();
609  void ScColumns();
610  void ScRows();
611  void ScSheets();
612  void ScColumn();
613  void ScRow();
614  void ScSheet();
615  void ScMatch();
617  void ScCountIf();
618  void ScSumIf();
619  void ScAverageIf();
620  void IterateParametersIfs( double(*ResultFunc)( const sc::ParamIfsResult& rRes ) );
621  void ScSumIfs();
622  void ScAverageIfs();
623  void ScCountIfs();
624  void ScCountEmptyCells();
625  void ScLookup();
626  void ScHLookup();
627  void ScVLookup();
628  void ScSubTotal();
630  // If upon call rMissingField==true then the database field parameter may be
631  // missing (Xcl DCOUNT() syntax), or may be faked as missing by having the
632  // value 0.0 or being exactly the entire database range reference (old SO
633  // compatibility). If this was the case then rMissingField is set to true upon
634  // return. If rMissingField==false upon call all "missing cases" are considered
635  // to be an error.
636  std::unique_ptr<ScDBQueryParamBase> GetDBParams( bool& rMissingField );
638  void DBIterator( ScIterFunc );
639  void ScDBSum();
640  void ScDBCount();
641  void ScDBCount2();
642  void ScDBAverage();
643  void ScDBGet();
644  void ScDBMax();
645  void ScDBMin();
646  void ScDBProduct();
647  void GetDBStVarParams( double& rVal, double& rValCount );
648  void ScDBStdDev();
649  void ScDBStdDevP();
650  void ScDBVar();
651  void ScDBVarP();
652  void ScIndirect();
653  void ScAddressFunc();
654  void ScOffset();
655  void ScIndex();
656  void ScMultiArea();
657  void ScAreas();
658  void ScCurrency();
659  void ScReplace();
660  void ScFixed();
661  void ScFind();
662  void ScExact();
663  void ScLeft();
664  void ScRight();
665  void ScSearch();
666  void ScMid();
667  void ScText();
668  void ScSubstitute();
669  void ScRept();
670  void ScRegex();
671  void ScConcat();
672  void ScConcat_MS();
673  void ScTextJoin_MS();
674  void ScIfs_MS();
675  void ScSwitch_MS();
676  void ScMinIfs_MS();
677  void ScMaxIfs_MS();
678  void ScExternal();
679  void ScMissing();
680  void ScMacro();
681  bool SetSbxVariable( SbxVariable* pVar, const ScAddress& );
683  void ScErrorType();
684  void ScErrorType_ODF();
685  void ScDBArea();
686  void ScColRowNameAuto();
687  void ScGetPivotData();
688  void ScHyperLink();
689  void ScBahtText();
690  void ScBitAnd();
691  void ScBitOr();
692  void ScBitXor();
693  void ScBitRshift();
694  void ScBitLshift();
695  void ScTTT();
696  void ScDebugVar();
708  double GetDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, bool bStrict );
710  void ScGetActDate();
711  void ScGetActTime();
712  void ScGetYear();
713  void ScGetMonth();
714  void ScGetDay();
715  void ScGetDayOfWeek();
716  void ScGetWeekOfYear();
717  void ScGetIsoWeekOfYear();
718  void ScWeeknumOOo();
719  void ScEasterSunday();
720  FormulaError GetWeekendAndHolidayMasks( const sal_uInt8 nParamCount, const sal_uInt32 nNullDate,
721  ::std::vector<double>& rSortArray, bool bWeekendMask[ 7 ] );
722  FormulaError GetWeekendAndHolidayMasks_MS( const sal_uInt8 nParamCount, const sal_uInt32 nNullDate,
723  ::std::vector<double>& rSortArray, bool bWeekendMask[ 7 ], bool bWorkdayFunction );
724  static inline sal_Int16 GetDayOfWeek( sal_Int32 n );
725  void ScNetWorkdays( bool bOOXML_Version );
726  void ScWorkday_MS();
727  void ScGetHour();
728  void ScGetMin();
729  void ScGetSec();
730  void ScPlusMinus();
731  void ScAbs();
732  void ScInt();
733  void ScEven();
734  void ScOdd();
735  void ScCeil( bool bODFF );
736  void ScCeil_MS();
737  void ScCeil_Precise();
738  void ScFloor( bool bODFF );
739  void ScFloor_MS();
740  void ScFloor_Precise();
741  void RoundNumber( rtl_math_RoundingMode eMode );
742  void ScRound();
743  void ScRoundUp();
744  void ScRoundDown();
745  void ScGetDateValue();
746  void ScGetTimeValue();
747  void ScArcTan2();
748  void ScLog();
749  void ScGetDate();
750  void ScGetTime();
751  void ScGetDiffDate();
752  void ScGetDiffDate360();
753  void ScGetDateDif();
754  void ScPower();
755  void ScAmpersand();
756  void ScAdd();
757  void ScSub();
758  void ScMul();
759  void ScDiv();
760  void ScPow();
761  void ScCurrent();
762  void ScStyle();
763  void ScDde();
764  void ScBase();
765  void ScDecimal();
766  void ScConvertOOo();
767  void ScEuroConvert();
768  void ScRoundSignificant();
769  static void RoundSignificant( double fX, double fDigits, double &fRes );
771  // financial functions
772  void ScNPV();
773  void ScIRR();
774  void ScMIRR();
775  void ScISPMT();
777  static double ScGetPV(double fRate, double fNper, double fPmt,
778  double fFv, bool bPayInAdvance);
779  void ScPV();
780  void ScSYD();
781  static double ScGetDDB(double fCost, double fSalvage, double fLife,
782  double fPeriod, double fFactor);
783  void ScDDB();
784  void ScDB();
785  static double ScInterVDB(double fCost, double fSalvage, double fLife, double fLife1,
786  double fPeriod, double fFactor);
787  void ScVDB();
788  void ScPDuration();
789  void ScSLN();
790  static double ScGetPMT(double fRate, double fNper, double fPv,
791  double fFv, bool bPayInAdvance);
792  void ScPMT();
793  void ScRRI();
794  static double ScGetFV(double fRate, double fNper, double fPmt,
795  double fPv, bool bPayInAdvance);
796  void ScFV();
797  void ScNper();
798  static bool RateIteration(double fNper, double fPayment, double fPv,
799  double fFv, bool bPayType, double& fGuess);
800  void ScRate();
801  double ScGetIpmt(double fRate, double fPer, double fNper, double fPv,
802  double fFv, bool bPayInAdvance, double& fPmt);
803  void ScIpmt();
804  void ScPpmt();
805  void ScCumIpmt();
806  void ScCumPrinc();
807  void ScEffect();
808  void ScNominal();
809  void ScMod();
810  void ScIntercept();
811  void ScGCD();
812  void ScLCM();
814  // matrix functions
815  void ScMatValue();
816  static void MEMat(const ScMatrixRef& mM, SCSIZE n);
817  void ScMatDet();
818  void ScMatInv();
819  void ScMatMult();
820  void ScMatTrans();
821  void ScEMat();
822  void ScMatRef();
823  ScMatrixRef MatConcat(const ScMatrixRef& pMat1, const ScMatrixRef& pMat2);
824  void ScSumProduct();
825  void ScSumX2MY2();
826  void ScSumX2DY2();
827  void ScSumXMY2();
828  void ScGrowth();
829  bool CalculateSkew(KahanSum& fSum, double& fCount, std::vector<double>& values);
830  void CalculateSkewOrSkewp( bool bSkewp );
831  void CalculateSlopeIntercept(bool bSlope);
832  void CalculateSmallLarge(bool bSmall);
833  void CalculatePearsonCovar( bool _bPearson, bool _bStexy, bool _bSample ); //fdo#70000 argument _bSample is ignored if _bPearson == true
834  bool CalculateTest( bool _bTemplin
835  ,const SCSIZE nC1, const SCSIZE nC2,const SCSIZE nR1,const SCSIZE nR2
836  ,const ScMatrixRef& pMat1,const ScMatrixRef& pMat2
837  ,double& fT,double& fF);
838  void CalculateLookup(bool bHLookup);
839  bool FillEntry(ScQueryEntry& rEntry);
840  void CalculateAddSub(bool _bSub);
841  void CalculateTrendGrowth(bool _bGrowth);
842  void CalculateRGPRKP(bool _bRKP);
843  void CalculateSumX2MY2SumX2DY2(bool _bSumX2DY2);
844  void CalculateMatrixValue(const ScMatrix* pMat,SCSIZE nC,SCSIZE nR);
845  bool CheckMatrix(bool _bLOG,sal_uInt8& nCase,SCSIZE& nCX,SCSIZE& nCY,SCSIZE& nRX,SCSIZE& nRY,SCSIZE& M,SCSIZE& N,ScMatrixRef& pMatX,ScMatrixRef& pMatY);
846  void ScLinest();
847  void ScLogest();
848  void ScForecast();
849  void ScForecast_Ets( ScETSType eETSType );
850  void ScFourier();
851  void ScNoName();
852  void ScBadName();
853  // Statistics:
854  static double taylor(const double* pPolynom, sal_uInt16 nMax, double x);
855  static double gauss(double x);
857 public:
858  static double phi(double x);
859  static double integralPhi(double x);
860  static double gaussinv(double x);
861  static double GetPercentile( ::std::vector<double> & rArray, double fPercentile );
864 private:
865  double GetBetaDist(double x, double alpha, double beta); //cumulative distribution function
866  double GetBetaDistPDF(double fX, double fA, double fB); //probability density function)
867  double GetChiDist(double fChi, double fDF); // for LEGACY.CHIDIST, returns right tail
868  double GetChiSqDistCDF(double fX, double fDF); // for CHISQDIST, returns left tail
869  static double GetChiSqDistPDF(double fX, double fDF); // probability density function
870  double GetFDist(double x, double fF1, double fF2);
871  double GetTDist( double T, double fDF, int nType );
872  double Fakultaet(double x);
873  static double BinomKoeff(double n, double k);
874  double GetGamma(double x);
875  static double GetLogGamma(double x);
876  double GetBeta(double fAlpha, double fBeta);
877  static double GetLogBeta(double fAlpha, double fBeta);
878  double GetBinomDistPMF(double x, double n, double p); //probability mass function
879  double GetHypGeomDist( double x, double n, double M, double N );
880  void ScLogGamma();
881  void ScGamma();
882  void ScPhi();
883  void ScGauss();
884  void ScStdNormDist();
885  void ScStdNormDist_MS();
886  void ScFisher();
887  void ScFisherInv();
888  void ScFact();
889  void ScNormDist( int nMinParamCount );
890  void ScGammaDist( bool bODFF );
891  void ScGammaInv();
892  void ScExpDist();
893  void ScBinomDist();
894  void ScPoissonDist( bool bODFF );
895  void ScCombin();
896  void ScCombinA();
897  void ScPermut();
898  void ScPermutationA();
899  void ScB();
900  void ScHypGeomDist( int nMinParamCount );
901  void ScLogNormDist( int nMinParamCount );
902  void ScLogNormInv();
903  void ScTDist();
904  void ScTDist_MS();
905  void ScTDist_T( int nTails );
906  void ScFDist();
907  void ScFDist_LT();
908  void ScChiDist( bool bODFF); // for LEGACY.CHIDIST, returns right tail
909  void ScChiSqDist(); // returns left tail or density
910  void ScChiSqDist_MS();
911  void ScChiSqInv(); // inverse to CHISQDIST
912  void ScWeibull();
913  void ScBetaDist();
914  void ScBetaDist_MS();
915  void ScFInv();
916  void ScFInv_LT();
917  void ScTInv( int nType );
918  void ScChiInv();
919  void ScBetaInv();
920  void ScCritBinom();
921  void ScNegBinomDist();
922  void ScNegBinomDist_MS();
923  void ScKurt();
924  void ScHarMean();
925  void ScGeoMean();
926  void ScStandard();
927  void ScSkew();
928  void ScSkewp();
929  void ScMedian();
930  double GetMedian( ::std::vector<double> & rArray );
931  double GetPercentileExclusive( ::std::vector<double> & rArray, double fPercentile );
932  std::vector<double> GetTopNumberArray( SCSIZE& rCol, SCSIZE& rRow );
933  void GetNumberSequenceArray( sal_uInt8 nParamCount, ::std::vector<double>& rArray, bool bConvertTextInArray );
934  void GetSortArray( sal_uInt8 nParamCount, ::std::vector<double>& rSortArray, ::std::vector<tools::Long>* pIndexOrder, bool bConvertTextInArray, bool bAllowEmptyArray );
935  static void QuickSort(::std::vector<double>& rSortArray, ::std::vector<tools::Long>* pIndexOrder);
936  void ScModalValue();
937  void ScModalValue_MS( bool bSingle );
938  void ScAveDev();
939  void ScAggregate();
940  void ScDevSq();
941  void ScZTest();
942  void ScTTest();
943  void ScFTest();
944  void ScChiTest();
945  void ScRank( bool bAverage );
946  void ScPercentile( bool bInclusive );
947  void ScPercentrank( bool bInclusive );
948  static double GetPercentrank( ::std::vector<double> & rArray, double fVal, bool bInclusive );
949  void ScLarge();
950  void ScSmall();
951  void ScFrequency();
952  void ScQuartile( bool bInclusive );
953  void ScNormInv();
954  void ScSNormInv();
955  void ScConfidence();
956  void ScConfidenceT();
957  void ScTrimMean();
958  void ScProbability();
959  void ScCorrel();
960  void ScCovarianceP();
961  void ScCovarianceS();
962  void ScPearson();
963  void ScRSQ();
964  void ScSTEYX();
965  void ScSlope();
966  void ScTrend();
967  void ScInfo();
968  void ScLenB();
969  void ScRightB();
970  void ScLeftB();
971  void ScMidB();
972  void ScReplaceB();
973  void ScFindB();
974  void ScSearchB();
976  void ScFilterXML();
977  void ScWebservice();
978  void ScEncodeURL();
979  void ScColor();
980  void ScErf();
981  void ScErfc();
983  static const double fMaxGammaArgument;
985  double GetGammaContFraction(double fA,double fX);
986  double GetGammaSeries(double fA,double fX);
987  double GetLowRegIGamma(double fA,double fX); // lower regularized incomplete gamma function, GAMMAQ
988  double GetUpRegIGamma(double fA,double fX); // upper regularized incomplete gamma function, GAMMAP
989  // probability density function; fLambda is "scale" parameter
990  double GetGammaDistPDF(double fX, double fAlpha, double fLambda);
991  // cumulative distribution function; fLambda is "scale" parameter
992  double GetGammaDist(double fX, double fAlpha, double fLambda);
993  double GetTInv( double fAlpha, double fSize, int nType );
995 public:
997  const ScAddress&, ScTokenArray&, bool bForGroupThreading = false );
998  ~ScInterpreter();
1000  // Used only for threaded formula-groups.
1001  // Resets the interpreter object, allowing reuse of interpreter object for each cell
1002  // in the group.
1003  void Init( ScFormulaCell* pCell, const ScAddress& rPos, ScTokenArray& rTokArray );
1007  void SetError(FormulaError nError)
1008  { if (nError != FormulaError::NONE && nGlobalError == FormulaError::NONE) nGlobalError = nError; }
1009  void AssertFormulaMatrix();
1012  { mpLinkManager = pLinkMgr; }
1014  FormulaError GetError() const { return nGlobalError; }
1015  formula::StackVar GetResultType() const { return xResult->GetType(); }
1016  const svl::SharedString & GetStringResult() const;
1017  double GetNumResult() const { return xResult->GetDouble(); }
1021 };
1024 {
1025  return bMatrixFormula || pCur->IsInForceArray();
1026 }
1029 {
1030  if (IsInArrayContext())
1032 }
1035 {
1037  !pJumpMatrix && sp > 0 )
1038  return ConvertMatrixParameters();
1039  return false;
1040 }
1043 {
1044  return maTokenMatrixMap;
1045 }
1047 inline bool ScInterpreter::MustHaveParamCount( short nAct, short nMust )
1048 {
1049  if ( nAct == nMust )
1050  return true;
1051  if ( nAct < nMust )
1053  else
1055  return false;
1056 }
1058 inline bool ScInterpreter::MustHaveParamCount( short nAct, short nMust, short nMax )
1059 {
1060  if ( nMust <= nAct && nAct <= nMax )
1061  return true;
1062  if ( nAct < nMust )
1064  else
1066  return false;
1067 }
1069 inline bool ScInterpreter::MustHaveParamCountMin( short nAct, short nMin )
1070 {
1071  if ( nAct >= nMin )
1072  return true;
1074  return false;
1075 }
1078 {
1079  if (!std::isfinite( fVal))
1080  {
1081  fVal = -1.0;
1082  return false;
1083  }
1084  else if (fVal < 0.0)
1085  {
1086  fVal = 0.0;
1087  return false;
1088  }
1089  else if (fVal > SAL_MAX_INT32)
1090  {
1091  fVal = static_cast<double>(SAL_MAX_INT32);
1092  return false;
1093  }
1094  return true;
1095 }
1098 {
1099  double fVal = rtl::math::approxFloor( GetDouble());
1100  if (!CheckStringPositionArgument( fVal))
1101  {
1102  fVal = -1.0;
1103  SetError( FormulaError::IllegalArgument);
1104  }
1105  return static_cast<sal_Int32>(fVal);
1106 }
1108 inline bool ScInterpreter::CheckStringResultLen( OUString& rResult, sal_Int32 nIncrease )
1109 {
1110  if (nIncrease > kScInterpreterMaxStrLen - rResult.getLength())
1111  {
1112  SetError( FormulaError::StringOverflow );
1113  rResult.clear();
1114  return false;
1115  }
1116  return true;
1117 }
1119 inline bool ScInterpreter::CheckStringResultLen( OUStringBuffer& rResult, sal_Int32 nIncrease )
1120 {
1121  if (nIncrease > kScInterpreterMaxStrLen - rResult.getLength())
1122  {
1123  SetError( FormulaError::StringOverflow );
1124  rResult.setLength(0);
1125  return false;
1126  }
1127  return true;
1128 }
1130 inline void ScInterpreter::TreatDoubleError( double& rVal )
1131 {
1132  if ( !std::isfinite( rVal ) )
1133  {
1134  FormulaError nErr = GetDoubleErrorValue( rVal );
1135  if ( nErr != FormulaError::NONE )
1136  SetError( nErr );
1137  else
1138  SetError( FormulaError::NoValue );
1139  rVal = 0.0;
1140  }
1141 }
1143 inline double ScInterpreter::div( const double& fNumerator, const double& fDenominator )
1144 {
1145  return sc::div(fNumerator, fDenominator);
1146 }
1148 inline sal_Int16 ScInterpreter::GetDayOfWeek( sal_Int32 n )
1149 { // monday = 0, ..., sunday = 6
1150  return static_cast< sal_Int16 >( ( n - 1 ) % 7 );
1151 }
1153 /* 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:1704
void ScGCD()
Definition: interpr5.cxx:129
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:2771
void ScGetDiffDate()
Definition: interpr2.cxx:664
::boost::intrusive_ptr< const FormulaToken > FormulaConstTokenRef
void ScFrequency()
Definition: interpr5.cxx:1861
void ScDBArea()
Definition: interpr4.cxx:3676
void ScBadName()
Definition: interpr3.cxx:185
void ScIndirect()
Definition: interpr1.cxx:8109
void ScArcTan2()
Definition: interpr2.cxx:1232
void GetExternalDoubleRef(sal_uInt16 nFileId, const OUString &rTabName, const ScComplexRefData &aData, ScExternalRefCache::TokenArrayRef &rArray)
Definition: interpr4.cxx:1283
void ScLessEqual()
Definition: interpr1.cxx:1234
void ScPearson()
Definition: interpr3.cxx:4517
void ScSumIfs()
Definition: interpr1.cxx:6516
Definition: interpre.hxx:102
sal_uInt32 nRetFmtIndex
Definition: interpre.hxx:203
sal_Int32 GetInt32()
if GetDouble() not within int32 limits sets nGlobalError and returns SAL_MAX_INT32 ...
Definition: interpr4.cxx:2203
void CalculateMatrixValue(const ScMatrix *pMat, SCSIZE nC, SCSIZE nR)
Definition: interpr5.cxx:707
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:4180
formula::FormulaTokenIterator aCode
Definition: interpre.hxx:182
bool CalculateSkew(KahanSum &fSum, double &fCount, std::vector< double > &values)
Definition: interpr3.cxx:3211
SvNumFormatType nFuncFmtType
Definition: interpre.hxx:204
void ScGetTimeValue()
Definition: interpr2.cxx:914
void ScSwitch_MS()
Definition: interpr8.cxx:1897
void ScUnichar()
Definition: interpr1.cxx:3590
void ScErfc()
Definition: interpr7.cxx:503
void ScUnicode()
Definition: interpr1.cxx:3576
void ScDebugVar()
Definition: interpr7.cxx:450
void ScBetaInv()
Definition: interpr3.cxx:2212
void ScRank(bool bAverage)
Definition: interpr3.cxx:4206
void CalculateAddSub(bool _bSub)
Definition: interpr5.cxx:1279
void ScMacro()
Definition: interpr4.cxx:3207
static double GetPercentile(::std::vector< double > &rArray, double fPercentile)
Definition: interpr3.cxx:3400
void PushIllegalParameter()
Definition: interpr4.cxx:1926
void ScGauss()
Definition: interpr3.cxx:1145
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:617
void ScLCM()
Definition: interpr5.cxx:203
void ScCritBinom()
Definition: interpr3.cxx:1410
void ScEMat()
Definition: interpr5.cxx:730
void ScFloor_Precise()
Definition: interpr2.cxx:1191
static double phi(double x)
Definition: interpr3.cxx:195
FormulaError GetError() const
Definition: interpre.hxx:1014
Single reference (one address) into the sheet.
Definition: refdata.hxx:29
ScTokenMatrixMap maTokenMatrixMap
Definition: interpre.hxx:191
static double GetChiSqDistPDF(double fX, double fDF)
Definition: interpr3.cxx:689
void ScRangeFunc()
Definition: interpr2.cxx:2491
SvNumFormatType nRetFmtType
Definition: interpre.hxx:206
void CalculateSumX2MY2SumX2DY2(bool _bSumX2DY2)
Definition: interpr5.cxx:1783
void ScLog10()
Definition: interpr2.cxx:1265
void ScPDuration()
Definition: interpr2.cxx:1864
formula::StackVar Interpret()
Definition: interpr4.cxx:3960
void ScIntersect()
Definition: interpr2.cxx:2344
void ScStdNormDist_MS()
Definition: interpr3.cxx:1601
void PushSingleRef(SCCOL nCol, SCROW nRow, SCTAB nTab)
Definition: interpr4.cxx:1824
void ScNumberValue()
Definition: interpr1.cxx:3360
void ScLogest()
Definition: interpr5.cxx:2384
double GetFDist(double x, double fF1, double fF2)
Definition: interpr3.cxx:640
void ScChiTest()
Definition: interpr3.cxx:2780
void ScTDist_MS()
Definition: interpr3.cxx:1674
void ScTextJoin_MS()
Definition: interpr8.cxx:1507
formula::FormulaConstTokenRef xResult
Definition: interpre.hxx:189
SubtotalFlags mnSubTotalFlags
Definition: interpre.hxx:208
void ScRound()
Definition: interpr2.cxx:990
void ScOffset()
Definition: interpr1.cxx:8430
void ReverseStack(sal_uInt8 nParamCount)
Definition: interpr4.cxx:1997
void SetLinkManager(sfx2::LinkManager *pLinkMgr)
Definition: interpre.hxx:1011
void ScEffect()
Definition: interpr2.cxx:2287
void ScStandard()
Definition: interpr3.cxx:3196
void AssertFormulaMatrix()
Definition: interpr4.cxx:4777
double GetCellValueOrZero(const ScAddress &, ScRefCellValue &rCell)
Definition: interpr4.cxx:187
void ScHypGeomDist(int nMinParamCount)
Calculates a value of the hypergeometric distribution.
Definition: interpr3.cxx:1856
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:4112
void ScLogNormInv()
Definition: interpr3.cxx:2143
void ScFourier()
Definition: interpr3.cxx:5474
ScMatrixRef GetMatrix()
Definition: interpr5.cxx:478
sal_uIntPtr sal_uLong
double GetPercentileExclusive(::std::vector< double > &rArray, double fPercentile)
Definition: interpr3.cxx:3424
bool IsMissing() const
Definition: interpr4.cxx:1946
void ScDBMin()
Definition: interpr1.cxx:8030
ScCalcConfig maCalcConfig
Definition: interpre.hxx:181
sal_Int32 GetInt32WithDefault(sal_Int32 nDefault)
if GetDoubleWithDefault() not within int32 limits sets nGlobalError and returns SAL_MAX_INT32 ...
Definition: interpr4.cxx:2208
const formula::FormulaToken * pCur
Definition: interpre.hxx:195
void ScRightB()
Definition: interpr1.cxx:9154
bool DoubleRefToPosSingleRef(const ScRange &rRange, ScAddress &rAdr)
Definition: interpr4.cxx:2005
void ScMax(bool bTextAsZero=false)
Definition: interpr1.cxx:3789
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:1437
double GetGamma(double x)
You must ensure non integer arguments for fZ<1.
Definition: interpr3.cxx:585
void ScIsEven()
Definition: interpr1.cxx:3122
void ScGreater()
Definition: interpr1.cxx:1217
void ScDBVar()
Definition: interpr1.cxx:8095
void ScCeil_MS()
Definition: interpr2.cxx:1082
void ScHLookup()
Definition: interpr1.cxx:7255
static thread_local bool bGlobalStackInUse
Definition: interpre.hxx:179
void GetNumberSequenceArray(sal_uInt8 nParamCount,::std::vector< double > &rArray, bool bConvertTextInArray)
Definition: interpr3.cxx:3929
void ScColumn()
Definition: interpr1.cxx:4392
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:906
bool FillEntry(ScQueryEntry &rEntry)
Definition: interpr1.cxx:7515
void ScConcat_MS()
Definition: interpr8.cxx:1382
void ScIfs_MS()
Definition: interpr8.cxx:1830
void ScGetActDate()
Definition: interpr2.cxx:99
void ScDevSq()
Definition: interpr3.cxx:4427
void PushDoubleRef(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2)
Definition: interpr4.cxx:1834
void ScBitAnd()
Definition: interpr1.cxx:1643
double GetChiDist(double fChi, double fDF)
You must ensure fDF>0.0.
Definition: interpr3.cxx:669
OpCode GetOpCode() const
void ScIsEmpty()
Definition: interpr1.cxx:1979
formula::StackVar GetRawStackType()
Raw stack type without default replacements.
Definition: interpr4.cxx:1951
void ScChiSqDist_MS()
Definition: interpr3.cxx:750
void CalculateRGPRKP(bool _bRKP)
Definition: interpr5.cxx:2389
void ScIntercept()
Definition: interpr3.cxx:4711
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:177
void ScChiSqDist()
Definition: interpr3.cxx:727
void ScStdNormDist()
Definition: interpr3.cxx:1596
void ScGetDiffDate360()
Definition: interpr2.cxx:674
void ScConcat()
Definition: interpr1.cxx:9811
void ScSumProduct()
Definition: interpr5.cxx:1718
void ScBitLshift()
Definition: interpr1.cxx:1688
void ScModalValue_MS(bool bSingle)
Definition: interpr3.cxx:3544
sal_uLong GetRetFormatIndex() const
Definition: interpre.hxx:1020
void ScDBCount2()
Definition: interpr1.cxx:7990
void ScGetMin()
Definition: interpr2.cxx:140
void ScArcCotHyp()
Definition: interpr1.cxx:1936
bool IsString()
Definition: interpr1.cxx:2033
void ScPermut()
Definition: interpr3.cxx:1199
void ScRawSubtract()
The purpose of RAWSUBTRACT() is exactly to not apply any error correction, approximation etc...
Definition: interpr6.cxx:989
void ScGammaInv()
Definition: interpr3.cxx:2172
void ScPoissonDist(bool bODFF)
Definition: interpr3.cxx:1781
std::vector< double > GetTopNumberArray(SCSIZE &rCol, SCSIZE &rRow)
Definition: interpr3.cxx:3844
void ScEqual()
Definition: interpr1.cxx:1166
const ScComplexRefData * GetStackDoubleRef(size_t rRefInList=0)
Definition: interpr4.cxx:1117
void ScFilterXML()
Definition: interpr7.cxx:39
double GetDoubleWithDefault(double nDefault)
Definition: interpr4.cxx:2166
void ScGammaDist(bool bODFF)
Definition: interpr3.cxx:2091
bool IfErrorPushError()
If nGlobalError is set push formula::FormulaErrorToken.
Definition: interpre.hxx:292
bool ConvertMatrixParameters()
Definition: interpr4.cxx:1456
bool PopDoubleRefOrSingleRef(ScAddress &rAdr)
Definition: interpr4.cxx:1341
void ScRight()
Definition: interpr1.cxx:9346
void ScGetActTime()
Definition: interpr2.cxx:107
ScTokenMatrixMap & GetTokenMatrixMap()
Definition: interpre.hxx:1042
SvNumberFormatter * pFormatter
Definition: interpre.hxx:193
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:686
void ScNoName()
Definition: interpr3.cxx:180
void CurFmtToFuncFmt()
Definition: interpre.hxx:453
void ScCount2()
Definition: interpr6.cxx:979
constexpr sal_Int32 kScInterpreterMaxStrLen
Arbitrary 256MB result string length limit.
Definition: interpre.hxx:92
void PushTempTokenWithoutError(const formula::FormulaToken *)
Does not substitute with formula::FormulaErrorToken in case nGlobalError is set.
Definition: interpr4.cxx:646
void PushParameterExpected()
Definition: interpr4.cxx:1921
void ScRandbetween()
Definition: interpr1.cxx:1809
Definition: global.hxx:238
void ScCellExternal()
Definition: interpr1.cxx:2438
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:3605
sal_uInt16 sal_Unicode
void ScSumSQ()
Definition: interpr6.cxx:954
sal_uInt32 GetCellNumberFormat(const ScAddress &rPos, ScRefCellValue &rCell)
Definition: interpr4.cxx:124
void ScReplaceB()
Definition: interpr1.cxx:9244
void ScCeil_Precise()
Definition: interpr2.cxx:1100
double PopDouble()
Definition: interpr4.cxx:780
ScInterpreter(ScFormulaCell *pCell, ScDocument &rDoc, ScInterpreterContext &rContext, const ScAddress &, ScTokenArray &, bool bForGroupThreading=false)
Definition: interpr4.cxx:3791
double GetBeta(double fAlpha, double fBeta)
Definition: interpr3.cxx:800
char sal_uInt16 & nParamCount
Definition: callform.cxx:53
void ScGetHour()
Definition: interpr2.cxx:159
void ScSearchB()
Definition: interpr1.cxx:9301
void ScUnionFunc()
Definition: interpr2.cxx:2511
double Fakultaet(double x)
Definition: interpr3.cxx:439
This class provides LO with Kahan summation algorithm About this algorithm: For general purpose software we assume first order error is enough.
Definition: kahan.hxx:25
void ScCorrel()
Definition: interpr3.cxx:4501
sal_Int16 GetInt16()
if GetDouble() not within int16 limits sets nGlobalError and returns SAL_MAX_INT16 ...
Definition: interpr4.cxx:2217
void ScDBAverage()
Definition: interpr1.cxx:8020
void PushInt(int nVal)
Definition: interpr4.cxx:1796
void ScAverage(bool bTextAsZero=false)
Definition: interpr6.cxx:969
SvNumFormatType nCurFmtType
Definition: interpre.hxx:205
sal_Int32 GetStringPositionArgument()
Obtain a sal_Int32 suitable as string position or length argument.
Definition: interpre.hxx:1097
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:1520
ScMatrixRef GetNewMat(SCSIZE nC, SCSIZE nR, bool bEmpty=false)
Definition: interpr5.cxx:298
static ScCalcConfig * mpGlobalConfig
Definition: interpre.hxx:176
void ScMatTrans()
Definition: interpr5.cxx:1127
void ScSinHyp()
Definition: interpr1.cxx:1893
void ScGetDateValue()
Definition: interpr2.cxx:167
void ScExpDist()
Definition: interpr3.cxx:1615
void PushExternalDoubleRef(sal_uInt16 nFileId, const OUString &rTabName, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2)
Definition: interpr4.cxx:1857
void ScFisher()
Definition: interpr3.cxx:1150
static double ScGetPMT(double fRate, double fNper, double fPv, double fFv, bool bPayInAdvance)
Definition: interpr2.cxx:1890
void CalculateSlopeIntercept(bool bSlope)
Definition: interpr3.cxx:4636
void ScNormInv()
Definition: interpr3.cxx:2116
static double ScGetFV(double fRate, double fNper, double fPmt, double fPv, bool bPayInAdvance)
Definition: interpr2.cxx:1937
Definition: interpre.hxx:113
void MatrixJumpConditionToMatrix()
Definition: interpre.hxx:1028
ScMatrixRef QueryMat(const ScMatrixRef &pMat, sc::CompareOptions &rOptions)
Definition: interpr1.cxx:1144
static double gaussinv(double x)
Definition: interpr3.cxx:268
Definition: interpre.hxx:119
void ScProper()
Definition: interpr1.cxx:3171
static const double fMaxGammaArgument
Definition: interpre.hxx:983
void ScFindB()
Definition: interpr1.cxx:9267
sal_Int32 double_to_int32(double fVal)
Definition: interpr4.cxx:2175
::boost::intrusive_ptr< ScMatrix > ScMatrixRef
Definition: types.hxx:25
void ScWebservice()
Definition: interpr7.cxx:272
void ScColumns()
Definition: interpr1.cxx:4231
void PushString(const OUString &rStr)
Definition: interpr4.cxx:1813
ScFormulaCell * pMyFormulaCell
Definition: interpre.hxx:192
FormulaError mnStringNoValueError
Definition: interpre.hxx:207
void ScArcSinHyp()
Definition: interpr1.cxx:1913
void ScSecantHyp()
Definition: interpr1.cxx:1960
FormulaError GetDoubleErrorValue(double fVal)
void ScMatDet()
Definition: interpr5.cxx:919
void ScRandomImpl(const std::function< double(double fFirst, double fLast)> &RandomFunc, double fFirst, double fLast)
Definition: interpr1.cxx:1739
void ScLinest()
Definition: interpr5.cxx:2378
const formula::FormulaToken ** pStack
Definition: interpre.hxx:197
void ScDBCount()
Definition: interpr1.cxx:7932
void ScConvertOOo()
Definition: interpr2.cxx:2958
void ScChooseJump()
Definition: interpr1.cxx:416
void ScIsString()
Definition: interpr1.cxx:2101
void PushError(FormulaError nError)
Definition: interpr4.cxx:1915
sc::RangeMatrix CompareMat(ScQueryOp eOp, sc::CompareOptions *pOptions=nullptr)
Definition: interpr1.cxx:982
void ScCount()
Definition: interpr6.cxx:974
void ScChiSqInv()
Definition: interpr3.cxx:2403
void ScSumIf()
Definition: interpr1.cxx:5617
void ScGetWeekOfYear()
Definition: interpr2.cxx:246
double GetTDist(double T, double fDF, int nType)
Definition: interpr3.cxx:648
void ScSheet()
Definition: interpr1.cxx:4599
void ScFalse()
Definition: interpr1.cxx:1837
void ScGreaterEqual()
Definition: interpr1.cxx:1251
void ScNetWorkdays(bool bOOXML_Version)
Definition: interpr2.cxx:499
void ScColRowNameAuto()
Definition: interpr4.cxx:3693
void IterateParametersIf(ScIterFuncIf)
Definition: interpr1.cxx:5212
void ScFisherInv()
Definition: interpr3.cxx:1159
void MakeMatNew(ScMatrixRef &rMat, SCSIZE nC, SCSIZE nR)
Definition: interpr5.cxx:283
sc::RangeMatrix PopRangeMatrix()
Definition: interpr4.cxx:1662
void ScIsOdd()
Definition: interpr1.cxx:3127
double GetDouble()
Definition: interpr4.cxx:2085
std::unique_ptr< ScDBQueryParamBase > GetDBParams(bool &rMissingField)
Definition: interpr1.cxx:7722
static double gauss(double x)
Definition: interpr3.cxx:215
bool CreateCellArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt8 *pCellArr)
Definition: interpr4.cxx:460
ScInterpreterContext & mrContext
Definition: interpre.hxx:185
void ScInt()
Definition: interpr2.cxx:952
void ScEuroConvert()
Definition: interpr2.cxx:3251
bool MustHaveParamCount(short nAct, short nMust)
Definition: interpre.hxx:1047
static void SetGlobalConfig(const ScCalcConfig &rConfig)
Definition: interpr4.cxx:3885
void ScSkewp()
Definition: interpr3.cxx:3361
ScMatrixRef PopMatrix()
Definition: interpr4.cxx:1630
bool CheckStringResultLen(OUString &rResult, sal_Int32 nIncrease)
Definition: interpre.hxx:1108
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:599
formula::FormulaConstTokenRef PopToken()
Definition: interpr4.cxx:765
void ScGeoMean()
Definition: interpr3.cxx:3024
void DoubleRefToRange(const ScComplexRefData &, ScRange &, bool bDontCheckForTableOp=false)
Definition: interpr4.cxx:1025
void CalculateSmallLarge(bool bSmall)
Definition: interpr3.cxx:3630
::std::map< const formula::FormulaConstTokenRef, formula::FormulaConstTokenRef, FormulaTokenRef_less > ScTokenMatrixMap
Definition: interpre.hxx:135
void ScAddressFunc()
Definition: interpr1.cxx:8328
static void GlobalExit()
Definition: interpr4.cxx:3901
ScMatValType GetDoubleOrStringFromMatrix(double &rDouble, svl::SharedString &rString)
Definition: interpr4.cxx:2423
#define SAL_MAX_INT32
void ScTInv(int nType)
Definition: interpr3.cxx:2264
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:1143
double ConvertStringToValue(const OUString &)
Definition: interpr4.cxx:162
const svl::SharedString & GetStringResult() const
Definition: interpr4.cxx:4782
sal_uInt16 sp
Definition: interpre.hxx:199
void ScLookup()
Definition: interpr1.cxx:6603
void ScTrimMean()
Definition: interpr3.cxx:3815
void ScVar(bool bTextAsZero=false)
Definition: interpr1.cxx:4168
void ScCountEmptyCells()
Definition: interpr1.cxx:5132
bool LookupQueryWithCache(ScAddress &o_rResultPos, const ScQueryParam &rParam, const ScComplexRefData *refData) const
Definition: interpr1.cxx:10080
sfx2::LinkManager * mpLinkManager
Definition: interpre.hxx:187
void ScGetIsoWeekOfYear()
Definition: interpr2.cxx:292
bool IsTableOpInRange(const ScRange &)
Definition: interpr4.cxx:106
void ScLogGamma()
Definition: interpr3.cxx:791
void ScGetDateDif()
Definition: interpr2.cxx:765
svl::SharedString PopString()
Definition: interpr4.cxx:812
void CalculatePearsonCovar(bool _bPearson, bool _bStexy, bool _bSample)
Definition: interpr3.cxx:4522
void PushDouble(double nVal)
Definition: interpr4.cxx:1789
void ScIsRef()
Definition: interpr1.cxx:2579
void ScBinomDist()
Definition: interpr3.cxx:1346
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:9902
void ScPercentile(bool bInclusive)
Definition: interpr3.cxx:3454
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:629
void ScAbs()
Definition: interpr2.cxx:947
sal_uInt16 & nParam
Definition: callform.cxx:57
CAUTION! The following defines must be in the same namespace as the respective type.
void ScMaxIfs_MS()
Definition: interpr1.cxx:6586
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:316
void PopDoubleRef(ScRange &rRange, short &rParam, size_t &rRefInList)
If formula::StackVar formula::svDoubleRef pop ScDoubleRefToken and return values of ScComplexRefData...
Definition: interpr4.cxx:1043
bool IsInForceArray() const
void ScMedian()
Definition: interpr3.cxx:3390
void ScArcCos()
Definition: interpr1.cxx:1878
void ScMatValue()
Definition: interpr5.cxx:629
void ScAmpersand()
Definition: interpr5.cxx:1407
void ScSlope()
Definition: interpr3.cxx:4706
void ScSum()
Definition: interpr6.cxx:959
void ScArcTan()
Definition: interpr1.cxx:1883
void ScDBGet()
Definition: interpr4.cxx:2494
static ScCalcConfig & GetOrCreateGlobalConfig()
Definition: interpr4.cxx:3878
void ScIsFormula()
Definition: interpr1.cxx:2702
static void QuickSort(::std::vector< double > &rSortArray,::std::vector< tools::Long > *pIndexOrder)
Definition: interpr3.cxx:4179
double GetDoubleFromMatrix(const ScMatrixRef &pMat)
Definition: interpr4.cxx:2044
formula::FormulaToken * CreateFormulaDoubleToken(double fVal, SvNumFormatType nFmt=SvNumFormatType::NUMBER)
Definition: interpr4.cxx:1754
bool MustHaveParamCountMin(short nAct, short nMin)
Definition: interpre.hxx:1069
SvNumFormatType GetRetFormatType() const
Definition: interpre.hxx:1019
void PushMatrix(const sc::RangeMatrix &rMat)
Definition: interpr4.cxx:1890
void ScTDist_T(int nTails)
Definition: interpr3.cxx:1656
ScTokenArray * pArr
Definition: interpre.hxx:184
void ScErrorType_ODF()
Definition: interpr1.cxx:9916
void ScIfJump()
Definition: interpr1.cxx:87
static FormulaError GetCellErrCode(const ScRefCellValue &rCell)
Definition: interpr4.cxx:157
VolatileType meVolatileType
Definition: interpre.hxx:213
static utl::SearchParam::SearchType DetectSearchType(std::u16string_view rStr, const ScDocument &rDoc)
Detect if string should be used as regular expression or wildcard expression or literal string...
Definition: interpr1.cxx:9990
void PushExternalSingleRef(sal_uInt16 nFileId, const OUString &rTabName, SCCOL nCol, SCROW nRow, SCTAB nTab)
Definition: interpr4.cxx:1845
void ScConfidence()
Definition: interpr3.cxx:2423
void QueryMatrixType(const ScMatrixRef &xMat, SvNumFormatType &rRetTypeExpr, sal_uInt32 &rRetIndexExpr)
Definition: interpr4.cxx:1702
void GetCellString(svl::SharedString &rStr, ScRefCellValue &rCell)
Definition: interpr4.cxx:244
void ScCotHyp()
Definition: interpr1.cxx:1908
void ScCountIfs()
Definition: interpr1.cxx:6551
void ScGetYear()
Definition: interpr2.cxx:119
void ScAverageIfs()
Definition: interpr1.cxx:6534
sal_uInt8 cPar
Definition: interpre.hxx:209
void ScAreas()
Definition: interpr1.cxx:8810
FormulaError nGlobalError
Definition: interpre.hxx:198
void ScFTest()
Definition: interpr3.cxx:2730
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:362
svl::SharedString GetStringFromMatrix(const ScMatrixRef &pMat)
Definition: interpr4.cxx:2401
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:8081
bool JumpMatrix(short nStackLevel)
Definition: interpr1.cxx:545
static double taylor(const double *pPolynom, sal_uInt16 nMax, double x)
Definition: interpr3.cxx:205
void ScIsLogical()
Definition: interpr1.cxx:2111
void ScChiDist(bool bODFF)
Definition: interpr3.cxx:1741
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:1377
formula::StackVar GetResultType() const
Definition: interpre.hxx:1015
void ScNotEqual()
Definition: interpr1.cxx:1183
void ScRoundDown()
Definition: interpr2.cxx:995
void ScCumPrinc()
Definition: interpr2.cxx:2248
void ScCosecantHyp()
Definition: interpr1.cxx:1955
sal_uInt32 nFuncFmtIndex
Definition: interpre.hxx:201
void ScSheets()
Definition: interpr1.cxx:4345
formula::StackVar GetStackType()
Stack type with replacement of defaults, e.g. svMissing and formula::svEmptyCell will result in formu...
Definition: interpr4.cxx:1966
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:2272
void ScDBStdDevP()
Definition: interpr1.cxx:8088
void ReplaceCell(ScAddress &)
Definition: interpr4.cxx:87
void ScConfidenceT()
Definition: interpr3.cxx:2437
static thread_local std::unique_ptr< ScTokenStack > pGlobalStack
Definition: interpre.hxx:178
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:147
void ScMissing()
Definition: interpr4.cxx:3110
void ScDBVarP()
Definition: interpr1.cxx:8102
sal_uInt8 GetByte() const
Definition: interpre.hxx:415
void ScGetSec()
Definition: interpr2.cxx:148
bool SetSbxVariable(SbxVariable *pVar, const ScAddress &)
static const ScCalcConfig & GetGlobalConfig()
Definition: interpr4.cxx:3890
void ScCosHyp()
Definition: interpr1.cxx:1898
void ScIndex()
Definition: interpr1.cxx:8592
void ValidateRef(const ScSingleRefData &rRef)
Definition: interpr4.cxx:840
void CalculateTrendGrowth(bool _bGrowth)
Definition: interpr5.cxx:2913
Reference< XOutputStream > stream
svl::SharedStringPool & mrStrPool
Definition: interpre.hxx:188
bool bCalcAsShown
Definition: interpre.hxx:210
double GetBinomDistPMF(double x, double n, double p)
Definition: interpr3.cxx:1232
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:3854
ScDBRangeBase * PopDBDoubleRef()
Definition: interpr4.cxx:961
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:1903
void CalculateSkewOrSkewp(bool bSkewp)
Definition: interpr3.cxx:3316
void ScUpper()
Definition: interpr1.cxx:3165
void ScSmall()
Definition: interpr3.cxx:3715
void ScMatRef()
Definition: interpr5.cxx:3211
sal_uInt16 maxsp
Definition: interpre.hxx:200
void PushIllegalArgument()
Definition: interpr4.cxx:1931
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:2246
void ScReplace()
Definition: interpr1.cxx:8903
::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:3195
void ScIsNonString()
Definition: interpr1.cxx:2106
void ScModalValue()
Definition: interpr3.cxx:3500
void ScISPMT()
Definition: interpr2.cxx:1598
void ScBitRshift()
Definition: interpr1.cxx:1711
void PushWithoutError(const formula::FormulaToken &r)
Does not substitute with formula::FormulaErrorToken in case nGlobalError is set.
Definition: interpr4.cxx:583
void ScMinIfs_MS()
Definition: interpr1.cxx:6568
static double GetLogBeta(double fAlpha, double fBeta)
Definition: interpr3.cxx:833
void ScArcCot()
Definition: interpr1.cxx:1888
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:7626
void ScStDevP(bool bTextAsZero=false)
Definition: interpr1.cxx:4202
void ScLarge()
Definition: interpr3.cxx:3710
static sal_Int16 GetDayOfWeek(sal_Int32 n)
Definition: interpre.hxx:1148
static double BinomKoeff(double n, double k)
Definition: interpr3.cxx:460
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:681
void ScBetaDist()
Definition: interpr3.cxx:1036
void ScSumX2DY2()
Definition: interpr5.cxx:1824
void ScDBMax()
Definition: interpr1.cxx:8025
void ScArabic()
Definition: interpr2.cxx:3065
unsigned char sal_uInt8
void ScForecast_Ets(ScETSType eETSType)
Definition: interpr8.cxx:1175
void ScRandom()
Definition: interpr1.cxx:1800
bool CreateDoubleArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt8 *pCellArr)
Definition: interpr4.cxx:279
void ScMatInv()
Definition: interpr5.cxx:966
bool bMatrixFormula
Definition: interpre.hxx:211
void PopDoubleRefPushMatrix()
Definition: interpr4.cxx:1363
FormulaError GetErrorType()
Definition: interpr1.cxx:9830
void ScIsError()
Definition: interpr1.cxx:2969
ScDocument & mrDoc
Definition: interpre.hxx:186
void ScTrend()
Definition: interpr5.cxx:2903
void CalculateLookup(bool bHLookup)
Definition: interpr1.cxx:7260
void ScCurrency()
Definition: interpr1.cxx:8846
void ScLeftB()
Definition: interpr1.cxx:9203
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:3947
static double ScInterVDB(double fCost, double fSalvage, double fLife, double fLife1, double fPeriod, double fFactor)
Definition: interpr2.cxx:1742
ScJumpMatrix * pJumpMatrix
Definition: interpre.hxx:190
void ScNegBinomDist()
Definition: interpr3.cxx:1500
void ScLogNormDist(int nMinParamCount)
Definition: interpr3.cxx:1566
double GetTInv(double fAlpha, double fSize, int nType)
Definition: interpr3.cxx:2288
void ScDBSum()
Definition: interpr1.cxx:7927
ScAddress aPos
Definition: interpre.hxx:183
Definition: types.hxx:31
void ScWorkday_MS()
Definition: interpr2.cxx:559
ScMatrixRef MatConcat(const ScMatrixRef &pMat1, const ScMatrixRef &pMat2)
Definition: interpr5.cxx:1230
void ScBetaDist_MS()
Microsoft version has parameters in different order Also, upper and lowerbound are optional and have ...
Definition: interpr3.cxx:1100
void SingleRefToVars(const ScSingleRefData &rRef, SCCOL &rCol, SCROW &rRow, SCTAB &rTab)
Definition: interpr4.cxx:862
svl::SharedString GetStringFromDouble(const double fVal)
Definition: interpr4.cxx:2484
void ScCosecant()
Definition: interpr1.cxx:1945
void ScNormDist(int nMinParamCount)
Definition: interpr3.cxx:1546
void ScSubTotal()
Definition: interpr1.cxx:7579
void RoundNumber(rtl_math_RoundingMode eMode)
Definition: interpr2.cxx:957
void ScBahtText()
Definition: interpr2.cxx:3422
Definition: qproform.cxx:398
svl::SharedString GetString()
Definition: interpr4.cxx:2322
These need to be in global namespace just like their respective types are.
double GetNumResult() const
Definition: interpre.hxx:1017
void ScVLookup()
Definition: interpr1.cxx:7574
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:1941
void ScNominal()
Definition: interpr2.cxx:2306
void ScPower()
Definition: interpr5.cxx:1658
bool MatrixParameterConversion()
Definition: interpre.hxx:1034
void ScSumX2MY2()
Definition: interpr5.cxx:1779
void ScGetPivotData()
Definition: interpr2.cxx:3489
void ScPermutationA()
Definition: interpr3.cxx:1219
Definition: global.hxx:817
void ScSTEYX()
Definition: interpr3.cxx:4632
void PopExternalSingleRef(sal_uInt16 &rFileId, OUString &rTabName, ScSingleRefData &rRef)
Definition: interpr4.cxx:1140
void ScSumXMY2()
Definition: interpr5.cxx:1829
void MergeCalcConfig()
Merge global and document specific settings.
Definition: interpr4.cxx:3895
void ScSecant()
Definition: interpr1.cxx:1950
Complex reference (a range) into the sheet.
Definition: refdata.hxx:122
void ScRoundUp()
Definition: interpr2.cxx:1000
void ScChiInv()
Definition: interpr3.cxx:2368
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:2580
double GetHypGeomDist(double x, double n, double M, double N)
Calculates a value of the hypergeometric distribution.
Definition: interpr3.cxx:1895
void ScCovarianceS()
Definition: interpr3.cxx:4512
void DBIterator(ScIterFunc)
Definition: interpr1.cxx:7860
void ScMatch()
Definition: interpr1.cxx:4787
void ScRegex()
Definition: interpr1.cxx:9428
void GetDBStVarParams(double &rVal, double &rValCount)
Definition: interpr1.cxx:8040
void ScAverageIf()
Definition: interpr1.cxx:5622
void PopError()
Definition: interpr4.cxx:753
void ScWeibull()
Definition: interpr3.cxx:1763
ScTokenStack * pStackObj
Definition: interpre.hxx:196
sc::RangeMatrix GetRangeMatrix()
Definition: interpr5.cxx:615
void ScBitXor()
Definition: interpr1.cxx:1673
void ScBitOr()
Definition: interpr1.cxx:1658
void ScTDist()
Definition: interpr3.cxx:1641
void ScFInv_LT()
Definition: interpr3.cxx:2333
void ScMin(bool bTextAsZero=false)
Definition: interpr1.cxx:3631
void ScGetMonth()
Definition: interpr2.cxx:126
void ScProbability()
Definition: interpr3.cxx:4436
void PopExternalDoubleRef(sal_uInt16 &rFileId, OUString &rTabName, ScComplexRefData &rRef)
Definition: interpr4.cxx:1219
void ScPercentrank(bool bInclusive)
Definition: interpr3.cxx:3720
double get() const
Returns the final sum.
Definition: kahan.hxx:211
void ScIsErr()
Definition: interpr1.cxx:2906
formula::FormulaToken * CreateDoubleOrTypedToken(double fVal)
Definition: interpr4.cxx:1779
void ScClean()
Definition: interpr1.cxx:3462
void ScGetDayOfWeek()
Definition: interpr2.cxx:187
void ScExternal()
Definition: interpr4.cxx:2529
const formula::FormulaConstTokenRef & GetResultToken() const
Definition: interpre.hxx:1018
void ScExact()
Definition: interpr1.cxx:9029
void ScFDist()
Definition: interpr3.cxx:1689
void ScForecast()
Definition: interpr3.cxx:4716
void ScMultiArea()
Definition: interpr1.cxx:8797
void ScSearch()
Definition: interpr1.cxx:9382
void ScArcSin()
Definition: interpr1.cxx:1873
void ScGrowth()
Definition: interpr5.cxx:2908
void TreatDoubleError(double &rVal)
Definition: interpre.hxx:1130
const formula::FormulaToken * pPointer[MAXSTACK]
Definition: interpre.hxx:99
void PushTokenRef(const formula::FormulaConstTokenRef &)
Pushes the token or substitutes with formula::FormulaErrorToken in case nGlobalError is set and the t...
Definition: interpr4.cxx:666
static void MEMat(const ScMatrixRef &mM, SCSIZE n)
Definition: interpr5.cxx:753
::std::vector< ScComplexRefData > ScRefList
Definition: token.hxx:37
double Compare(ScQueryOp eOp)
Definition: interpr1.cxx:885
void ScCombin()
Definition: interpr3.cxx:1173
void ScArcTanHyp()
Definition: interpr1.cxx:1927
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:1802
double GetBetaDistPDF(double fX, double fA, double fB)
Definition: interpr3.cxx:862
void ScSubstitute()
Definition: interpr1.cxx:9740
void ScQuartile(bool bInclusive)
Definition: interpr3.cxx:3477
void IterateParametersIfs(double(*ResultFunc)(const sc::ParamIfsResult &rRes))
Definition: interpr1.cxx:5835
void ScValue()
Definition: interpr1.cxx:3281
void ScProduct()
Definition: interpr6.cxx:964
void ScIsValue()
Definition: interpr1.cxx:2631
double GetGammaDistPDF(double fX, double fAlpha, double fLambda)
Gamma distribution, probability density function.
Definition: interpr6.cxx:144
void ScArcCosHyp()
Definition: interpr1.cxx:1918
void ScZTest()
Definition: interpr3.cxx:2453
void ScCombinA()
Definition: interpr3.cxx:1186
void ScCountIf()
Definition: interpr1.cxx:5627
void SetError(FormulaError nError)
Definition: interpre.hxx:1007
double GetMedian(::std::vector< double > &rArray)
Definition: interpr3.cxx:3366
bool GetBool()
Definition: interpre.hxx:433
static bool CheckStringPositionArgument(double &fVal)
Check if a double is suitable as string position or length argument.
Definition: interpre.hxx:1077
Each instance of this struct represents a single filtering criteria.
Definition: queryentry.hxx:33
VolatileType GetVolatileType() const
Definition: interpre.hxx:172
void ScTableOp()
Definition: interpr4.cxx:3586
void ScFixed()
Definition: interpr1.cxx:8940
void DoubleRefToVars(const formula::FormulaToken *p, SCCOL &rCol1, SCROW &rRow1, SCTAB &rTab1, SCCOL &rCol2, SCROW &rRow2, SCTAB &rTab2)
Definition: interpr4.cxx:943
void ScStDev(bool bTextAsZero=false)
Definition: interpr1.cxx:4190
double div(const double &fNumerator, const double &fDenominator)
Return fNumerator/fDenominator if fDenominator!=0 else #DIV/0! error coded into double.
Definition: math.hxx:29
static double GetPercentrank(::std::vector< double > &rArray, double fVal, bool bInclusive)
Definition: interpr3.cxx:3758
static double ScGetGCD(double fx, double fy)
Definition: interpr5.cxx:108
void ScHyperLink()
Definition: interpr2.cxx:3122
bool GetDoubleOrString(double &rValue, svl::SharedString &rString)
returns TRUE if double (or error, check nGlobalError), else FALSE
Definition: interpr4.cxx:2262
sal_Int16 SCTAB
Definition: types.hxx:22
void ScTTest()
Definition: interpr3.cxx:2647
void ScHarMean()
Definition: interpr3.cxx:2903
void ScIfError(bool bNAonly)
Definition: interpr1.cxx:249
void ScPercentSign()
Definition: interpr1.cxx:1599
void ScSNormInv()
Definition: interpr3.cxx:2132
void ScColor()
Definition: interpr7.cxx:510
void ScMatMult()
Definition: interpr5.cxx:1078
bool IsInArrayContext() const
Definition: interpre.hxx:1023
void ScDBProduct()
Definition: interpr1.cxx:8035
double GetBetaDist(double x, double alpha, double beta)
Definition: interpr3.cxx:985
void ScAveDev()
Definition: interpr3.cxx:4269
#define MAXSTACK
Definition: interpre.hxx:94
static double integralPhi(double x)
Definition: interpr3.cxx:200
bool operator()(const formula::FormulaConstTokenRef &r1, const formula::FormulaConstTokenRef &r2) const
Definition: interpre.hxx:132
sal_uInt32 nCurFmtIndex
Definition: interpre.hxx:202
void ScGamma()
Definition: interpr3.cxx:774
void ScCovarianceP()
Definition: interpr3.cxx:4507