Kaydet (Commit) 6e3e4cd3 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Indent part of ScInterpreter that for some reason was not indented at all

Change-Id: Ib514d8422a1a881f24fe7a10e8ce538ea997dc6b
üst 13a27860
...@@ -231,761 +231,761 @@ private: ...@@ -231,761 +231,761 @@ private:
/// Merge global and document specific settings. /// Merge global and document specific settings.
void MergeCalcConfig(); void MergeCalcConfig();
// nMust <= nAct <= nMax ? ok : PushError // nMust <= nAct <= nMax ? ok : PushError
inline bool MustHaveParamCount( short nAct, short nMust ); inline bool MustHaveParamCount( short nAct, short nMust );
inline bool MustHaveParamCount( short nAct, short nMust, short nMax ); inline bool MustHaveParamCount( short nAct, short nMust, short nMax );
inline bool MustHaveParamCountMin( short nAct, short nMin ); inline bool MustHaveParamCountMin( short nAct, short nMin );
void PushParameterExpected(); void PushParameterExpected();
void PushIllegalParameter(); void PushIllegalParameter();
void PushIllegalArgument(); void PushIllegalArgument();
void PushNoValue(); void PushNoValue();
void PushNA(); void PushNA();
// Functions for accessing a document // Functions for accessing a document
void ReplaceCell( ScAddress& ); // for TableOp void ReplaceCell( ScAddress& ); // for TableOp
bool IsTableOpInRange( const ScRange& ); bool IsTableOpInRange( const ScRange& );
sal_uLong GetCellNumberFormat( const ScAddress& rPos, ScRefCellValue& rCell ); sal_uLong GetCellNumberFormat( const ScAddress& rPos, ScRefCellValue& rCell );
double ConvertStringToValue( const OUString& ); double ConvertStringToValue( const OUString& );
public: public:
static double ScGetGCD(double fx, double fy); static double ScGetGCD(double fx, double fy);
/** For matrix back calls into the current interpreter. /** For matrix back calls into the current interpreter.
Uses rError instead of nGlobalError and rCurFmtType instead of nCurFmtType. */ Uses rError instead of nGlobalError and rCurFmtType instead of nCurFmtType. */
double ConvertStringToValue( const OUString&, FormulaError& rError, short& rCurFmtType ); double ConvertStringToValue( const OUString&, FormulaError& rError, short& rCurFmtType );
private: private:
double GetCellValue( const ScAddress&, ScRefCellValue& rCell ); double GetCellValue( const ScAddress&, ScRefCellValue& rCell );
double GetCellValueOrZero( const ScAddress&, ScRefCellValue& rCell ); double GetCellValueOrZero( const ScAddress&, ScRefCellValue& rCell );
double GetValueCellValue( const ScAddress&, double fOrig ); double GetValueCellValue( const ScAddress&, double fOrig );
void GetCellString( svl::SharedString& rStr, ScRefCellValue& rCell ); void GetCellString( svl::SharedString& rStr, ScRefCellValue& rCell );
static FormulaError GetCellErrCode( const ScRefCellValue& rCell ); static FormulaError GetCellErrCode( const ScRefCellValue& rCell );
bool CreateDoubleArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, bool CreateDoubleArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt8* pCellArr); SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt8* pCellArr);
bool CreateStringArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, bool CreateStringArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt8* pCellArr); SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt8* pCellArr);
bool CreateCellArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, bool CreateCellArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt8* pCellArr); SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt8* pCellArr);
// Stack operations // Stack operations
/** Does substitute with formula::FormulaErrorToken in case nGlobalError is set and the token /** Does substitute with formula::FormulaErrorToken in case nGlobalError is set and the token
passed is not formula::FormulaErrorToken. passed is not formula::FormulaErrorToken.
Increments RefCount of the original token if not substituted. */ Increments RefCount of the original token if not substituted. */
void Push( const formula::FormulaToken& r ); void Push( const formula::FormulaToken& r );
/** Does not substitute with formula::FormulaErrorToken in case nGlobalError is set. /** Does not substitute with formula::FormulaErrorToken in case nGlobalError is set.
Used to push RPN tokens or from within Push() or tokens that are already Used to push RPN tokens or from within Push() or tokens that are already
explicit formula::FormulaErrorToken. Increments RefCount. */ explicit formula::FormulaErrorToken. Increments RefCount. */
void PushWithoutError( const formula::FormulaToken& r ); void PushWithoutError( const formula::FormulaToken& r );
/** Does substitute with formula::FormulaErrorToken in case nGlobalError is set and the token /** Does substitute with formula::FormulaErrorToken in case nGlobalError is set and the token
passed is not formula::FormulaErrorToken. passed is not formula::FormulaErrorToken.
Increments RefCount of the original token if not substituted. Increments RefCount of the original token if not substituted.
ATTENTION! The token had to be allocated with `new' and must not be used ATTENTION! The token had to be allocated with `new' and must not be used
after this call if no RefCount was set because possibly it gets immediately after this call if no RefCount was set because possibly it gets immediately
deleted in case of an FormulaError::StackOverflow or if substituted with formula::FormulaErrorToken! */ deleted in case of an FormulaError::StackOverflow or if substituted with formula::FormulaErrorToken! */
void PushTempToken( formula::FormulaToken* ); void PushTempToken( formula::FormulaToken* );
/** Pushes the token or substitutes with formula::FormulaErrorToken in case /** Pushes the token or substitutes with formula::FormulaErrorToken in case
nGlobalError is set and the token passed is not formula::FormulaErrorToken. nGlobalError is set and the token passed is not formula::FormulaErrorToken.
Increments RefCount of the original token if not substituted. */ Increments RefCount of the original token if not substituted. */
void PushTokenRef( const formula::FormulaConstTokenRef& ); void PushTokenRef( const formula::FormulaConstTokenRef& );
/** Does not substitute with formula::FormulaErrorToken in case nGlobalError is set. /** Does not substitute with formula::FormulaErrorToken in case nGlobalError is set.
Used to push tokens from within PushTempToken() or tokens that are already Used to push tokens from within PushTempToken() or tokens that are already
explicit formula::FormulaErrorToken. Increments RefCount. explicit formula::FormulaErrorToken. Increments RefCount.
ATTENTION! The token had to be allocated with `new' and must not be used ATTENTION! The token had to be allocated with `new' and must not be used
after this call if no RefCount was set because possibly it gets immediately after this call if no RefCount was set because possibly it gets immediately
decremented again and thus deleted in case of an FormulaError::StackOverflow! */ decremented again and thus deleted in case of an FormulaError::StackOverflow! */
void PushTempTokenWithoutError( const formula::FormulaToken* ); void PushTempTokenWithoutError( const formula::FormulaToken* );
/** If nGlobalError is set push formula::FormulaErrorToken. /** If nGlobalError is set push formula::FormulaErrorToken.
If nGlobalError is not set do nothing. If nGlobalError is not set do nothing.
Used in PushTempToken() and alike to simplify handling. Used in PushTempToken() and alike to simplify handling.
@return: <TRUE/> if nGlobalError. */ @return: <TRUE/> if nGlobalError. */
bool IfErrorPushError() bool IfErrorPushError()
{
if (nGlobalError != FormulaError::NONE)
{ {
PushTempTokenWithoutError( new formula::FormulaErrorToken( nGlobalError)); if (nGlobalError != FormulaError::NONE)
return true; {
PushTempTokenWithoutError( new formula::FormulaErrorToken( nGlobalError));
return true;
}
return false;
} }
return false;
}
/** Obtain cell result / content from address and push as temp token.
@param bDisplayEmptyAsString
is passed to ScEmptyCell in case of an empty cell result.
@param pRetTypeExpr
@param pRetIndexExpr
Obtain number format and type if _both_, type and index pointer,
are not NULL.
@param bFinalResult /** Obtain cell result / content from address and push as temp token.
If TRUE, only a standard FormulaDoubleToken is pushed.
If FALSE, PushDouble() is used that may push either a
FormulaDoubleToken or a FormulaTypedDoubleToken.
*/
void PushCellResultToken( bool bDisplayEmptyAsString, const ScAddress & rAddress,
short * pRetTypeExpr, sal_uLong * pRetIndexExpr, bool bFinalResult = false );
formula::FormulaConstTokenRef PopToken();
void Pop();
void PopError();
double PopDouble();
svl::SharedString PopString();
void ValidateRef( const ScSingleRefData & rRef );
void ValidateRef( const ScComplexRefData & rRef );
void ValidateRef( const ScRefList & rRefList );
void SingleRefToVars( const ScSingleRefData & rRef, SCCOL & rCol, SCROW & rRow, SCTAB & rTab );
void PopSingleRef( ScAddress& );
void PopSingleRef(SCCOL& rCol, SCROW &rRow, SCTAB& rTab);
void DoubleRefToRange( const ScComplexRefData&, ScRange&, bool bDontCheckForTableOp = false );
/** If formula::StackVar formula::svDoubleRef pop ScDoubleRefToken and return values of
ScComplexRefData.
Else if StackVar svRefList return values of the ScComplexRefData where
rRefInList is pointing to. rRefInList is incremented. If rRefInList was the
last element in list pop ScRefListToken and set rRefInList to 0, else
rParam is incremented (!) to allow usage as in
while(nParamCount--) PopDoubleRef(aRange,nParamCount,nRefInList);
*/
void PopDoubleRef( ScRange & rRange, short & rParam, size_t & rRefInList );
void PopDoubleRef( ScRange&, bool bDontCheckForTableOp = false );
void DoubleRefToVars( const formula::FormulaToken* p,
SCCOL& rCol1, SCROW &rRow1, SCTAB& rTab1,
SCCOL& rCol2, SCROW &rRow2, SCTAB& rTab2 );
ScDBRangeBase* PopDBDoubleRef();
void PopDoubleRef(SCCOL& rCol1, SCROW &rRow1, SCTAB& rTab1,
SCCOL& rCol2, SCROW &rRow2, SCTAB& rTab2 );
void PopExternalSingleRef(sal_uInt16& rFileId, OUString& rTabName, ScSingleRefData& rRef);
/** Guarantees that nGlobalError is set if rToken could not be obtained. */
void PopExternalSingleRef(ScExternalRefCache::TokenRef& rToken, ScExternalRefCache::CellFormat* pFmt = nullptr);
/** Guarantees that nGlobalError is set if rToken could not be obtained. */
void PopExternalSingleRef(sal_uInt16& rFileId, OUString& rTabName, ScSingleRefData& rRef,
ScExternalRefCache::TokenRef& rToken, ScExternalRefCache::CellFormat* pFmt = nullptr);
void PopExternalDoubleRef(sal_uInt16& rFileId, OUString& rTabName, ScComplexRefData& rRef);
void PopExternalDoubleRef(ScExternalRefCache::TokenArrayRef& rArray);
void PopExternalDoubleRef(ScMatrixRef& rMat);
void GetExternalDoubleRef(sal_uInt16 nFileId, const OUString& rTabName, const ScComplexRefData& aData, ScExternalRefCache::TokenArrayRef& rArray);
bool PopDoubleRefOrSingleRef( ScAddress& rAdr );
void PopDoubleRefPushMatrix();
void PopRefListPushMatrixOrRef();
// If MatrixFormula: convert svDoubleRef to svMatrix, create JumpMatrix.
// Else convert area reference parameters marked as ForceArray to array.
// Returns true if JumpMatrix created.
bool ConvertMatrixParameters();
// If MatrixFormula: ConvertMatrixJumpConditionToMatrix()
inline void MatrixJumpConditionToMatrix();
// For MatrixFormula (preconditions already checked by
// MatrixJumpConditionToMatrix()): convert svDoubleRef to svMatrix, or if
// JumpMatrix currently in effect convert also other types to svMatrix so
// another JumpMatrix will be created by jump commands.
void ConvertMatrixJumpConditionToMatrix();
// If MatrixFormula or ForceArray: ConvertMatrixParameters()
inline bool MatrixParameterConversion();
ScMatrixRef PopMatrix();
sc::RangeMatrix PopRangeMatrix();
void QueryMatrixType(const ScMatrixRef& xMat, short& rRetTypeExpr, sal_uLong& rRetIndexExpr);
formula::FormulaToken* CreateDoubleOrTypedToken( double fVal );
void PushDouble(double nVal);
void PushInt( int nVal );
void PushStringBuffer( const sal_Unicode* pString );
void PushString( const OUString& rStr );
void PushString( const svl::SharedString& rString );
void PushSingleRef(SCCOL nCol, SCROW nRow, SCTAB nTab);
void PushDoubleRef(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
SCCOL nCol2, SCROW nRow2, SCTAB nTab2);
void PushExternalSingleRef(sal_uInt16 nFileId, const OUString& rTabName,
SCCOL nCol, SCROW nRow, SCTAB nTab);
void PushExternalDoubleRef(sal_uInt16 nFileId, const OUString& rTabName,
SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
SCCOL nCol2, SCROW nRow2, SCTAB nTab2);
void PushSingleRef( const ScRefAddress& rRef );
void PushDoubleRef( const ScRefAddress& rRef1, const ScRefAddress& rRef2 );
void PushMatrix( const sc::RangeMatrix& rMat );
void PushMatrix(const ScMatrixRef& pMat);
void PushError( FormulaError nError );
/// Raw stack type without default replacements.
formula::StackVar GetRawStackType();
/// Stack type with replacement of defaults, e.g. svMissing and formula::svEmptyCell will result in formula::svDouble.
formula::StackVar GetStackType();
// peek StackType of Parameter, Parameter 1 == TOS, 2 == TOS-1, ...
formula::StackVar GetStackType( sal_uInt8 nParam );
sal_uInt8 GetByte() { return cPar; }
// reverse order of stack
void ReverseStack( sal_uInt8 nParamCount );
// generates a position-dependent SingleRef out of a DoubleRef
bool DoubleRefToPosSingleRef( const ScRange& rRange, ScAddress& rAdr );
double GetDoubleFromMatrix(const ScMatrixRef& pMat);
double GetDouble();
double GetDoubleWithDefault(double nDefault);
bool IsMissing();
sal_Int32 double_to_int32(double fVal);
/** if GetDouble() not within int32 limits sets nGlobalError and returns SAL_MAX_INT32 */
sal_Int32 GetInt32();
/** if GetDoubleWithDefault() not within int32 limits sets nGlobalError and returns SAL_MAX_INT32 */
sal_Int32 GetInt32WithDefault( sal_Int32 nDefault );
/** if GetDouble() not within int16 limits sets nGlobalError and returns SAL_MAX_INT16 */
sal_Int16 GetInt16();
/** if GetDouble() not within uint32 limits sets nGlobalError and returns SAL_MAX_UINT32 */
sal_uInt32 GetUInt32();
bool GetBool() { return GetDouble() != 0.0; }
/// returns TRUE if double (or error, check nGlobalError), else FALSE
bool GetDoubleOrString( double& rValue, svl::SharedString& rString );
svl::SharedString GetString();
svl::SharedString GetStringFromMatrix(const ScMatrixRef& pMat);
svl::SharedString GetStringFromDouble( const double fVal);
// pop matrix and obtain one element, upper left or according to jump matrix
ScMatValType GetDoubleOrStringFromMatrix( double& rDouble, svl::SharedString& rString );
ScMatrixRef CreateMatrixFromDoubleRef( const formula::FormulaToken* pToken,
SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
SCCOL nCol2, SCROW nRow2, SCTAB nTab2 );
inline ScTokenMatrixMap& GetTokenMatrixMap();
static ScTokenMatrixMap* CreateTokenMatrixMap();
ScMatrixRef GetMatrix();
ScMatrixRef GetMatrix( short & rParam, size_t & rInRefList );
sc::RangeMatrix GetRangeMatrix();
void ScTableOp(); // repeated operations
// common helper functions
void CurFmtToFuncFmt()
{ nFuncFmtType = nCurFmtType; nFuncFmtIndex = nCurFmtIndex; }
/** Check if a double is suitable as string position or length argument.
If fVal is Inf or NaN it is changed to -1, if it is less than 0 it is
sanitized to 0, if it is greater than some implementation defined max
string length it is sanitized to that max.
@return TRUE if double value fVal is suitable as string argument and was
not sanitized.
FALSE if not and fVal was adapted.
*/
static inline bool CheckStringPositionArgument( double & fVal );
/** Obtain a double suitable as string position or length argument.
Returns -1 if the number is Inf or NaN or less than 0 or greater than some
implementation defined max string length. */
inline double GetStringPositionArgument();
// Check for String overflow of rResult+rAdd and set error and erase rResult
// if so. Return true if ok, false if overflow
inline bool CheckStringResultLen( OUString& rResult, const OUString& rAdd );
// Set error according to rVal, and set rVal to 0.0 if there was an error.
inline void TreatDoubleError( double& rVal );
// Lookup using ScLookupCache, @returns true if found and result address
bool LookupQueryWithCache( ScAddress & o_rResultPos,
const ScQueryParam & rParam ) const;
void ScIfJump();
void ScIfError( bool bNAonly );
void ScChooseJump();
// Be sure to only call this if pStack[sp-nStackLevel] really contains a
// ScJumpMatrixToken, no further checks are applied!
// Returns true if last jump was executed and result matrix pushed.
bool JumpMatrix( short nStackLevel );
double Compare( ScQueryOp eOp );
/** @param pOptions
NULL means case sensitivity document option is to be used!
*/
sc::RangeMatrix CompareMat( ScQueryOp eOp, sc::CompareOptions* pOptions = nullptr );
ScMatrixRef QueryMat( const ScMatrixRef& pMat, sc::CompareOptions& rOptions );
void ScEqual();
void ScNotEqual();
void ScLess();
void ScGreater();
void ScLessEqual();
void ScGreaterEqual();
void ScAnd();
void ScOr();
void ScXor();
void ScNot();
void ScNeg();
void ScPercentSign();
void ScIntersect();
void ScRangeFunc();
void ScUnionFunc();
void ScPi();
void ScRandom();
void ScTrue();
void ScFalse();
void ScDeg();
void ScRad();
void ScSin();
void ScCos();
void ScTan();
void ScCot();
void ScArcSin();
void ScArcCos();
void ScArcTan();
void ScArcCot();
void ScSinHyp();
void ScCosHyp();
void ScTanHyp();
void ScCotHyp();
void ScArcSinHyp();
void ScArcCosHyp();
void ScArcTanHyp();
void ScArcCotHyp();
void ScCosecant();
void ScSecant();
void ScCosecantHyp();
void ScSecantHyp();
void ScExp();
void ScLn();
void ScLog10();
void ScSqrt();
void ScIsEmpty();
bool IsString();
void ScIsString();
void ScIsNonString();
void ScIsLogical();
void ScType();
void ScCell();
void ScCellExternal();
void ScIsRef();
void ScIsValue();
void ScIsFormula();
void ScFormula();
void ScRoman();
void ScArabic();
void ScIsNV();
void ScIsErr();
void ScIsError();
bool IsEven();
void ScIsEven();
void ScIsOdd();
void ScN();
void ScCode();
void ScTrim();
void ScUpper();
void ScProper();
void ScLower();
void ScLen();
void ScT();
void ScValue();
void ScNumberValue();
void ScClean();
void ScChar();
void ScJis();
void ScAsc();
void ScUnicode();
void ScUnichar();
void ScMin( bool bTextAsZero = false );
void ScMax( bool bTextAsZero = false );
/** Check for array of references to determine the maximum size of a return
column vector if in array context. */
size_t GetRefListArrayMaxSize( short nParamCount );
/** Switch to array reference list if current TOS is one and create/init or
update matrix and return true. Else return false. */
bool SwitchToArrayRefList( ScMatrixRef& xResMat, SCSIZE nMatRows, double fCurrent,
const std::function<void( SCSIZE i, double fCurrent )>& MatOpFunc, bool bDoMatOp );
void IterateParameters( ScIterFunc, bool bTextAsZero = false );
void ScSumSQ();
void ScSum();
void ScProduct();
void ScAverage( bool bTextAsZero = false );
void ScCount();
void ScCount2();
void GetStVarParams( bool bTextAsZero, double(*VarResult)( double fVal, size_t nValCount ) );
void ScVar( bool bTextAsZero = false );
void ScVarP( bool bTextAsZero = false );
void ScStDev( bool bTextAsZero = false );
void ScStDevP( bool bTextAsZero = false );
void ScRawSubtract();
void ScColumns();
void ScRows();
void ScSheets();
void ScColumn();
void ScRow();
void ScSheet();
void ScMatch();
void IterateParametersIf( ScIterFuncIf );
void ScCountIf();
void ScSumIf();
void ScAverageIf();
void IterateParametersIfs( double(*ResultFunc)( const sc::ParamIfsResult& rRes ) );
void ScSumIfs();
void ScAverageIfs();
void ScCountIfs();
void ScCountEmptyCells();
void ScLookup();
void ScHLookup();
void ScVLookup();
void ScSubTotal();
// If upon call rMissingField==true then the database field parameter may be
// missing (Xcl DCOUNT() syntax), or may be faked as missing by having the
// value 0.0 or being exactly the entire database range reference (old SO
// compatibility). If this was the case then rMissingField is set to true upon
// return. If rMissingField==false upon call all "missing cases" are considered
// to be an error.
std::unique_ptr<ScDBQueryParamBase> GetDBParams( bool& rMissingField );
void DBIterator( ScIterFunc );
void ScDBSum();
void ScDBCount();
void ScDBCount2();
void ScDBAverage();
void ScDBGet();
void ScDBMax();
void ScDBMin();
void ScDBProduct();
void GetDBStVarParams( double& rVal, double& rValCount );
void ScDBStdDev();
void ScDBStdDevP();
void ScDBVar();
void ScDBVarP();
void ScIndirect();
void ScAddressFunc();
void ScOffset();
void ScIndex();
void ScMultiArea();
void ScAreas();
void ScCurrency();
void ScReplace();
void ScFixed();
void ScFind();
void ScExact();
void ScLeft();
void ScRight();
void ScSearch();
void ScMid();
void ScText();
void ScSubstitute();
void ScRept();
void ScConcat();
void ScConcat_MS();
void ScTextJoin_MS();
void ScIfs_MS();
void ScSwitch_MS();
void ScMinIfs_MS();
void ScMaxIfs_MS();
void ScExternal();
void ScMissing();
void ScMacro();
bool SetSbxVariable( SbxVariable* pVar, const ScAddress& );
FormulaError GetErrorType();
void ScErrorType();
void ScErrorType_ODF();
void ScDBArea();
void ScColRowNameAuto();
void ScGetPivotData();
void ScHyperLink();
void ScBahtText();
void ScBitAnd();
void ScBitOr();
void ScBitXor();
void ScBitRshift();
void ScBitLshift();
void ScTTT();
void ScDebugVar();
/** Obtain the date serial number for a given date.
@param bStrict
If false, nYear < 100 takes the two-digit year setting into account,
and rollover of invalid calendar dates takes place, e.g. 1999-02-31 =>
1999-03-03.
If true, the date passed must be a valid Gregorian calendar date. No
two-digit expanding or rollover is done.
Date must be Gregorian, i.e. >= 1582-10-15.
*/
double GetDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, bool bStrict );
void ScGetActDate();
void ScGetActTime();
void ScGetYear();
void ScGetMonth();
void ScGetDay();
void ScGetDayOfWeek();
void ScGetWeekOfYear();
void ScGetIsoWeekOfYear();
void ScWeeknumOOo();
void ScEasterSunday();
FormulaError GetWeekendAndHolidayMasks( const sal_uInt8 nParamCount, const sal_uInt32 nNullDate,
::std::vector<double>& rSortArray, bool bWeekendMask[ 7 ] );
FormulaError GetWeekendAndHolidayMasks_MS( const sal_uInt8 nParamCount, const sal_uInt32 nNullDate,
::std::vector<double>& rSortArray, bool bWeekendMask[ 7 ], bool bWorkdayFunction );
static inline sal_Int16 GetDayOfWeek( sal_Int32 n );
void ScNetWorkdays( bool bOOXML_Version );
void ScWorkday_MS();
void ScGetHour();
void ScGetMin();
void ScGetSec();
void ScPlusMinus();
void ScAbs();
void ScInt();
void ScEven();
void ScOdd();
void ScCeil( bool bODFF );
void ScCeil_MS();
void ScCeil_Precise();
void ScFloor( bool bODFF );
void ScFloor_MS();
void ScFloor_Precise();
void RoundNumber( rtl_math_RoundingMode eMode );
void ScRound();
void ScRoundUp();
void ScRoundDown();
void ScGetDateValue();
void ScGetTimeValue();
void ScArcTan2();
void ScLog();
void ScGetDate();
void ScGetTime();
void ScGetDiffDate();
void ScGetDiffDate360();
void ScGetDateDif();
void ScPower();
void ScAmpersand();
void ScAdd();
void ScSub();
void ScMul();
void ScDiv();
void ScPow();
void ScCurrent();
void ScStyle();
void ScDde();
void ScBase();
void ScDecimal();
void ScConvertOOo();
void ScEuroConvert();
void ScRoundSignificant();
// financial functions
void ScNPV();
void ScIRR();
void ScMIRR();
void ScISPMT();
static double ScGetBw(double fInterest, double fZzr, double fRmz,
double fZw, bool bPayInAdvance);
void ScPV();
void ScSYD();
static double ScGetGDA(double fWert, double fRest, double fDauer,
double fPeriode, double fFactor);
void ScDDB();
void ScDB();
static double ScInterVDB(double fWert,double fRest,double fDauer,double fDauer1,
double fPeriode,double fFactor);
void ScVDB();
void ScPDuration();
void ScSLN();
static double ScGetRmz(double fInterest, double fZzr, double fBw,
double fZw, bool bPayInAdvance);
void ScPMT();
void ScRRI();
static double ScGetZw(double fInterest, double fZzr, double fRmz,
double fBw, bool bFlag);
void ScFV();
void ScNper();
static bool RateIteration(double fNper, double fPayment, double fPv,
double fFv, bool bPayType, double& fGuess);
void ScRate();
double ScGetCompoundInterest(double fInterest, double fZr, double fZzr, double fBw,
double fZw, bool bPayInAdvance, double& fRmz);
void ScIpmt();
void ScPpmt();
void ScCumIpmt();
void ScCumPrinc();
void ScEffect();
void ScNominal();
void ScMod();
void ScIntercept();
void ScGCD();
void ScLCM();
// matrix functions
void ScMatValue();
static void MEMat(const ScMatrixRef& mM, SCSIZE n);
void ScMatDet();
void ScMatInv();
void ScMatMult();
void ScMatTrans();
void ScEMat();
void ScMatRef();
ScMatrixRef MatConcat(const ScMatrixRef& pMat1, const ScMatrixRef& pMat2);
void ScSumProduct();
void ScSumX2MY2();
void ScSumX2DY2();
void ScSumXMY2();
void ScGrowth();
bool CalculateSkew(double& fSum,double& fCount,double& vSum,std::vector<double>& values);
void CalculateSkewOrSkewp( bool bSkewp );
void CalculateSlopeIntercept(bool bSlope);
void CalculateSmallLarge(bool bSmall);
void CalculatePearsonCovar( bool _bPearson, bool _bStexy, bool _bSample ); //fdo#70000 argument _bSample is ignored if _bPearson == true
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);
void CalculateLookup(bool bHLookup);
bool FillEntry(ScQueryEntry& rEntry);
void CalculateAddSub(bool _bSub);
void CalculateTrendGrowth(bool _bGrowth);
void CalculateRGPRKP(bool _bRKP);
void CalculateSumX2MY2SumX2DY2(bool _bSumX2DY2);
void CalculateMatrixValue(const ScMatrix* pMat,SCSIZE nC,SCSIZE nR);
bool CheckMatrix(bool _bLOG,sal_uInt8& nCase,SCSIZE& nCX,SCSIZE& nCY,SCSIZE& nRX,SCSIZE& nRY,SCSIZE& M,SCSIZE& N,ScMatrixRef& pMatX,ScMatrixRef& pMatY);
void ScLinest();
void ScLogest();
void ScForecast();
void ScForecast_Ets( ScETSType eETSType );
void ScNoName();
void ScBadName();
// Statistics:
static double taylor(const double* pPolynom, sal_uInt16 nMax, double x);
static double gauss(double x);
public: @param bDisplayEmptyAsString
static SC_DLLPUBLIC double phi(double x); is passed to ScEmptyCell in case of an empty cell result.
static SC_DLLPUBLIC double integralPhi(double x);
static SC_DLLPUBLIC double gaussinv(double x);
static SC_DLLPUBLIC double GetPercentile( ::std::vector<double> & rArray, double fPercentile );
@param pRetTypeExpr
@param pRetIndexExpr
Obtain number format and type if _both_, type and index pointer,
are not NULL.
private: @param bFinalResult
double GetBetaDist(double x, double alpha, double beta); //cumulative distribution function If TRUE, only a standard FormulaDoubleToken is pushed.
double GetBetaDistPDF(double fX, double fA, double fB); //probability density function) If FALSE, PushDouble() is used that may push either a
double GetChiDist(double fChi, double fDF); // for LEGACY.CHIDIST, returns right tail FormulaDoubleToken or a FormulaTypedDoubleToken.
double GetChiSqDistCDF(double fX, double fDF); // for CHISQDIST, returns left tail */
static double GetChiSqDistPDF(double fX, double fDF); // probability density function void PushCellResultToken( bool bDisplayEmptyAsString, const ScAddress & rAddress,
double GetFDist(double x, double fF1, double fF2); short * pRetTypeExpr, sal_uLong * pRetIndexExpr, bool bFinalResult = false );
double GetTDist( double T, double fDF, int nType );
double Fakultaet(double x); formula::FormulaConstTokenRef PopToken();
static double BinomKoeff(double n, double k); void Pop();
double GetGamma(double x); void PopError();
static double GetLogGamma(double x); double PopDouble();
double GetBeta(double fAlpha, double fBeta); svl::SharedString PopString();
static double GetLogBeta(double fAlpha, double fBeta); void ValidateRef( const ScSingleRefData & rRef );
double GetBinomDistPMF(double x, double n, double p); //probability mass function void ValidateRef( const ScComplexRefData & rRef );
double GetHypGeomDist( double x, double n, double M, double N ); void ValidateRef( const ScRefList & rRefList );
void ScLogGamma(); void SingleRefToVars( const ScSingleRefData & rRef, SCCOL & rCol, SCROW & rRow, SCTAB & rTab );
void ScGamma(); void PopSingleRef( ScAddress& );
void ScPhi(); void PopSingleRef(SCCOL& rCol, SCROW &rRow, SCTAB& rTab);
void ScGauss(); void DoubleRefToRange( const ScComplexRefData&, ScRange&, bool bDontCheckForTableOp = false );
void ScStdNormDist(); /** If formula::StackVar formula::svDoubleRef pop ScDoubleRefToken and return values of
void ScStdNormDist_MS(); ScComplexRefData.
void ScFisher(); Else if StackVar svRefList return values of the ScComplexRefData where
void ScFisherInv(); rRefInList is pointing to. rRefInList is incremented. If rRefInList was the
void ScFact(); last element in list pop ScRefListToken and set rRefInList to 0, else
void ScNormDist( int nMinParamCount ); rParam is incremented (!) to allow usage as in
void ScGammaDist( bool bODFF ); while(nParamCount--) PopDoubleRef(aRange,nParamCount,nRefInList);
void ScGammaInv(); */
void ScExpDist(); void PopDoubleRef( ScRange & rRange, short & rParam, size_t & rRefInList );
void ScBinomDist(); void PopDoubleRef( ScRange&, bool bDontCheckForTableOp = false );
void ScPoissonDist( bool bODFF ); void DoubleRefToVars( const formula::FormulaToken* p,
void ScCombin(); SCCOL& rCol1, SCROW &rRow1, SCTAB& rTab1,
void ScCombinA(); SCCOL& rCol2, SCROW &rRow2, SCTAB& rTab2 );
void ScPermut(); ScDBRangeBase* PopDBDoubleRef();
void ScPermutationA(); void PopDoubleRef(SCCOL& rCol1, SCROW &rRow1, SCTAB& rTab1,
void ScB(); SCCOL& rCol2, SCROW &rRow2, SCTAB& rTab2 );
void ScHypGeomDist( int nMinParamCount );
void ScLogNormDist( int nMinParamCount ); void PopExternalSingleRef(sal_uInt16& rFileId, OUString& rTabName, ScSingleRefData& rRef);
void ScLogNormInv();
void ScTDist(); /** Guarantees that nGlobalError is set if rToken could not be obtained. */
void ScTDist_MS(); void PopExternalSingleRef(ScExternalRefCache::TokenRef& rToken, ScExternalRefCache::CellFormat* pFmt = nullptr);
void ScTDist_T( int nTails );
void ScFDist(); /** Guarantees that nGlobalError is set if rToken could not be obtained. */
void ScFDist_LT(); void PopExternalSingleRef(sal_uInt16& rFileId, OUString& rTabName, ScSingleRefData& rRef,
void ScChiDist( bool bODFF); // for LEGACY.CHIDIST, returns right tail ScExternalRefCache::TokenRef& rToken, ScExternalRefCache::CellFormat* pFmt = nullptr);
void ScChiSqDist(); // returns left tail or density
void ScChiSqDist_MS(); void PopExternalDoubleRef(sal_uInt16& rFileId, OUString& rTabName, ScComplexRefData& rRef);
void ScChiSqInv(); //invers to CHISQDIST void PopExternalDoubleRef(ScExternalRefCache::TokenArrayRef& rArray);
void ScWeibull(); void PopExternalDoubleRef(ScMatrixRef& rMat);
void ScBetaDist(); void GetExternalDoubleRef(sal_uInt16 nFileId, const OUString& rTabName, const ScComplexRefData& aData, ScExternalRefCache::TokenArrayRef& rArray);
void ScBetaDist_MS(); bool PopDoubleRefOrSingleRef( ScAddress& rAdr );
void ScFInv(); void PopDoubleRefPushMatrix();
void ScFInv_LT(); void PopRefListPushMatrixOrRef();
void ScTInv( int nType ); // If MatrixFormula: convert svDoubleRef to svMatrix, create JumpMatrix.
void ScChiInv(); // Else convert area reference parameters marked as ForceArray to array.
void ScBetaInv(); // Returns true if JumpMatrix created.
void ScCritBinom(); bool ConvertMatrixParameters();
void ScNegBinomDist(); // If MatrixFormula: ConvertMatrixJumpConditionToMatrix()
void ScNegBinomDist_MS(); inline void MatrixJumpConditionToMatrix();
void ScKurt(); // For MatrixFormula (preconditions already checked by
void ScHarMean(); // MatrixJumpConditionToMatrix()): convert svDoubleRef to svMatrix, or if
void ScGeoMean(); // JumpMatrix currently in effect convert also other types to svMatrix so
void ScStandard(); // another JumpMatrix will be created by jump commands.
void ScSkew(); void ConvertMatrixJumpConditionToMatrix();
void ScSkewp(); // If MatrixFormula or ForceArray: ConvertMatrixParameters()
void ScMedian(); inline bool MatrixParameterConversion();
double GetMedian( ::std::vector<double> & rArray ); ScMatrixRef PopMatrix();
double GetPercentileExclusive( ::std::vector<double> & rArray, double fPercentile ); sc::RangeMatrix PopRangeMatrix();
void GetNumberSequenceArray( sal_uInt8 nParamCount, ::std::vector<double>& rArray, bool bConvertTextInArray ); void QueryMatrixType(const ScMatrixRef& xMat, short& rRetTypeExpr, sal_uLong& rRetIndexExpr);
void GetSortArray( sal_uInt8 nParamCount, ::std::vector<double>& rSortArray, ::std::vector<long>* pIndexOrder, bool bConvertTextInArray, bool bAllowEmptyArray );
static void QuickSort(::std::vector<double>& rSortArray, ::std::vector<long>* pIndexOrder); formula::FormulaToken* CreateDoubleOrTypedToken( double fVal );
void ScModalValue();
void ScModalValue_Multi(); void PushDouble(double nVal);
void ScAveDev(); void PushInt( int nVal );
void ScAggregate(); void PushStringBuffer( const sal_Unicode* pString );
void ScDevSq(); void PushString( const OUString& rStr );
void ScZTest(); void PushString( const svl::SharedString& rString );
void ScTTest(); void PushSingleRef(SCCOL nCol, SCROW nRow, SCTAB nTab);
void ScFTest(); void PushDoubleRef(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
void ScChiTest(); SCCOL nCol2, SCROW nRow2, SCTAB nTab2);
void ScRank( bool bAverage ); void PushExternalSingleRef(sal_uInt16 nFileId, const OUString& rTabName,
void ScPercentile( bool bInclusive ); SCCOL nCol, SCROW nRow, SCTAB nTab);
void ScPercentrank( bool bInclusive ); void PushExternalDoubleRef(sal_uInt16 nFileId, const OUString& rTabName,
static double GetPercentrank( ::std::vector<double> & rArray, double fVal, bool bInclusive ); SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
void ScLarge(); SCCOL nCol2, SCROW nRow2, SCTAB nTab2);
void ScSmall(); void PushSingleRef( const ScRefAddress& rRef );
void ScFrequency(); void PushDoubleRef( const ScRefAddress& rRef1, const ScRefAddress& rRef2 );
void ScQuartile( bool bInclusive ); void PushMatrix( const sc::RangeMatrix& rMat );
void ScNormInv(); void PushMatrix(const ScMatrixRef& pMat);
void ScSNormInv(); void PushError( FormulaError nError );
void ScConfidence(); /// Raw stack type without default replacements.
void ScConfidenceT(); formula::StackVar GetRawStackType();
void ScTrimMean(); /// Stack type with replacement of defaults, e.g. svMissing and formula::svEmptyCell will result in formula::svDouble.
void ScProbability(); formula::StackVar GetStackType();
void ScCorrel(); // peek StackType of Parameter, Parameter 1 == TOS, 2 == TOS-1, ...
void ScCovarianceP(); formula::StackVar GetStackType( sal_uInt8 nParam );
void ScCovarianceS(); sal_uInt8 GetByte() { return cPar; }
void ScPearson(); // reverse order of stack
void ScRSQ(); void ReverseStack( sal_uInt8 nParamCount );
void ScSTEYX(); // generates a position-dependent SingleRef out of a DoubleRef
void ScSlope(); bool DoubleRefToPosSingleRef( const ScRange& rRange, ScAddress& rAdr );
void ScTrend(); double GetDoubleFromMatrix(const ScMatrixRef& pMat);
void ScInfo(); double GetDouble();
void ScLenB(); double GetDoubleWithDefault(double nDefault);
void ScRightB(); bool IsMissing();
void ScLeftB(); sal_Int32 double_to_int32(double fVal);
void ScMidB(); /** if GetDouble() not within int32 limits sets nGlobalError and returns SAL_MAX_INT32 */
void ScReplaceB(); sal_Int32 GetInt32();
void ScFindB(); /** if GetDoubleWithDefault() not within int32 limits sets nGlobalError and returns SAL_MAX_INT32 */
void ScSearchB(); sal_Int32 GetInt32WithDefault( sal_Int32 nDefault );
/** if GetDouble() not within int16 limits sets nGlobalError and returns SAL_MAX_INT16 */
void ScFilterXML(); sal_Int16 GetInt16();
void ScWebservice(); /** if GetDouble() not within uint32 limits sets nGlobalError and returns SAL_MAX_UINT32 */
void ScEncodeURL(); sal_uInt32 GetUInt32();
void ScColor(); bool GetBool() { return GetDouble() != 0.0; }
void ScErf(); /// returns TRUE if double (or error, check nGlobalError), else FALSE
void ScErfc(); bool GetDoubleOrString( double& rValue, svl::SharedString& rString );
svl::SharedString GetString();
static const double fMaxGammaArgument; svl::SharedString GetStringFromMatrix(const ScMatrixRef& pMat);
svl::SharedString GetStringFromDouble( const double fVal);
double GetGammaContFraction(double fA,double fX); // pop matrix and obtain one element, upper left or according to jump matrix
double GetGammaSeries(double fA,double fX); ScMatValType GetDoubleOrStringFromMatrix( double& rDouble, svl::SharedString& rString );
double GetLowRegIGamma(double fA,double fX); // lower regularized incomplete gamma function, GAMMAQ ScMatrixRef CreateMatrixFromDoubleRef( const formula::FormulaToken* pToken,
double GetUpRegIGamma(double fA,double fX); // upper regularized incomplete gamma function, GAMMAP SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
// probability density function; fLambda is "scale" parameter SCCOL nCol2, SCROW nRow2, SCTAB nTab2 );
double GetGammaDistPDF(double fX, double fAlpha, double fLambda); inline ScTokenMatrixMap& GetTokenMatrixMap();
// cumulative distribution function; fLambda is "scale" parameter static ScTokenMatrixMap* CreateTokenMatrixMap();
double GetGammaDist(double fX, double fAlpha, double fLambda); ScMatrixRef GetMatrix();
double GetTInv( double fAlpha, double fSize, int nType ); ScMatrixRef GetMatrix( short & rParam, size_t & rInRefList );
sc::RangeMatrix GetRangeMatrix();
void ScTableOp(); // repeated operations
// common helper functions
void CurFmtToFuncFmt()
{ nFuncFmtType = nCurFmtType; nFuncFmtIndex = nCurFmtIndex; }
/** Check if a double is suitable as string position or length argument.
If fVal is Inf or NaN it is changed to -1, if it is less than 0 it is
sanitized to 0, if it is greater than some implementation defined max
string length it is sanitized to that max.
@return TRUE if double value fVal is suitable as string argument and was
not sanitized.
FALSE if not and fVal was adapted.
*/
static inline bool CheckStringPositionArgument( double & fVal );
/** Obtain a double suitable as string position or length argument.
Returns -1 if the number is Inf or NaN or less than 0 or greater than some
implementation defined max string length. */
inline double GetStringPositionArgument();
// Check for String overflow of rResult+rAdd and set error and erase rResult
// if so. Return true if ok, false if overflow
inline bool CheckStringResultLen( OUString& rResult, const OUString& rAdd );
// Set error according to rVal, and set rVal to 0.0 if there was an error.
inline void TreatDoubleError( double& rVal );
// Lookup using ScLookupCache, @returns true if found and result address
bool LookupQueryWithCache( ScAddress & o_rResultPos,
const ScQueryParam & rParam ) const;
void ScIfJump();
void ScIfError( bool bNAonly );
void ScChooseJump();
// Be sure to only call this if pStack[sp-nStackLevel] really contains a
// ScJumpMatrixToken, no further checks are applied!
// Returns true if last jump was executed and result matrix pushed.
bool JumpMatrix( short nStackLevel );
double Compare( ScQueryOp eOp );
/** @param pOptions
NULL means case sensitivity document option is to be used!
*/
sc::RangeMatrix CompareMat( ScQueryOp eOp, sc::CompareOptions* pOptions = nullptr );
ScMatrixRef QueryMat( const ScMatrixRef& pMat, sc::CompareOptions& rOptions );
void ScEqual();
void ScNotEqual();
void ScLess();
void ScGreater();
void ScLessEqual();
void ScGreaterEqual();
void ScAnd();
void ScOr();
void ScXor();
void ScNot();
void ScNeg();
void ScPercentSign();
void ScIntersect();
void ScRangeFunc();
void ScUnionFunc();
void ScPi();
void ScRandom();
void ScTrue();
void ScFalse();
void ScDeg();
void ScRad();
void ScSin();
void ScCos();
void ScTan();
void ScCot();
void ScArcSin();
void ScArcCos();
void ScArcTan();
void ScArcCot();
void ScSinHyp();
void ScCosHyp();
void ScTanHyp();
void ScCotHyp();
void ScArcSinHyp();
void ScArcCosHyp();
void ScArcTanHyp();
void ScArcCotHyp();
void ScCosecant();
void ScSecant();
void ScCosecantHyp();
void ScSecantHyp();
void ScExp();
void ScLn();
void ScLog10();
void ScSqrt();
void ScIsEmpty();
bool IsString();
void ScIsString();
void ScIsNonString();
void ScIsLogical();
void ScType();
void ScCell();
void ScCellExternal();
void ScIsRef();
void ScIsValue();
void ScIsFormula();
void ScFormula();
void ScRoman();
void ScArabic();
void ScIsNV();
void ScIsErr();
void ScIsError();
bool IsEven();
void ScIsEven();
void ScIsOdd();
void ScN();
void ScCode();
void ScTrim();
void ScUpper();
void ScProper();
void ScLower();
void ScLen();
void ScT();
void ScValue();
void ScNumberValue();
void ScClean();
void ScChar();
void ScJis();
void ScAsc();
void ScUnicode();
void ScUnichar();
void ScMin( bool bTextAsZero = false );
void ScMax( bool bTextAsZero = false );
/** Check for array of references to determine the maximum size of a return
column vector if in array context. */
size_t GetRefListArrayMaxSize( short nParamCount );
/** Switch to array reference list if current TOS is one and create/init or
update matrix and return true. Else return false. */
bool SwitchToArrayRefList( ScMatrixRef& xResMat, SCSIZE nMatRows, double fCurrent,
const std::function<void( SCSIZE i, double fCurrent )>& MatOpFunc, bool bDoMatOp );
void IterateParameters( ScIterFunc, bool bTextAsZero = false );
void ScSumSQ();
void ScSum();
void ScProduct();
void ScAverage( bool bTextAsZero = false );
void ScCount();
void ScCount2();
void GetStVarParams( bool bTextAsZero, double(*VarResult)( double fVal, size_t nValCount ) );
void ScVar( bool bTextAsZero = false );
void ScVarP( bool bTextAsZero = false );
void ScStDev( bool bTextAsZero = false );
void ScStDevP( bool bTextAsZero = false );
void ScRawSubtract();
void ScColumns();
void ScRows();
void ScSheets();
void ScColumn();
void ScRow();
void ScSheet();
void ScMatch();
void IterateParametersIf( ScIterFuncIf );
void ScCountIf();
void ScSumIf();
void ScAverageIf();
void IterateParametersIfs( double(*ResultFunc)( const sc::ParamIfsResult& rRes ) );
void ScSumIfs();
void ScAverageIfs();
void ScCountIfs();
void ScCountEmptyCells();
void ScLookup();
void ScHLookup();
void ScVLookup();
void ScSubTotal();
// If upon call rMissingField==true then the database field parameter may be
// missing (Xcl DCOUNT() syntax), or may be faked as missing by having the
// value 0.0 or being exactly the entire database range reference (old SO
// compatibility). If this was the case then rMissingField is set to true upon
// return. If rMissingField==false upon call all "missing cases" are considered
// to be an error.
std::unique_ptr<ScDBQueryParamBase> GetDBParams( bool& rMissingField );
void DBIterator( ScIterFunc );
void ScDBSum();
void ScDBCount();
void ScDBCount2();
void ScDBAverage();
void ScDBGet();
void ScDBMax();
void ScDBMin();
void ScDBProduct();
void GetDBStVarParams( double& rVal, double& rValCount );
void ScDBStdDev();
void ScDBStdDevP();
void ScDBVar();
void ScDBVarP();
void ScIndirect();
void ScAddressFunc();
void ScOffset();
void ScIndex();
void ScMultiArea();
void ScAreas();
void ScCurrency();
void ScReplace();
void ScFixed();
void ScFind();
void ScExact();
void ScLeft();
void ScRight();
void ScSearch();
void ScMid();
void ScText();
void ScSubstitute();
void ScRept();
void ScConcat();
void ScConcat_MS();
void ScTextJoin_MS();
void ScIfs_MS();
void ScSwitch_MS();
void ScMinIfs_MS();
void ScMaxIfs_MS();
void ScExternal();
void ScMissing();
void ScMacro();
bool SetSbxVariable( SbxVariable* pVar, const ScAddress& );
FormulaError GetErrorType();
void ScErrorType();
void ScErrorType_ODF();
void ScDBArea();
void ScColRowNameAuto();
void ScGetPivotData();
void ScHyperLink();
void ScBahtText();
void ScBitAnd();
void ScBitOr();
void ScBitXor();
void ScBitRshift();
void ScBitLshift();
void ScTTT();
void ScDebugVar();
/** Obtain the date serial number for a given date.
@param bStrict
If false, nYear < 100 takes the two-digit year setting into account,
and rollover of invalid calendar dates takes place, e.g. 1999-02-31 =>
1999-03-03.
If true, the date passed must be a valid Gregorian calendar date. No
two-digit expanding or rollover is done.
Date must be Gregorian, i.e. >= 1582-10-15.
*/
double GetDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, bool bStrict );
void ScGetActDate();
void ScGetActTime();
void ScGetYear();
void ScGetMonth();
void ScGetDay();
void ScGetDayOfWeek();
void ScGetWeekOfYear();
void ScGetIsoWeekOfYear();
void ScWeeknumOOo();
void ScEasterSunday();
FormulaError GetWeekendAndHolidayMasks( const sal_uInt8 nParamCount, const sal_uInt32 nNullDate,
::std::vector<double>& rSortArray, bool bWeekendMask[ 7 ] );
FormulaError GetWeekendAndHolidayMasks_MS( const sal_uInt8 nParamCount, const sal_uInt32 nNullDate,
::std::vector<double>& rSortArray, bool bWeekendMask[ 7 ], bool bWorkdayFunction );
static inline sal_Int16 GetDayOfWeek( sal_Int32 n );
void ScNetWorkdays( bool bOOXML_Version );
void ScWorkday_MS();
void ScGetHour();
void ScGetMin();
void ScGetSec();
void ScPlusMinus();
void ScAbs();
void ScInt();
void ScEven();
void ScOdd();
void ScCeil( bool bODFF );
void ScCeil_MS();
void ScCeil_Precise();
void ScFloor( bool bODFF );
void ScFloor_MS();
void ScFloor_Precise();
void RoundNumber( rtl_math_RoundingMode eMode );
void ScRound();
void ScRoundUp();
void ScRoundDown();
void ScGetDateValue();
void ScGetTimeValue();
void ScArcTan2();
void ScLog();
void ScGetDate();
void ScGetTime();
void ScGetDiffDate();
void ScGetDiffDate360();
void ScGetDateDif();
void ScPower();
void ScAmpersand();
void ScAdd();
void ScSub();
void ScMul();
void ScDiv();
void ScPow();
void ScCurrent();
void ScStyle();
void ScDde();
void ScBase();
void ScDecimal();
void ScConvertOOo();
void ScEuroConvert();
void ScRoundSignificant();
// financial functions
void ScNPV();
void ScIRR();
void ScMIRR();
void ScISPMT();
static double ScGetBw(double fInterest, double fZzr, double fRmz,
double fZw, bool bPayInAdvance);
void ScPV();
void ScSYD();
static double ScGetGDA(double fWert, double fRest, double fDauer,
double fPeriode, double fFactor);
void ScDDB();
void ScDB();
static double ScInterVDB(double fWert,double fRest,double fDauer,double fDauer1,
double fPeriode,double fFactor);
void ScVDB();
void ScPDuration();
void ScSLN();
static double ScGetRmz(double fInterest, double fZzr, double fBw,
double fZw, bool bPayInAdvance);
void ScPMT();
void ScRRI();
static double ScGetZw(double fInterest, double fZzr, double fRmz,
double fBw, bool bFlag);
void ScFV();
void ScNper();
static bool RateIteration(double fNper, double fPayment, double fPv,
double fFv, bool bPayType, double& fGuess);
void ScRate();
double ScGetCompoundInterest(double fInterest, double fZr, double fZzr, double fBw,
double fZw, bool bPayInAdvance, double& fRmz);
void ScIpmt();
void ScPpmt();
void ScCumIpmt();
void ScCumPrinc();
void ScEffect();
void ScNominal();
void ScMod();
void ScIntercept();
void ScGCD();
void ScLCM();
// matrix functions
void ScMatValue();
static void MEMat(const ScMatrixRef& mM, SCSIZE n);
void ScMatDet();
void ScMatInv();
void ScMatMult();
void ScMatTrans();
void ScEMat();
void ScMatRef();
ScMatrixRef MatConcat(const ScMatrixRef& pMat1, const ScMatrixRef& pMat2);
void ScSumProduct();
void ScSumX2MY2();
void ScSumX2DY2();
void ScSumXMY2();
void ScGrowth();
bool CalculateSkew(double& fSum,double& fCount,double& vSum,std::vector<double>& values);
void CalculateSkewOrSkewp( bool bSkewp );
void CalculateSlopeIntercept(bool bSlope);
void CalculateSmallLarge(bool bSmall);
void CalculatePearsonCovar( bool _bPearson, bool _bStexy, bool _bSample ); //fdo#70000 argument _bSample is ignored if _bPearson == true
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);
void CalculateLookup(bool bHLookup);
bool FillEntry(ScQueryEntry& rEntry);
void CalculateAddSub(bool _bSub);
void CalculateTrendGrowth(bool _bGrowth);
void CalculateRGPRKP(bool _bRKP);
void CalculateSumX2MY2SumX2DY2(bool _bSumX2DY2);
void CalculateMatrixValue(const ScMatrix* pMat,SCSIZE nC,SCSIZE nR);
bool CheckMatrix(bool _bLOG,sal_uInt8& nCase,SCSIZE& nCX,SCSIZE& nCY,SCSIZE& nRX,SCSIZE& nRY,SCSIZE& M,SCSIZE& N,ScMatrixRef& pMatX,ScMatrixRef& pMatY);
void ScLinest();
void ScLogest();
void ScForecast();
void ScForecast_Ets( ScETSType eETSType );
void ScNoName();
void ScBadName();
// Statistics:
static double taylor(const double* pPolynom, sal_uInt16 nMax, double x);
static double gauss(double x);
public:
static SC_DLLPUBLIC double phi(double x);
static SC_DLLPUBLIC double integralPhi(double x);
static SC_DLLPUBLIC double gaussinv(double x);
static SC_DLLPUBLIC double GetPercentile( ::std::vector<double> & rArray, double fPercentile );
private:
double GetBetaDist(double x, double alpha, double beta); //cumulative distribution function
double GetBetaDistPDF(double fX, double fA, double fB); //probability density function)
double GetChiDist(double fChi, double fDF); // for LEGACY.CHIDIST, returns right tail
double GetChiSqDistCDF(double fX, double fDF); // for CHISQDIST, returns left tail
static double GetChiSqDistPDF(double fX, double fDF); // probability density function
double GetFDist(double x, double fF1, double fF2);
double GetTDist( double T, double fDF, int nType );
double Fakultaet(double x);
static double BinomKoeff(double n, double k);
double GetGamma(double x);
static double GetLogGamma(double x);
double GetBeta(double fAlpha, double fBeta);
static double GetLogBeta(double fAlpha, double fBeta);
double GetBinomDistPMF(double x, double n, double p); //probability mass function
double GetHypGeomDist( double x, double n, double M, double N );
void ScLogGamma();
void ScGamma();
void ScPhi();
void ScGauss();
void ScStdNormDist();
void ScStdNormDist_MS();
void ScFisher();
void ScFisherInv();
void ScFact();
void ScNormDist( int nMinParamCount );
void ScGammaDist( bool bODFF );
void ScGammaInv();
void ScExpDist();
void ScBinomDist();
void ScPoissonDist( bool bODFF );
void ScCombin();
void ScCombinA();
void ScPermut();
void ScPermutationA();
void ScB();
void ScHypGeomDist( int nMinParamCount );
void ScLogNormDist( int nMinParamCount );
void ScLogNormInv();
void ScTDist();
void ScTDist_MS();
void ScTDist_T( int nTails );
void ScFDist();
void ScFDist_LT();
void ScChiDist( bool bODFF); // for LEGACY.CHIDIST, returns right tail
void ScChiSqDist(); // returns left tail or density
void ScChiSqDist_MS();
void ScChiSqInv(); //invers to CHISQDIST
void ScWeibull();
void ScBetaDist();
void ScBetaDist_MS();
void ScFInv();
void ScFInv_LT();
void ScTInv( int nType );
void ScChiInv();
void ScBetaInv();
void ScCritBinom();
void ScNegBinomDist();
void ScNegBinomDist_MS();
void ScKurt();
void ScHarMean();
void ScGeoMean();
void ScStandard();
void ScSkew();
void ScSkewp();
void ScMedian();
double GetMedian( ::std::vector<double> & rArray );
double GetPercentileExclusive( ::std::vector<double> & rArray, double fPercentile );
void GetNumberSequenceArray( sal_uInt8 nParamCount, ::std::vector<double>& rArray, bool bConvertTextInArray );
void GetSortArray( sal_uInt8 nParamCount, ::std::vector<double>& rSortArray, ::std::vector<long>* pIndexOrder, bool bConvertTextInArray, bool bAllowEmptyArray );
static void QuickSort(::std::vector<double>& rSortArray, ::std::vector<long>* pIndexOrder);
void ScModalValue();
void ScModalValue_Multi();
void ScAveDev();
void ScAggregate();
void ScDevSq();
void ScZTest();
void ScTTest();
void ScFTest();
void ScChiTest();
void ScRank( bool bAverage );
void ScPercentile( bool bInclusive );
void ScPercentrank( bool bInclusive );
static double GetPercentrank( ::std::vector<double> & rArray, double fVal, bool bInclusive );
void ScLarge();
void ScSmall();
void ScFrequency();
void ScQuartile( bool bInclusive );
void ScNormInv();
void ScSNormInv();
void ScConfidence();
void ScConfidenceT();
void ScTrimMean();
void ScProbability();
void ScCorrel();
void ScCovarianceP();
void ScCovarianceS();
void ScPearson();
void ScRSQ();
void ScSTEYX();
void ScSlope();
void ScTrend();
void ScInfo();
void ScLenB();
void ScRightB();
void ScLeftB();
void ScMidB();
void ScReplaceB();
void ScFindB();
void ScSearchB();
void ScFilterXML();
void ScWebservice();
void ScEncodeURL();
void ScColor();
void ScErf();
void ScErfc();
static const double fMaxGammaArgument;
double GetGammaContFraction(double fA,double fX);
double GetGammaSeries(double fA,double fX);
double GetLowRegIGamma(double fA,double fX); // lower regularized incomplete gamma function, GAMMAQ
double GetUpRegIGamma(double fA,double fX); // upper regularized incomplete gamma function, GAMMAP
// probability density function; fLambda is "scale" parameter
double GetGammaDistPDF(double fX, double fAlpha, double fLambda);
// cumulative distribution function; fLambda is "scale" parameter
double GetGammaDist(double fX, double fAlpha, double fLambda);
double GetTInv( double fAlpha, double fSize, int nType );
public: public:
ScInterpreter( ScFormulaCell* pCell, ScDocument* pDoc, ScInterpreter( ScFormulaCell* pCell, ScDocument* pDoc,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment