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