xref: /aoo42x/main/basic/inc/basic/sbxvar.hxx (revision 7fef15a0)
1234bd5c5SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3234bd5c5SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4234bd5c5SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5234bd5c5SAndrew Rist  * distributed with this work for additional information
6234bd5c5SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7234bd5c5SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8234bd5c5SAndrew Rist  * "License"); you may not use this file except in compliance
9234bd5c5SAndrew Rist  * with the License.  You may obtain a copy of the License at
10234bd5c5SAndrew Rist  *
11234bd5c5SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12234bd5c5SAndrew Rist  *
13234bd5c5SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14234bd5c5SAndrew Rist  * software distributed under the License is distributed on an
15234bd5c5SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16234bd5c5SAndrew Rist  * KIND, either express or implied.  See the License for the
17234bd5c5SAndrew Rist  * specific language governing permissions and limitations
18234bd5c5SAndrew Rist  * under the License.
19234bd5c5SAndrew Rist  *
20234bd5c5SAndrew Rist  *************************************************************/
21234bd5c5SAndrew Rist 
22234bd5c5SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SBXVAR_HXX
25cdf0e10cSrcweir #define _SBXVAR_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <rtl/ustring.hxx>
28cdf0e10cSrcweir #include <tools/string.hxx>
29cdf0e10cSrcweir #include <com/sun/star/bridge/oleautomation/Decimal.hpp>
30cdf0e10cSrcweir #include <basic/sbxcore.hxx>
31*7fef15a0SDamjan Jovanovic #include "basic/basicdllapi.h"
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #ifndef __SBX_64
34cdf0e10cSrcweir #define __SBX_64
35cdf0e10cSrcweir 
36*7fef15a0SDamjan Jovanovic struct BASIC_DLLPUBLIC SbxINT64
37cdf0e10cSrcweir {
38cdf0e10cSrcweir 	sal_Int32 nHigh; sal_uInt32 nLow;
39cdf0e10cSrcweir 
40cdf0e10cSrcweir #if FALSE
SbxINT64SbxINT6441cdf0e10cSrcweir 	SbxINT64()           : nHigh( 0 ), nLow( 0 ) {}
SbxINT64SbxINT6442cdf0e10cSrcweir 	SbxINT64( sal_uInt8  n ) : nHigh( 0 ), nLow( n ) {}
SbxINT64SbxINT6443cdf0e10cSrcweir 	SbxINT64( sal_uInt16 n ) : nHigh( 0 ), nLow( n ) {}
SbxINT64SbxINT6444cdf0e10cSrcweir 	SbxINT64( sal_uInt32 n ) : nHigh( 0 ), nLow( n ) {}
SbxINT64SbxINT6445cdf0e10cSrcweir 	SbxINT64( unsigned int n ) : nHigh( 0 ), nLow( n ) {}
SbxINT64SbxINT6446cdf0e10cSrcweir 	SbxINT64( sal_Int8   n ) : nHigh( n < 0 ? -1 : 0 ), nLow( n ) {}
SbxINT64SbxINT6447cdf0e10cSrcweir 	SbxINT64( sal_Int16  n ) : nHigh( n < 0 ? -1 : 0 ), nLow( n ) {}
SbxINT64SbxINT6448cdf0e10cSrcweir 	SbxINT64( sal_Int32  n ) : nHigh( n < 0 ? -1 : 0 ), nLow( n ) {}
SbxINT64SbxINT6449cdf0e10cSrcweir 	SbxINT64( int    n ) : nHigh( n < 0 ? -1 : 0 ), nLow( n ) {}
SbxINT64SbxINT6450cdf0e10cSrcweir 	SbxINT64( SbxINT64 &r ) : nHigh( r.nHigh ), nLow( r.nLow ) {}
51cdf0e10cSrcweir 
52cdf0e10cSrcweir 	SbxINT64( BigInt &r );
53cdf0e10cSrcweir 	SbxINT64( double n );
54cdf0e10cSrcweir #endif
CHSSbxINT6455cdf0e10cSrcweir 	void CHS()
56cdf0e10cSrcweir 	{
57cdf0e10cSrcweir 		nLow  ^= (sal_uInt32)-1;
58cdf0e10cSrcweir 		nHigh ^= -1;
59cdf0e10cSrcweir 		nLow++;
60cdf0e10cSrcweir 		if( !nLow )
61cdf0e10cSrcweir 			nHigh++;
62cdf0e10cSrcweir 	}
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 	// blc/os2i do not like operator =
SetSbxINT6465cdf0e10cSrcweir 	void Set(double n)
66cdf0e10cSrcweir 	{
67cdf0e10cSrcweir 		if( n >= 0 )
68cdf0e10cSrcweir 		{
69cdf0e10cSrcweir 			nHigh = (sal_Int32)(n / (double)4294967296.0);
70cdf0e10cSrcweir 			nLow  = (sal_uInt32)(n - ((double)nHigh * (double)4294967296.0) + 0.5);
71cdf0e10cSrcweir 		}
72cdf0e10cSrcweir 		else {
73cdf0e10cSrcweir 			nHigh = (sal_Int32)(-n / (double)4294967296.0);
74cdf0e10cSrcweir 			nLow  = (sal_uInt32)(-n - ((double)nHigh * (double)4294967296.0) + 0.5);
75cdf0e10cSrcweir 			CHS();
76cdf0e10cSrcweir 		}
77cdf0e10cSrcweir 	}
SetSbxINT6478cdf0e10cSrcweir 	void Set(sal_Int32 n) { nHigh = n < 0 ? -1 : 0; nLow = n; }
79cdf0e10cSrcweir 
SetMaxSbxINT6480cdf0e10cSrcweir 	void SetMax()  { nHigh = 0x7FFFFFFF; nLow = 0xFFFFFFFF; }
SetMinSbxINT6481cdf0e10cSrcweir 	void SetMin()  { nHigh = 0x80000000; nLow = 0x00000000; }
SetNullSbxINT6482cdf0e10cSrcweir 	void SetNull() { nHigh = 0x00000000; nLow = 0x00000000; }
83cdf0e10cSrcweir 
operator !SbxINT6484cdf0e10cSrcweir 	int operator ! () const { return !nHigh && !nLow; }
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	SbxINT64 &operator -= ( const SbxINT64 &r );
87cdf0e10cSrcweir 	SbxINT64 &operator += ( const SbxINT64 &r );
88cdf0e10cSrcweir 	SbxINT64 &operator /= ( const SbxINT64 &r );
89cdf0e10cSrcweir 	SbxINT64 &operator %= ( const SbxINT64 &r );
90cdf0e10cSrcweir 	SbxINT64 &operator *= ( const SbxINT64 &r );
91cdf0e10cSrcweir 	SbxINT64 &operator &= ( const SbxINT64 &r );
92cdf0e10cSrcweir 	SbxINT64 &operator |= ( const SbxINT64 &r );
93cdf0e10cSrcweir 	SbxINT64 &operator ^= ( const SbxINT64 &r );
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 	friend SbxINT64 operator - ( const SbxINT64 &l, const SbxINT64 &r );
96cdf0e10cSrcweir 	friend SbxINT64 operator + ( const SbxINT64 &l, const SbxINT64 &r );
97cdf0e10cSrcweir 	friend SbxINT64 operator / ( const SbxINT64 &l, const SbxINT64 &r );
98cdf0e10cSrcweir 	friend SbxINT64 operator % ( const SbxINT64 &l, const SbxINT64 &r );
99cdf0e10cSrcweir 	friend SbxINT64 operator * ( const SbxINT64 &l, const SbxINT64 &r );
100cdf0e10cSrcweir 	friend SbxINT64 operator & ( const SbxINT64 &l, const SbxINT64 &r );
101cdf0e10cSrcweir 	friend SbxINT64 operator | ( const SbxINT64 &l, const SbxINT64 &r );
102cdf0e10cSrcweir 	friend SbxINT64 operator ^ ( const SbxINT64 &l, const SbxINT64 &r );
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 	friend SbxINT64 operator - ( const SbxINT64 &r );
105cdf0e10cSrcweir 	friend SbxINT64 operator ~ ( const SbxINT64 &r );
106cdf0e10cSrcweir 
GetMinSbxINT64107cdf0e10cSrcweir 	static double GetMin() { return ((double)0x7FFFFFFF*(double)4294967296.0
108cdf0e10cSrcweir 									 + (double)0xFFFFFFFF)
109cdf0e10cSrcweir 									/ CURRENCY_FACTOR; }
GetMaxSbxINT64110cdf0e10cSrcweir 	static double GetMax() { return ((double)0x80000000*(double)4294967296.0
111cdf0e10cSrcweir 									 + (double)0xFFFFFFFF)
112cdf0e10cSrcweir 									/ CURRENCY_FACTOR; }
113cdf0e10cSrcweir };
114cdf0e10cSrcweir 
115*7fef15a0SDamjan Jovanovic struct BASIC_DLLPUBLIC SbxUINT64
116cdf0e10cSrcweir {
117cdf0e10cSrcweir 	sal_uInt32 nHigh; sal_uInt32 nLow;
SetSbxUINT64118cdf0e10cSrcweir 	void Set(double n)
119cdf0e10cSrcweir 	{
120cdf0e10cSrcweir 		nHigh = (sal_uInt32)(n / (double)4294967296.0);
121cdf0e10cSrcweir 		nLow  = (sal_uInt32)(n - ((double)nHigh * (double)4294967296.0));
122cdf0e10cSrcweir 	}
123cdf0e10cSrcweir 
SetSbxUINT64124cdf0e10cSrcweir 	void Set(sal_uInt32 n) { nHigh = 0; nLow = n; }
125cdf0e10cSrcweir 
SetMaxSbxUINT64126cdf0e10cSrcweir 	void SetMax()  { nHigh = 0xFFFFFFFF; nLow = 0xFFFFFFFF; }
SetMinSbxUINT64127cdf0e10cSrcweir 	void SetMin()  { nHigh = 0x00000000; nLow = 0x00000000; }
SetNullSbxUINT64128cdf0e10cSrcweir 	void SetNull() { nHigh = 0x00000000; nLow = 0x00000000; }
129cdf0e10cSrcweir 
operator !SbxUINT64130cdf0e10cSrcweir 	int operator ! () const { return !nHigh && !nLow; }
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 	SbxUINT64 &operator -= ( const SbxUINT64 &r );
133cdf0e10cSrcweir 	SbxUINT64 &operator += ( const SbxUINT64 &r );
134cdf0e10cSrcweir 	SbxUINT64 &operator /= ( const SbxUINT64 &r );
135cdf0e10cSrcweir 	SbxUINT64 &operator %= ( const SbxUINT64 &r );
136cdf0e10cSrcweir 	SbxUINT64 &operator *= ( const SbxUINT64 &r );
137cdf0e10cSrcweir 	SbxUINT64 &operator &= ( const SbxUINT64 &r );
138cdf0e10cSrcweir 	SbxUINT64 &operator |= ( const SbxUINT64 &r );
139cdf0e10cSrcweir 	SbxUINT64 &operator ^= ( const SbxUINT64 &r );
140cdf0e10cSrcweir 
141cdf0e10cSrcweir 	friend SbxUINT64 operator - ( const SbxUINT64 &l, const SbxUINT64 &r );
142cdf0e10cSrcweir 	friend SbxUINT64 operator + ( const SbxUINT64 &l, const SbxUINT64 &r );
143cdf0e10cSrcweir 	friend SbxUINT64 operator / ( const SbxUINT64 &l, const SbxUINT64 &r );
144cdf0e10cSrcweir 	friend SbxUINT64 operator % ( const SbxUINT64 &l, const SbxUINT64 &r );
145cdf0e10cSrcweir 	friend SbxUINT64 operator * ( const SbxUINT64 &l, const SbxUINT64 &r );
146cdf0e10cSrcweir 	friend SbxUINT64 operator & ( const SbxUINT64 &l, const SbxUINT64 &r );
147cdf0e10cSrcweir 	friend SbxUINT64 operator | ( const SbxUINT64 &l, const SbxUINT64 &r );
148cdf0e10cSrcweir 	friend SbxUINT64 operator ^ ( const SbxUINT64 &l, const SbxUINT64 &r );
149cdf0e10cSrcweir 
150cdf0e10cSrcweir 	friend SbxUINT64 operator ~ ( const SbxUINT64 &r );
151cdf0e10cSrcweir };
152cdf0e10cSrcweir 
153cdf0e10cSrcweir #endif
154cdf0e10cSrcweir 
155cdf0e10cSrcweir #ifndef __SBX_SBXVALUES_HXX
156cdf0e10cSrcweir #define __SBX_SBXVALUES_HXX
157cdf0e10cSrcweir 
158cdf0e10cSrcweir class BigInt;
159cdf0e10cSrcweir class SbxDecimal;
160cdf0e10cSrcweir 
161*7fef15a0SDamjan Jovanovic struct BASIC_DLLPUBLIC SbxValues
162cdf0e10cSrcweir {
163cdf0e10cSrcweir 	union {
164cdf0e10cSrcweir 		sal_Unicode		nChar;
165cdf0e10cSrcweir 		sal_uInt8			nByte;
166cdf0e10cSrcweir 		sal_Int16			nInteger;
167cdf0e10cSrcweir 		sal_Int32           nLong;
168cdf0e10cSrcweir 		sal_uInt16          nUShort;
169cdf0e10cSrcweir 		sal_uInt32          nULong;
170cdf0e10cSrcweir 		float           nSingle;
171cdf0e10cSrcweir 		double          nDouble;
172cdf0e10cSrcweir 		SbxINT64        nLong64;
173cdf0e10cSrcweir 		SbxUINT64       nULong64;
174cdf0e10cSrcweir 		sal_Int64       nInt64;
175cdf0e10cSrcweir 		sal_uInt64      uInt64;
176cdf0e10cSrcweir 		int             nInt;
177cdf0e10cSrcweir 		unsigned int    nUInt;
178cdf0e10cSrcweir 		::rtl::OUString* pOUString;
179cdf0e10cSrcweir 		SbxDecimal*		pDecimal;
180cdf0e10cSrcweir 
181cdf0e10cSrcweir 		SbxBase*        pObj;
182cdf0e10cSrcweir 		sal_Unicode*    pChar;
183cdf0e10cSrcweir 		sal_uInt8*	        pByte;
184cdf0e10cSrcweir 		sal_Int16*	        pInteger;
185cdf0e10cSrcweir 		sal_Int32*	        pLong;
186cdf0e10cSrcweir 		sal_uInt16*	        pUShort;
187cdf0e10cSrcweir 		sal_uInt32*	        pULong;
188cdf0e10cSrcweir 		float*	        pSingle;
189cdf0e10cSrcweir 		double*	        pDouble;
190cdf0e10cSrcweir 		SbxINT64*       pLong64;
191cdf0e10cSrcweir 		SbxUINT64*      pULong64;
192cdf0e10cSrcweir 		sal_Int64*      pnInt64;
193cdf0e10cSrcweir 		sal_uInt64*     puInt64;
194cdf0e10cSrcweir 		int*	        pInt;
195cdf0e10cSrcweir 		unsigned int*   pUInt;
196cdf0e10cSrcweir 		void*	        pData;
197cdf0e10cSrcweir 	};
198cdf0e10cSrcweir 	SbxDataType	 eType;
199cdf0e10cSrcweir 
SbxValuesSbxValues200cdf0e10cSrcweir 	SbxValues(): pData( NULL ), eType(SbxEMPTY) {}
SbxValuesSbxValues201cdf0e10cSrcweir 	SbxValues( SbxDataType e ): eType(e) {}
SbxValuesSbxValues202cdf0e10cSrcweir 	SbxValues( char _nChar ): nChar( _nChar ), eType(SbxCHAR) {}
SbxValuesSbxValues203cdf0e10cSrcweir 	SbxValues( sal_uInt8 _nByte ): nByte( _nByte ), eType(SbxBYTE) {}
SbxValuesSbxValues204cdf0e10cSrcweir 	SbxValues( short _nInteger ): nInteger( _nInteger ), eType(SbxINTEGER ) {}
SbxValuesSbxValues205cdf0e10cSrcweir 	SbxValues( long _nLong ): nLong( _nLong ), eType(SbxLONG) {}
SbxValuesSbxValues206cdf0e10cSrcweir 	SbxValues( sal_uInt16 _nUShort ): nUShort( _nUShort ), eType(SbxUSHORT) {}
SbxValuesSbxValues207cdf0e10cSrcweir 	SbxValues( sal_uIntPtr _nULong ): nULong( _nULong ), eType(SbxULONG) {}
SbxValuesSbxValues208cdf0e10cSrcweir 	SbxValues( float _nSingle ): nSingle( _nSingle ), eType(SbxSINGLE) {}
SbxValuesSbxValues209cdf0e10cSrcweir 	SbxValues( double _nDouble ): nDouble( _nDouble ), eType(SbxDOUBLE) {}
SbxValuesSbxValues210cdf0e10cSrcweir 	SbxValues( int _nInt ): nInt( _nInt ), eType(SbxINT) {}
SbxValuesSbxValues211cdf0e10cSrcweir 	SbxValues( unsigned int _nUInt ): nUInt( _nUInt ), eType(SbxUINT) {}
SbxValuesSbxValues212cdf0e10cSrcweir 	SbxValues( const ::rtl::OUString* _pString ): pOUString( (::rtl::OUString*)_pString ), eType(SbxSTRING) {}
SbxValuesSbxValues213cdf0e10cSrcweir 	SbxValues( SbxBase* _pObj ): pObj( _pObj ), eType(SbxOBJECT) {}
SbxValuesSbxValues214cdf0e10cSrcweir 	SbxValues( sal_Unicode* _pChar ): pChar( _pChar ), eType(SbxLPSTR) {}
SbxValuesSbxValues215cdf0e10cSrcweir 	SbxValues( void* _pData ): pData( _pData ), eType(SbxPOINTER) {}
216cdf0e10cSrcweir 	SbxValues( const BigInt &rBig );
217cdf0e10cSrcweir };
218cdf0e10cSrcweir 
219cdf0e10cSrcweir #endif
220cdf0e10cSrcweir 
221cdf0e10cSrcweir #ifndef __SBX_SBXVALUE
222cdf0e10cSrcweir #define __SBX_SBXVALUE
223cdf0e10cSrcweir 
224cdf0e10cSrcweir struct SbxValues;
225cdf0e10cSrcweir 
226cdf0e10cSrcweir class SbxValueImpl;
227cdf0e10cSrcweir 
228*7fef15a0SDamjan Jovanovic class BASIC_DLLPUBLIC SbxValue : public SbxBase
229cdf0e10cSrcweir {
230cdf0e10cSrcweir 	SbxValueImpl* mpSbxValueImplImpl;	// Impl data
231cdf0e10cSrcweir 
232cdf0e10cSrcweir 	// #55226 Transport additional infos
233cdf0e10cSrcweir 	SbxValue* TheRealValue( sal_Bool bObjInObjError ) const;
234cdf0e10cSrcweir 	SbxValue* TheRealValue() const;
235cdf0e10cSrcweir protected:
236cdf0e10cSrcweir 	SbxValues aData; // Data
237cdf0e10cSrcweir 	::rtl::OUString aPic;  // Picture-String
238cdf0e10cSrcweir 	String          aToolString;  // tool string copy
239cdf0e10cSrcweir 
240cdf0e10cSrcweir 	virtual void Broadcast( sal_uIntPtr );   	// Broadcast-Call
241cdf0e10cSrcweir 	virtual ~SbxValue();
242cdf0e10cSrcweir 	virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
243cdf0e10cSrcweir 	virtual sal_Bool StoreData( SvStream& ) const;
244cdf0e10cSrcweir public:
245cdf0e10cSrcweir 	SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_VALUE,1);
246cdf0e10cSrcweir 	TYPEINFO();
247cdf0e10cSrcweir 	SbxValue();
248cdf0e10cSrcweir 	SbxValue( SbxDataType, void* = NULL );
249cdf0e10cSrcweir 	SbxValue( const SbxValue& );
250cdf0e10cSrcweir 	SbxValue& operator=( const SbxValue& );
251cdf0e10cSrcweir 	virtual void Clear();
252cdf0e10cSrcweir 	virtual sal_Bool IsFixed() const;
253cdf0e10cSrcweir 
IsInteger() const254cdf0e10cSrcweir 	sal_Bool IsInteger() const { return sal_Bool( GetType() == SbxINTEGER  ); }
IsLong() const255cdf0e10cSrcweir 	sal_Bool IsLong()    const { return sal_Bool( GetType() == SbxLONG     ); }
IsSingle() const256cdf0e10cSrcweir 	sal_Bool IsSingle()  const { return sal_Bool( GetType() == SbxSINGLE   ); }
IsDouble() const257cdf0e10cSrcweir 	sal_Bool IsDouble()  const { return sal_Bool( GetType() == SbxDOUBLE   ); }
IsString() const258cdf0e10cSrcweir 	sal_Bool IsString()  const { return sal_Bool( GetType() == SbxSTRING   ); }
IsDate() const259cdf0e10cSrcweir 	sal_Bool IsDate()    const { return sal_Bool( GetType() == SbxDATE     ); }
IsCurrency() const260cdf0e10cSrcweir 	sal_Bool IsCurrency()const { return sal_Bool( GetType() == SbxCURRENCY ); }
IsObject() const261cdf0e10cSrcweir 	sal_Bool IsObject()  const { return sal_Bool( GetType() == SbxOBJECT   ); }
IsDataObject() const262cdf0e10cSrcweir 	sal_Bool IsDataObject()const{return sal_Bool( GetType() == SbxDATAOBJECT);}
IsBool() const263cdf0e10cSrcweir 	sal_Bool IsBool()    const { return sal_Bool( GetType() == SbxBOOL     ); }
IsErr() const264cdf0e10cSrcweir 	sal_Bool IsErr()     const { return sal_Bool( GetType() == SbxERROR    ); }
IsEmpty() const265cdf0e10cSrcweir 	sal_Bool IsEmpty()   const { return sal_Bool( GetType() == SbxEMPTY    ); }
IsNull() const266cdf0e10cSrcweir 	sal_Bool IsNull()    const { return sal_Bool( GetType() == SbxNULL     ); }
IsChar() const267cdf0e10cSrcweir 	sal_Bool IsChar()    const { return sal_Bool( GetType() == SbxCHAR     ); }
IsByte() const268cdf0e10cSrcweir 	sal_Bool IsByte()    const { return sal_Bool( GetType() == SbxBYTE     ); }
IsUShort() const269cdf0e10cSrcweir 	sal_Bool IsUShort()  const { return sal_Bool( GetType() == SbxUSHORT   ); }
IsULong() const270cdf0e10cSrcweir 	sal_Bool IsULong()   const { return sal_Bool( GetType() == SbxULONG    ); }
IsInt() const271cdf0e10cSrcweir 	sal_Bool IsInt()     const { return sal_Bool( GetType() == SbxINT      ); }
IsUInt() const272cdf0e10cSrcweir 	sal_Bool IsUInt()    const { return sal_Bool( GetType() == SbxUINT     ); }
IspChar() const273cdf0e10cSrcweir 	sal_Bool IspChar()   const { return sal_Bool( GetType() == SbxLPSTR    ); }
274cdf0e10cSrcweir 	sal_Bool IsNumeric() const;
275cdf0e10cSrcweir 	sal_Bool IsNumericRTL() const;	// #41692 Interface for Basic
276cdf0e10cSrcweir 	sal_Bool ImpIsNumeric( sal_Bool bOnlyIntntl ) const;	// Implementation
277cdf0e10cSrcweir 
278cdf0e10cSrcweir 	virtual SbxClassType GetClass() const;
279cdf0e10cSrcweir 	virtual SbxDataType GetType() const;
280cdf0e10cSrcweir 	SbxDataType GetFullType() const;
281cdf0e10cSrcweir 	sal_Bool SetType( SbxDataType );
282cdf0e10cSrcweir 
283cdf0e10cSrcweir 	virtual sal_Bool Get( SbxValues& ) const;
284cdf0e10cSrcweir 	sal_Bool GetNoBroadcast( SbxValues& );
GetValues_Impl() const285cdf0e10cSrcweir 	const SbxValues& GetValues_Impl() const { return aData; }
286cdf0e10cSrcweir 	virtual sal_Bool Put( const SbxValues& );
287cdf0e10cSrcweir 
data()288cdf0e10cSrcweir     inline SbxValues * data() { return &aData; }
289cdf0e10cSrcweir 
290cdf0e10cSrcweir 	SbxINT64 GetCurrency() const;
291cdf0e10cSrcweir 	SbxINT64 GetLong64() const;
292cdf0e10cSrcweir 	SbxUINT64 GetULong64() const;
293cdf0e10cSrcweir 	sal_Int64  GetInt64() const;
294cdf0e10cSrcweir 	sal_uInt64 GetUInt64() const;
295cdf0e10cSrcweir 	sal_Int16  GetInteger() const;
296cdf0e10cSrcweir 	sal_Int32  GetLong() const;
297cdf0e10cSrcweir 	float  GetSingle() const;
298cdf0e10cSrcweir 	double GetDouble() const;
299cdf0e10cSrcweir 	double GetDate() const;
300cdf0e10cSrcweir 	sal_Bool   GetBool() const;
301cdf0e10cSrcweir 	sal_uInt16 GetErr() const;
302cdf0e10cSrcweir 	const  String& GetString() const;
303cdf0e10cSrcweir 	const  String& GetCoreString() const;
304cdf0e10cSrcweir     ::rtl::OUString GetOUString() const;
305cdf0e10cSrcweir 	SbxDecimal* GetDecimal() const;
306cdf0e10cSrcweir 	SbxBase* GetObject() const;
307cdf0e10cSrcweir 	sal_Bool	 HasObject() const;
308cdf0e10cSrcweir 	void*  GetData() const;
309cdf0e10cSrcweir 	sal_Unicode GetChar() const;
310cdf0e10cSrcweir 	sal_uInt8   GetByte() const;
311cdf0e10cSrcweir 	sal_uInt16 GetUShort() const;
312cdf0e10cSrcweir 	sal_uInt32 GetULong() const;
313cdf0e10cSrcweir 	int	   GetInt() const;
314cdf0e10cSrcweir 
315cdf0e10cSrcweir 	sal_Bool PutCurrency( const SbxINT64& );
316cdf0e10cSrcweir 	sal_Bool PutLong64( const SbxINT64& );
317cdf0e10cSrcweir 	sal_Bool PutULong64( const SbxUINT64& );
318cdf0e10cSrcweir 	sal_Bool PutInt64( sal_Int64 );
319cdf0e10cSrcweir 	sal_Bool PutUInt64( sal_uInt64 );
320cdf0e10cSrcweir 	sal_Bool PutInteger( sal_Int16 );
321cdf0e10cSrcweir 	sal_Bool PutLong( sal_Int32 );
322cdf0e10cSrcweir 	sal_Bool PutSingle( float );
323cdf0e10cSrcweir 	sal_Bool PutDouble( double );
324cdf0e10cSrcweir 	sal_Bool PutDate( double );
325cdf0e10cSrcweir 	sal_Bool PutBool( sal_Bool );
326cdf0e10cSrcweir 	sal_Bool PutErr( sal_uInt16 );
327cdf0e10cSrcweir 	sal_Bool PutStringExt( const ::rtl::OUString& );     // with extended analysis (International, "sal_True"/"sal_False")
328cdf0e10cSrcweir 	sal_Bool PutString( const ::rtl::OUString& );
329cdf0e10cSrcweir 	sal_Bool PutString( const sal_Unicode* );   // Type = SbxSTRING
330cdf0e10cSrcweir 	sal_Bool PutpChar( const sal_Unicode* );    // Type = SbxLPSTR
331cdf0e10cSrcweir 	sal_Bool PutDecimal( SbxDecimal* pDecimal );
332cdf0e10cSrcweir 	sal_Bool PutObject( SbxBase* );
333cdf0e10cSrcweir 	sal_Bool PutData( void* );
334cdf0e10cSrcweir 	sal_Bool PutChar( sal_Unicode );
335cdf0e10cSrcweir 	sal_Bool PutByte( sal_uInt8 );
336cdf0e10cSrcweir 	sal_Bool PutUShort( sal_uInt16 );
337cdf0e10cSrcweir 	sal_Bool PutULong( sal_uInt32 );
338cdf0e10cSrcweir 	sal_Bool PutInt( int );
339cdf0e10cSrcweir 	sal_Bool PutEmpty();
340cdf0e10cSrcweir 	sal_Bool PutNull();
341cdf0e10cSrcweir 
342cdf0e10cSrcweir 	// Special decimal methods
343cdf0e10cSrcweir 	sal_Bool PutDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec );
344cdf0e10cSrcweir 	sal_Bool fillAutomationDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec );
345cdf0e10cSrcweir 
346cdf0e10cSrcweir 	virtual sal_Bool Convert( SbxDataType );
347cdf0e10cSrcweir 	virtual sal_Bool Compute( SbxOperator, const SbxValue& );
348cdf0e10cSrcweir 	virtual sal_Bool Compare( SbxOperator, const SbxValue& ) const;
349cdf0e10cSrcweir 	sal_Bool Scan( const String&, sal_uInt16* = NULL );
350cdf0e10cSrcweir 	void Format( String&, const String* = NULL ) const;
351cdf0e10cSrcweir 
352cdf0e10cSrcweir 	// Interface for CDbl in Basic
353cdf0e10cSrcweir 	static SbxError ScanNumIntnl( const String& rSrc, double& nVal, sal_Bool bSingle=sal_False );
354cdf0e10cSrcweir 
355cdf0e10cSrcweir 	// The following operators are definied for easier handling.
356cdf0e10cSrcweir 	// Error conditions (overflow, conversions) are not
357cdf0e10cSrcweir 	// taken into consideration.
358cdf0e10cSrcweir 
359cdf0e10cSrcweir 	inline int operator ==( const SbxValue& ) const;
360cdf0e10cSrcweir 	inline int operator !=( const SbxValue& ) const;
361cdf0e10cSrcweir 	inline int operator <( const SbxValue& ) const;
362cdf0e10cSrcweir 	inline int operator >( const SbxValue& ) const;
363cdf0e10cSrcweir 	inline int operator <=( const SbxValue& ) const;
364cdf0e10cSrcweir 	inline int operator >=( const SbxValue& ) const;
365cdf0e10cSrcweir 
366cdf0e10cSrcweir 	inline SbxValue& operator *=( const SbxValue& );
367cdf0e10cSrcweir 	inline SbxValue& operator /=( const SbxValue& );
368cdf0e10cSrcweir 	inline SbxValue& operator %=( const SbxValue& );
369cdf0e10cSrcweir 	inline SbxValue& operator +=( const SbxValue& );
370cdf0e10cSrcweir 	inline SbxValue& operator -=( const SbxValue& );
371cdf0e10cSrcweir 	inline SbxValue& operator &=( const SbxValue& );
372cdf0e10cSrcweir 	inline SbxValue& operator |=( const SbxValue& );
373cdf0e10cSrcweir 	inline SbxValue& operator ^=( const SbxValue& );
374cdf0e10cSrcweir };
375cdf0e10cSrcweir 
operator ==(const SbxValue & r) const376cdf0e10cSrcweir inline int SbxValue::operator==( const SbxValue& r ) const
377cdf0e10cSrcweir { return Compare( SbxEQ, r ); }
378cdf0e10cSrcweir 
operator !=(const SbxValue & r) const379cdf0e10cSrcweir inline int SbxValue::operator!=( const SbxValue& r ) const
380cdf0e10cSrcweir { return Compare( SbxNE, r ); }
381cdf0e10cSrcweir 
operator <(const SbxValue & r) const382cdf0e10cSrcweir inline int SbxValue::operator<( const SbxValue& r ) const
383cdf0e10cSrcweir { return Compare( SbxLT, r ); }
384cdf0e10cSrcweir 
operator >(const SbxValue & r) const385cdf0e10cSrcweir inline int SbxValue::operator>( const SbxValue& r ) const
386cdf0e10cSrcweir { return Compare( SbxGT, r ); }
387cdf0e10cSrcweir 
operator <=(const SbxValue & r) const388cdf0e10cSrcweir inline int SbxValue::operator<=( const SbxValue& r ) const
389cdf0e10cSrcweir { return Compare( SbxLE, r ); }
390cdf0e10cSrcweir 
operator >=(const SbxValue & r) const391cdf0e10cSrcweir inline int SbxValue::operator>=( const SbxValue& r ) const
392cdf0e10cSrcweir { return Compare( SbxGE, r ); }
393cdf0e10cSrcweir 
operator *=(const SbxValue & r)394cdf0e10cSrcweir inline SbxValue& SbxValue::operator*=( const SbxValue& r )
395cdf0e10cSrcweir { Compute( SbxMUL, r ); return *this; }
396cdf0e10cSrcweir 
operator /=(const SbxValue & r)397cdf0e10cSrcweir inline SbxValue& SbxValue::operator/=( const SbxValue& r )
398cdf0e10cSrcweir { Compute( SbxDIV, r ); return *this; }
399cdf0e10cSrcweir 
operator %=(const SbxValue & r)400cdf0e10cSrcweir inline SbxValue& SbxValue::operator%=( const SbxValue& r )
401cdf0e10cSrcweir { Compute( SbxMOD, r ); return *this; }
402cdf0e10cSrcweir 
operator +=(const SbxValue & r)403cdf0e10cSrcweir inline SbxValue& SbxValue::operator+=( const SbxValue& r )
404cdf0e10cSrcweir { Compute( SbxPLUS, r ); return *this; }
405cdf0e10cSrcweir 
operator -=(const SbxValue & r)406cdf0e10cSrcweir inline SbxValue& SbxValue::operator-=( const SbxValue& r )
407cdf0e10cSrcweir { Compute( SbxMINUS, r ); return *this; }
408cdf0e10cSrcweir 
operator &=(const SbxValue & r)409cdf0e10cSrcweir inline SbxValue& SbxValue::operator&=( const SbxValue& r )
410cdf0e10cSrcweir { Compute( SbxAND, r ); return *this; }
411cdf0e10cSrcweir 
operator |=(const SbxValue & r)412cdf0e10cSrcweir inline SbxValue& SbxValue::operator|=( const SbxValue& r )
413cdf0e10cSrcweir { Compute( SbxOR, r ); return *this; }
414cdf0e10cSrcweir 
operator ^=(const SbxValue & r)415cdf0e10cSrcweir inline SbxValue& SbxValue::operator^=( const SbxValue& r )
416cdf0e10cSrcweir { Compute( SbxXOR, r ); return *this; }
417cdf0e10cSrcweir 
418cdf0e10cSrcweir #endif
419cdf0e10cSrcweir 
420cdf0e10cSrcweir #ifndef __SBX_SBXVARIABLE_HXX
421cdf0e10cSrcweir #define __SBX_SBXVARIABLE_HXX
422cdf0e10cSrcweir 
423cdf0e10cSrcweir class SbxArray;
424cdf0e10cSrcweir class SbxInfo;
425cdf0e10cSrcweir 
426cdf0e10cSrcweir #ifndef SBX_ARRAY_DECL_DEFINED
427cdf0e10cSrcweir #define SBX_ARRAY_DECL_DEFINED
428cdf0e10cSrcweir SV_DECL_REF(SbxArray)
429cdf0e10cSrcweir #endif
430cdf0e10cSrcweir 
431cdf0e10cSrcweir #ifndef SBX_INFO_DECL_DEFINED
432cdf0e10cSrcweir #define SBX_INFO_DECL_DEFINED
433cdf0e10cSrcweir SV_DECL_REF(SbxInfo)
434cdf0e10cSrcweir #endif
435cdf0e10cSrcweir 
436cdf0e10cSrcweir class SfxBroadcaster;
437cdf0e10cSrcweir 
438cdf0e10cSrcweir class SbxVariableImpl;
439cdf0e10cSrcweir class StarBASIC;
440cdf0e10cSrcweir 
441*7fef15a0SDamjan Jovanovic class BASIC_DLLPUBLIC SbxVariable : public SbxValue
442cdf0e10cSrcweir {
443cdf0e10cSrcweir     friend class SbMethod;
444cdf0e10cSrcweir 
445cdf0e10cSrcweir     SbxVariableImpl* mpSbxVariableImpl;	// Impl data
446cdf0e10cSrcweir     SfxBroadcaster*  pCst;		// Broadcaster, if needed
447cdf0e10cSrcweir     String           maName;            // Name, if available
448cdf0e10cSrcweir     SbxArrayRef      mpPar;             // Parameter-Array, if set
449cdf0e10cSrcweir     sal_uInt16           nHash;             // Hash-ID for search
450cdf0e10cSrcweir 
451cdf0e10cSrcweir 	SbxVariableImpl* getImpl( void );
452cdf0e10cSrcweir 
453cdf0e10cSrcweir protected:
454cdf0e10cSrcweir 	SbxInfoRef  pInfo;              // Probably called information
455cdf0e10cSrcweir 	sal_uIntPtr nUserData;          // User data for Call()
456cdf0e10cSrcweir 	SbxObject* pParent;             // Currently attached object
457cdf0e10cSrcweir 	virtual ~SbxVariable();
458cdf0e10cSrcweir 	virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
459cdf0e10cSrcweir 	virtual sal_Bool StoreData( SvStream& ) const;
460cdf0e10cSrcweir public:
461cdf0e10cSrcweir 	SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_VARIABLE,2);
462cdf0e10cSrcweir 	TYPEINFO();
463cdf0e10cSrcweir 	SbxVariable();
464cdf0e10cSrcweir 	SbxVariable( SbxDataType, void* = NULL );
465cdf0e10cSrcweir 	SbxVariable( const SbxVariable& );
466cdf0e10cSrcweir 	SbxVariable& operator=( const SbxVariable& );
467cdf0e10cSrcweir 
468cdf0e10cSrcweir 	void Dump( SvStream&, sal_Bool bDumpAll=sal_False );
469cdf0e10cSrcweir 
470cdf0e10cSrcweir 	virtual void SetName( const String& );
471cdf0e10cSrcweir 	virtual const String& GetName( SbxNameType = SbxNAME_NONE ) const;
GetHashCode() const472cdf0e10cSrcweir 	sal_uInt16 GetHashCode() const			{ return nHash; }
473cdf0e10cSrcweir 
474cdf0e10cSrcweir 	virtual void SetModified( sal_Bool );
475cdf0e10cSrcweir 
GetUserData() const476cdf0e10cSrcweir 	sal_uIntPtr GetUserData() const 	   { return nUserData; }
SetUserData(sal_uIntPtr n)477cdf0e10cSrcweir 	void SetUserData( sal_uIntPtr n ) { nUserData = n;    }
478cdf0e10cSrcweir 
479cdf0e10cSrcweir 	virtual SbxDataType  GetType()  const;
480cdf0e10cSrcweir 	virtual SbxClassType GetClass() const;
481cdf0e10cSrcweir 
482cdf0e10cSrcweir 	// Parameter-Interface
483cdf0e10cSrcweir 	virtual SbxInfo* GetInfo();
484cdf0e10cSrcweir 	void SetInfo( SbxInfo* p );
485cdf0e10cSrcweir 	void SetParameters( SbxArray* p );
GetParameters() const486cdf0e10cSrcweir 	SbxArray* GetParameters() const		{ return mpPar; }
487cdf0e10cSrcweir 
488cdf0e10cSrcweir 	// Sfx-Broadcasting-Support:
489cdf0e10cSrcweir 	// Due to data reduction and better DLL-hierarchie currently via casting
490cdf0e10cSrcweir 	SfxBroadcaster& GetBroadcaster();
IsBroadcaster() const491cdf0e10cSrcweir 	sal_Bool IsBroadcaster() const { return sal_Bool( pCst != NULL ); }
492cdf0e10cSrcweir 	virtual void Broadcast( sal_uIntPtr nHintId );
493cdf0e10cSrcweir 
GetParent() const494cdf0e10cSrcweir 	inline const SbxObject* GetParent() const { return pParent; }
GetParent()495cdf0e10cSrcweir 	inline SbxObject* GetParent() { return pParent; }
496cdf0e10cSrcweir 	virtual void SetParent( SbxObject* );
497cdf0e10cSrcweir 
498cdf0e10cSrcweir 	const String& GetDeclareClassName( void );
499cdf0e10cSrcweir 	void SetDeclareClassName( const String& );
500cdf0e10cSrcweir 	void SetComListener( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xComListener,
501cdf0e10cSrcweir 		StarBASIC* pParentBasic );
502cdf0e10cSrcweir 	void ClearComListener( void );
503cdf0e10cSrcweir 
504cdf0e10cSrcweir 	static sal_uInt16 MakeHashCode( const String& rName );
505cdf0e10cSrcweir };
506cdf0e10cSrcweir 
507cdf0e10cSrcweir #ifndef SBX_VARIABLE_DECL_DEFINED
508cdf0e10cSrcweir #define SBX_VARIABLE_DECL_DEFINED
509cdf0e10cSrcweir SV_DECL_REF(SbxVariable)
510cdf0e10cSrcweir #endif
511cdf0e10cSrcweir 
512cdf0e10cSrcweir #endif
513cdf0e10cSrcweir 
514cdf0e10cSrcweir #endif	// _SBXVAR_HXX
515