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