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  std::unique_ptr<ScTokenMatrixMap> pTokenMatrixMap; // 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 );
453  static std::unique_ptr<ScTokenMatrixMap> CreateTokenMatrixMap();
455  ScMatrixRef GetMatrix( short & rParam, size_t & rInRefList );
457 
458  void ScTableOp(); // repeated operations
459 
460  // common helper functions
461 
463  { nFuncFmtType = nCurFmtType; nFuncFmtIndex = nCurFmtIndex; }
464 
475  static inline bool CheckStringPositionArgument( double & fVal );
476 
481  inline sal_Int32 GetStringPositionArgument();
482 
483  // Check for String overflow of rResult+rAdd and set error and erase rResult
484  // if so. Return true if ok, false if overflow
485  inline bool CheckStringResultLen( OUString& rResult, const OUString& rAdd );
486 
487  // Check for String overflow of rResult+rAdd and set error and erase rResult
488  // if so. Return true if ok, false if overflow
489  inline bool CheckStringResultLen( OUStringBuffer& rResult, const OUString& rAdd );
490 
491  // Set error according to rVal, and set rVal to 0.0 if there was an error.
492  inline void TreatDoubleError( double& rVal );
493  // Lookup using ScLookupCache, @returns true if found and result address
494  bool LookupQueryWithCache( ScAddress & o_rResultPos,
495  const ScQueryParam & rParam ) const;
496 
497  void ScIfJump();
498  void ScIfError( bool bNAonly );
499  void ScChooseJump();
500 
501  // Be sure to only call this if pStack[sp-nStackLevel] really contains a
502  // ScJumpMatrixToken, no further checks are applied!
503  // Returns true if last jump was executed and result matrix pushed.
504  bool JumpMatrix( short nStackLevel );
505 
506  double Compare( ScQueryOp eOp );
510  sc::RangeMatrix CompareMat( ScQueryOp eOp, sc::CompareOptions* pOptions = nullptr );
511  ScMatrixRef QueryMat( const ScMatrixRef& pMat, sc::CompareOptions& rOptions );
512  void ScEqual();
513  void ScNotEqual();
514  void ScLess();
515  void ScGreater();
516  void ScLessEqual();
517  void ScGreaterEqual();
518  void ScAnd();
519  void ScOr();
520  void ScXor();
521  void ScNot();
522  void ScNeg();
523  void ScPercentSign();
524  void ScIntersect();
525  void ScRangeFunc();
526  void ScUnionFunc();
527  void ScPi();
528  void ScRandom();
529  void ScRandbetween();
530  void ScRandomImpl( const std::function<double( double fFirst, double fLast )>& RandomFunc,
531  double fFirst, double fLast );
532  void ScTrue();
533  void ScFalse();
534  void ScDeg();
535  void ScRad();
536  void ScSin();
537  void ScCos();
538  void ScTan();
539  void ScCot();
540  void ScArcSin();
541  void ScArcCos();
542  void ScArcTan();
543  void ScArcCot();
544  void ScSinHyp();
545  void ScCosHyp();
546  void ScTanHyp();
547  void ScCotHyp();
548  void ScArcSinHyp();
549  void ScArcCosHyp();
550  void ScArcTanHyp();
551  void ScArcCotHyp();
552  void ScCosecant();
553  void ScSecant();
554  void ScCosecantHyp();
555  void ScSecantHyp();
556  void ScExp();
557  void ScLn();
558  void ScLog10();
559  void ScSqrt();
560  void ScIsEmpty();
561  bool IsString();
562  void ScIsString();
563  void ScIsNonString();
564  void ScIsLogical();
565  void ScType();
566  void ScCell();
567  void ScCellExternal();
568  void ScIsRef();
569  void ScIsValue();
570  void ScIsFormula();
571  void ScFormula();
572  void ScRoman();
573  void ScArabic();
574  void ScIsNV();
575  void ScIsErr();
576  void ScIsError();
577  bool IsEven();
578  void ScIsEven();
579  void ScIsOdd();
580  void ScN();
581  void ScCode();
582  void ScTrim();
583  void ScUpper();
584  void ScProper();
585  void ScLower();
586  void ScLen();
587  void ScT();
588  void ScValue();
589  void ScNumberValue();
590  void ScClean();
591  void ScChar();
592  void ScJis();
593  void ScAsc();
594  void ScUnicode();
595  void ScUnichar();
596  void ScMin( bool bTextAsZero = false );
597  void ScMax( bool bTextAsZero = false );
600  size_t GetRefListArrayMaxSize( short nParamCount );
603  bool SwitchToArrayRefList( ScMatrixRef& xResMat, SCSIZE nMatRows, double fCurrent,
604  const std::function<void( SCSIZE i, double fCurrent )>& MatOpFunc, bool bDoMatOp );
605  void IterateParameters( ScIterFunc, bool bTextAsZero = false );
606  void ScSumSQ();
607  void ScSum();
608  void ScProduct();
609  void ScAverage( bool bTextAsZero = false );
610  void ScCount();
611  void ScCount2();
612  void GetStVarParams( bool bTextAsZero, double(*VarResult)( double fVal, size_t nValCount ) );
613  void ScVar( bool bTextAsZero = false );
614  void ScVarP( bool bTextAsZero = false );
615  void ScStDev( bool bTextAsZero = false );
616  void ScStDevP( bool bTextAsZero = false );
617  void ScRawSubtract();
618  void ScColumns();
619  void ScRows();
620  void ScSheets();
621  void ScColumn();
622  void ScRow();
623  void ScSheet();
624  void ScMatch();
626  void ScCountIf();
627  void ScSumIf();
628  void ScAverageIf();
629  void IterateParametersIfs( double(*ResultFunc)( const sc::ParamIfsResult& rRes ) );
630  void ScSumIfs();
631  void ScAverageIfs();
632  void ScCountIfs();
633  void ScCountEmptyCells();
634  void ScLookup();
635  void ScHLookup();
636  void ScVLookup();
637  void ScSubTotal();
638 
639  // If upon call rMissingField==true then the database field parameter may be
640  // missing (Xcl DCOUNT() syntax), or may be faked as missing by having the
641  // value 0.0 or being exactly the entire database range reference (old SO
642  // compatibility). If this was the case then rMissingField is set to true upon
643  // return. If rMissingField==false upon call all "missing cases" are considered
644  // to be an error.
645  std::unique_ptr<ScDBQueryParamBase> GetDBParams( bool& rMissingField );
646 
647  void DBIterator( ScIterFunc );
648  void ScDBSum();
649  void ScDBCount();
650  void ScDBCount2();
651  void ScDBAverage();
652  void ScDBGet();
653  void ScDBMax();
654  void ScDBMin();
655  void ScDBProduct();
656  void GetDBStVarParams( double& rVal, double& rValCount );
657  void ScDBStdDev();
658  void ScDBStdDevP();
659  void ScDBVar();
660  void ScDBVarP();
661  void ScIndirect();
662  void ScAddressFunc();
663  void ScOffset();
664  void ScIndex();
665  void ScMultiArea();
666  void ScAreas();
667  void ScCurrency();
668  void ScReplace();
669  void ScFixed();
670  void ScFind();
671  void ScExact();
672  void ScLeft();
673  void ScRight();
674  void ScSearch();
675  void ScMid();
676  void ScText();
677  void ScSubstitute();
678  void ScRept();
679  void ScRegex();
680  void ScConcat();
681  void ScConcat_MS();
682  void ScTextJoin_MS();
683  void ScIfs_MS();
684  void ScSwitch_MS();
685  void ScMinIfs_MS();
686  void ScMaxIfs_MS();
687  void ScExternal();
688  void ScMissing();
689  void ScMacro();
690  bool SetSbxVariable( SbxVariable* pVar, const ScAddress& );
692  void ScErrorType();
693  void ScErrorType_ODF();
694  void ScDBArea();
695  void ScColRowNameAuto();
696  void ScGetPivotData();
697  void ScHyperLink();
698  void ScBahtText();
699  void ScBitAnd();
700  void ScBitOr();
701  void ScBitXor();
702  void ScBitRshift();
703  void ScBitLshift();
704  void ScTTT();
705  void ScDebugVar();
706 
717  double GetDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, bool bStrict );
718 
719  void ScGetActDate();
720  void ScGetActTime();
721  void ScGetYear();
722  void ScGetMonth();
723  void ScGetDay();
724  void ScGetDayOfWeek();
725  void ScGetWeekOfYear();
726  void ScGetIsoWeekOfYear();
727  void ScWeeknumOOo();
728  void ScEasterSunday();
729  FormulaError GetWeekendAndHolidayMasks( const sal_uInt8 nParamCount, const sal_uInt32 nNullDate,
730  ::std::vector<double>& rSortArray, bool bWeekendMask[ 7 ] );
731  FormulaError GetWeekendAndHolidayMasks_MS( const sal_uInt8 nParamCount, const sal_uInt32 nNullDate,
732  ::std::vector<double>& rSortArray, bool bWeekendMask[ 7 ], bool bWorkdayFunction );
733  static inline sal_Int16 GetDayOfWeek( sal_Int32 n );
734  void ScNetWorkdays( bool bOOXML_Version );
735  void ScWorkday_MS();
736  void ScGetHour();
737  void ScGetMin();
738  void ScGetSec();
739  void ScPlusMinus();
740  void ScAbs();
741  void ScInt();
742  void ScEven();
743  void ScOdd();
744  void ScCeil( bool bODFF );
745  void ScCeil_MS();
746  void ScCeil_Precise();
747  void ScFloor( bool bODFF );
748  void ScFloor_MS();
749  void ScFloor_Precise();
750  void RoundNumber( rtl_math_RoundingMode eMode );
751  void ScRound();
752  void ScRoundUp();
753  void ScRoundDown();
754  void ScGetDateValue();
755  void ScGetTimeValue();
756  void ScArcTan2();
757  void ScLog();
758  void ScGetDate();
759  void ScGetTime();
760  void ScGetDiffDate();
761  void ScGetDiffDate360();
762  void ScGetDateDif();
763  void ScPower();
764  void ScAmpersand();
765  void ScAdd();
766  void ScSub();
767  void ScMul();
768  void ScDiv();
769  void ScPow();
770  void ScCurrent();
771  void ScStyle();
772  void ScDde();
773  void ScBase();
774  void ScDecimal();
775  void ScConvertOOo();
776  void ScEuroConvert();
777  void ScRoundSignificant();
778  static void RoundSignificant( double fX, double fDigits, double &fRes );
779 
780  // financial functions
781  void ScNPV();
782  void ScIRR();
783  void ScMIRR();
784  void ScISPMT();
785 
786  static double ScGetPV(double fRate, double fNper, double fPmt,
787  double fFv, bool bPayInAdvance);
788  void ScPV();
789  void ScSYD();
790  static double ScGetDDB(double fCost, double fSalvage, double fLife,
791  double fPeriod, double fFactor);
792  void ScDDB();
793  void ScDB();
794  static double ScInterVDB(double fCost, double fSalvage, double fLife, double fLife1,
795  double fPeriod, double fFactor);
796  void ScVDB();
797  void ScPDuration();
798  void ScSLN();
799  static double ScGetPMT(double fRate, double fNper, double fPv,
800  double fFv, bool bPayInAdvance);
801  void ScPMT();
802  void ScRRI();
803  static double ScGetFV(double fRate, double fNper, double fPmt,
804  double fPv, bool bPayInAdvance);
805  void ScFV();
806  void ScNper();
807  static bool RateIteration(double fNper, double fPayment, double fPv,
808  double fFv, bool bPayType, double& fGuess);
809  void ScRate();
810  double ScGetIpmt(double fRate, double fPer, double fNper, double fPv,
811  double fFv, bool bPayInAdvance, double& fPmt);
812  void ScIpmt();
813  void ScPpmt();
814  void ScCumIpmt();
815  void ScCumPrinc();
816  void ScEffect();
817  void ScNominal();
818  void ScMod();
819  void ScIntercept();
820  void ScGCD();
821  void ScLCM();
822 
823  // matrix functions
824  void ScMatValue();
825  static void MEMat(const ScMatrixRef& mM, SCSIZE n);
826  void ScMatDet();
827  void ScMatInv();
828  void ScMatMult();
829  void ScMatTrans();
830  void ScEMat();
831  void ScMatRef();
832  ScMatrixRef MatConcat(const ScMatrixRef& pMat1, const ScMatrixRef& pMat2);
833  void ScSumProduct();
834  void ScSumX2MY2();
835  void ScSumX2DY2();
836  void ScSumXMY2();
837  void ScGrowth();
838  bool CalculateSkew(KahanSum& fSum, double& fCount, std::vector<double>& values);
839  void CalculateSkewOrSkewp( bool bSkewp );
840  void CalculateSlopeIntercept(bool bSlope);
841  void CalculateSmallLarge(bool bSmall);
842  void CalculatePearsonCovar( bool _bPearson, bool _bStexy, bool _bSample ); //fdo#70000 argument _bSample is ignored if _bPearson == true
843  bool CalculateTest( bool _bTemplin
844  ,const SCSIZE nC1, const SCSIZE nC2,const SCSIZE nR1,const SCSIZE nR2
845  ,const ScMatrixRef& pMat1,const ScMatrixRef& pMat2
846  ,double& fT,double& fF);
847  void CalculateLookup(bool bHLookup);
848  bool FillEntry(ScQueryEntry& rEntry);
849  void CalculateAddSub(bool _bSub);
850  void CalculateTrendGrowth(bool _bGrowth);
851  void CalculateRGPRKP(bool _bRKP);
852  void CalculateSumX2MY2SumX2DY2(bool _bSumX2DY2);
853  void CalculateMatrixValue(const ScMatrix* pMat,SCSIZE nC,SCSIZE nR);
854  bool CheckMatrix(bool _bLOG,sal_uInt8& nCase,SCSIZE& nCX,SCSIZE& nCY,SCSIZE& nRX,SCSIZE& nRY,SCSIZE& M,SCSIZE& N,ScMatrixRef& pMatX,ScMatrixRef& pMatY);
855  void ScLinest();
856  void ScLogest();
857  void ScForecast();
858  void ScForecast_Ets( ScETSType eETSType );
859  void ScFourier();
860  void ScNoName();
861  void ScBadName();
862  // Statistics:
863  static double taylor(const double* pPolynom, sal_uInt16 nMax, double x);
864  static double gauss(double x);
865 
866 public:
867  static double phi(double x);
868  static double integralPhi(double x);
869  static double gaussinv(double x);
870  static double GetPercentile( ::std::vector<double> & rArray, double fPercentile );
871 
872 
873 private:
874  double GetBetaDist(double x, double alpha, double beta); //cumulative distribution function
875  double GetBetaDistPDF(double fX, double fA, double fB); //probability density function)
876  double GetChiDist(double fChi, double fDF); // for LEGACY.CHIDIST, returns right tail
877  double GetChiSqDistCDF(double fX, double fDF); // for CHISQDIST, returns left tail
878  static double GetChiSqDistPDF(double fX, double fDF); // probability density function
879  double GetFDist(double x, double fF1, double fF2);
880  double GetTDist( double T, double fDF, int nType );
881  double Fakultaet(double x);
882  static double BinomKoeff(double n, double k);
883  double GetGamma(double x);
884  static double GetLogGamma(double x);
885  double GetBeta(double fAlpha, double fBeta);
886  static double GetLogBeta(double fAlpha, double fBeta);
887  double GetBinomDistPMF(double x, double n, double p); //probability mass function
888  double GetHypGeomDist( double x, double n, double M, double N );
889  void ScLogGamma();
890  void ScGamma();
891  void ScPhi();
892  void ScGauss();
893  void ScStdNormDist();
894  void ScStdNormDist_MS();
895  void ScFisher();
896  void ScFisherInv();
897  void ScFact();
898  void ScNormDist( int nMinParamCount );
899  void ScGammaDist( bool bODFF );
900  void ScGammaInv();
901  void ScExpDist();
902  void ScBinomDist();
903  void ScPoissonDist( bool bODFF );
904  void ScCombin();
905  void ScCombinA();
906  void ScPermut();
907  void ScPermutationA();
908  void ScB();
909  void ScHypGeomDist( int nMinParamCount );
910  void ScLogNormDist( int nMinParamCount );
911  void ScLogNormInv();
912  void ScTDist();
913  void ScTDist_MS();
914  void ScTDist_T( int nTails );
915  void ScFDist();
916  void ScFDist_LT();
917  void ScChiDist( bool bODFF); // for LEGACY.CHIDIST, returns right tail
918  void ScChiSqDist(); // returns left tail or density
919  void ScChiSqDist_MS();
920  void ScChiSqInv(); // inverse to CHISQDIST
921  void ScWeibull();
922  void ScBetaDist();
923  void ScBetaDist_MS();
924  void ScFInv();
925  void ScFInv_LT();
926  void ScTInv( int nType );
927  void ScChiInv();
928  void ScBetaInv();
929  void ScCritBinom();
930  void ScNegBinomDist();
931  void ScNegBinomDist_MS();
932  void ScKurt();
933  void ScHarMean();
934  void ScGeoMean();
935  void ScStandard();
936  void ScSkew();
937  void ScSkewp();
938  void ScMedian();
939  double GetMedian( ::std::vector<double> & rArray );
940  double GetPercentileExclusive( ::std::vector<double> & rArray, double fPercentile );
941  std::vector<double> GetTopNumberArray( SCSIZE& rCol, SCSIZE& rRow );
942  void GetNumberSequenceArray( sal_uInt8 nParamCount, ::std::vector<double>& rArray, bool bConvertTextInArray );
943  void GetSortArray( sal_uInt8 nParamCount, ::std::vector<double>& rSortArray, ::std::vector<tools::Long>* pIndexOrder, bool bConvertTextInArray, bool bAllowEmptyArray );
944  static void QuickSort(::std::vector<double>& rSortArray, ::std::vector<tools::Long>* pIndexOrder);
945  void ScModalValue();
946  void ScModalValue_MS( bool bSingle );
947  void ScAveDev();
948  void ScAggregate();
949  void ScDevSq();
950  void ScZTest();
951  void ScTTest();
952  void ScFTest();
953  void ScChiTest();
954  void ScRank( bool bAverage );
955  void ScPercentile( bool bInclusive );
956  void ScPercentrank( bool bInclusive );
957  static double GetPercentrank( ::std::vector<double> & rArray, double fVal, bool bInclusive );
958  void ScLarge();
959  void ScSmall();
960  void ScFrequency();
961  void ScQuartile( bool bInclusive );
962  void ScNormInv();
963  void ScSNormInv();
964  void ScConfidence();
965  void ScConfidenceT();
966  void ScTrimMean();
967  void ScProbability();
968  void ScCorrel();
969  void ScCovarianceP();
970  void ScCovarianceS();
971  void ScPearson();
972  void ScRSQ();
973  void ScSTEYX();
974  void ScSlope();
975  void ScTrend();
976  void ScInfo();
977  void ScLenB();
978  void ScRightB();
979  void ScLeftB();
980  void ScMidB();
981  void ScReplaceB();
982  void ScFindB();
983  void ScSearchB();
984 
985  void ScFilterXML();
986  void ScWebservice();
987  void ScEncodeURL();
988  void ScColor();
989  void ScErf();
990  void ScErfc();
991 
992  static const double fMaxGammaArgument;
993 
994  double GetGammaContFraction(double fA,double fX);
995  double GetGammaSeries(double fA,double fX);
996  double GetLowRegIGamma(double fA,double fX); // lower regularized incomplete gamma function, GAMMAQ
997  double GetUpRegIGamma(double fA,double fX); // upper regularized incomplete gamma function, GAMMAP
998  // probability density function; fLambda is "scale" parameter
999  double GetGammaDistPDF(double fX, double fAlpha, double fLambda);
1000  // cumulative distribution function; fLambda is "scale" parameter
1001  double GetGammaDist(double fX, double fAlpha, double fLambda);
1002  double GetTInv( double fAlpha, double fSize, int nType );
1003 
1004 public:
1005  ScInterpreter( ScFormulaCell* pCell, ScDocument& rDoc, ScInterpreterContext& rContext,
1006  const ScAddress&, ScTokenArray&, bool bForGroupThreading = false );
1007  ~ScInterpreter();
1008 
1009  // Used only for threaded formula-groups.
1010  // Resets the interpreter object, allowing reuse of interpreter object for each cell
1011  // in the group.
1012  void Init( ScFormulaCell* pCell, const ScAddress& rPos, ScTokenArray& rTokArray );
1013 
1015 
1016  void SetError(FormulaError nError)
1017  { if (nError != FormulaError::NONE && nGlobalError == FormulaError::NONE) nGlobalError = nError; }
1018  void AssertFormulaMatrix();
1019 
1021  { mpLinkManager = pLinkMgr; }
1022 
1023  FormulaError GetError() const { return nGlobalError; }
1024  formula::StackVar GetResultType() const { return xResult->GetType(); }
1025  const svl::SharedString & GetStringResult() const;
1026  double GetNumResult() const { return xResult->GetDouble(); }
1030 };
1031 
1033 {
1034  return bMatrixFormula || pCur->IsInForceArray();
1035 }
1036 
1038 {
1039  if (IsInArrayContext())
1041 }
1042 
1044 {
1046  !pJumpMatrix && sp > 0 )
1047  return ConvertMatrixParameters();
1048  return false;
1049 }
1050 
1052 {
1053  if (!pTokenMatrixMap)
1054  pTokenMatrixMap = CreateTokenMatrixMap();
1055  return *pTokenMatrixMap;
1056 }
1057 
1058 inline bool ScInterpreter::MustHaveParamCount( short nAct, short nMust )
1059 {
1060  if ( nAct == nMust )
1061  return true;
1062  if ( nAct < nMust )
1064  else
1066  return false;
1067 }
1068 
1069 inline bool ScInterpreter::MustHaveParamCount( short nAct, short nMust, short nMax )
1070 {
1071  if ( nMust <= nAct && nAct <= nMax )
1072  return true;
1073  if ( nAct < nMust )
1075  else
1077  return false;
1078 }
1079 
1080 inline bool ScInterpreter::MustHaveParamCountMin( short nAct, short nMin )
1081 {
1082  if ( nAct >= nMin )
1083  return true;
1085  return false;
1086 }
1087 
1089 {
1090  if (!std::isfinite( fVal))
1091  {
1092  fVal = -1.0;
1093  return false;
1094  }
1095  else if (fVal < 0.0)
1096  {
1097  fVal = 0.0;
1098  return false;
1099  }
1100  else if (fVal > SAL_MAX_INT32)
1101  {
1102  fVal = static_cast<double>(SAL_MAX_INT32);
1103  return false;
1104  }
1105  return true;
1106 }
1107 
1109 {
1110  double fVal = rtl::math::approxFloor( GetDouble());
1111  if (!CheckStringPositionArgument( fVal))
1112  {
1113  fVal = -1.0;
1114  SetError( FormulaError::IllegalArgument);
1115  }
1116  return static_cast<sal_Int32>(fVal);
1117 }
1118 
1119 inline bool ScInterpreter::CheckStringResultLen( OUString& rResult, const OUString& rAdd )
1120 {
1121  if (rAdd.getLength() > kScInterpreterMaxStrLen - rResult.getLength())
1122  {
1123  SetError( FormulaError::StringOverflow );
1124  rResult.clear();
1125  return false;
1126  }
1127  return true;
1128 }
1129 
1130 inline bool ScInterpreter::CheckStringResultLen( OUStringBuffer& rResult, const OUString& rAdd )
1131 {
1132  if (rAdd.getLength() > kScInterpreterMaxStrLen - rResult.getLength())
1133  {
1134  SetError( FormulaError::StringOverflow );
1135  rResult = OUStringBuffer();
1136  return false;
1137  }
1138  return true;
1139 }
1140 
1141 inline void ScInterpreter::TreatDoubleError( double& rVal )
1142 {
1143  if ( !std::isfinite( rVal ) )
1144  {
1145  FormulaError nErr = GetDoubleErrorValue( rVal );
1146  if ( nErr != FormulaError::NONE )
1147  SetError( nErr );
1148  else
1149  SetError( FormulaError::NoValue );
1150  rVal = 0.0;
1151  }
1152 }
1153 
1154 inline double ScInterpreter::div( const double& fNumerator, const double& fDenominator )
1155 {
1156  return sc::div(fNumerator, fDenominator);
1157 }
1158 
1159 inline sal_Int16 ScInterpreter::GetDayOfWeek( sal_Int32 n )
1160 { // monday = 0, ..., sunday = 6
1161  return static_cast< sal_Int16 >( ( n - 1 ) % 7 );
1162 }
1163 
1164 /* 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:1710
void ScGCD()
Definition: interpr5.cxx:129
void ScDecimal()
Definition: interpr2.cxx:2903
double GetLowRegIGamma(double fA, double fX)
You must ensure fA>0.0 && fX>0.0)
Definition: interpr6.cxx:119
void ScRoundSignificant()
Definition: interpr2.cxx:1013
void ScFormula()
Definition: interpr1.cxx:2760
void ScGetDiffDate()
Definition: interpr2.cxx:663
::boost::intrusive_ptr< const FormulaToken > FormulaConstTokenRef
void ScFrequency()
Definition: interpr5.cxx:1860
void ScDBArea()
Definition: interpr4.cxx:3658
void ScBadName()
Definition: interpr3.cxx:186
void ScIndirect()
Definition: interpr1.cxx:8045
void ScArcTan2()
Definition: interpr2.cxx:1233
void GetExternalDoubleRef(sal_uInt16 nFileId, const OUString &rTabName, const ScComplexRefData &aData, ScExternalRefCache::TokenArrayRef &rArray)
Definition: interpr4.cxx:1258
void ScLessEqual()
Definition: interpr1.cxx:1231
void ScPearson()
Definition: interpr3.cxx:4533
void ScSumIfs()
Definition: interpr1.cxx:6454
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:2183
void CalculateMatrixValue(const ScMatrix *pMat, SCSIZE nC, SCSIZE nR)
Definition: interpr5.cxx:707
void ScEasterSunday()
Definition: interpr2.cxx:301
static void RoundSignificant(double fX, double fDigits, double &fRes)
Definition: interpr2.cxx:1006
void ScVarP(bool bTextAsZero=false)
Definition: interpr1.cxx:4163
formula::FormulaTokenIterator aCode
Definition: interpre.hxx:192
bool CalculateSkew(KahanSum &fSum, double &fCount, std::vector< double > &values)
Definition: interpr3.cxx:3227
SvNumFormatType nFuncFmtType
Definition: interpre.hxx:214
void ScGetTimeValue()
Definition: interpr2.cxx:913
void ScSwitch_MS()
Definition: interpr8.cxx:1919
void ScUnichar()
Definition: interpr1.cxx:3573
void ScErfc()
Definition: interpr7.cxx:506
void ScUnicode()
Definition: interpr1.cxx:3559
void ScDebugVar()
Definition: interpr7.cxx:450
void ScBetaInv()
Definition: interpr3.cxx:2218
void ScRank(bool bAverage)
Definition: interpr3.cxx:4222
void CalculateAddSub(bool _bSub)
Definition: interpr5.cxx:1279
void ScMacro()
Definition: interpr4.cxx:3188
static double GetPercentile(::std::vector< double > &rArray, double fPercentile)
Definition: interpr3.cxx:3416
void PushIllegalParameter()
Definition: interpr4.cxx:1906
void ScGauss()
Definition: interpr3.cxx:1146
void ScGetDay()
Definition: interpr2.cxx:132
void PushTempToken(formula::FormulaToken *)
Does substitute with formula::FormulaErrorToken in case nGlobalError is set and the token passed is n...
Definition: interpr4.cxx:612
void ScLCM()
Definition: interpr5.cxx:203
void ScCritBinom()
Definition: interpr3.cxx:1412
void ScEMat()
Definition: interpr5.cxx:730
void ScFloor_Precise()
Definition: interpr2.cxx:1192
static double phi(double x)
Definition: interpr3.cxx:196
FormulaError GetError() const
Definition: interpre.hxx:1023
Single reference (one address) into the sheet.
Definition: refdata.hxx:29
static double GetChiSqDistPDF(double fX, double fDF)
Definition: interpr3.cxx:690
void ScRangeFunc()
Definition: interpr2.cxx:2492
SvNumFormatType nRetFmtType
Definition: interpre.hxx:216
void CalculateSumX2MY2SumX2DY2(bool _bSumX2DY2)
Definition: interpr5.cxx:1783
void ScLog10()
Definition: interpr2.cxx:1266
void ScPDuration()
Definition: interpr2.cxx:1865
formula::StackVar Interpret()
Definition: interpr4.cxx:3944
void ScIntersect()
Definition: interpr2.cxx:2345
void ScStdNormDist_MS()
Definition: interpr3.cxx:1607
void PushSingleRef(SCCOL nCol, SCROW nRow, SCTAB nTab)
Definition: interpr4.cxx:1804
void ScNumberValue()
Definition: interpr1.cxx:3349
void ScLogest()
Definition: interpr5.cxx:2383
double GetFDist(double x, double fF1, double fF2)
Definition: interpr3.cxx:641
void ScChiTest()
Definition: interpr3.cxx:2801
void ScTDist_MS()
Definition: interpr3.cxx:1680
void ScTextJoin_MS()
Definition: interpr8.cxx:1511
formula::FormulaConstTokenRef xResult
Definition: interpre.hxx:199
SubtotalFlags mnSubTotalFlags
Definition: interpre.hxx:218
void ScRound()
Definition: interpr2.cxx:991
void ScOffset()
Definition: interpr1.cxx:8366
void ReverseStack(sal_uInt8 nParamCount)
Definition: interpr4.cxx:1977
void SetLinkManager(sfx2::LinkManager *pLinkMgr)
Definition: interpre.hxx:1020
void ScEffect()
Definition: interpr2.cxx:2288
void ScStandard()
Definition: interpr3.cxx:3212
void AssertFormulaMatrix()
Definition: interpr4.cxx:4750
double GetCellValueOrZero(const ScAddress &, ScRefCellValue &rCell)
Definition: interpr4.cxx:185
void ScHypGeomDist(int nMinParamCount)
Calculates a value of the hypergeometric distribution.
Definition: interpr3.cxx:1862
void ScRoman()
Definition: interpr2.cxx:2982
void GetSortArray(sal_uInt8 nParamCount,::std::vector< double > &rSortArray,::std::vector< tools::Long > *pIndexOrder, bool bConvertTextInArray, bool bAllowEmptyArray)
Definition: interpr3.cxx:4128
void ScLogNormInv()
Definition: interpr3.cxx:2149
void ScFourier()
Definition: interpr3.cxx:5490
ScMatrixRef GetMatrix()
Definition: interpr5.cxx:478
sal_uIntPtr sal_uLong
double GetPercentileExclusive(::std::vector< double > &rArray, double fPercentile)
Definition: interpr3.cxx:3440
bool IsMissing() const
Definition: interpr4.cxx:1926
void ScDBMin()
Definition: interpr1.cxx:7966
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:2188
const formula::FormulaToken * pCur
Definition: interpre.hxx:205
void ScRightB()
Definition: interpr1.cxx:9091
bool DoubleRefToPosSingleRef(const ScRange &rRange, ScAddress &rAdr)
Definition: interpr4.cxx:1985
void ScMax(bool bTextAsZero=false)
Definition: interpr1.cxx:3772
FormulaError GetWeekendAndHolidayMasks_MS(const sal_uInt8 nParamCount, const sal_uInt32 nNullDate,::std::vector< double > &rSortArray, bool bWeekendMask[7], bool bWorkdayFunction)
Definition: interpr2.cxx:381
void ConvertMatrixJumpConditionToMatrix()
Definition: interpr4.cxx:1412
double GetGamma(double x)
You must ensure non integer arguments for fZ<1.
Definition: interpr3.cxx:586
void ScIsEven()
Definition: interpr1.cxx:3111
void ScGreater()
Definition: interpr1.cxx:1214
void ScDBVar()
Definition: interpr1.cxx:8031
void ScCeil_MS()
Definition: interpr2.cxx:1083
void ScHLookup()
Definition: interpr1.cxx:7193
static thread_local bool bGlobalStackInUse
Definition: interpre.hxx:189
void GetNumberSequenceArray(sal_uInt8 nParamCount,::std::vector< double > &rArray, bool bConvertTextInArray)
Definition: interpr3.cxx:3945
void ScColumn()
Definition: interpr1.cxx:4375
void ScCeil(bool bODFF)
tdf69552 ODFF1.2 function CEILING and Excel function CEILING.MATH In essence, the difference between ...
Definition: interpr2.cxx:1043
void PopSingleRef(ScAddress &)
Definition: interpr4.cxx:901
bool FillEntry(ScQueryEntry &rEntry)
Definition: interpr1.cxx:7451
void ScConcat_MS()
Definition: interpr8.cxx:1378
void ScIfs_MS()
Definition: interpr8.cxx:1852
void ScGetActDate()
Definition: interpr2.cxx:98
void ScDevSq()
Definition: interpr3.cxx:4443
void PushDoubleRef(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2)
Definition: interpr4.cxx:1814
void ScBitAnd()
Definition: interpr1.cxx:1640
double GetChiDist(double fChi, double fDF)
You must ensure fDF>0.0.
Definition: interpr3.cxx:670
OpCode GetOpCode() const
void ScIsEmpty()
Definition: interpr1.cxx:1966
formula::StackVar GetRawStackType()
Raw stack type without default replacements.
Definition: interpr4.cxx:1931
void ScChiSqDist_MS()
Definition: interpr3.cxx:751
void CalculateRGPRKP(bool _bRKP)
Definition: interpr5.cxx:2388
void ScIntercept()
Definition: interpr3.cxx:4727
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:175
void ScChiSqDist()
Definition: interpr3.cxx:728
void ScStdNormDist()
Definition: interpr3.cxx:1602
void ScGetDiffDate360()
Definition: interpr2.cxx:673
void ScConcat()
Definition: interpr1.cxx:9753
void ScSumProduct()
Definition: interpr5.cxx:1718
void ScBitLshift()
Definition: interpr1.cxx:1685
void ScModalValue_MS(bool bSingle)
Definition: interpr3.cxx:3560
sal_uLong GetRetFormatIndex() const
Definition: interpre.hxx:1029
void ScDBCount2()
Definition: interpr1.cxx:7926
void ScGetMin()
Definition: interpr2.cxx:139
constexpr double get() const
Returns the final sum.
Definition: kahan.hxx:181
void ScArcCotHyp()
Definition: interpr1.cxx:1923
bool IsString()
Definition: interpr1.cxx:2020
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:992
void ScGammaInv()
Definition: interpr3.cxx:2178
void ScPoissonDist(bool bODFF)
Definition: interpr3.cxx:1787
std::vector< double > GetTopNumberArray(SCSIZE &rCol, SCSIZE &rRow)
Definition: interpr3.cxx:3860
void ScEqual()
Definition: interpr1.cxx:1163
void ScFilterXML()
Definition: interpr7.cxx:39
double GetDoubleWithDefault(double nDefault)
Definition: interpr4.cxx:2146
void ScGammaDist(bool bODFF)
Definition: interpr3.cxx:2097
bool IfErrorPushError()
If nGlobalError is set push formula::FormulaErrorToken.
Definition: interpre.hxx:302
bool ConvertMatrixParameters()
Definition: interpr4.cxx:1436
bool PopDoubleRefOrSingleRef(ScAddress &rAdr)
Definition: interpr4.cxx:1316
void ScRight()
Definition: interpr1.cxx:9283
void ScGetActTime()
Definition: interpr2.cxx:106
static std::unique_ptr< ScTokenMatrixMap > CreateTokenMatrixMap()
Definition: interpr4.cxx:1431
ScTokenMatrixMap & GetTokenMatrixMap()
Definition: interpre.hxx:1051
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:681
void ScNoName()
Definition: interpr3.cxx:181
void CurFmtToFuncFmt()
Definition: interpre.hxx:462
void ScCount2()
Definition: interpr6.cxx:982
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:641
void PushParameterExpected()
Definition: interpr4.cxx:1901
void ScRandbetween()
Definition: interpr1.cxx:1796
SubtotalFlags
Definition: global.hxx:249
void ScCellExternal()
Definition: interpr1.cxx:2427
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:3588
sal_uInt16 sal_Unicode
void ScSumSQ()
Definition: interpr6.cxx:957
sal_uInt32 GetCellNumberFormat(const ScAddress &rPos, ScRefCellValue &rCell)
Definition: interpr4.cxx:122
void ScReplaceB()
Definition: interpr1.cxx:9181
void ScCeil_Precise()
Definition: interpr2.cxx:1101
double PopDouble()
Definition: interpr4.cxx:775
ScInterpreter(ScFormulaCell *pCell, ScDocument &rDoc, ScInterpreterContext &rContext, const ScAddress &, ScTokenArray &, bool bForGroupThreading=false)
Definition: interpr4.cxx:3773
double GetBeta(double fAlpha, double fBeta)
Definition: interpr3.cxx:801
char sal_uInt16 & nParamCount
Definition: callform.cxx:53
void ScGetHour()
Definition: interpr2.cxx:158
void ScSearchB()
Definition: interpr1.cxx:9238
void ScUnionFunc()
Definition: interpr2.cxx:2512
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:19
void ScCorrel()
Definition: interpr3.cxx:4517
sal_Int16 GetInt16()
if GetDouble() not within int16 limits sets nGlobalError and returns SAL_MAX_INT16 ...
Definition: interpr4.cxx:2197
void ScDBAverage()
Definition: interpr1.cxx:7956
void PushInt(int nVal)
Definition: interpr4.cxx:1776
void ScAverage(bool bTextAsZero=false)
Definition: interpr6.cxx:972
SvNumFormatType nCurFmtType
Definition: interpre.hxx:215
sal_Int32 GetStringPositionArgument()
Obtain a sal_Int32 suitable as string position or length argument.
Definition: interpre.hxx:1108
std::unique_ptr< ScTokenMatrixMap > pTokenMatrixMap
Definition: interpre.hxx:201
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:1526
ScMatrixRef GetNewMat(SCSIZE nC, SCSIZE nR, bool bEmpty=false)
Definition: interpr5.cxx:298
static ScCalcConfig * mpGlobalConfig
Definition: interpre.hxx:186
void ScMatTrans()
Definition: interpr5.cxx:1127
void ScSinHyp()
Definition: interpr1.cxx:1880
void ScGetDateValue()
Definition: interpr2.cxx:166
void ScExpDist()
Definition: interpr3.cxx:1621
void PushExternalDoubleRef(sal_uInt16 nFileId, const OUString &rTabName, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2)
Definition: interpr4.cxx:1837
void ScFisher()
Definition: interpr3.cxx:1151
static double ScGetPMT(double fRate, double fNper, double fPv, double fFv, bool bPayInAdvance)
Definition: interpr2.cxx:1891
void CalculateSlopeIntercept(bool bSlope)
Definition: interpr3.cxx:4652
void ScNormInv()
Definition: interpr3.cxx:2122
static double ScGetFV(double fRate, double fNper, double fPmt, double fPv, bool bPayInAdvance)
Definition: interpr2.cxx:1938
ScIterFuncIf
Definition: interpre.hxx:112
void MatrixJumpConditionToMatrix()
Definition: interpre.hxx:1037
ScMatrixRef QueryMat(const ScMatrixRef &pMat, sc::CompareOptions &rOptions)
Definition: interpr1.cxx:1141
static double gaussinv(double x)
Definition: interpr3.cxx:269
ScETSType
Definition: interpre.hxx:118
void ScProper()
Definition: interpr1.cxx:3160
static const double fMaxGammaArgument
Definition: interpre.hxx:992
void ScFindB()
Definition: interpr1.cxx:9204
sal_Int32 double_to_int32(double fVal)
Definition: interpr4.cxx:2155
::boost::intrusive_ptr< ScMatrix > ScMatrixRef
Definition: types.hxx:25
void ScWebservice()
Definition: interpr7.cxx:272
void ScColumns()
Definition: interpr1.cxx:4214
void PushString(const OUString &rStr)
Definition: interpr4.cxx:1793
ScFormulaCell * pMyFormulaCell
Definition: interpre.hxx:202
FormulaError mnStringNoValueError
Definition: interpre.hxx:217
void ScArcSinHyp()
Definition: interpr1.cxx:1900
void ScSecantHyp()
Definition: interpr1.cxx:1947
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:1736
void ScLinest()
Definition: interpr5.cxx:2377
const formula::FormulaToken ** pStack
Definition: interpre.hxx:207
void ScDBCount()
Definition: interpr1.cxx:7868
void ScConvertOOo()
Definition: interpr2.cxx:2959
void ScChooseJump()
Definition: interpr1.cxx:407
void ScIsString()
Definition: interpr1.cxx:2088
void PushError(FormulaError nError)
Definition: interpr4.cxx:1895
sc::RangeMatrix CompareMat(ScQueryOp eOp, sc::CompareOptions *pOptions=nullptr)
Definition: interpr1.cxx:979
void ScCount()
Definition: interpr6.cxx:977
void ScChiSqInv()
Definition: interpr3.cxx:2409
void ScSumIf()
Definition: interpr1.cxx:5597
void ScGetWeekOfYear()
Definition: interpr2.cxx:245
double GetTDist(double T, double fDF, int nType)
Definition: interpr3.cxx:649
void ScSheet()
Definition: interpr1.cxx:4582
void ScFalse()
Definition: interpr1.cxx:1824
void ScGreaterEqual()
Definition: interpr1.cxx:1248
void ScNetWorkdays(bool bOOXML_Version)
Definition: interpr2.cxx:498
void ScColRowNameAuto()
Definition: interpr4.cxx:3675
void IterateParametersIf(ScIterFuncIf)
Definition: interpr1.cxx:5192
void ScFisherInv()
Definition: interpr3.cxx:1160
void MakeMatNew(ScMatrixRef &rMat, SCSIZE nC, SCSIZE nR)
Definition: interpr5.cxx:283
sc::RangeMatrix PopRangeMatrix()
Definition: interpr4.cxx:1642
void ScIsOdd()
Definition: interpr1.cxx:3116
double GetDouble()
Definition: interpr4.cxx:2065
std::unique_ptr< ScDBQueryParamBase > GetDBParams(bool &rMissingField)
Definition: interpr1.cxx:7658
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:456
ScInterpreterContext & mrContext
Definition: interpre.hxx:195
void ScInt()
Definition: interpr2.cxx:951
void ScEuroConvert()
Definition: interpr2.cxx:3254
bool LookupQueryWithCache(ScAddress &o_rResultPos, const ScQueryParam &rParam) const
Definition: interpr1.cxx:10024
bool MustHaveParamCount(short nAct, short nMust)
Definition: interpre.hxx:1058
static void SetGlobalConfig(const ScCalcConfig &rConfig)
Definition: interpr4.cxx:3867
void ScSkewp()
Definition: interpr3.cxx:3377
ScMatrixRef PopMatrix()
Definition: interpr4.cxx:1610
void ScFloor_MS()
Definition: interpr2.cxx:1171
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:594
formula::FormulaConstTokenRef PopToken()
Definition: interpr4.cxx:760
void ScGeoMean()
Definition: interpr3.cxx:3040
void DoubleRefToRange(const ScComplexRefData &, ScRange &, bool bDontCheckForTableOp=false)
Definition: interpr4.cxx:1023
void CalculateSmallLarge(bool bSmall)
Definition: interpr3.cxx:3646
::std::map< const formula::FormulaConstTokenRef, formula::FormulaConstTokenRef, FormulaTokenRef_less > ScTokenMatrixMap
Definition: interpre.hxx:134
void ScAddressFunc()
Definition: interpr1.cxx:8264
static void GlobalExit()
Definition: interpr4.cxx:3883
ScMatValType GetDoubleOrStringFromMatrix(double &rDouble, svl::SharedString &rString)
Definition: interpr4.cxx:2403
#define SAL_MAX_INT32
void ScTInv(int nType)
Definition: interpr3.cxx:2270
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:1154
double ConvertStringToValue(const OUString &)
Definition: interpr4.cxx:160
const svl::SharedString & GetStringResult() const
Definition: interpr4.cxx:4755
sal_uInt16 sp
Definition: interpre.hxx:209
void ScLookup()
Definition: interpr1.cxx:6541
void ScTrimMean()
Definition: interpr3.cxx:3831
void ScVar(bool bTextAsZero=false)
Definition: interpr1.cxx:4151
void ScCountEmptyCells()
Definition: interpr1.cxx:5112
sfx2::LinkManager * mpLinkManager
Definition: interpre.hxx:197
void ScGetIsoWeekOfYear()
Definition: interpr2.cxx:291
bool IsTableOpInRange(const ScRange &)
Definition: interpr4.cxx:104
void ScLogGamma()
Definition: interpr3.cxx:792
void ScGetDateDif()
Definition: interpr2.cxx:764
svl::SharedString PopString()
Definition: interpr4.cxx:807
void CalculatePearsonCovar(bool _bPearson, bool _bStexy, bool _bSample)
Definition: interpr3.cxx:4538
void PushDouble(double nVal)
Definition: interpr4.cxx:1769
void ScIsRef()
Definition: interpr1.cxx:2568
void ScBinomDist()
Definition: interpr3.cxx:1348
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:2147
void ScErrorType()
Definition: interpr1.cxx:9840
void ScPercentile(bool bInclusive)
Definition: interpr3.cxx:3470
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:423
static double GetLogGamma(double x)
You must ensure fZ>0.
Definition: interpr3.cxx:630
void ScAbs()
Definition: interpr2.cxx:946
sal_uInt16 & nParam
Definition: callform.cxx:57
void ScMaxIfs_MS()
Definition: interpr1.cxx:6524
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:1041
bool IsInForceArray() const
void ScMedian()
Definition: interpr3.cxx:3406
void ScArcCos()
Definition: interpr1.cxx:1865
void ScMatValue()
Definition: interpr5.cxx:629
void ScAmpersand()
Definition: interpr5.cxx:1407
void ScSlope()
Definition: interpr3.cxx:4722
void ScSum()
Definition: interpr6.cxx:962
void ScArcTan()
Definition: interpr1.cxx:1870
void ScDBGet()
Definition: interpr4.cxx:2474
static ScCalcConfig & GetOrCreateGlobalConfig()
Definition: interpr4.cxx:3860
void ScIsFormula()
Definition: interpr1.cxx:2691
static void QuickSort(::std::vector< double > &rSortArray,::std::vector< tools::Long > *pIndexOrder)
Definition: interpr3.cxx:4195
double GetDoubleFromMatrix(const ScMatrixRef &pMat)
Definition: interpr4.cxx:2024
formula::FormulaToken * CreateFormulaDoubleToken(double fVal, SvNumFormatType nFmt=SvNumFormatType::NUMBER)
Definition: interpr4.cxx:1734
bool MustHaveParamCountMin(short nAct, short nMin)
Definition: interpre.hxx:1080
SvNumFormatType GetRetFormatType() const
Definition: interpre.hxx:1028
void PushMatrix(const sc::RangeMatrix &rMat)
Definition: interpr4.cxx:1870
void ScTDist_T(int nTails)
Definition: interpr3.cxx:1662
ScTokenArray * pArr
Definition: interpre.hxx:194
void ScErrorType_ODF()
Definition: interpr1.cxx:9854
void ScIfJump()
Definition: interpr1.cxx:84
static FormulaError GetCellErrCode(const ScRefCellValue &rCell)
Definition: interpr4.cxx:155
VolatileType meVolatileType
Definition: interpre.hxx:223
void PushExternalSingleRef(sal_uInt16 nFileId, const OUString &rTabName, SCCOL nCol, SCROW nRow, SCTAB nTab)
Definition: interpr4.cxx:1825
void ScConfidence()
Definition: interpr3.cxx:2429
void QueryMatrixType(const ScMatrixRef &xMat, SvNumFormatType &rRetTypeExpr, sal_uInt32 &rRetIndexExpr)
Definition: interpr4.cxx:1682
SvNumFormatType
void GetCellString(svl::SharedString &rStr, ScRefCellValue &rCell)
Definition: interpr4.cxx:242
void ScCotHyp()
Definition: interpr1.cxx:1895
void ScCountIfs()
Definition: interpr1.cxx:6489
void ScGetYear()
Definition: interpr2.cxx:118
void ScAverageIfs()
Definition: interpr1.cxx:6472
sal_uInt8 cPar
Definition: interpre.hxx:219
void ScAreas()
Definition: interpr1.cxx:8746
FormulaError nGlobalError
Definition: interpre.hxx:208
void ScFTest()
Definition: interpr3.cxx:2736
void ScGetTime()
Definition: interpr2.cxx:647
bool CreateStringArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt8 *pCellArr)
Definition: interpr4.cxx:359
svl::SharedString GetStringFromMatrix(const ScMatrixRef &pMat)
Definition: interpr4.cxx:2381
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:8017
bool JumpMatrix(short nStackLevel)
Definition: interpr1.cxx:536
static double taylor(const double *pPolynom, sal_uInt16 nMax, double x)
Definition: interpr3.cxx:206
void ScIsLogical()
Definition: interpr1.cxx:2098
void ScChiDist(bool bODFF)
Definition: interpr3.cxx:1747
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:58
void PopRefListPushMatrixOrRef()
Definition: interpr4.cxx:1352
formula::StackVar GetResultType() const
Definition: interpre.hxx:1024
void ScNotEqual()
Definition: interpr1.cxx:1180
void ScRoundDown()
Definition: interpr2.cxx:996
void ScCumPrinc()
Definition: interpr2.cxx:2249
void ScCosecantHyp()
Definition: interpr1.cxx:1942
sal_uInt32 nFuncFmtIndex
Definition: interpre.hxx:211
void ScSheets()
Definition: interpr1.cxx:4328
formula::StackVar GetStackType()
Stack type with replacement of defaults, e.g. svMissing and formula::svEmptyCell will result in formu...
Definition: interpr4.cxx:1946
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:8024
void ReplaceCell(ScAddress &)
Definition: interpr4.cxx:85
void ScConfidenceT()
Definition: interpr3.cxx:2443
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:1131
double GetValueCellValue(const ScAddress &, double fOrig)
Only ValueCell, formula cells already store the result rounded.
Definition: interpr4.cxx:145
void ScMissing()
Definition: interpr4.cxx:3090
void ScDBVarP()
Definition: interpr1.cxx:8038
FormulaError
sal_uInt8 GetByte() const
Definition: interpre.hxx:423
void ScGetSec()
Definition: interpr2.cxx:147
bool SetSbxVariable(SbxVariable *pVar, const ScAddress &)
static const ScCalcConfig & GetGlobalConfig()
Definition: interpr4.cxx:3872
void ScCosHyp()
Definition: interpr1.cxx:1885
void ScIndex()
Definition: interpr1.cxx:8528
void ValidateRef(const ScSingleRefData &rRef)
Definition: interpr4.cxx:835
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:3836
ScDBRangeBase * PopDBDoubleRef()
Definition: interpr4.cxx:959
FormulaError GetWeekendAndHolidayMasks(const sal_uInt8 nParamCount, const sal_uInt32 nNullDate,::std::vector< double > &rSortArray, bool bWeekendMask[7])
Definition: interpr2.cxx:341
void IterateParameters(ScIterFunc, bool bTextAsZero=false)
Definition: interpr6.cxx:462
Configuration options for formula interpreter.
Definition: calcconfig.hxx:43
void ScTanHyp()
Definition: interpr1.cxx:1890
void CalculateSkewOrSkewp(bool bSkewp)
Definition: interpr3.cxx:3332
void ScUpper()
Definition: interpr1.cxx:3154
void ScSmall()
Definition: interpr3.cxx:3731
void ScMatRef()
Definition: interpr5.cxx:3210
sal_uInt16 maxsp
Definition: interpre.hxx:210
void PushIllegalArgument()
Definition: interpr4.cxx:1911
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:2226
void ScReplace()
Definition: interpr1.cxx:8839
::formula::FormulaTokenRef TokenRef
void ScGetDate()
Definition: interpr2.cxx:630
void ScWeeknumOOo()
Definition: interpr2.cxx:233
void ScCumIpmt()
Definition: interpr2.cxx:2208
sal_Int32 SCROW
Definition: types.hxx:17
void ScLower()
Definition: interpr1.cxx:3184
void ScIsNonString()
Definition: interpr1.cxx:2093
void ScModalValue()
Definition: interpr3.cxx:3516
void ScISPMT()
Definition: interpr2.cxx:1599
void ScBitRshift()
Definition: interpr1.cxx:1708
void PushWithoutError(const formula::FormulaToken &r)
Does not substitute with formula::FormulaErrorToken in case nGlobalError is set.
Definition: interpr4.cxx:578
void ScMinIfs_MS()
Definition: interpr1.cxx:6506
static double GetLogBeta(double fAlpha, double fBeta)
Definition: interpr3.cxx:834
void ScArcCot()
Definition: interpr1.cxx:1875
static bool RateIteration(double fNper, double fPayment, double fPv, double fFv, bool bPayType, double &fGuess)
Definition: interpr2.cxx:1992
void ScStyle()
Definition: interpr2.cxx:2597
void ScAggregate()
Definition: interpr1.cxx:7562
void ScStDevP(bool bTextAsZero=false)
Definition: interpr1.cxx:4185
void ScLarge()
Definition: interpr3.cxx:3726
static sal_Int16 GetDayOfWeek(sal_Int32 n)
Definition: interpre.hxx:1159
static double BinomKoeff(double n, double k)
Definition: interpr3.cxx:461
void ScPlusMinus()
Definition: interpr2.cxx:935
static double ScGetDDB(double fCost, double fSalvage, double fLife, double fPeriod, double fFactor)
Definition: interpr2.cxx:1665
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:7961
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:9950
void ScArabic()
Definition: interpr2.cxx:3068
unsigned char sal_uInt8
void ScForecast_Ets(ScETSType eETSType)
Definition: interpr8.cxx:1171
void ScRandom()
Definition: interpr1.cxx:1787
bool CreateDoubleArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt8 *pCellArr)
Definition: interpr4.cxx:277
void ScMatInv()
Definition: interpr5.cxx:966
bool bMatrixFormula
Definition: interpre.hxx:221
void PopDoubleRefPushMatrix()
Definition: interpr4.cxx:1338
FormulaError GetErrorType()
Definition: interpr1.cxx:9768
void ScIsError()
Definition: interpr1.cxx:2958
static bool MayBeRegExp(const OUString &rStr)
Could string be a regular expression? if regularExpressions are disabled the function returns false r...
Definition: interpr1.cxx:9910
ScDocument & mrDoc
Definition: interpre.hxx:196
void ScTrend()
Definition: interpr5.cxx:2902
void CalculateLookup(bool bHLookup)
Definition: interpr1.cxx:7198
void ScCurrency()
Definition: interpr1.cxx:8782
void ScLeftB()
Definition: interpr1.cxx:9140
std::shared_ptr< ScTokenArray > TokenArrayRef
void ScCurrent()
Definition: interpr2.cxx:2585
void GetStVarParams(bool bTextAsZero, double(*VarResult)(double fVal, size_t nValCount))
Definition: interpr1.cxx:3930
static double ScInterVDB(double fCost, double fSalvage, double fLife, double fLife1, double fPeriod, double fFactor)
Definition: interpr2.cxx:1743
ScJumpMatrix * pJumpMatrix
Definition: interpre.hxx:200
void ScNegBinomDist()
Definition: interpr3.cxx:1506
void ScLogNormDist(int nMinParamCount)
Definition: interpr3.cxx:1572
double GetTInv(double fAlpha, double fSize, int nType)
Definition: interpr3.cxx:2294
void ScDBSum()
Definition: interpr1.cxx:7863
ScAddress aPos
Definition: interpre.hxx:193
ScMatValType
Definition: types.hxx:31
void ScWorkday_MS()
Definition: interpr2.cxx:558
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:1101
void SingleRefToVars(const ScSingleRefData &rRef, SCCOL &rCol, SCROW &rRow, SCTAB &rTab)
Definition: interpr4.cxx:857
svl::SharedString GetStringFromDouble(const double fVal)
Definition: interpr4.cxx:2464
void ScCosecant()
Definition: interpr1.cxx:1932
void ScNormDist(int nMinParamCount)
Definition: interpr3.cxx:1552
void ScSubTotal()
Definition: interpr1.cxx:7515
void RoundNumber(rtl_math_RoundingMode eMode)
Definition: interpr2.cxx:956
void ScBahtText()
Definition: interpr2.cxx:3425
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:400
svl::SharedString GetString()
Definition: interpr4.cxx:2302
These need to be in global namespace just like their respective types are.
double GetNumResult() const
Definition: interpre.hxx:1026
void ScVLookup()
Definition: interpr1.cxx:7510
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:1921
void ScNominal()
Definition: interpr2.cxx:2307
void ScPower()
Definition: interpr5.cxx:1658
bool MatrixParameterConversion()
Definition: interpre.hxx:1043
void ScSumX2MY2()
Definition: interpr5.cxx:1779
void ScGetPivotData()
Definition: interpr2.cxx:3492
void ScPermutationA()
Definition: interpr3.cxx:1220
ScQueryOp
Definition: global.hxx:818
void ScSTEYX()
Definition: interpr3.cxx:4648
void PopExternalSingleRef(sal_uInt16 &rFileId, OUString &rTabName, ScSingleRefData &rRef)
Definition: interpr4.cxx:1115
void ScSumXMY2()
Definition: interpr5.cxx:1828
void MergeCalcConfig()
Merge global and document specific settings.
Definition: interpr4.cxx:3877
void ScSecant()
Definition: interpr1.cxx:1937
Complex reference (a range) into the sheet.
Definition: refdata.hxx:122
void ScRoundUp()
Definition: interpr2.cxx:1001
void ScChiInv()
Definition: interpr3.cxx:2374
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:2586
double GetHypGeomDist(double x, double n, double M, double N)
Calculates a value of the hypergeometric distribution.
Definition: interpr3.cxx:1901
void ScCovarianceS()
Definition: interpr3.cxx:4528
void DBIterator(ScIterFunc)
Definition: interpr1.cxx:7796
void ScMatch()
Definition: interpr1.cxx:4770
void ScRegex()
Definition: interpr1.cxx:9365
void GetDBStVarParams(double &rVal, double &rValCount)
Definition: interpr1.cxx:7976
void ScAverageIf()
Definition: interpr1.cxx:5602
void PopError()
Definition: interpr4.cxx:748
void ScWeibull()
Definition: interpr3.cxx:1769
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:9930
sc::RangeMatrix GetRangeMatrix()
Definition: interpr5.cxx:615
void ScBitXor()
Definition: interpr1.cxx:1670
void ScBitOr()
Definition: interpr1.cxx:1655
void ScTDist()
Definition: interpr3.cxx:1647
void ScFInv_LT()
Definition: interpr3.cxx:2339
void ScMin(bool bTextAsZero=false)
Definition: interpr1.cxx:3614
void ScGetMonth()
Definition: interpr2.cxx:125
void ScProbability()
Definition: interpr3.cxx:4452
void PopExternalDoubleRef(sal_uInt16 &rFileId, OUString &rTabName, ScComplexRefData &rRef)
Definition: interpr4.cxx:1194
void ScPercentrank(bool bInclusive)
Definition: interpr3.cxx:3736
void ScIsErr()
Definition: interpr1.cxx:2895
formula::FormulaToken * CreateDoubleOrTypedToken(double fVal)
Definition: interpr4.cxx:1759
void ScClean()
Definition: interpr1.cxx:3450
void ScGetDayOfWeek()
Definition: interpr2.cxx:186
bool CheckStringResultLen(OUString &rResult, const OUString &rAdd)
Definition: interpre.hxx:1119
void ScExternal()
Definition: interpr4.cxx:2509
const formula::FormulaConstTokenRef & GetResultToken() const
Definition: interpre.hxx:1027
void ScExact()
Definition: interpr1.cxx:8966
void ScFDist()
Definition: interpr3.cxx:1695
void ScForecast()
Definition: interpr3.cxx:4732
void ScMultiArea()
Definition: interpr1.cxx:8733
void ScSearch()
Definition: interpr1.cxx:9319
void ScArcSin()
Definition: interpr1.cxx:1860
void ScGrowth()
Definition: interpr5.cxx:2907
void TreatDoubleError(double &rVal)
Definition: interpre.hxx:1141
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:661
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:882
void ScCombin()
Definition: interpr3.cxx:1174
void ScArcTanHyp()
Definition: interpr1.cxx:1914
static double ScGetPV(double fRate, double fNper, double fPmt, double fFv, bool bPayInAdvance)
Definition: interpr2.cxx:1616
void PushStringBuffer(const sal_Unicode *pString)
Definition: interpr4.cxx:1782
double GetBetaDistPDF(double fX, double fA, double fB)
Definition: interpr3.cxx:863
void ScSubstitute()
Definition: interpr1.cxx:9677
void ScQuartile(bool bInclusive)
Definition: interpr3.cxx:3493
void IterateParametersIfs(double(*ResultFunc)(const sc::ParamIfsResult &rRes))
Definition: interpr1.cxx:5804
void ScValue()
Definition: interpr1.cxx:3270
void ScProduct()
Definition: interpr6.cxx:967
void ScIsValue()
Definition: interpr1.cxx:2620
double GetGammaDistPDF(double fX, double fAlpha, double fLambda)
Gamma distribution, probability density function.
Definition: interpr6.cxx:144
void ScArcCosHyp()
Definition: interpr1.cxx:1905
void ScZTest()
Definition: interpr3.cxx:2459
void ScCombinA()
Definition: interpr3.cxx:1187
void ScCountIf()
Definition: interpr1.cxx:5607
void SetError(FormulaError nError)
Definition: interpre.hxx:1016
double GetMedian(::std::vector< double > &rArray)
Definition: interpr3.cxx:3382
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:1088
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:3567
void ScFixed()
Definition: interpr1.cxx:8877
void DoubleRefToVars(const formula::FormulaToken *p, SCCOL &rCol1, SCROW &rRow1, SCTAB &rTab1, SCCOL &rCol2, SCROW &rRow2, SCTAB &rTab2)
Definition: interpr4.cxx:938
void ScStDev(bool bTextAsZero=false)
Definition: interpr1.cxx:4173
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:3774
static double ScGetGCD(double fx, double fy)
Definition: interpr5.cxx:108
void ScHyperLink()
Definition: interpr2.cxx:3125
bool GetDoubleOrString(double &rValue, svl::SharedString &rString)
returns TRUE if double (or error, check nGlobalError), else FALSE
Definition: interpr4.cxx:2242
sal_Int16 SCTAB
Definition: types.hxx:22
void ScTTest()
Definition: interpr3.cxx:2653
void ScHarMean()
Definition: interpr3.cxx:2919
void ScIfError(bool bNAonly)
Definition: interpr1.cxx:240
void ScPercentSign()
Definition: interpr1.cxx:1596
void ScSNormInv()
Definition: interpr3.cxx:2138
void ScColor()
Definition: interpr7.cxx:516
void ScMatMult()
Definition: interpr5.cxx:1078
bool IsInArrayContext() const
Definition: interpre.hxx:1032
void ScDBProduct()
Definition: interpr1.cxx:7971
double GetBetaDist(double x, double alpha, double beta)
Definition: interpr3.cxx:986
void ScAveDev()
Definition: interpr3.cxx:4285
#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:4523