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