xref: /AOO41X/main/scaddins/source/analysis/analysishelper.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir #ifndef ANALYSISHELPER_HXX
28*cdf0e10cSrcweir #define ANALYSISHELPER_HXX
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceName.hpp>
32*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
33*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
34*cdf0e10cSrcweir #include <com/sun/star/util/Date.hpp>
35*cdf0e10cSrcweir #include <com/sun/star/util/XNumberFormatter.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/sheet/XAddIn.hpp>
38*cdf0e10cSrcweir #include <com/sun/star/sheet/addin/XAnalysis.hpp>
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir #include <math.h>
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir #include <tools/resid.hxx>
43*cdf0e10cSrcweir #include <tools/rc.hxx>
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir #include "analysisdefs.hxx"
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir class ResMgr;
49*cdf0e10cSrcweir class SortedIndividualInt32List;
50*cdf0e10cSrcweir class ScaAnyConverter;
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir #define	PI			3.1415926535897932
54*cdf0e10cSrcweir #define PI_2		(PI/2.0)
55*cdf0e10cSrcweir //#define	EULER		2.7182818284590452
56*cdf0e10cSrcweir #define	EOL			( ( const sal_Char* ) 1 )
57*cdf0e10cSrcweir #define	EOE			( ( const sal_Char* ) 2 )
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir //double				_Test( sal_Int32 nMode, double f1, double f2, double f3 );
61*cdf0e10cSrcweir inline sal_Bool     IsLeapYear( sal_uInt16 nYear );
62*cdf0e10cSrcweir sal_uInt16			DaysInMonth( sal_uInt16 nMonth, sal_uInt16 nYear );
63*cdf0e10cSrcweir sal_Int32			DateToDays( sal_uInt16 nDay, sal_uInt16 nMonth, sal_uInt16 nYear );
64*cdf0e10cSrcweir void				DaysToDate( sal_Int32 nDays, sal_uInt16& rDay, sal_uInt16& rMonth, sal_uInt16& rYear ) throw( ::com::sun::star::lang::IllegalArgumentException );
65*cdf0e10cSrcweir sal_Int32           GetNullDate( const REF( CSS::beans::XPropertySet )& xOptions ) THROWDEF_RTE;
66*cdf0e10cSrcweir sal_Int32			GetDiffDate360(
67*cdf0e10cSrcweir 						sal_uInt16 nDay1, sal_uInt16 nMonth1, sal_uInt16 nYear1, sal_Bool bLeapYear1,
68*cdf0e10cSrcweir 						sal_uInt16 nDay2, sal_uInt16 nMonth2, sal_uInt16 nYear2,
69*cdf0e10cSrcweir 						sal_Bool bUSAMethod );
70*cdf0e10cSrcweir inline sal_Int32	GetDiffDate360( constREFXPS& xOpt, sal_Int32 nDate1, sal_Int32 nDate2, sal_Bool bUSAMethod );
71*cdf0e10cSrcweir sal_Int32			GetDiffDate360( sal_Int32 nNullDate, sal_Int32 nDate1, sal_Int32 nDate2, sal_Bool bUSAMethod );
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir sal_Int32			GetDaysInYears( sal_uInt16 nYear1, sal_uInt16 nYear2 );
74*cdf0e10cSrcweir inline sal_Int16	GetDayOfWeek( sal_Int32 nDate );
75*cdf0e10cSrcweir void				GetDiffParam( sal_Int32 nNullDate, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode,
76*cdf0e10cSrcweir 						sal_uInt16& rYears, sal_Int32& rDayDiffPart, sal_Int32& rDaysInYear ) THROWDEF_RTE_IAE;
77*cdf0e10cSrcweir 						// rYears = full num of years
78*cdf0e10cSrcweir 						// rDayDiffPart = num of days for last year
79*cdf0e10cSrcweir 						// rDaysInYear = num of days in first year
80*cdf0e10cSrcweir sal_Int32			GetDiffDate( sal_Int32 nNullDate, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode,
81*cdf0e10cSrcweir 								sal_Int32* pOptDaysIn1stYear = NULL ) THROWDEF_RTE_IAE;
82*cdf0e10cSrcweir double				GetYearDiff( sal_Int32 nNullDate, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode )
83*cdf0e10cSrcweir 								THROWDEF_RTE_IAE;
84*cdf0e10cSrcweir sal_Int32			GetDaysInYear( sal_Int32 nNullDate, sal_Int32 nDate, sal_Int32 nMode ) THROWDEF_RTE_IAE;
85*cdf0e10cSrcweir double				GetYearFrac( sal_Int32 nNullDate, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode )
86*cdf0e10cSrcweir 						THROWDEF_RTE_IAE;
87*cdf0e10cSrcweir inline double		GetYearFrac( constREFXPS& xOpt, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode )
88*cdf0e10cSrcweir 						THROWDEF_RTE_IAE;
89*cdf0e10cSrcweir inline void			AlignDate( sal_uInt16& rDay, sal_uInt16 nMonth, sal_uInt16 nYear );
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir double				Fak( sal_Int32 n );
92*cdf0e10cSrcweir double				GetGcd( double f1, double f2 );
93*cdf0e10cSrcweir double				ConvertToDec( const STRING& rFromNum, sal_uInt16 nBaseFrom, sal_uInt16 nCharLim ) THROWDEF_RTE_IAE;
94*cdf0e10cSrcweir STRING				ConvertFromDec(
95*cdf0e10cSrcweir                         double fNum, double fMin, double fMax, sal_uInt16 nBase,
96*cdf0e10cSrcweir                         sal_Int32 nPlaces, sal_Int32 nMaxPlaces, sal_Bool bUsePlaces ) THROWDEF_RTE_IAE;
97*cdf0e10cSrcweir double				Erf( double fX );
98*cdf0e10cSrcweir double				Erfc( double fX );
99*cdf0e10cSrcweir sal_Bool			ParseDouble( const sal_Unicode*& rpDoubleAsString, double& rReturn );
100*cdf0e10cSrcweir STRING				GetString( double fNumber, sal_Bool bLeadingSign = sal_False, sal_uInt16 nMaxNumOfDigits = 15 );
101*cdf0e10cSrcweir inline double		Exp10( sal_Int16 nPower );		// 10 ^ nPower
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir double				GetAmordegrc( sal_Int32 nNullDate, double fCost, sal_Int32 nDate, sal_Int32 nFirstPer,
104*cdf0e10cSrcweir 								double fRestVal, double fPer, double fRate, sal_Int32 nBase ) THROWDEF_RTE_IAE;
105*cdf0e10cSrcweir double				GetAmorlinc( sal_Int32 nNullDate, double fCost, sal_Int32 nDate, sal_Int32 nFirstPer,
106*cdf0e10cSrcweir 								double fRestVal, double fPer, double fRate, sal_Int32 nBase ) THROWDEF_RTE_IAE;
107*cdf0e10cSrcweir double				GetDuration( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, double fCoup,
108*cdf0e10cSrcweir 								double fYield, sal_Int32 nFreq, sal_Int32 nBase ) THROWDEF_RTE_IAE;
109*cdf0e10cSrcweir double				GetYieldmat( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nIssue,
110*cdf0e10cSrcweir 								double fRate, double fPrice, sal_Int32 nBase ) THROWDEF_RTE_IAE;
111*cdf0e10cSrcweir double				GetOddfprice( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nIssue,
112*cdf0e10cSrcweir 								sal_Int32 nFirstCoup, double fRate, double fYield, double fRedemp,
113*cdf0e10cSrcweir 								sal_Int32 nFreq, sal_Int32 nBase ) THROWDEF_RTE_IAE;
114*cdf0e10cSrcweir double				getYield_( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, double fCoup, double fPrice,
115*cdf0e10cSrcweir 								double fRedemp, sal_Int32 nFreq, sal_Int32 nBase ) THROWDEF_RTE_IAE;
116*cdf0e10cSrcweir double				getPrice_( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, double fRate, double fYield,
117*cdf0e10cSrcweir 								double fRedemp, sal_Int32 nFreq, sal_Int32 nBase ) THROWDEF_RTE_IAE;
118*cdf0e10cSrcweir double				GetOddfyield( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nIssue,
119*cdf0e10cSrcweir 								sal_Int32 nFirstCoup, double fRate, double fPrice, double fRedemp,
120*cdf0e10cSrcweir 								sal_Int32 nFreq, sal_Int32 nBase ) THROWDEF_RTE_IAE;
121*cdf0e10cSrcweir double				GetOddlprice( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nLastInterest,
122*cdf0e10cSrcweir 								double fRate, double fYield, double fRedemp, sal_Int32 nFreq, sal_Int32 nBase ) THROWDEF_RTE_IAE;
123*cdf0e10cSrcweir double				GetOddlyield( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nLastInterest,
124*cdf0e10cSrcweir 								double fRate, double fPrice, double fRedemp, sal_Int32 nFreq, sal_Int32 nBase ) THROWDEF_RTE_IAE;
125*cdf0e10cSrcweir double				GetRmz( double fZins, double fZzr, double fBw, double fZw, sal_Int32 nF );
126*cdf0e10cSrcweir double				GetZw( double fZins, double fZzr, double fRmz, double fBw, sal_Int32 nF );
127*cdf0e10cSrcweir //double				TBillYield( constREFXPS& xOpt, sal_Int32 nSettle, sal_Int32 nMat, double fPrice )THROWDEF_RTE_IAE;
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir double				GetCouppcd( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq,
130*cdf0e10cSrcweir 								sal_Int32 nBase ) THROWDEF_RTE_IAE;
131*cdf0e10cSrcweir double              GetCoupncd( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq,
132*cdf0e10cSrcweir 								sal_Int32 nBase ) THROWDEF_RTE_IAE;
133*cdf0e10cSrcweir double              GetCoupdaybs( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq,
134*cdf0e10cSrcweir 								sal_Int32 nBase ) THROWDEF_RTE_IAE;
135*cdf0e10cSrcweir double				GetCoupdaysnc( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq,
136*cdf0e10cSrcweir 								sal_Int32 nBase ) THROWDEF_RTE_IAE;
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir double              GetCoupnum( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat,
139*cdf0e10cSrcweir 								sal_Int32 nFreq, sal_Int32 nBase ) THROWDEF_RTE_IAE;
140*cdf0e10cSrcweir double				GetCoupdays( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nFreq,
141*cdf0e10cSrcweir 								sal_Int32 nBase ) THROWDEF_RTE_IAE;
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir //-----------------------------------------------------------------------------
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir class MyList
151*cdf0e10cSrcweir {
152*cdf0e10cSrcweir private:
153*cdf0e10cSrcweir 	static const sal_uInt32	nStartSize;
154*cdf0e10cSrcweir 	static const sal_uInt32	nIncrSize;
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir 	void**					pData;			// pointer array
157*cdf0e10cSrcweir 	sal_uInt32				nSize;			// array size
158*cdf0e10cSrcweir 	sal_uInt32				nNew;			// next index to be inserted at
159*cdf0e10cSrcweir 	sal_uInt32				nAct;			// actual for iterations
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir 	void					_Grow( void );
162*cdf0e10cSrcweir 	inline void				Grow( void );
163*cdf0e10cSrcweir protected:
164*cdf0e10cSrcweir public:
165*cdf0e10cSrcweir 							MyList( void );
166*cdf0e10cSrcweir 	virtual					~MyList();
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir 	inline const void*		GetObject( sal_uInt32 nIndex ) const;
169*cdf0e10cSrcweir 	inline const void*		First( void );
170*cdf0e10cSrcweir 	inline const void*		Next( void );
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir 	inline void				Append( void* pNewElement );
173*cdf0e10cSrcweir 	void					Insert( void* pNewLement, sal_uInt32 nPlace );
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir 	inline sal_uInt32		Count( void ) const;
176*cdf0e10cSrcweir };
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir class StringList : protected MyList
182*cdf0e10cSrcweir {
183*cdf0e10cSrcweir public:
184*cdf0e10cSrcweir 	virtual					~StringList();
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir 	inline const STRING*	First( void );
187*cdf0e10cSrcweir 	inline const STRING*	Next( void );
188*cdf0e10cSrcweir 	inline const STRING*	Get( sal_uInt32 nIndex ) const;
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir     using MyList::Append;
191*cdf0e10cSrcweir 	inline void				Append( STRING* pNew );
192*cdf0e10cSrcweir 	inline void				Append( const STRING& rNew );
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir 	using MyList::Count;
195*cdf0e10cSrcweir };
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir 
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir enum FDCategory
201*cdf0e10cSrcweir {
202*cdf0e10cSrcweir 	FDCat_AddIn,
203*cdf0e10cSrcweir 	FDCat_DateTime,
204*cdf0e10cSrcweir 	FDCat_Finance,
205*cdf0e10cSrcweir 	FDCat_Inf,
206*cdf0e10cSrcweir 	FDCat_Math,
207*cdf0e10cSrcweir 	FDCat_Tech
208*cdf0e10cSrcweir };
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir struct FuncDataBase
212*cdf0e10cSrcweir {
213*cdf0e10cSrcweir 	const sal_Char*			pIntName;
214*cdf0e10cSrcweir 	sal_uInt16				nUINameID;			// resource ID to UI name
215*cdf0e10cSrcweir 	sal_uInt16				nDescrID;			// resource ID to description, parameter names and ~ description
216*cdf0e10cSrcweir 	sal_Bool				bDouble;			// name already exist in Calc
217*cdf0e10cSrcweir 	sal_Bool				bWithOpt;			// first parameter is internal
218*cdf0e10cSrcweir 	sal_uInt16				nCompListID;		// resource ID to list of valid names
219*cdf0e10cSrcweir 	sal_uInt16				nNumOfParams;		// number of named / described parameters
220*cdf0e10cSrcweir 	FDCategory				eCat;				// function category
221*cdf0e10cSrcweir };
222*cdf0e10cSrcweir 
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir 
226*cdf0e10cSrcweir class FuncData
227*cdf0e10cSrcweir {
228*cdf0e10cSrcweir private:
229*cdf0e10cSrcweir     ::rtl::OUString         aIntName;
230*cdf0e10cSrcweir 	sal_uInt16				nUINameID;
231*cdf0e10cSrcweir 	sal_uInt16				nDescrID;			// leads also to parameter descriptions!
232*cdf0e10cSrcweir 	sal_Bool				bDouble;			// flag for names, wich already exist in Calc
233*cdf0e10cSrcweir 	sal_Bool				bWithOpt;			// has internal parameter on first position
234*cdf0e10cSrcweir 
235*cdf0e10cSrcweir 	sal_uInt16				nParam;				// num of parameters
236*cdf0e10cSrcweir 	sal_uInt16				nCompID;
237*cdf0e10cSrcweir 	StringList				aCompList;			// list of all valid names
238*cdf0e10cSrcweir 	FDCategory				eCat;				// function category
239*cdf0e10cSrcweir public:
240*cdf0e10cSrcweir 							FuncData( const FuncDataBase& rBaseData, ResMgr& );
241*cdf0e10cSrcweir 	virtual					~FuncData();
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir 	inline sal_uInt16		GetUINameID( void ) const;
244*cdf0e10cSrcweir 	inline sal_uInt16		GetDescrID( void ) const;
245*cdf0e10cSrcweir 	inline sal_Bool			IsDouble( void ) const;
246*cdf0e10cSrcweir 	inline sal_Bool			HasIntParam( void ) const;
247*cdf0e10cSrcweir 
248*cdf0e10cSrcweir 	sal_uInt16				GetStrIndex( sal_uInt16 nParamNum ) const;
249*cdf0e10cSrcweir     inline sal_Bool         Is( const ::rtl::OUString& rCompareTo ) const;
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir 	inline const StringList&	GetCompNameList( void ) const;
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir 	inline FDCategory		GetCategory( void ) const;
254*cdf0e10cSrcweir };
255*cdf0e10cSrcweir 
256*cdf0e10cSrcweir 
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir 
259*cdf0e10cSrcweir class CStrList : private MyList
260*cdf0e10cSrcweir {
261*cdf0e10cSrcweir public:
262*cdf0e10cSrcweir     using MyList::Append;
263*cdf0e10cSrcweir 	inline void				Append( const sal_Char* pNew );
264*cdf0e10cSrcweir 	inline const sal_Char*	Get( sal_uInt32 nIndex ) const;
265*cdf0e10cSrcweir 	using MyList::Count;
266*cdf0e10cSrcweir };
267*cdf0e10cSrcweir 
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir 
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir class FuncDataList : private MyList
272*cdf0e10cSrcweir {
273*cdf0e10cSrcweir     ::rtl::OUString         aLastName;
274*cdf0e10cSrcweir 	sal_uInt32				nLast;
275*cdf0e10cSrcweir public:
276*cdf0e10cSrcweir 							FuncDataList( ResMgr& );
277*cdf0e10cSrcweir 	virtual					~FuncDataList();
278*cdf0e10cSrcweir     using MyList::Append;
279*cdf0e10cSrcweir 	inline void				Append( FuncData* pNew );
280*cdf0e10cSrcweir 	inline const FuncData*	Get( sal_uInt32 nIndex ) const;
281*cdf0e10cSrcweir 	using MyList::Count;
282*cdf0e10cSrcweir 
283*cdf0e10cSrcweir     const FuncData*         Get( const ::rtl::OUString& aProgrammaticName ) const;
284*cdf0e10cSrcweir };
285*cdf0e10cSrcweir 
286*cdf0e10cSrcweir 
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir class AnalysisResId : public ResId
289*cdf0e10cSrcweir {
290*cdf0e10cSrcweir  public:
291*cdf0e10cSrcweir 					AnalysisResId( sal_uInt16 nId, ResMgr& rResMgr );
292*cdf0e10cSrcweir };
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir 
296*cdf0e10cSrcweir 
297*cdf0e10cSrcweir class AnalysisRscStrLoader : public Resource
298*cdf0e10cSrcweir {
299*cdf0e10cSrcweir private:
300*cdf0e10cSrcweir 	String			aStr;
301*cdf0e10cSrcweir public:
302*cdf0e10cSrcweir 	AnalysisRscStrLoader( sal_uInt16 nRsc, sal_uInt16 nStrId, ResMgr& rResMgr ) :
303*cdf0e10cSrcweir 		Resource( AnalysisResId( nRsc, rResMgr ) ),
304*cdf0e10cSrcweir 		aStr( AnalysisResId( nStrId, rResMgr ) )
305*cdf0e10cSrcweir 	{
306*cdf0e10cSrcweir 		FreeResource();
307*cdf0e10cSrcweir 	}
308*cdf0e10cSrcweir 
309*cdf0e10cSrcweir 	const String&	GetString() const { return aStr; }
310*cdf0e10cSrcweir 
311*cdf0e10cSrcweir };
312*cdf0e10cSrcweir 
313*cdf0e10cSrcweir 
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir //-----------------------------------------------------------------------------
316*cdf0e10cSrcweir 
317*cdf0e10cSrcweir /// sorted list with unique sal_Int32 values
318*cdf0e10cSrcweir class SortedIndividualInt32List : private MyList
319*cdf0e10cSrcweir {
320*cdf0e10cSrcweir protected:
321*cdf0e10cSrcweir     using MyList::Insert;
322*cdf0e10cSrcweir     void                        Insert( sal_Int32 nDay );
323*cdf0e10cSrcweir     void                        Insert( sal_Int32 nDay, sal_Int32 nNullDate, sal_Bool bInsertOnWeekend );
324*cdf0e10cSrcweir     void                        Insert( double fDay, sal_Int32 nNullDate, sal_Bool bInsertOnWeekend )
325*cdf0e10cSrcweir                                     throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir                                 /** @param rAnyConv  must be an initialized ScaAnyConmverter
328*cdf0e10cSrcweir                                     @param bInsertOnWeekend  insertion mode: sal_False = holidays on weekend are omitted */
329*cdf0e10cSrcweir     void                        InsertHolidayList(
330*cdf0e10cSrcweir                                     const ScaAnyConverter& rAnyConv,
331*cdf0e10cSrcweir                                     const CSS::uno::Any& rHolAny,
332*cdf0e10cSrcweir                                     sal_Int32 nNullDate,
333*cdf0e10cSrcweir                                     sal_Bool bInsertOnWeekend ) throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
334*cdf0e10cSrcweir 
335*cdf0e10cSrcweir public:
336*cdf0e10cSrcweir                                 SortedIndividualInt32List();
337*cdf0e10cSrcweir     virtual                     ~SortedIndividualInt32List();
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir                                 using MyList::Count;
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir                                 /// @return  element on position nIndex or 0 on invalid index
342*cdf0e10cSrcweir     inline sal_Int32            Get( sal_uInt32 nIndex ) const
343*cdf0e10cSrcweir                                     { return (sal_Int32)(sal_IntPtr) MyList::GetObject( nIndex ); }
344*cdf0e10cSrcweir 
345*cdf0e10cSrcweir                                 /// @return  sal_True if nVal (internal date representation) is contained
346*cdf0e10cSrcweir     sal_Bool                    Find( sal_Int32 nVal ) const;
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir                                 /** @param rAnyConv  is an initialized or uninitialized ScaAnyConverter
349*cdf0e10cSrcweir                                     @param bInsertOnWeekend  insertion mode: sal_False = holidays on weekend are omitted */
350*cdf0e10cSrcweir     void                        InsertHolidayList(
351*cdf0e10cSrcweir                                     ScaAnyConverter& rAnyConv,
352*cdf0e10cSrcweir                                     const CSS::uno::Reference< CSS::beans::XPropertySet >& xOptions,
353*cdf0e10cSrcweir                                     const CSS::uno::Any& rHolAny,
354*cdf0e10cSrcweir                                     sal_Int32 nNullDate,
355*cdf0e10cSrcweir                                     sal_Bool bInsertOnWeekend ) throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
356*cdf0e10cSrcweir };
357*cdf0e10cSrcweir 
358*cdf0e10cSrcweir 
359*cdf0e10cSrcweir //-----------------------------------------------------------------------------
360*cdf0e10cSrcweir 
361*cdf0e10cSrcweir class ScaDoubleList : protected MyList
362*cdf0e10cSrcweir {
363*cdf0e10cSrcweir protected:
364*cdf0e10cSrcweir     inline void                 ListAppend( double fValue ) { MyList::Append( new double( fValue ) ); }
365*cdf0e10cSrcweir 
366*cdf0e10cSrcweir     using MyList::Append;
367*cdf0e10cSrcweir     inline void                 Append( double fValue ) throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException )
368*cdf0e10cSrcweir                                     { if( CheckInsert( fValue ) ) ListAppend( fValue ); }
369*cdf0e10cSrcweir 
370*cdf0e10cSrcweir                                 /** @param rAnyConv  must be an initialized ScaAnyConmverter
371*cdf0e10cSrcweir                                     @param bIgnoreEmpty  handling of empty Any's/strings: sal_False = inserted as 0.0; sal_True = omitted */
372*cdf0e10cSrcweir     void                        Append(
373*cdf0e10cSrcweir                                     const ScaAnyConverter& rAnyConv,
374*cdf0e10cSrcweir                                     const CSS::uno::Any& rAny,
375*cdf0e10cSrcweir                                     sal_Bool bIgnoreEmpty ) throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
376*cdf0e10cSrcweir 
377*cdf0e10cSrcweir                                 /** @param rAnyConv  must be an initialized ScaAnyConmverter
378*cdf0e10cSrcweir                                     @param bIgnoreEmpty  handling of empty Any's/strings: sal_False = inserted as 0.0; sal_True = omitted */
379*cdf0e10cSrcweir     void                        Append(
380*cdf0e10cSrcweir                                     const ScaAnyConverter& rAnyConv,
381*cdf0e10cSrcweir                                     const CSS::uno::Sequence< CSS::uno::Any >& rAnySeq,
382*cdf0e10cSrcweir                                     sal_Bool bIgnoreEmpty ) throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
383*cdf0e10cSrcweir 
384*cdf0e10cSrcweir                                 /** @param rAnyConv  must be an initialized ScaAnyConmverter
385*cdf0e10cSrcweir                                     @param bIgnoreEmpty  handling of empty Any's/strings: sal_False = inserted as 0.0; sal_True = omitted */
386*cdf0e10cSrcweir     void                        Append(
387*cdf0e10cSrcweir                                     const ScaAnyConverter& rAnyConv,
388*cdf0e10cSrcweir                                     const CSS::uno::Sequence< CSS::uno::Sequence< CSS::uno::Any > >& rAnySeq,
389*cdf0e10cSrcweir                                     sal_Bool bIgnoreEmpty ) throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
390*cdf0e10cSrcweir 
391*cdf0e10cSrcweir public:
392*cdf0e10cSrcweir     virtual                     ~ScaDoubleList();
393*cdf0e10cSrcweir 
394*cdf0e10cSrcweir                                 using MyList::Count;
395*cdf0e10cSrcweir     inline const double*        Get( sal_uInt32 nIndex ) const
396*cdf0e10cSrcweir                                         { return static_cast< const double* >( MyList::GetObject( nIndex ) ); }
397*cdf0e10cSrcweir 
398*cdf0e10cSrcweir     inline const double*        First() { return static_cast< const double* >( MyList::First() ); }
399*cdf0e10cSrcweir     inline const double*        Next()  { return static_cast< const double* >( MyList::Next() ); }
400*cdf0e10cSrcweir 
401*cdf0e10cSrcweir     void                        Append( const CSS::uno::Sequence< CSS::uno::Sequence< double > >& rValueArr )
402*cdf0e10cSrcweir                                     throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
403*cdf0e10cSrcweir     void                        Append( const CSS::uno::Sequence< CSS::uno::Sequence< sal_Int32 > >& rValueArr )
404*cdf0e10cSrcweir                                     throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
405*cdf0e10cSrcweir 
406*cdf0e10cSrcweir                                 /** @param rAnyConv  is an initialized or uninitialized ScaAnyConverter
407*cdf0e10cSrcweir                                     @param bIgnoreEmpty  handling of empty Any's/strings: sal_False = inserted as 0.0; sal_True = omitted */
408*cdf0e10cSrcweir     void                        Append(
409*cdf0e10cSrcweir                                     ScaAnyConverter& rAnyConv,
410*cdf0e10cSrcweir                                     const CSS::uno::Reference< CSS::beans::XPropertySet >& xOpt,
411*cdf0e10cSrcweir                                     const CSS::uno::Sequence< CSS::uno::Any >& rAnySeq,
412*cdf0e10cSrcweir                                     sal_Bool bIgnoreEmpty = sal_True ) throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
413*cdf0e10cSrcweir 
414*cdf0e10cSrcweir     virtual sal_Bool            CheckInsert( double fValue ) const
415*cdf0e10cSrcweir                                     throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
416*cdf0e10cSrcweir };
417*cdf0e10cSrcweir 
418*cdf0e10cSrcweir 
419*cdf0e10cSrcweir //-----------------------------------------------------------------------------
420*cdf0e10cSrcweir 
421*cdf0e10cSrcweir /// stores double values >0.0, throws exception for double values <0.0, does nothing for 0.0
422*cdf0e10cSrcweir class ScaDoubleListGT0 : public ScaDoubleList
423*cdf0e10cSrcweir {
424*cdf0e10cSrcweir public:
425*cdf0e10cSrcweir     virtual sal_Bool            CheckInsert( double fValue ) const
426*cdf0e10cSrcweir                                     throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
427*cdf0e10cSrcweir };
428*cdf0e10cSrcweir 
429*cdf0e10cSrcweir 
430*cdf0e10cSrcweir //-----------------------------------------------------------------------------
431*cdf0e10cSrcweir 
432*cdf0e10cSrcweir /// stores double values >=0.0, throws exception for double values <0.0
433*cdf0e10cSrcweir class ScaDoubleListGE0 : public ScaDoubleList
434*cdf0e10cSrcweir {
435*cdf0e10cSrcweir public:
436*cdf0e10cSrcweir     virtual sal_Bool            CheckInsert( double fValue ) const
437*cdf0e10cSrcweir                                     throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
438*cdf0e10cSrcweir };
439*cdf0e10cSrcweir 
440*cdf0e10cSrcweir 
441*cdf0e10cSrcweir //-----------------------------------------------------------------------------
442*cdf0e10cSrcweir 
443*cdf0e10cSrcweir class Complex
444*cdf0e10cSrcweir {
445*cdf0e10cSrcweir 	double					r;
446*cdf0e10cSrcweir 	double					i;
447*cdf0e10cSrcweir     sal_Unicode             c;
448*cdf0e10cSrcweir 
449*cdf0e10cSrcweir public:
450*cdf0e10cSrcweir     inline                  Complex( double fReal, double fImag = 0.0, sal_Char cC = '\0' );
451*cdf0e10cSrcweir 							Complex( const STRING& rComplexAsString ) THROWDEF_RTE_IAE;
452*cdf0e10cSrcweir 
453*cdf0e10cSrcweir 	inline static sal_Bool	IsImagUnit( sal_Unicode c );
454*cdf0e10cSrcweir 	static sal_Bool			ParseString( const STRING& rComplexAsString, Complex& rReturn );
455*cdf0e10cSrcweir     STRING                  GetString() const THROWDEF_RTE_IAE;
456*cdf0e10cSrcweir 
457*cdf0e10cSrcweir 	inline double			Real( void ) const;
458*cdf0e10cSrcweir 	inline double			Imag( void ) const;
459*cdf0e10cSrcweir 
460*cdf0e10cSrcweir 	double					Arg( void ) const THROWDEF_RTE_IAE;
461*cdf0e10cSrcweir 	inline double			Abs( void ) const;
462*cdf0e10cSrcweir 
463*cdf0e10cSrcweir 	// following functions change the complex number itself to avoid unnecessary copy actions!
464*cdf0e10cSrcweir 	void					Power( double fPower ) THROWDEF_RTE_IAE;
465*cdf0e10cSrcweir 	void					Sqrt( void );
466*cdf0e10cSrcweir 	void					Sin( void ) THROWDEF_RTE_IAE;
467*cdf0e10cSrcweir 	void					Cos( void ) THROWDEF_RTE_IAE;
468*cdf0e10cSrcweir 	void					Div( const Complex& rDivisor ) THROWDEF_RTE_IAE;
469*cdf0e10cSrcweir 	void					Exp( void );
470*cdf0e10cSrcweir 	inline void				Conjugate( void );
471*cdf0e10cSrcweir 	void					Ln( void ) THROWDEF_RTE_IAE;
472*cdf0e10cSrcweir 	void					Log10( void ) THROWDEF_RTE_IAE;
473*cdf0e10cSrcweir 	void					Log2( void ) THROWDEF_RTE_IAE;
474*cdf0e10cSrcweir 	inline void				Mult( double fFact );
475*cdf0e10cSrcweir 	inline void				Mult( const Complex& rMult );
476*cdf0e10cSrcweir 	inline void				Sub( const Complex& rMult );
477*cdf0e10cSrcweir 	inline void				Add( const Complex& rAdd );
478*cdf0e10cSrcweir };
479*cdf0e10cSrcweir 
480*cdf0e10cSrcweir 
481*cdf0e10cSrcweir 
482*cdf0e10cSrcweir 
483*cdf0e10cSrcweir enum ComplListAppendHandl
484*cdf0e10cSrcweir {
485*cdf0e10cSrcweir 	AH_EmptyAsErr,
486*cdf0e10cSrcweir 	AH_EmpyAs0,
487*cdf0e10cSrcweir 	AH_IgnoreEmpty
488*cdf0e10cSrcweir };
489*cdf0e10cSrcweir 
490*cdf0e10cSrcweir 
491*cdf0e10cSrcweir class ComplexList : protected MyList
492*cdf0e10cSrcweir {
493*cdf0e10cSrcweir public:
494*cdf0e10cSrcweir 	virtual					~ComplexList();
495*cdf0e10cSrcweir 
496*cdf0e10cSrcweir 	inline const Complex*	Get( sal_uInt32 nIndex ) const;
497*cdf0e10cSrcweir 	inline const Complex*	First( void );
498*cdf0e10cSrcweir 	inline const Complex*	Next( void );
499*cdf0e10cSrcweir 
500*cdf0e10cSrcweir 	using MyList::Count;
501*cdf0e10cSrcweir 
502*cdf0e10cSrcweir     using MyList::Append;
503*cdf0e10cSrcweir 	inline void				Append( Complex* pNew );
504*cdf0e10cSrcweir 	void					Append( const SEQSEQ( STRING )& rComplexNumList, ComplListAppendHandl eAH = AH_EmpyAs0 ) THROWDEF_RTE_IAE;
505*cdf0e10cSrcweir 	void					Append( const SEQ( ANY )& aMultPars,ComplListAppendHandl eAH = AH_EmpyAs0 ) THROWDEF_RTE_IAE;
506*cdf0e10cSrcweir };
507*cdf0e10cSrcweir 
508*cdf0e10cSrcweir 
509*cdf0e10cSrcweir 
510*cdf0e10cSrcweir 
511*cdf0e10cSrcweir enum ConvertDataClass
512*cdf0e10cSrcweir {
513*cdf0e10cSrcweir 	CDC_Mass, CDC_Length, CDC_Time, CDC_Pressure, CDC_Force, CDC_Energy, CDC_Power, CDC_Magnetism,
514*cdf0e10cSrcweir 	CDC_Temperature, CDC_Volume, CDC_Area, CDC_Speed, CDC_Information
515*cdf0e10cSrcweir };
516*cdf0e10cSrcweir 
517*cdf0e10cSrcweir 
518*cdf0e10cSrcweir #define	INV_MATCHLEV		1764					// guess, what this is... :-)
519*cdf0e10cSrcweir 
520*cdf0e10cSrcweir 
521*cdf0e10cSrcweir class ConvertDataList;
522*cdf0e10cSrcweir 
523*cdf0e10cSrcweir 
524*cdf0e10cSrcweir 
525*cdf0e10cSrcweir 
526*cdf0e10cSrcweir class ConvertData
527*cdf0e10cSrcweir {
528*cdf0e10cSrcweir protected:
529*cdf0e10cSrcweir 	friend class ConvertDataList;
530*cdf0e10cSrcweir 	double					fConst;
531*cdf0e10cSrcweir 	STRING					aName;
532*cdf0e10cSrcweir 	ConvertDataClass		eClass;
533*cdf0e10cSrcweir     sal_Bool                bPrefixSupport;
534*cdf0e10cSrcweir public:
535*cdf0e10cSrcweir 							ConvertData(
536*cdf0e10cSrcweir 								const sal_Char		pUnitName[],
537*cdf0e10cSrcweir 								double				fConvertConstant,
538*cdf0e10cSrcweir 								ConvertDataClass	eClass,
539*cdf0e10cSrcweir                                 sal_Bool            bPrefSupport = sal_False );
540*cdf0e10cSrcweir 
541*cdf0e10cSrcweir     virtual                 ~ConvertData();
542*cdf0e10cSrcweir 
543*cdf0e10cSrcweir 	sal_Int16				GetMatchingLevel( const STRING& rRef ) const;
544*cdf0e10cSrcweir 									// 0.0 = no equality
545*cdf0e10cSrcweir 									// 1.0 = matches exact
546*cdf0e10cSrcweir 									// rest = matches without an assumed prefix of one character
547*cdf0e10cSrcweir 									//  rest gives power for 10 represented by the prefix (e.g. 3 for k or -9 for n
548*cdf0e10cSrcweir 
549*cdf0e10cSrcweir 	virtual double			Convert( double fVal, const ConvertData& rTo,
550*cdf0e10cSrcweir 								sal_Int16 nMatchLevelFrom, sal_Int16 nMatchLevelTo ) const THROWDEF_RTE_IAE;
551*cdf0e10cSrcweir 									// converts fVal from this unit to rFrom unit
552*cdf0e10cSrcweir 									// throws exception if not from same class
553*cdf0e10cSrcweir 									// this implementation is for proportional cases only
554*cdf0e10cSrcweir 	virtual double			ConvertToBase( double fVal, sal_Int16 nMatchLevel ) const;
555*cdf0e10cSrcweir 	virtual double			ConvertFromBase( double fVal, sal_Int16 nMatchLevel ) const;
556*cdf0e10cSrcweir 
557*cdf0e10cSrcweir 	inline ConvertDataClass	Class( void ) const;
558*cdf0e10cSrcweir     inline sal_Bool         IsPrefixSupport( void ) const;
559*cdf0e10cSrcweir };
560*cdf0e10cSrcweir 
561*cdf0e10cSrcweir 
562*cdf0e10cSrcweir 
563*cdf0e10cSrcweir 
564*cdf0e10cSrcweir class ConvertDataLinear : public ConvertData
565*cdf0e10cSrcweir {
566*cdf0e10cSrcweir protected:
567*cdf0e10cSrcweir 	double					fOffs;
568*cdf0e10cSrcweir public:
569*cdf0e10cSrcweir 	inline					ConvertDataLinear(
570*cdf0e10cSrcweir 								const sal_Char		pUnitName[],
571*cdf0e10cSrcweir 								double				fConvertConstant,
572*cdf0e10cSrcweir 								double				fConvertOffset,
573*cdf0e10cSrcweir 								ConvertDataClass	eClass,
574*cdf0e10cSrcweir                                 sal_Bool            bPrefSupport = sal_False );
575*cdf0e10cSrcweir 
576*cdf0e10cSrcweir     virtual                 ~ConvertDataLinear();
577*cdf0e10cSrcweir 
578*cdf0e10cSrcweir 	virtual double			Convert( double fVal, const ConvertData& rTo,
579*cdf0e10cSrcweir 								sal_Int16 nMatchLevelFrom, sal_Int16 nMatchLevelTo ) const THROWDEF_RTE_IAE;
580*cdf0e10cSrcweir 									// for cases where f(x) = a + bx applies (e.g. Temperatures)
581*cdf0e10cSrcweir 
582*cdf0e10cSrcweir 	virtual double			ConvertToBase( double fVal, sal_Int16 nMatchLevel ) const;
583*cdf0e10cSrcweir 	virtual double			ConvertFromBase( double fVal, sal_Int16 nMatchLevel ) const;
584*cdf0e10cSrcweir };
585*cdf0e10cSrcweir 
586*cdf0e10cSrcweir 
587*cdf0e10cSrcweir 
588*cdf0e10cSrcweir 
589*cdf0e10cSrcweir class ConvertDataList : protected MyList
590*cdf0e10cSrcweir {
591*cdf0e10cSrcweir private:
592*cdf0e10cSrcweir protected:
593*cdf0e10cSrcweir 	inline ConvertData*		First( void );
594*cdf0e10cSrcweir 	inline ConvertData*		Next( void );
595*cdf0e10cSrcweir public:
596*cdf0e10cSrcweir 							ConvertDataList( void );
597*cdf0e10cSrcweir 	virtual					~ConvertDataList();
598*cdf0e10cSrcweir 
599*cdf0e10cSrcweir 	double					Convert( double fVal, const STRING& rFrom, const STRING& rTo ) THROWDEF_RTE_IAE;
600*cdf0e10cSrcweir };
601*cdf0e10cSrcweir 
602*cdf0e10cSrcweir 
603*cdf0e10cSrcweir 
604*cdf0e10cSrcweir 
605*cdf0e10cSrcweir inline sal_Bool IsLeapYear( sal_uInt16 n )
606*cdf0e10cSrcweir {
607*cdf0e10cSrcweir     return ( (( ( n % 4 ) == 0 ) && ( ( n % 100 ) != 0)) || ( ( n % 400 ) == 0 ) );
608*cdf0e10cSrcweir }
609*cdf0e10cSrcweir 
610*cdf0e10cSrcweir 
611*cdf0e10cSrcweir inline sal_Int32 GetDiffDate360( constREFXPS& xOpt, sal_Int32 nDate1, sal_Int32 nDate2, sal_Bool bUSAMethod )
612*cdf0e10cSrcweir {
613*cdf0e10cSrcweir 	return GetDiffDate360( GetNullDate( xOpt ), nDate1, nDate2, bUSAMethod );
614*cdf0e10cSrcweir }
615*cdf0e10cSrcweir 
616*cdf0e10cSrcweir 
617*cdf0e10cSrcweir inline sal_Int16 GetDayOfWeek( sal_Int32 n )
618*cdf0e10cSrcweir {	// monday = 0, ..., sunday = 6
619*cdf0e10cSrcweir     return static_cast< sal_Int16 >( ( n - 1 ) % 7 );
620*cdf0e10cSrcweir }
621*cdf0e10cSrcweir 
622*cdf0e10cSrcweir 
623*cdf0e10cSrcweir inline double GetYearFrac( constREFXPS& xOpt, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode ) THROWDEF_RTE_IAE
624*cdf0e10cSrcweir {
625*cdf0e10cSrcweir 	return GetYearFrac( GetNullDate( xOpt ), nStartDate, nEndDate, nMode );
626*cdf0e10cSrcweir }
627*cdf0e10cSrcweir 
628*cdf0e10cSrcweir 
629*cdf0e10cSrcweir inline void AlignDate( sal_uInt16& rD, sal_uInt16 nM, sal_uInt16 nY )
630*cdf0e10cSrcweir {
631*cdf0e10cSrcweir 	sal_uInt16	nMax = DaysInMonth( nM, nY );
632*cdf0e10cSrcweir 
633*cdf0e10cSrcweir 	if( rD > nMax )
634*cdf0e10cSrcweir 		rD = nMax;
635*cdf0e10cSrcweir }
636*cdf0e10cSrcweir 
637*cdf0e10cSrcweir 
638*cdf0e10cSrcweir inline void MyList::Grow( void )
639*cdf0e10cSrcweir {
640*cdf0e10cSrcweir 	if( nNew >= nSize )
641*cdf0e10cSrcweir 		_Grow();
642*cdf0e10cSrcweir }
643*cdf0e10cSrcweir 
644*cdf0e10cSrcweir 
645*cdf0e10cSrcweir inline const void* MyList::GetObject( sal_uInt32 n ) const
646*cdf0e10cSrcweir {
647*cdf0e10cSrcweir 	if( n < nNew )
648*cdf0e10cSrcweir 		return pData[ n ];
649*cdf0e10cSrcweir 	else
650*cdf0e10cSrcweir 		return NULL;
651*cdf0e10cSrcweir }
652*cdf0e10cSrcweir 
653*cdf0e10cSrcweir 
654*cdf0e10cSrcweir inline const void* MyList::First( void )
655*cdf0e10cSrcweir {
656*cdf0e10cSrcweir 	nAct = 0;
657*cdf0e10cSrcweir 	if( nNew )
658*cdf0e10cSrcweir 		return pData[ 0 ];
659*cdf0e10cSrcweir 	else
660*cdf0e10cSrcweir 		return NULL;
661*cdf0e10cSrcweir }
662*cdf0e10cSrcweir 
663*cdf0e10cSrcweir 
664*cdf0e10cSrcweir inline const void* MyList::Next( void )
665*cdf0e10cSrcweir {
666*cdf0e10cSrcweir 	nAct++;
667*cdf0e10cSrcweir 	if( nAct < nNew )
668*cdf0e10cSrcweir 		return pData[ nAct ];
669*cdf0e10cSrcweir 	else
670*cdf0e10cSrcweir 	{
671*cdf0e10cSrcweir 		nAct--;
672*cdf0e10cSrcweir 		return NULL;
673*cdf0e10cSrcweir 	}
674*cdf0e10cSrcweir }
675*cdf0e10cSrcweir 
676*cdf0e10cSrcweir 
677*cdf0e10cSrcweir inline void MyList::Append( void* p )
678*cdf0e10cSrcweir {
679*cdf0e10cSrcweir 	Grow();
680*cdf0e10cSrcweir 	pData[ nNew ] = p;
681*cdf0e10cSrcweir 	nNew++;
682*cdf0e10cSrcweir }
683*cdf0e10cSrcweir 
684*cdf0e10cSrcweir 
685*cdf0e10cSrcweir inline sal_uInt32 MyList::Count( void ) const
686*cdf0e10cSrcweir {
687*cdf0e10cSrcweir 	return nNew;
688*cdf0e10cSrcweir }
689*cdf0e10cSrcweir 
690*cdf0e10cSrcweir 
691*cdf0e10cSrcweir 
692*cdf0e10cSrcweir 
693*cdf0e10cSrcweir inline const STRING* StringList::First( void )
694*cdf0e10cSrcweir {
695*cdf0e10cSrcweir 	return ( const STRING* ) MyList::First();
696*cdf0e10cSrcweir }
697*cdf0e10cSrcweir 
698*cdf0e10cSrcweir 
699*cdf0e10cSrcweir inline const STRING* StringList::Next( void )
700*cdf0e10cSrcweir {
701*cdf0e10cSrcweir 	return ( const STRING* ) MyList::Next();
702*cdf0e10cSrcweir }
703*cdf0e10cSrcweir 
704*cdf0e10cSrcweir 
705*cdf0e10cSrcweir inline const STRING* StringList::Get( sal_uInt32 n ) const
706*cdf0e10cSrcweir {
707*cdf0e10cSrcweir 	return ( const STRING* ) MyList::GetObject( n );
708*cdf0e10cSrcweir }
709*cdf0e10cSrcweir 
710*cdf0e10cSrcweir 
711*cdf0e10cSrcweir inline void StringList::Append( STRING* p )
712*cdf0e10cSrcweir {
713*cdf0e10cSrcweir 	MyList::Append( p );
714*cdf0e10cSrcweir }
715*cdf0e10cSrcweir 
716*cdf0e10cSrcweir 
717*cdf0e10cSrcweir inline void StringList::Append( const STRING& r )
718*cdf0e10cSrcweir {
719*cdf0e10cSrcweir 	MyList::Append( new STRING( r ) );
720*cdf0e10cSrcweir }
721*cdf0e10cSrcweir 
722*cdf0e10cSrcweir 
723*cdf0e10cSrcweir 
724*cdf0e10cSrcweir 
725*cdf0e10cSrcweir inline sal_uInt16 FuncData::GetUINameID( void ) const
726*cdf0e10cSrcweir {
727*cdf0e10cSrcweir 	return nUINameID;
728*cdf0e10cSrcweir }
729*cdf0e10cSrcweir 
730*cdf0e10cSrcweir 
731*cdf0e10cSrcweir inline sal_uInt16 FuncData::GetDescrID( void ) const
732*cdf0e10cSrcweir {
733*cdf0e10cSrcweir 	return nDescrID;
734*cdf0e10cSrcweir }
735*cdf0e10cSrcweir 
736*cdf0e10cSrcweir 
737*cdf0e10cSrcweir inline sal_Bool FuncData::IsDouble( void ) const
738*cdf0e10cSrcweir {
739*cdf0e10cSrcweir 	return bDouble;
740*cdf0e10cSrcweir }
741*cdf0e10cSrcweir 
742*cdf0e10cSrcweir 
743*cdf0e10cSrcweir inline sal_Bool FuncData::HasIntParam( void ) const
744*cdf0e10cSrcweir {
745*cdf0e10cSrcweir 	return bWithOpt;
746*cdf0e10cSrcweir }
747*cdf0e10cSrcweir 
748*cdf0e10cSrcweir 
749*cdf0e10cSrcweir inline sal_Bool FuncData::Is( const ::rtl::OUString& r ) const
750*cdf0e10cSrcweir {
751*cdf0e10cSrcweir 	return aIntName == r;
752*cdf0e10cSrcweir }
753*cdf0e10cSrcweir 
754*cdf0e10cSrcweir 
755*cdf0e10cSrcweir inline const StringList& FuncData::GetCompNameList( void ) const
756*cdf0e10cSrcweir {
757*cdf0e10cSrcweir 	return aCompList;
758*cdf0e10cSrcweir }
759*cdf0e10cSrcweir 
760*cdf0e10cSrcweir 
761*cdf0e10cSrcweir inline FDCategory FuncData::GetCategory( void ) const
762*cdf0e10cSrcweir {
763*cdf0e10cSrcweir 	return eCat;
764*cdf0e10cSrcweir }
765*cdf0e10cSrcweir 
766*cdf0e10cSrcweir 
767*cdf0e10cSrcweir 
768*cdf0e10cSrcweir 
769*cdf0e10cSrcweir inline void CStrList::Append( const sal_Char* p )
770*cdf0e10cSrcweir {
771*cdf0e10cSrcweir 	MyList::Append( ( void* ) p );
772*cdf0e10cSrcweir }
773*cdf0e10cSrcweir 
774*cdf0e10cSrcweir 
775*cdf0e10cSrcweir inline const sal_Char* CStrList::Get( sal_uInt32 n ) const
776*cdf0e10cSrcweir {
777*cdf0e10cSrcweir 	return ( const sal_Char* ) MyList::GetObject( n );
778*cdf0e10cSrcweir }
779*cdf0e10cSrcweir 
780*cdf0e10cSrcweir 
781*cdf0e10cSrcweir 
782*cdf0e10cSrcweir 
783*cdf0e10cSrcweir inline void FuncDataList::Append( FuncData* p )
784*cdf0e10cSrcweir {
785*cdf0e10cSrcweir 	MyList::Append( p );
786*cdf0e10cSrcweir }
787*cdf0e10cSrcweir 
788*cdf0e10cSrcweir 
789*cdf0e10cSrcweir inline const FuncData* FuncDataList::Get( sal_uInt32 n ) const
790*cdf0e10cSrcweir {
791*cdf0e10cSrcweir 	return ( const FuncData* ) MyList::GetObject( n );
792*cdf0e10cSrcweir }
793*cdf0e10cSrcweir 
794*cdf0e10cSrcweir 
795*cdf0e10cSrcweir inline Complex::Complex( double fReal, double fImag, sal_Char cC ) :
796*cdf0e10cSrcweir 		r( fReal ), i( fImag ), c( cC )
797*cdf0e10cSrcweir {
798*cdf0e10cSrcweir }
799*cdf0e10cSrcweir 
800*cdf0e10cSrcweir 
801*cdf0e10cSrcweir inline double Complex::Real( void ) const
802*cdf0e10cSrcweir {
803*cdf0e10cSrcweir 	return r;
804*cdf0e10cSrcweir }
805*cdf0e10cSrcweir 
806*cdf0e10cSrcweir 
807*cdf0e10cSrcweir inline double Complex::Imag( void ) const
808*cdf0e10cSrcweir {
809*cdf0e10cSrcweir 	return i;
810*cdf0e10cSrcweir }
811*cdf0e10cSrcweir 
812*cdf0e10cSrcweir 
813*cdf0e10cSrcweir inline double Complex::Abs( void ) const
814*cdf0e10cSrcweir {
815*cdf0e10cSrcweir 	return sqrt( r * r + i * i );
816*cdf0e10cSrcweir }
817*cdf0e10cSrcweir 
818*cdf0e10cSrcweir 
819*cdf0e10cSrcweir void Complex::Conjugate( void )
820*cdf0e10cSrcweir {
821*cdf0e10cSrcweir 	i = -i;
822*cdf0e10cSrcweir }
823*cdf0e10cSrcweir 
824*cdf0e10cSrcweir 
825*cdf0e10cSrcweir inline void Complex::Mult( double f )
826*cdf0e10cSrcweir {
827*cdf0e10cSrcweir 	i *= f;
828*cdf0e10cSrcweir 	r *= f;
829*cdf0e10cSrcweir }
830*cdf0e10cSrcweir 
831*cdf0e10cSrcweir 
832*cdf0e10cSrcweir inline void Complex::Mult( const Complex& rM )
833*cdf0e10cSrcweir {
834*cdf0e10cSrcweir 	double	r_ = r;
835*cdf0e10cSrcweir 	double	i_ = i;
836*cdf0e10cSrcweir 
837*cdf0e10cSrcweir 	r = r_ * rM.r - i_ * rM.i;
838*cdf0e10cSrcweir 	i = r_ * rM.i + i_ * rM.r;
839*cdf0e10cSrcweir 
840*cdf0e10cSrcweir     if( !c ) c = rM.c;
841*cdf0e10cSrcweir }
842*cdf0e10cSrcweir 
843*cdf0e10cSrcweir 
844*cdf0e10cSrcweir inline void Complex::Sub( const Complex& rC )
845*cdf0e10cSrcweir {
846*cdf0e10cSrcweir 	r -= rC.r;
847*cdf0e10cSrcweir 	i -= rC.i;
848*cdf0e10cSrcweir     if( !c ) c = rC.c;
849*cdf0e10cSrcweir }
850*cdf0e10cSrcweir 
851*cdf0e10cSrcweir 
852*cdf0e10cSrcweir inline void Complex::Add( const Complex& rAdd )
853*cdf0e10cSrcweir {
854*cdf0e10cSrcweir 	r += rAdd.r;
855*cdf0e10cSrcweir 	i += rAdd.i;
856*cdf0e10cSrcweir     if( !c ) c = rAdd.c;
857*cdf0e10cSrcweir }
858*cdf0e10cSrcweir 
859*cdf0e10cSrcweir 
860*cdf0e10cSrcweir 
861*cdf0e10cSrcweir 
862*cdf0e10cSrcweir inline const Complex* ComplexList::Get( sal_uInt32 n ) const
863*cdf0e10cSrcweir {
864*cdf0e10cSrcweir 	return ( const Complex* ) MyList::GetObject( n );
865*cdf0e10cSrcweir }
866*cdf0e10cSrcweir 
867*cdf0e10cSrcweir 
868*cdf0e10cSrcweir inline const Complex* ComplexList::First( void )
869*cdf0e10cSrcweir {
870*cdf0e10cSrcweir 	return ( const Complex* ) MyList::First();
871*cdf0e10cSrcweir }
872*cdf0e10cSrcweir 
873*cdf0e10cSrcweir 
874*cdf0e10cSrcweir inline const Complex* ComplexList::Next( void )
875*cdf0e10cSrcweir {
876*cdf0e10cSrcweir 	return ( const Complex* ) MyList::Next();
877*cdf0e10cSrcweir }
878*cdf0e10cSrcweir 
879*cdf0e10cSrcweir 
880*cdf0e10cSrcweir inline void ComplexList::Append( Complex* p )
881*cdf0e10cSrcweir {
882*cdf0e10cSrcweir 	MyList::Append( p );
883*cdf0e10cSrcweir }
884*cdf0e10cSrcweir 
885*cdf0e10cSrcweir 
886*cdf0e10cSrcweir 
887*cdf0e10cSrcweir 
888*cdf0e10cSrcweir inline ConvertDataClass	ConvertData::Class( void ) const
889*cdf0e10cSrcweir {
890*cdf0e10cSrcweir 	return eClass;
891*cdf0e10cSrcweir }
892*cdf0e10cSrcweir 
893*cdf0e10cSrcweir 
894*cdf0e10cSrcweir 
895*cdf0e10cSrcweir inline sal_Bool ConvertData::IsPrefixSupport( void ) const
896*cdf0e10cSrcweir {
897*cdf0e10cSrcweir     return bPrefixSupport;
898*cdf0e10cSrcweir }
899*cdf0e10cSrcweir 
900*cdf0e10cSrcweir inline ConvertDataLinear::ConvertDataLinear( const sal_Char* p, double fC, double fO, ConvertDataClass e,
901*cdf0e10cSrcweir         sal_Bool bPrefSupport ) :
902*cdf0e10cSrcweir 	ConvertData( p, fC, e, bPrefSupport ),
903*cdf0e10cSrcweir 	fOffs( fO )
904*cdf0e10cSrcweir {
905*cdf0e10cSrcweir }
906*cdf0e10cSrcweir 
907*cdf0e10cSrcweir 
908*cdf0e10cSrcweir 
909*cdf0e10cSrcweir 
910*cdf0e10cSrcweir inline ConvertData* ConvertDataList::First( void )
911*cdf0e10cSrcweir {
912*cdf0e10cSrcweir 	return ( ConvertData* ) MyList::First();
913*cdf0e10cSrcweir }
914*cdf0e10cSrcweir 
915*cdf0e10cSrcweir 
916*cdf0e10cSrcweir inline ConvertData* ConvertDataList::Next( void )
917*cdf0e10cSrcweir {
918*cdf0e10cSrcweir 	return ( ConvertData* ) MyList::Next();
919*cdf0e10cSrcweir }
920*cdf0e10cSrcweir 
921*cdf0e10cSrcweir //-----------------------------------------------------------------------------
922*cdf0e10cSrcweir 
923*cdf0e10cSrcweir /// Helper class for date calculation for various financial functions
924*cdf0e10cSrcweir class ScaDate
925*cdf0e10cSrcweir {
926*cdf0e10cSrcweir private:
927*cdf0e10cSrcweir     sal_uInt16                  nOrigDay;           /// is the day of the original date.
928*cdf0e10cSrcweir     sal_uInt16                  nDay;               /// is the calculated day depending on the current month/year.
929*cdf0e10cSrcweir     sal_uInt16                  nMonth;             /// is the current month (one-based).
930*cdf0e10cSrcweir     sal_uInt16                  nYear;              /// is the current year.
931*cdf0e10cSrcweir     sal_Bool                    bLastDayMode : 1;   /// if sal_True, recalculate nDay after every calculation.
932*cdf0e10cSrcweir     sal_Bool                    bLastDay : 1;       /// is sal_True, if original date was the last day in month.
933*cdf0e10cSrcweir     sal_Bool                    b30Days : 1;        /// is sal_True, if every month has 30 days in calculations.
934*cdf0e10cSrcweir     sal_Bool                    bUSMode : 1;        /// is sal_True, if the US method of 30-day-calculations is used.
935*cdf0e10cSrcweir 
936*cdf0e10cSrcweir                                 /// Calculates nDay from nOrigDay and current date.
937*cdf0e10cSrcweir     void                        setDay();
938*cdf0e10cSrcweir 
939*cdf0e10cSrcweir                                 /// @return  count of days in current month
940*cdf0e10cSrcweir     inline sal_uInt16           getDaysInMonth() const;
941*cdf0e10cSrcweir                                 /// @return  count of days in given month
942*cdf0e10cSrcweir     inline sal_uInt16           getDaysInMonth( sal_uInt16 _nMon ) const;
943*cdf0e10cSrcweir 
944*cdf0e10cSrcweir                                 /// @ return  count of days in the given month range
945*cdf0e10cSrcweir     sal_Int32                   getDaysInMonthRange( sal_uInt16 nFrom, sal_uInt16 nTo ) const;
946*cdf0e10cSrcweir                                 /// @ return  count of days in the given year range
947*cdf0e10cSrcweir     sal_Int32                   getDaysInYearRange( sal_uInt16 nFrom, sal_uInt16 nTo ) const;
948*cdf0e10cSrcweir 
949*cdf0e10cSrcweir                                 /// Adds/subtracts the given count of years, does not adjust day.
950*cdf0e10cSrcweir     void                        doAddYears( sal_Int32 nYearCount ) throw( CSS::lang::IllegalArgumentException );
951*cdf0e10cSrcweir 
952*cdf0e10cSrcweir public:
953*cdf0e10cSrcweir                                 ScaDate();
954*cdf0e10cSrcweir                                 /** @param nBase
955*cdf0e10cSrcweir                                         date handling mode (days in month / days in year):
956*cdf0e10cSrcweir                                         0 = 30 days / 360 days (US NASD)
957*cdf0e10cSrcweir                                         1 = exact / exact
958*cdf0e10cSrcweir                                         2 = exact / 360
959*cdf0e10cSrcweir                                         3 = exact / 365
960*cdf0e10cSrcweir                                         4 = 30 days / 360 days (Europe)
961*cdf0e10cSrcweir                                         5 = exact / exact (no last day adjustment) */
962*cdf0e10cSrcweir                                 ScaDate( sal_Int32 nNullDate, sal_Int32 nDate, sal_Int32 nBase );
963*cdf0e10cSrcweir                                 ScaDate( const ScaDate& rCopy );
964*cdf0e10cSrcweir     ScaDate&                    operator=( const ScaDate& rCopy );
965*cdf0e10cSrcweir 
966*cdf0e10cSrcweir                                 /// @return  the current month.
967*cdf0e10cSrcweir     inline sal_uInt16           getMonth() const    { return nMonth; };
968*cdf0e10cSrcweir                                 /// @return  the current year.
969*cdf0e10cSrcweir     inline sal_uInt16           getYear() const     { return nYear; };
970*cdf0e10cSrcweir 
971*cdf0e10cSrcweir                                 /// adds/subtracts the given count of months, adjusts day
972*cdf0e10cSrcweir     void                        addMonths( sal_Int32 nMonthCount ) throw( CSS::lang::IllegalArgumentException );
973*cdf0e10cSrcweir 
974*cdf0e10cSrcweir                                 /// sets the given year, adjusts day
975*cdf0e10cSrcweir     inline void                 setYear( sal_uInt16 nNewYear );
976*cdf0e10cSrcweir                                 /// adds/subtracts the given count of years, adjusts day
977*cdf0e10cSrcweir     inline void                 addYears( sal_Int32 nYearCount ) throw( CSS::lang::IllegalArgumentException );
978*cdf0e10cSrcweir 
979*cdf0e10cSrcweir                                 /// @return  the internal number of the current date
980*cdf0e10cSrcweir     sal_Int32                   getDate( sal_Int32 nNullDate ) const;
981*cdf0e10cSrcweir                                 /// @return  the number of days between the two dates
982*cdf0e10cSrcweir     static sal_Int32            getDiff( const ScaDate& rFrom, const ScaDate& rTo ) throw( CSS::lang::IllegalArgumentException );
983*cdf0e10cSrcweir 
984*cdf0e10cSrcweir     sal_Bool                    operator<( const ScaDate& rCmp ) const;
985*cdf0e10cSrcweir     inline sal_Bool             operator<=( const ScaDate& rCmp ) const { return !(rCmp < *this); }
986*cdf0e10cSrcweir     inline sal_Bool             operator>( const ScaDate& rCmp ) const  { return rCmp < *this; }
987*cdf0e10cSrcweir     inline sal_Bool             operator>=( const ScaDate& rCmp ) const { return !(*this < rCmp); }
988*cdf0e10cSrcweir };
989*cdf0e10cSrcweir 
990*cdf0e10cSrcweir inline sal_uInt16 ScaDate::getDaysInMonth() const
991*cdf0e10cSrcweir {
992*cdf0e10cSrcweir     return getDaysInMonth( nMonth );
993*cdf0e10cSrcweir }
994*cdf0e10cSrcweir 
995*cdf0e10cSrcweir inline sal_uInt16 ScaDate::getDaysInMonth( sal_uInt16 _nMon ) const
996*cdf0e10cSrcweir {
997*cdf0e10cSrcweir     return b30Days ? 30 : DaysInMonth( _nMon, nYear );
998*cdf0e10cSrcweir }
999*cdf0e10cSrcweir 
1000*cdf0e10cSrcweir inline void ScaDate::setYear( sal_uInt16 nNewYear )
1001*cdf0e10cSrcweir {
1002*cdf0e10cSrcweir     nYear = nNewYear;
1003*cdf0e10cSrcweir     setDay();
1004*cdf0e10cSrcweir }
1005*cdf0e10cSrcweir 
1006*cdf0e10cSrcweir inline void ScaDate::addYears( sal_Int32 nYearCount ) throw( CSS::lang::IllegalArgumentException )
1007*cdf0e10cSrcweir {
1008*cdf0e10cSrcweir     doAddYears( nYearCount );
1009*cdf0e10cSrcweir     setDay();
1010*cdf0e10cSrcweir }
1011*cdf0e10cSrcweir 
1012*cdf0e10cSrcweir 
1013*cdf0e10cSrcweir //-----------------------------------------------------------------------------
1014*cdf0e10cSrcweir 
1015*cdf0e10cSrcweir /// Helper class for Any->double conversion, using current language settings
1016*cdf0e10cSrcweir class ScaAnyConverter
1017*cdf0e10cSrcweir {
1018*cdf0e10cSrcweir private:
1019*cdf0e10cSrcweir     CSS::uno::Reference< CSS::util::XNumberFormatter > xFormatter;
1020*cdf0e10cSrcweir     sal_Int32                   nDefaultFormat;
1021*cdf0e10cSrcweir     sal_Bool                    bHasValidFormat;
1022*cdf0e10cSrcweir 
1023*cdf0e10cSrcweir                                 /** Converts a string to double using the number formatter. If the formatter is not
1024*cdf0e10cSrcweir                                     valid, ::rtl::math::stringToDouble() with english separators will be used.
1025*cdf0e10cSrcweir                                     @throws com::sun::star::lang::IllegalArgumentException
1026*cdf0e10cSrcweir                                         on strings not representing any double value.
1027*cdf0e10cSrcweir                                     @return  the converted double value. */
1028*cdf0e10cSrcweir     double                      convertToDouble(
1029*cdf0e10cSrcweir                                     const ::rtl::OUString& rString ) const
1030*cdf0e10cSrcweir                                 throw( CSS::lang::IllegalArgumentException );
1031*cdf0e10cSrcweir 
1032*cdf0e10cSrcweir public:
1033*cdf0e10cSrcweir                                 ScaAnyConverter(
1034*cdf0e10cSrcweir                                     const CSS::uno::Reference< CSS::lang::XMultiServiceFactory >& xServiceFact );
1035*cdf0e10cSrcweir                                 ~ScaAnyConverter();
1036*cdf0e10cSrcweir 
1037*cdf0e10cSrcweir                                 /// Initializing with current language settings
1038*cdf0e10cSrcweir     void                        init(
1039*cdf0e10cSrcweir                                     const CSS::uno::Reference< CSS::beans::XPropertySet >& xPropSet )
1040*cdf0e10cSrcweir                                 throw( CSS::uno::RuntimeException );
1041*cdf0e10cSrcweir 
1042*cdf0e10cSrcweir                                 /** Converts an Any to double (without initialization).
1043*cdf0e10cSrcweir                                     The Any can be empty or contain a double or string.
1044*cdf0e10cSrcweir                                     @throws com::sun::star::lang::IllegalArgumentException
1045*cdf0e10cSrcweir                                         on other Any types or on invalid strings.
1046*cdf0e10cSrcweir                                     @return  sal_True if the Any contains a double or a non-empty valid string,
1047*cdf0e10cSrcweir                                              sal_False if the Any is empty or the string is empty */
1048*cdf0e10cSrcweir     sal_Bool                    getDouble(
1049*cdf0e10cSrcweir                                     double& rfResult,
1050*cdf0e10cSrcweir                                     const CSS::uno::Any& rAny ) const
1051*cdf0e10cSrcweir                                 throw( CSS::lang::IllegalArgumentException );
1052*cdf0e10cSrcweir 
1053*cdf0e10cSrcweir                                 /** Converts an Any to double (with initialization).
1054*cdf0e10cSrcweir                                     The Any can be empty or contain a double or string.
1055*cdf0e10cSrcweir                                     @throws com::sun::star::lang::IllegalArgumentException
1056*cdf0e10cSrcweir                                         on other Any types or on invalid strings.
1057*cdf0e10cSrcweir                                     @return  sal_True if the Any contains a double or a non-empty valid string,
1058*cdf0e10cSrcweir                                              sal_False if the Any is empty or the string is empty */
1059*cdf0e10cSrcweir     sal_Bool                    getDouble(
1060*cdf0e10cSrcweir                                     double& rfResult,
1061*cdf0e10cSrcweir                                     const CSS::uno::Reference< CSS::beans::XPropertySet >& xPropSet,
1062*cdf0e10cSrcweir                                     const CSS::uno::Any& rAny )
1063*cdf0e10cSrcweir                                 throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
1064*cdf0e10cSrcweir 
1065*cdf0e10cSrcweir                                 /** Converts an Any to double (with initialization).
1066*cdf0e10cSrcweir                                     The Any can be empty or contain a double or string.
1067*cdf0e10cSrcweir                                     @throws com::sun::star::lang::IllegalArgumentException
1068*cdf0e10cSrcweir                                         on other Any types or on invalid strings.
1069*cdf0e10cSrcweir                                     @return  the value of the double or string or fDefault if the Any or string is empty */
1070*cdf0e10cSrcweir     double                      getDouble(
1071*cdf0e10cSrcweir                                     const CSS::uno::Reference< CSS::beans::XPropertySet >& xPropSet,
1072*cdf0e10cSrcweir                                     const CSS::uno::Any& rAny,
1073*cdf0e10cSrcweir                                     double fDefault )
1074*cdf0e10cSrcweir                                 throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
1075*cdf0e10cSrcweir 
1076*cdf0e10cSrcweir                                 /** Converts an Any to sal_Int32 (with initialization).
1077*cdf0e10cSrcweir                                     The Any can be empty or contain a double or string.
1078*cdf0e10cSrcweir                                     @throws com::sun::star::lang::IllegalArgumentException
1079*cdf0e10cSrcweir                                         on other Any types or on invalid values or strings.
1080*cdf0e10cSrcweir                                     @return  sal_True if the Any contains a double or a non-empty valid string,
1081*cdf0e10cSrcweir                                              sal_False if the Any is empty or the string is empty */
1082*cdf0e10cSrcweir     sal_Bool                    getInt32(
1083*cdf0e10cSrcweir                                     sal_Int32& rnResult,
1084*cdf0e10cSrcweir                                     const CSS::uno::Reference< CSS::beans::XPropertySet >& xPropSet,
1085*cdf0e10cSrcweir                                     const CSS::uno::Any& rAny )
1086*cdf0e10cSrcweir                                 throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
1087*cdf0e10cSrcweir 
1088*cdf0e10cSrcweir                                 /** Converts an Any to sal_Int32 (with initialization).
1089*cdf0e10cSrcweir                                     The Any can be empty or contain a double or string.
1090*cdf0e10cSrcweir                                     @throws com::sun::star::lang::IllegalArgumentException
1091*cdf0e10cSrcweir                                         on other Any types or on invalid values or strings.
1092*cdf0e10cSrcweir                                     @return  the truncated value of the double or string or nDefault if the Any or string is empty */
1093*cdf0e10cSrcweir     sal_Int32                   getInt32(
1094*cdf0e10cSrcweir                                     const CSS::uno::Reference< CSS::beans::XPropertySet >& xPropSet,
1095*cdf0e10cSrcweir                                     const CSS::uno::Any& rAny,
1096*cdf0e10cSrcweir                                     sal_Int32 nDefault )
1097*cdf0e10cSrcweir                                 throw( CSS::uno::RuntimeException, CSS::lang::IllegalArgumentException );
1098*cdf0e10cSrcweir };
1099*cdf0e10cSrcweir 
1100*cdf0e10cSrcweir 
1101*cdf0e10cSrcweir //-----------------------------------------------------------------------------
1102*cdf0e10cSrcweir 
1103*cdf0e10cSrcweir 
1104*cdf0e10cSrcweir #endif
1105*cdf0e10cSrcweir 
1106