22#include <com/sun/star/uno/Reference.hxx>
40#ifdef DISABLE_DYNLOADING
49#define DaysInMonth analysishelper_DaysInMonth
50#define DateToDays analysishelper_DateToDays
51#define DaysToDate analysishelper_DaysToDate
52#define GetNullDate analysishelper_GetNullDate
56sal_uInt16
DaysInMonth( sal_uInt16 nMonth, sal_uInt16 nYear );
57sal_Int32
DateToDays( sal_uInt16 nDay, sal_uInt16 nMonth, sal_uInt16 nYear );
59void DaysToDate( sal_Int32 nDays, sal_uInt16& rDay, sal_uInt16& rMonth, sal_uInt16& rYear );
61sal_Int32
GetNullDate(
const css::uno::Reference< css::beans::XPropertySet >& xOptions );
63 sal_uInt16 nDay1, sal_uInt16 nMonth1, sal_uInt16 nYear1,
bool bLeapYear1,
64 sal_uInt16 nDay2, sal_uInt16 nMonth2, sal_uInt16 nYear2,
66inline sal_Int32
GetDiffDate360(
const css::uno::Reference< css::beans::XPropertySet >& xOpt, sal_Int32 nDate1, sal_Int32 nDate2,
bool bUSAMethod );
67sal_Int32
GetDiffDate360( sal_Int32 nNullDate, sal_Int32 nDate1, sal_Int32 nDate2,
bool bUSAMethod );
73sal_Int32
GetDiffDate( sal_Int32 nNullDate, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode,
74 sal_Int32* pOptDaysIn1stYear );
77double GetYearDiff( sal_Int32 nNullDate, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode );
80sal_Int32
GetDaysInYear( sal_Int32 nNullDate, sal_Int32 nDate, sal_Int32 nMode );
83double GetYearFrac( sal_Int32 nNullDate, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode );
86inline double GetYearFrac(
const css::uno::Reference< css::beans::XPropertySet >& xOpt, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode );
89double GetGcd(
double f1,
double f2 );
92double ConvertToDec(
const OUString& rFromNum, sal_uInt16 nBaseFrom, sal_uInt16 nCharLim );
96 double fNum,
double fMin,
double fMax, sal_uInt16 nBase,
97 sal_Int32 nPlaces, sal_Int32 nMaxPlaces,
bool bUsePlaces );
98double Erf(
double fX );
99double Erfc(
double fX );
101OUString
GetString(
double fNumber,
bool bLeadingSign, sal_uInt16 nMaxNumOfDigits = 15 );
105double GetAmordegrc( sal_Int32 nNullDate,
double fCost, sal_Int32 nDate, sal_Int32 nFirstPer,
106 double fRestVal,
double fPer,
double fRate, sal_Int32 nBase );
109double GetAmorlinc( sal_Int32 nNullDate,
double fCost, sal_Int32 nDate, sal_Int32 nFirstPer,
110 double fRestVal,
double fPer,
double fRate, sal_Int32 nBase );
113double GetDuration( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat,
double fCoup,
114 double fYield, sal_Int32 nFreq, sal_Int32 nBase );
117double GetYieldmat( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nIssue,
118 double fRate,
double fPrice, sal_Int32 nBase );
121double GetOddfprice( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nIssue,
122 sal_Int32 nFirstCoup,
double fRate,
double fYield,
double fRedemp,
123 sal_Int32 nFreq, sal_Int32 nBase );
126double getYield_( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat,
double fCoup,
double fPrice,
127 double fRedemp, sal_Int32 nFreq, sal_Int32 nBase );
130double getPrice_( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat,
double fRate,
double fYield,
131 double fRedemp, sal_Int32 nFreq, sal_Int32 nBase );
134double GetOddfyield( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nIssue,
135 sal_Int32 nFirstCoup,
double fRate,
double fPrice,
double fRedemp,
136 sal_Int32 nFreq, sal_Int32 nBase );
139double GetOddlprice( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nLastInterest,
140 double fRate,
double fYield,
double fRedemp, sal_Int32 nFreq, sal_Int32 nBase );
143double GetOddlyield( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nLastInterest,
144 double fRate,
double fPrice,
double fRedemp, sal_Int32 nFreq, sal_Int32 nBase );
145double GetPmt(
double fRate,
double fNper,
double fPv,
double fFv, sal_Int32 nPayType );
146double GetFv(
double fRate,
double fNper,
double fPmt,
double fPv, sal_Int32 nPayType );
150double GetCouppcd( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq,
154double GetCoupncd( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq,
158double GetCoupdaybs( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq,
162double GetCoupdaysnc( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq,
167double GetCoupnum( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat,
168 sal_Int32 nFreq, sal_Int32 nBase );
171double GetCoupdays( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq,
219 inline const OUString&
GetSuffix()
const;
221 sal_uInt16
GetStrIndex( sal_uInt16 nParamNum )
const;
222 inline bool Is( std::u16string_view rCompareTo )
const;
224 inline const std::vector<OUString> &
248 void Insert( sal_Int32 nDay );
249 void Insert( sal_Int32 nDay, sal_Int32 nNullDate,
bool bInsertOnWeekend );
252 void Insert(
double fDay, sal_Int32 nNullDate,
bool bInsertOnWeekend );
261 const css::uno::Any& rHolAny,
263 bool bInsertOnWeekend );
273 sal_Int32
Get( sal_uInt32 n )
const
277 bool Find( sal_Int32 nVal )
const;
286 const css::uno::Reference< css::beans::XPropertySet >& xOptions,
287 const css::uno::Any& rHolAny,
288 sal_Int32 nNullDate);
311 const css::uno::Any& rAny,
321 const css::uno::Sequence< css::uno::Any >& rAnySeq,
331 const css::uno::Sequence< css::uno::Sequence< css::uno::Any > >& rAnySeq,
339 double Get( sal_uInt32 n )
const
344 void Append(
const css::uno::Sequence< css::uno::Sequence< double > >& rValueArr );
347 void Append(
const css::uno::Sequence< css::uno::Sequence< sal_Int32 > >& rValueArr );
356 const css::uno::Reference< css::beans::XPropertySet >& xOpt,
357 const css::uno::Sequence< css::uno::Any >& rAnySeq );
369 virtual bool CheckInsert(
double fValue )
const override;
377 virtual bool CheckInsert(
double fValue )
const override;
391 explicit Complex(
const OUString& rComplexAsString );
399 inline double Real()
const;
400 inline double Imag()
const;
405 inline double Abs()
const;
410 void Power(
double fPower );
432 inline void Mult(
double fFact );
471 inline const Complex&
Get( sal_uInt32 nIndex )
const;
481 void Append(
const css::uno::Sequence< css::uno::Sequence< OUString > >& rComplexNumList );
484 void Append(
const css::uno::Sequence< css::uno::Any >& aMultPars );
495#define INV_MATCHLEV 1764
508 const char pUnitName[],
509 double fConvertConstant,
511 bool bPrefSupport =
false );
524 sal_Int16 nMatchLevelFrom, sal_Int16 nMatchLevelTo )
const;
525 virtual double ConvertFromBase(
double fVal, sal_Int16 nMatchLevel )
const;
535 const char pUnitName[],
536 double fConvertConstant,
537 double fConvertOffset,
539 bool bPrefSupport =
false );
544 sal_Int16 nMatchLevelFrom, sal_Int16 nMatchLevelTo )
const override;
550 double ConvertToBase(
double fVal, sal_Int16 nMatchLevel )
const;
551 virtual double ConvertFromBase(
double fVal, sal_Int16 nMatchLevel )
const override;
558 std::vector<std::unique_ptr<ConvertData>>
maVector;
565 double Convert(
double fVal,
const OUString& rFrom,
const OUString& rTo );
571 return ( (( (
n % 4 ) == 0 ) && ( (
n % 100 ) != 0)) || ( (
n % 400 ) == 0 ) );
575inline sal_Int32
GetDiffDate360(
const css::uno::Reference< css::beans::XPropertySet >& xOpt, sal_Int32 nDate1, sal_Int32 nDate2,
bool bUSAMethod )
583 return static_cast< sal_Int16
>( (
n - 1 ) % 7 );
587inline double GetYearFrac(
const css::uno::Reference< css::beans::XPropertySet >& xOpt, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode )
636 r( fReal ),
i( fImag ), c( cC )
655 return std::hypot(
r,
i);
677 r = r_ * rM.
r - i_ * rM.
i;
678 i = r_ * rM.
i + i_ * rM.
r;
718 bool bPrefSupport ) :
766 ScaDate( sal_Int32 nNullDate, sal_Int32 nDate, sal_Int32 nBase );
781 inline void setYear( sal_uInt16 nNewYear );
785 inline void addYears( sal_Int32 nYearCount );
788 sal_Int32
getDate( sal_Int32 nNullDate )
const;
827 css::uno::Reference< css::util::XNumberFormatter2 >
xFormatter;
837 const OUString& rString )
const;
841 const css::uno::Reference< css::uno::XComponentContext >& xContext );
848 const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
858 const css::uno::Any& rAny )
const;
868 const css::uno::Reference< css::beans::XPropertySet >& xPropSet,
869 const css::uno::Any& rAny );
877 const css::uno::Reference< css::beans::XPropertySet >& xPropSet,
878 const css::uno::Any& rAny,
889 const css::uno::Reference< css::beans::XPropertySet >& xPropSet,
890 const css::uno::Any& rAny );
898 const css::uno::Reference< css::beans::XPropertySet >& xPropSet,
899 const css::uno::Any& rAny,
900 sal_Int32 nDefault );
std::vector< Complex > maVector
void Append(Complex &&pNew)
void Append(const css::uno::Sequence< css::uno::Any > &aMultPars)
const Complex & Get(sal_uInt32 nIndex) const
void Append(const css::uno::Sequence< css::uno::Sequence< OUString > > &rComplexNumList)
OUString GetString() const
void Div(const Complex &rDivisor)
void Power(double fPower)
void Add(const Complex &rAdd)
static bool ParseString(const OUString &rComplexAsString, Complex &rReturn)
void Sub(const Complex &rMult)
static bool IsImagUnit(sal_Unicode c)
Complex(double fReal, double fImag=0.0, sal_Unicode cC='\0')
ConvertDataLinear(const char pUnitName[], double fConvertConstant, double fConvertOffset, ConvertDataClass eClass, bool bPrefSupport=false)
double ConvertToBase(double fVal, sal_Int16 nMatchLevel) const
virtual double ConvertFromBase(double fVal, sal_Int16 nMatchLevel) const override
virtual double Convert(double fVal, const ConvertData &rTo, sal_Int16 nMatchLevelFrom, sal_Int16 nMatchLevelTo) const override
virtual ~ConvertDataLinear() override
double Convert(double fVal, const OUString &rFrom, const OUString &rTo)
std::vector< std::unique_ptr< ConvertData > > maVector
virtual double Convert(double fVal, const ConvertData &rTo, sal_Int16 nMatchLevelFrom, sal_Int16 nMatchLevelTo) const
ConvertData(const char pUnitName[], double fConvertConstant, ConvertDataClass eClass, bool bPrefSupport=false)
ConvertDataClass Class() const
virtual double ConvertFromBase(double fVal, sal_Int16 nMatchLevel) const
sal_Int16 GetMatchingLevel(const OUString &rRef) const
std::vector< OUString > aCompList
FDCategory GetCategory() const
sal_uInt16 GetStrIndex(sal_uInt16 nParamNum) const
const TranslateId * pDescrID
const OUString & GetSuffix() const
FuncData(const FuncDataBase &rBaseData)
bool Is(std::u16string_view rCompareTo) const
const std::vector< OUString > & GetCompNameList() const
const TranslateId & GetUINameID() const
const TranslateId * GetDescrID() const
Helper class for Any->double conversion, using current language settings.
double convertToDouble(const OUString &rString) const
Converts a string to double using the number formatter.
ScaAnyConverter(const css::uno::Reference< css::uno::XComponentContext > &xContext)
bool getDouble(double &rfResult, const css::uno::Any &rAny) const
Converts an Any to double (without initialization).
sal_Int32 getInt32(const css::uno::Reference< css::beans::XPropertySet > &xPropSet, const css::uno::Any &rAny, sal_Int32 nDefault)
Converts an Any to sal_Int32 (with initialization).
css::uno::Reference< css::util::XNumberFormatter2 > xFormatter
void init(const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
Initializing with current language settings.
bool getInt32(sal_Int32 &rnResult, const css::uno::Reference< css::beans::XPropertySet > &xPropSet, const css::uno::Any &rAny)
Converts an Any to sal_Int32 (with initialization).
double getDouble(const css::uno::Reference< css::beans::XPropertySet > &xPropSet, const css::uno::Any &rAny, double fDefault)
Converts an Any to double (with initialization).
bool getDouble(double &rfResult, const css::uno::Reference< css::beans::XPropertySet > &xPropSet, const css::uno::Any &rAny)
Converts an Any to double (with initialization).
Helper class for date calculation for various financial functions.
bool operator<=(const ScaDate &rCmp) const
sal_uInt16 nDay
is the day of the original date.
sal_Int32 getDate(sal_Int32 nNullDate) const
bool operator>=(const ScaDate &rCmp) const
void doAddYears(sal_Int32 nYearCount)
Adds/subtracts the given count of years, does not adjust day.
bool bLastDayMode
is the current year.
sal_uInt16 getDaysInMonth() const
sal_Int32 getDaysInYearRange(sal_uInt16 nFrom, sal_uInt16 nTo) const
@ return count of days in the given year range
void addMonths(sal_Int32 nMonthCount)
adds/subtracts the given count of months, adjusts day
void setYear(sal_uInt16 nNewYear)
sets the given year, adjusts day
void setDay()
is true, if the US method of 30-day-calculations is used.
void addYears(sal_Int32 nYearCount)
adds/subtracts the given count of years, adjusts day
bool bLastDay
if true, recalculate nDay after every calculation.
bool operator>(const ScaDate &rCmp) const
sal_uInt16 nYear
is the current month (one-based).
sal_uInt16 getYear() const
sal_uInt16 getMonth() const
ScaDate & operator=(const ScaDate &rCopy)
sal_Int32 getDaysInMonthRange(sal_uInt16 nFrom, sal_uInt16 nTo) const
@ return count of days in the given month range
static sal_Int32 getDiff(const ScaDate &rFrom, const ScaDate &rTo)
bool b30Days
is true, if original date was the last day in month.
bool bUSMode
is true, if every month has 30 days in calculations.
sal_uInt16 nMonth
is the calculated day depending on the current month/year.
bool operator<(const ScaDate &rCmp) const
stores double values >=0.0, throws exception for double values <0.0
virtual bool CheckInsert(double fValue) const override
stores double values >0.0, throws exception for double values <0.0, does nothing for 0....
virtual bool CheckInsert(double fValue) const override
void Append(const ScaAnyConverter &rAnyConv, const css::uno::Sequence< css::uno::Any > &rAnySeq, bool bIgnoreEmpty)
void Append(ScaAnyConverter &rAnyConv, const css::uno::Reference< css::beans::XPropertySet > &xOpt, const css::uno::Sequence< css::uno::Any > &rAnySeq)
void Append(const css::uno::Sequence< css::uno::Sequence< sal_Int32 > > &rValueArr)
void Append(const ScaAnyConverter &rAnyConv, const css::uno::Any &rAny, bool bIgnoreEmpty)
std::vector< double > maVector
double Get(sal_uInt32 n) const
void Append(const css::uno::Sequence< css::uno::Sequence< double > > &rValueArr)
virtual bool CheckInsert(double fValue) const
void Append(double fValue)
void Append(const ScaAnyConverter &rAnyConv, const css::uno::Sequence< css::uno::Sequence< css::uno::Any > > &rAnySeq, bool bIgnoreEmpty)
void ListAppend(double fValue)
sorted list with unique sal_Int32 values
bool Find(sal_Int32 nVal) const
SortedIndividualInt32List()
sal_Int32 Get(sal_uInt32 n) const
void Insert(sal_Int32 nDay)
std::vector< sal_Int32 > maVector
~SortedIndividualInt32List()
void InsertHolidayList(const ScaAnyConverter &rAnyConv, const css::uno::Any &rHolAny, sal_Int32 nNullDate, bool bInsertOnWeekend)
void InsertHolidayList(ScaAnyConverter &rAnyConv, const css::uno::Reference< css::beans::XPropertySet > &xOptions, const css::uno::Any &rHolAny, sal_Int32 nNullDate)
class SAL_NO_VTABLE XPropertySet
double GetYearDiff(sal_Int32 nNullDate, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode)
double GetOddfprice(sal_Int32, sal_Int32, sal_Int32, sal_Int32, sal_Int32, double, double, double, sal_Int32, sal_Int32)
double getYield_(sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, double fCoup, double fPrice, double fRedemp, sal_Int32 nFreq, sal_Int32 nBase)
double BinomialCoefficient(double n, double k)
double GetOddfyield(sal_Int32, sal_Int32, sal_Int32, sal_Int32, sal_Int32, double, double, double, sal_Int32, sal_Int32)
void InitFuncDataList(FuncDataList &rList)
sal_Int32 GetNullDate(const uno::Reference< beans::XPropertySet > &xOpt)
Get the null date used by the spreadsheet document.
double GetYieldmat(sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nIssue, double fRate, double fPrice, sal_Int32 nBase)
double GetPmt(double fRate, double fNper, double fPv, double fFv, sal_Int32 nPayType)
double GetCoupdaysnc(sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq, sal_Int32 nBase)
double GetCouppcd(sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq, sal_Int32 nBase)
sal_Int32 GetDaysInYear(sal_Int32 nNullDate, sal_Int32 nDate, sal_Int32 nMode)
double GetAmordegrc(sal_Int32 nNullDate, double fCost, sal_Int32 nDate, sal_Int32 nFirstPer, double fRestVal, double fPer, double fRate, sal_Int32 nBase)
double GetCoupnum(sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq, sal_Int32 nBase)
double GetGcd(double f1, double f2)
OUString GetString(double f, bool bLeadingSign, sal_uInt16 nMaxDig)
OUString ConvertFromDec(double fNum, double fMin, double fMax, sal_uInt16 nBase, sal_Int32 nPlaces, sal_Int32 nMaxPlaces, bool bUsePlaces)
bool ParseDouble(const sal_Unicode *&rp, double &rRet)
sal_Int32 GetDiffDate(sal_Int32 nNullDate, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode, sal_Int32 *pOptDaysIn1stYear)
double getPrice_(sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, double fRate, double fYield, double fRedemp, sal_Int32 nFreq, sal_Int32 nBase)
double GetCoupdays(sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq, sal_Int32 nBase)
double GetOddlyield(sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nLastCoup, double fRate, double fPrice, double fRedemp, sal_Int32 nFreq, sal_Int32 nBase)
double ConvertToDec(const OUString &aStr, sal_uInt16 nBase, sal_uInt16 nCharLim)
sal_Int32 GetDiffDate360(sal_uInt16 nDay1, sal_uInt16 nMonth1, sal_uInt16 nYear1, bool bLeapYear1, sal_uInt16 nDay2, sal_uInt16 nMonth2, sal_uInt16 nYear2, bool bUSAMethod)
sal_Int32 DateToDays(sal_uInt16 nDay, sal_uInt16 nMonth, sal_uInt16 nYear)
Convert a date to a count of days starting from 01/01/0001.
void DaysToDate(sal_Int32 nDays, sal_uInt16 &rDay, sal_uInt16 &rMonth, sal_uInt16 &rYear)
Convert a count of days starting from 01/01/0001 to a date.
double GetYearFrac(sal_Int32 nNullDate, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode)
Function GetYearFrac implements YEARFRAC as defined in: Open Document Format for Office Applications ...
sal_uInt16 DaysInMonth(sal_uInt16 nMonth, sal_uInt16 nYear)
sal_Int32 GetDaysInYears(sal_uInt16 nYear1, sal_uInt16 nYear2)
double GetCoupdaybs(sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq, sal_Int32 nBase)
double GetOddlprice(sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nLastCoup, double fRate, double fYield, double fRedemp, sal_Int32 nFreq, sal_Int32 nBase)
double GetFv(double fRate, double fNper, double fPmt, double fPv, sal_Int32 nPayType)
bool IsLeapYear(sal_uInt16 nYear)
double GetAmorlinc(sal_Int32 nNullDate, double fCost, sal_Int32 nDate, sal_Int32 nFirstPer, double fRestVal, double fPer, double fRate, sal_Int32 nBase)
double GetCoupncd(sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq, sal_Int32 nBase)
double GetDuration(sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, double fCoup, double fYield, sal_Int32 nFreq, sal_Int32 nBase)
sal_Int16 GetDayOfWeek(sal_Int32 nDate)
std::vector< FuncData > FuncDataList
bool operator()(FuncData const &rCandidate) const
FindFuncData(const OUString &rId)
const TranslateId * pDescrID
const char ** pCompListID