diff options
-rw-r--r-- | scaddins/source/analysis/analysis.cxx | 95 | ||||
-rw-r--r-- | scaddins/source/analysis/analysis.hxx | 36 | ||||
-rw-r--r-- | scaddins/source/analysis/analysisadd.idl | 36 | ||||
-rw-r--r-- | scaddins/source/analysis/analysishelper.cxx | 9 | ||||
-rw-r--r-- | scaddins/source/analysis/financial.cxx | 8 |
5 files changed, 107 insertions, 77 deletions
diff --git a/scaddins/source/analysis/analysis.cxx b/scaddins/source/analysis/analysis.cxx index fe2041230a7b..c5dcfca9ebdc 100644 --- a/scaddins/source/analysis/analysis.cxx +++ b/scaddins/source/analysis/analysis.cxx @@ -2,9 +2,9 @@ * * $RCSfile: analysis.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: gt $ $Date: 2001-05-22 13:59:04 $ + * last change: $Author: gt $ $Date: 2001-05-28 10:17:18 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -472,7 +472,7 @@ const sal_Char* pFuncDatas[] = INTERNPARAM, "pSettlement", "pMaturity", "pPrice", "pRedemption", "pBase", INTERNPARAM, "PSettlement", "PMaturity", "PPrice", "PRedemption", "PBase", EOE, - "igetDuration", "1Duration", "2Duration_add", + "igetDuration", "1Duration_add", "2Duration_add", "dReturns the annual duration of a security with periodic interest payments", INTERNPARAM, "pSettlement", "pMaturity", "pCoupon", "pYield", "pFrequency", "pBase", INTERNPARAM, "PSettlement", "PMaturity", "PCoupon", "PYield", "PFrequency", "PBase", @@ -905,9 +905,9 @@ sal_Int32 SAL_CALL AnalysisAddIn::getWorkday( constREFXPS& xOptions, */ double SAL_CALL AnalysisAddIn::getYearfrac( constREFXPS& xOpt, - sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode ) THROWDEF_RTE_IAE + sal_Int32 nStartDate, sal_Int32 nEndDate, const ANY& rMode ) THROWDEF_RTE_IAE { - return GetYearFrac( xOpt, nStartDate, nEndDate, nMode ); + return GetYearFrac( xOpt, nStartDate, nEndDate, GetOptBase( rMode ) ); } @@ -971,8 +971,7 @@ sal_Int32 SAL_CALL AnalysisAddIn::getEomonth( constREFXPS& xOpt, sal_Int32 nDate sal_Int32 SAL_CALL AnalysisAddIn::getNetworkdays( constREFXPS& xOpt, - sal_Int32 nStartDate, sal_Int32 nEndDate, const SEQSEQ( sal_Int32 )& aHDay ) THROWDEF_RTE -// sal_Int32 nStartDate, sal_Int32 nEndDate, const uno::Any& aHDay ) THROWDEF_RTE + sal_Int32 nStartDate, sal_Int32 nEndDate, const ANY& aHDay ) THROWDEF_RTE { sal_Int32 nNullDate = GetNullDate( xOpt ); @@ -1221,10 +1220,11 @@ double SAL_CALL AnalysisAddIn::getBessely( double fNum, sal_Int32 nOrder ) THROW #define _MAX8 536870911 // max. val for octal numbers #define _MIN16 -1099511627776 // min. val for hexadecimal numbers #define _MAX16 1099511627775 // max. val for hexadecimal numbers -#define DOUBLECONV(from,to) ConvertFromDec(sal_Int64(ConvertToDec(aNum,from,_P)),_MIN##to,_MAX##to,to,nPlaces,_P) +#define GETPLACES() GetOpt(rPlaces,sal_Int32(-(2^31))) +#define DOUBLECONV(from,to) ConvertFromDec(sal_Int64(ConvertToDec(aNum,from,_P)),_MIN##to,_MAX##to,to,GETPLACES(),_P) -STRING SAL_CALL AnalysisAddIn::getBin2oct( const STRING& aNum, sal_Int32 nPlaces ) THROWDEF_RTE_IAE +STRING SAL_CALL AnalysisAddIn::getBin2oct( const STRING& aNum, const ANY& rPlaces ) THROWDEF_RTE_IAE { return DOUBLECONV( 2, 8 ); } @@ -1236,13 +1236,13 @@ double SAL_CALL AnalysisAddIn::getBin2dec( const STRING& aNum ) THROWDEF_RTE_IAE } -STRING SAL_CALL AnalysisAddIn::getBin2hex( const STRING& aNum, sal_Int32 nPlaces ) THROWDEF_RTE_IAE +STRING SAL_CALL AnalysisAddIn::getBin2hex( const STRING& aNum, const ANY& rPlaces ) THROWDEF_RTE_IAE { return DOUBLECONV( 2, 16 ); } -STRING SAL_CALL AnalysisAddIn::getOct2bin( const STRING& aNum, sal_Int32 nPlaces ) THROWDEF_RTE_IAE +STRING SAL_CALL AnalysisAddIn::getOct2bin( const STRING& aNum, const ANY& rPlaces ) THROWDEF_RTE_IAE { return DOUBLECONV( 8, 2 ); } @@ -1254,31 +1254,31 @@ double SAL_CALL AnalysisAddIn::getOct2dec( const STRING& aNum ) THROWDEF_RTE_IAE } -STRING SAL_CALL AnalysisAddIn::getOct2hex( const STRING& aNum, sal_Int32 nPlaces ) THROWDEF_RTE_IAE +STRING SAL_CALL AnalysisAddIn::getOct2hex( const STRING& aNum, const ANY& rPlaces ) THROWDEF_RTE_IAE { return DOUBLECONV( 8, 16 ); } -STRING SAL_CALL AnalysisAddIn::getDec2bin( sal_Int32 nNum, sal_Int32 nPlaces ) THROWDEF_RTE_IAE +STRING SAL_CALL AnalysisAddIn::getDec2bin( sal_Int32 nNum, const ANY& rPlaces ) THROWDEF_RTE_IAE { - return ConvertFromDec( nNum, _MIN2, _MAX2, 2, nPlaces, _P ); + return ConvertFromDec( nNum, _MIN2, _MAX2, 2, GETPLACES(), _P ); } -STRING SAL_CALL AnalysisAddIn::getDec2oct( sal_Int32 nNum, sal_Int32 nPlaces ) THROWDEF_RTE_IAE +STRING SAL_CALL AnalysisAddIn::getDec2oct( sal_Int32 nNum, const ANY& rPlaces ) THROWDEF_RTE_IAE { - return ConvertFromDec( nNum, _MIN8, _MAX8, 8, nPlaces, _P ); + return ConvertFromDec( nNum, _MIN8, _MAX8, 8, GETPLACES(), _P ); } -STRING SAL_CALL AnalysisAddIn::getDec2hex( double fNum, sal_Int32 nPlaces ) THROWDEF_RTE_IAE +STRING SAL_CALL AnalysisAddIn::getDec2hex( double fNum, const ANY& rPlaces ) THROWDEF_RTE_IAE { - return ConvertFromDec( sal_Int64( fNum ), _MIN16, _MAX16, 16, nPlaces, _P ); + return ConvertFromDec( sal_Int64( fNum ), _MIN16, _MAX16, 16, GETPLACES(), _P ); } -STRING SAL_CALL AnalysisAddIn::getHex2bin( const STRING& aNum, sal_Int32 nPlaces ) THROWDEF_RTE_IAE +STRING SAL_CALL AnalysisAddIn::getHex2bin( const STRING& aNum, const ANY& rPlaces ) THROWDEF_RTE_IAE { return DOUBLECONV( 16, 2 ); } @@ -1290,25 +1290,38 @@ double SAL_CALL AnalysisAddIn::getHex2dec( const STRING& aNum ) THROWDEF_RTE_IAE } -STRING SAL_CALL AnalysisAddIn::getHex2oct( const STRING& aNum, sal_Int32 nPlaces ) THROWDEF_RTE_IAE +STRING SAL_CALL AnalysisAddIn::getHex2oct( const STRING& aNum, const ANY& rPlaces ) THROWDEF_RTE_IAE { return DOUBLECONV( 16, 8 ); } -sal_Int32 SAL_CALL AnalysisAddIn::getDelta( double fNum1, double fNum2 ) THROWDEF_RTE +sal_Int32 SAL_CALL AnalysisAddIn::getDelta( double fNum1, const ANY& rNum2 ) THROWDEF_RTE { #ifdef DEBUG - return ( fNum1 == fNum2 )? 1 : 0; + return ( fNum1 == GetOpt( rNum2, 0.0 ) )? 1 : 0; #else - return fNum1 == fNum2; + return fNum1 == GetOpt( rNum2, 0.0 ); #endif } -double SAL_CALL AnalysisAddIn::getErf( double fLL, double fUL ) THROWDEF_RTE +double SAL_CALL AnalysisAddIn::getErf( double fLL, const ANY& rUL ) THROWDEF_RTE { - return Erf( fUL ) - Erf( fLL ); + switch( rUL.getValueTypeClass() ) + { + case uno::TypeClass_VOID: + return Erf( fLL ); + break; + case uno::TypeClass_DOUBLE: + double fUL = *( double* ) rUL.getValue(); + return Erf( fUL ) - Erf( fLL ); + break; + } + + THROW_IAE; + + return 0.0; } @@ -1318,12 +1331,12 @@ double SAL_CALL AnalysisAddIn::getErfc( double f ) THROWDEF_RTE } -sal_Int32 SAL_CALL AnalysisAddIn::getGestep( double fNum, double fStep ) THROWDEF_RTE +sal_Int32 SAL_CALL AnalysisAddIn::getGestep( double fNum, const ANY& rStep ) THROWDEF_RTE { #ifdef DEBUG - return ( fNum >= fStep )? 1 : 0; + return ( fNum >= GetOpt( rStep, 0.0 ) )? 1 : 0; #else - return fNum >= fStep; + return fNum >= GetOpt( rStep, 0.0 ); #endif } @@ -1498,14 +1511,28 @@ STRING SAL_CALL AnalysisAddIn::getImsqrt( const STRING& aNum ) THROWDEF_RTE_IAE } -STRING SAL_CALL AnalysisAddIn::getComplex( double fR, double fI, const STRING& rSuff ) THROWDEF_RTE_IAE +STRING SAL_CALL AnalysisAddIn::getComplex( double fR, double fI, const ANY& rSuff ) THROWDEF_RTE_IAE { - sal_Bool bi = rSuff.compareToAscii( "i" ) == 0; + sal_Bool bi; - if( bi || !rSuff.compareToAscii( "j" ) ) - return Complex( fR,fI ).GetString( bi ); - else - THROW_IAE; + switch( rSuff.getValueTypeClass() ) + { + case uno::TypeClass_VOID: + bi = sal_True; + break; + case uno::TypeClass_STRING: + { + const STRING* pSuff = ( const STRING* ) rSuff.getValue(); + bi = pSuff->compareToAscii( "i" ) == 0 || pSuff->getLength() == 0; + if( !bi && pSuff->compareToAscii( "j" ) != 0 ) + THROW_IAE; + } + break; + default: + THROW_IAE; + } + + return Complex( fR,fI ).GetString( bi ); } diff --git a/scaddins/source/analysis/analysis.hxx b/scaddins/source/analysis/analysis.hxx index 14a0ce089921..6cbbdea02b2c 100644 --- a/scaddins/source/analysis/analysis.hxx +++ b/scaddins/source/analysis/analysis.hxx @@ -2,9 +2,9 @@ * * $RCSfile: analysis.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: gt $ $Date: 2001-05-22 11:49:14 $ + * last change: $Author: gt $ $Date: 2001-05-28 10:17:19 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -127,11 +127,11 @@ public: // virtual double SAL_CALL get_Test( constREFXPS&, sal_Int32 nMode, double f1, double f2, double f3 ) THROWDEF_RTE; virtual sal_Int32 SAL_CALL getWorkday( constREFXPS&, sal_Int32 nStartDate, sal_Int32 nDays, const ANY& aHDay ) THROWDEF_RTE; - virtual double SAL_CALL getYearfrac( constREFXPS&, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode ) THROWDEF_RTE_IAE; + virtual double SAL_CALL getYearfrac( constREFXPS&, sal_Int32 nStartDate, sal_Int32 nEndDate, const ANY& aMode ) THROWDEF_RTE_IAE; virtual sal_Int32 SAL_CALL getEdate( constREFXPS&, sal_Int32 nStartDate, sal_Int32 nMonths ) THROWDEF_RTE; virtual sal_Int32 SAL_CALL getWeeknum( constREFXPS&, sal_Int32 nStartDate, sal_Int32 nMode ) THROWDEF_RTE; virtual sal_Int32 SAL_CALL getEomonth( constREFXPS&, sal_Int32 nStartDate, sal_Int32 nMonths ) THROWDEF_RTE; - virtual sal_Int32 SAL_CALL getNetworkdays( constREFXPS&, sal_Int32 nStartDate, sal_Int32 nEndDate, const SEQSEQ( sal_Int32 )& aHDay ) THROWDEF_RTE; + virtual sal_Int32 SAL_CALL getNetworkdays( constREFXPS&, sal_Int32 nStartDate, sal_Int32 nEndDate, const ANY& aHDay ) THROWDEF_RTE; virtual sal_Int32 SAL_CALL getIseven( sal_Int32 nVal ) THROWDEF_RTE; virtual sal_Int32 SAL_CALL getIsodd( sal_Int32 nVal ) THROWDEF_RTE; @@ -153,28 +153,28 @@ public: virtual double SAL_CALL getBesselk( double fNum, sal_Int32 nOrder ) THROWDEF_RTE_IAE; virtual double SAL_CALL getBessely( double fNum, sal_Int32 nOrder ) THROWDEF_RTE_IAE; - virtual STRING SAL_CALL getBin2oct( const STRING& aNum, sal_Int32 nPlaces ) THROWDEF_RTE_IAE; + virtual STRING SAL_CALL getBin2oct( const STRING& aNum, const ANY& rPlaces ) THROWDEF_RTE_IAE; virtual double SAL_CALL getBin2dec( const STRING& aNum ) THROWDEF_RTE_IAE; - virtual STRING SAL_CALL getBin2hex( const STRING& aNum, sal_Int32 nPlaces ) THROWDEF_RTE_IAE; + virtual STRING SAL_CALL getBin2hex( const STRING& aNum, const ANY& rPlaces ) THROWDEF_RTE_IAE; - virtual STRING SAL_CALL getOct2bin( const STRING& aNum, sal_Int32 nPlaces ) THROWDEF_RTE_IAE; + virtual STRING SAL_CALL getOct2bin( const STRING& aNum, const ANY& rPlaces ) THROWDEF_RTE_IAE; virtual double SAL_CALL getOct2dec( const STRING& aNum ) THROWDEF_RTE_IAE; - virtual STRING SAL_CALL getOct2hex( const STRING& aNum, sal_Int32 nPlaces ) THROWDEF_RTE_IAE; + virtual STRING SAL_CALL getOct2hex( const STRING& aNum, const ANY& rPlaces ) THROWDEF_RTE_IAE; - virtual STRING SAL_CALL getDec2bin( sal_Int32 fNum, sal_Int32 nPlaces ) THROWDEF_RTE_IAE; - virtual STRING SAL_CALL getDec2oct( sal_Int32 fNum, sal_Int32 nPlaces ) THROWDEF_RTE_IAE; - virtual STRING SAL_CALL getDec2hex( double fNum, sal_Int32 nPlaces ) THROWDEF_RTE_IAE; + virtual STRING SAL_CALL getDec2bin( sal_Int32 fNum, const ANY& rPlaces ) THROWDEF_RTE_IAE; + virtual STRING SAL_CALL getDec2oct( sal_Int32 fNum, const ANY& rPlaces ) THROWDEF_RTE_IAE; + virtual STRING SAL_CALL getDec2hex( double fNum, const ANY& rPlaces ) THROWDEF_RTE_IAE; - virtual STRING SAL_CALL getHex2bin( const STRING& aNum, sal_Int32 nPlaces ) THROWDEF_RTE_IAE; + virtual STRING SAL_CALL getHex2bin( const STRING& aNum, const ANY& rPlaces ) THROWDEF_RTE_IAE; virtual double SAL_CALL getHex2dec( const STRING& aNum ) THROWDEF_RTE_IAE; - virtual STRING SAL_CALL getHex2oct( const STRING& aNum, sal_Int32 nPlaces ) THROWDEF_RTE_IAE; + virtual STRING SAL_CALL getHex2oct( const STRING& aNum, const ANY& rPlaces ) THROWDEF_RTE_IAE; - virtual sal_Int32 SAL_CALL getDelta( double fNum1, double fNum2 ) THROWDEF_RTE; + virtual sal_Int32 SAL_CALL getDelta( double fNum1, const ANY& rNum2 ) THROWDEF_RTE; - virtual double SAL_CALL getErf( double fLowerLimit, double fUpperLimit ) THROWDEF_RTE; + virtual double SAL_CALL getErf( double fLowerLimit, const ANY& rUpperLimit ) THROWDEF_RTE; virtual double SAL_CALL getErfc( double fLowerLimit ) THROWDEF_RTE; - virtual sal_Int32 SAL_CALL getGestep( double fNum, double fStep ) THROWDEF_RTE; + virtual sal_Int32 SAL_CALL getGestep( double fNum, const ANY& rStep ) THROWDEF_RTE; virtual double SAL_CALL getFactdouble( sal_Int32 nNum ) THROWDEF_RTE_IAE; @@ -196,14 +196,14 @@ public: virtual STRING SAL_CALL getImsum( const STRING& aNum1, const SEQ( ANY )& aFollowingPars ) THROWDEF_RTE_IAE; virtual STRING SAL_CALL getImsqrt( const STRING& aNum ) THROWDEF_RTE_IAE; - virtual STRING SAL_CALL getComplex( double fReal, double fImaginary, const STRING& rSuffix ) THROWDEF_RTE_IAE; + virtual STRING SAL_CALL getComplex( double fReal, double fImaginary, const ANY& rSuffix ) THROWDEF_RTE_IAE; virtual double SAL_CALL getConvert( double fVal, const STRING& aFromUnit, const STRING& aToUnit ) THROWDEF_RTE_IAE; virtual double SAL_CALL getAmordegrc( constREFXPS&, double fCost, sal_Int32 nDate, sal_Int32 nFirstPer, double fRestVal, double fPer, double fRate, const ANY& rOptBase ) THROWDEF_RTE_IAE; virtual double SAL_CALL getAmorlinc( constREFXPS&, double fCost, sal_Int32 nDate, sal_Int32 nFirstPer, double fRestVal, double fPer, double fRate, const ANY& rOptBase ) THROWDEF_RTE_IAE; virtual double SAL_CALL getAccrint( constREFXPS& xOpt, sal_Int32 nIssue, sal_Int32 nFirstInter, sal_Int32 nSettle, double fRate, double fVal, sal_Int32 nFreq, const ANY& rOptBase ) THROWDEF_RTE_IAE; - virtual double SAL_CALL getAccrintm( constREFXPS& xOpt, sal_Int32 nIssue, sal_Int32 nSettle, double fRate, double fVal, const ANY& rOptBase ) THROWDEF_RTE_IAE; + virtual double SAL_CALL getAccrintm( constREFXPS& xOpt, sal_Int32 nIssue, sal_Int32 nSettle, double fRate, const ANY& rVal, const ANY& rOptBase ) THROWDEF_RTE_IAE; virtual double SAL_CALL getReceived( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, double fInvest, double fDisc, const ANY& rOptBase ) THROWDEF_RTE_IAE; virtual double SAL_CALL getDisc( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, double fPrice, double fRedemp, const ANY& rOptBase ) THROWDEF_RTE_IAE; virtual double SAL_CALL getDuration( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, double fCoup, double fYield, sal_Int32 nFreq, const ANY& rOptBase ) THROWDEF_RTE_IAE; diff --git a/scaddins/source/analysis/analysisadd.idl b/scaddins/source/analysis/analysisadd.idl index 1fb3cf984e0e..fdad6aedd614 100644 --- a/scaddins/source/analysis/analysisadd.idl +++ b/scaddins/source/analysis/analysisadd.idl @@ -2,9 +2,9 @@ * * $RCSfile: analysisadd.idl,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: gt $ $Date: 2001-05-22 11:49:14 $ + * last change: $Author: gt $ $Date: 2001-05-28 10:17:19 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,7 +92,7 @@ module addin /// yearfrac. double getYearfrac( [in] com::sun::star::beans::XPropertySet xOptions, - [in] long nStartDate, [in] long nEndDate, [in] long nMode ); + [in] long StartDate, [in] long EndDate, [in] any Mode ); /// edate. long getEdate( @@ -112,7 +112,7 @@ module addin /// networkdays. long getNetworkdays( [in] com::sun::star::beans::XPropertySet xOptions, - [in] long nStartDate, [in] long nEndDate, [in] sequence< sequence<long> > aHolidays ); + [in] long StartDate, [in] long EndDate, [in] any Holidays ); /// iseven. long getIseven( [in] long nValue ); @@ -157,52 +157,52 @@ module addin double getBessely( [in] double Num, [in] long Order ); /// bin2oct. - string getBin2oct( [in] string BinaryNum, [in] long nPlaces ); + string getBin2oct( [in] string BinaryNum, [in] any Places ); /// bin2dec. double getBin2dec( [in] string BinaryNum ); /// bin2hex. - string getBin2hex( [in] string BinaryNum, [in] long nPlaces ); + string getBin2hex( [in] string BinaryNum, [in] any Places ); /// oct2bin. - string getOct2bin( [in] string OctalNum, [in] long nPlaces ); + string getOct2bin( [in] string OctalNum, [in] any Places ); /// oct2dec. double getOct2dec( [in] string OctalNum ); /// oct2hex. - string getOct2hex( [in] string OctalNum, [in] long nPlaces ); + string getOct2hex( [in] string OctalNum, [in] any Places ); /// dec2bin. - string getDec2bin( [in] long Value, [in] long nPlaces ); + string getDec2bin( [in] long Value, [in] any Places ); /// dec2oct. - string getDec2oct( [in] long Value, [in] long nPlaces ); + string getDec2oct( [in] long Value, [in] any Places ); /// dec2hex. - string getDec2hex( [in] double Value, [in] long nPlaces ); + string getDec2hex( [in] double Value, [in] any Places ); /// hex2bin. - string getHex2bin( [in] string HexadecimalValue, [in] long nPlaces ); + string getHex2bin( [in] string HexadecimalValue, [in] any Places ); /// hex2dec. double getHex2dec( [in] string HexadecimalValue ); /// hex2oct. - string getHex2oct( [in] string HexadecimalValue, [in] long nPlaces ); + string getHex2oct( [in] string HexadecimalValue, [in] any Places ); /// delta. - long getDelta( [in] double Num1, [in] double Num2 ); + long getDelta( [in] double Num1, [in] any Num2 ); /// erf. - double getErf( [in] double LowerLimit, [in] double UpperLimit ); + double getErf( [in] double LowerLimit, [in] any UpperLimit ); /// erfc. double getErfc( [in] double LowerLimit ); /// gestep. - long getGestep( [in] double Num, [in] double Step ); + long getGestep( [in] double Num, [in] any Step ); /// factdouble. double getFactdouble( [in] long Num ); @@ -259,7 +259,7 @@ module addin string getImsqrt( [in] string Num ); /// complex. - string getComplex( [in] double Real, [in] double Imaginary, [in] string Suffix ); + string getComplex( [in] double Real, [in] double Imaginary, [in] any Suffix ); /// convert. double getConvert( [in] double Value, [in] string FromUnit, [in] string ToUnit ); @@ -286,7 +286,7 @@ module addin /// accrintm. double getAccrintm( [in] com::sun::star::beans::XPropertySet xOptions, - [in] long Issue, [in] long Settlement, [in] double Rate, [in] double Value, [in] any Base ); + [in] long Issue, [in] long Settlement, [in] double Rate, [in] any Value, [in] any Base ); /// received. double getReceived( diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx index e6120f3e2401..0404ece6a885 100644 --- a/scaddins/source/analysis/analysishelper.cxx +++ b/scaddins/source/analysis/analysishelper.cxx @@ -2,9 +2,9 @@ * * $RCSfile: analysishelper.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: gt $ $Date: 2001-05-22 11:49:14 $ + * last change: $Author: gt $ $Date: 2001-05-28 10:19:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -841,7 +841,8 @@ static inline sal_Char GetMaxChar( sal_uInt16 nBase ) STRING ConvertFromDec( sal_Int64 nNum, sal_Int64 nMin, sal_Int64 nMax, sal_uInt16 nBase, sal_Int32 nPlaces, sal_Int32 nMaxPlaces ) THROWDEF_RTE_IAE { - if( nNum < nMin || nNum > nMax || nPlaces <= 0 || nPlaces > nMaxPlaces ) + sal_Bool bUsePlaces = nPlaces != -(2^31); + if( nNum < nMin || nNum > nMax || ( bUsePlaces && ( nPlaces <= 0 || nPlaces > nMaxPlaces ) ) ) THROW_IAE; sal_Bool bNeg = nNum < 0; @@ -853,7 +854,7 @@ STRING ConvertFromDec( sal_Int64 nNum, sal_Int64 nMin, sal_Int64 nMax, sal_uInt1 sal_Int32 nLen = aRet.getLength(); if( !bNeg && nLen > nPlaces ) THROW_IAE; - else if( ( bNeg && nLen < nMaxPlaces ) || ( !bNeg && nLen < nPlaces ) ) + else if( bUsePlaces && ( ( bNeg && nLen < nMaxPlaces ) || ( !bNeg && nLen < nPlaces ) ) ) { sal_uInt32 nLeft = nPlaces - nLen; sal_Char* p = new sal_Char[ nLeft + 1 ]; diff --git a/scaddins/source/analysis/financial.cxx b/scaddins/source/analysis/financial.cxx index 0a9b59553dcf..830c534628e1 100644 --- a/scaddins/source/analysis/financial.cxx +++ b/scaddins/source/analysis/financial.cxx @@ -2,9 +2,9 @@ * * $RCSfile: financial.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: gt $ $Date: 2001-05-22 14:23:17 $ + * last change: $Author: gt $ $Date: 2001-05-28 10:19:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -99,8 +99,10 @@ double SAL_CALL AnalysisAddIn::getAccrint( constREFXPS& xOpt, double SAL_CALL AnalysisAddIn::getAccrintm( constREFXPS& xOpt, - sal_Int32 nIssue, sal_Int32 nSettle, double fRate, double fVal, const ANY& rOB ) THROWDEF_RTE_IAE + sal_Int32 nIssue, sal_Int32 nSettle, double fRate, const ANY& rVal, const ANY& rOB ) THROWDEF_RTE_IAE { + double fVal = GetOpt( rVal, 1000.0 ); + if( fRate <= 0.0 || fVal <= 0.0 || nIssue >= nSettle ) THROW_IAE; |