diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2007-04-11 11:56:19 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2007-04-11 11:56:19 +0000 |
commit | 5b0aa95919d036901b5fcb5833f5a76aa363cbd7 (patch) | |
tree | b7cd55979c2efcbe44f10fba20b21387ec3c6c33 /basic/inc | |
parent | 6895466141448d78d66d4ec3852be196e1b99c56 (diff) |
INTEGRATION: CWS hedaburemove01 (1.1.2); FILE ADDED
2006/12/12 16:41:54 vg 1.1.2.1: #i72503# gathered global includes in one place
Diffstat (limited to 'basic/inc')
-rw-r--r-- | basic/inc/basic/sbxprop.hxx | 71 | ||||
-rw-r--r-- | basic/inc/basic/sbxvar.hxx | 526 | ||||
-rw-r--r-- | basic/inc/basic/testtool.hxx | 173 | ||||
-rw-r--r-- | basic/inc/basic/ttstrhlp.hxx | 84 |
4 files changed, 854 insertions, 0 deletions
diff --git a/basic/inc/basic/sbxprop.hxx b/basic/inc/basic/sbxprop.hxx new file mode 100644 index 000000000000..54d46f68da70 --- /dev/null +++ b/basic/inc/basic/sbxprop.hxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sbxprop.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: vg $ $Date: 2007-04-11 12:55:27 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef __SBX_SBXPROPERTY_HXX +#define __SBX_SBXPROPERTY_HXX + +#ifndef _SBXVAR_HXX +#include <basic/sbxvar.hxx> +#endif + +class SbxPropertyImpl; + +class SbxProperty : public SbxVariable +{ + SbxPropertyImpl* mpSbxPropertyImpl; // Impl data + +public: + SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_PROPERTY,1); + TYPEINFO(); + SbxProperty( const String& r, SbxDataType t ) + : SbxVariable( t ) { SetName( r ); } + SbxProperty( const SbxProperty& r ) : SvRefBase( r ), SbxVariable( r ) {} + SbxProperty& operator=( const SbxProperty& r ) + { SbxVariable::operator=( r ); return *this; } + virtual SbxClassType GetClass() const; +}; + +#ifndef __SBX_SBXPROPERTYREF_HXX +#define __SBX_SBXPROPERTYREF_HXX + +#ifndef SBX_PROPERTY_DECL_DEFINED +#define SBX_PROPERTY_DECL_DEFINED +SV_DECL_REF(SbxProperty) +#endif +SV_IMPL_REF(SbxProperty) + +#endif + +#endif diff --git a/basic/inc/basic/sbxvar.hxx b/basic/inc/basic/sbxvar.hxx new file mode 100644 index 000000000000..73807c3701b5 --- /dev/null +++ b/basic/inc/basic/sbxvar.hxx @@ -0,0 +1,526 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sbxvar.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: vg $ $Date: 2007-04-11 12:55:39 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef _SBXVAR_HXX +#define _SBXVAR_HXX + +#ifndef _RTL_USTRING_HXX_ +#include <rtl/ustring.hxx> +#endif + +#ifndef _STRING_HXX //autogen +#include <tools/string.hxx> +#endif + +#ifndef _COM_SUN_STAR_BRIDGE_OLEAUTOMATION_DECIMAL_HPP_ +#include <com/sun/star/bridge/oleautomation/Decimal.hpp> +#endif + +#ifndef _SBXCORE_HXX +#include <basic/sbxcore.hxx> +#endif + +#ifndef __SBX_64 +#define __SBX_64 + +struct SbxINT64 +{ + INT32 nHigh; UINT32 nLow; + +#if FALSE + SbxINT64() : nHigh( 0 ), nLow( 0 ) {} + SbxINT64( UINT8 n ) : nHigh( 0 ), nLow( n ) {} + SbxINT64( UINT16 n ) : nHigh( 0 ), nLow( n ) {} + SbxINT64( UINT32 n ) : nHigh( 0 ), nLow( n ) {} + SbxINT64( unsigned int n ) : nHigh( 0 ), nLow( n ) {} + SbxINT64( INT8 n ) : nHigh( n < 0 ? -1 : 0 ), nLow( n ) {} + SbxINT64( INT16 n ) : nHigh( n < 0 ? -1 : 0 ), nLow( n ) {} + SbxINT64( INT32 n ) : nHigh( n < 0 ? -1 : 0 ), nLow( n ) {} + SbxINT64( int n ) : nHigh( n < 0 ? -1 : 0 ), nLow( n ) {} + SbxINT64( SbxINT64 &r ) : nHigh( r.nHigh ), nLow( r.nLow ) {} + + SbxINT64( BigInt &r ); + SbxINT64( double n ); +#endif + void CHS() + { + nLow ^= (UINT32)-1; + nHigh ^= -1; + nLow++; + if( !nLow ) + nHigh++; + } + + // blc/os2i vertraegt kein operator = + void Set(double n) + { + if( n >= 0 ) + { + nHigh = (INT32)(n / (double)4294967296.0); + nLow = (UINT32)(n - ((double)nHigh * (double)4294967296.0)); + } + else { + nHigh = (INT32)(-n / (double)4294967296.0); + nLow = (UINT32)(-n - ((double)nHigh * (double)4294967296.0)); + CHS(); + } + } + void Set(INT32 n) { nHigh = n < 0 ? -1 : 0; nLow = n; } + + void SetMax() { nHigh = 0x7FFFFFFF; nLow = 0xFFFFFFFF; } + void SetMin() { nHigh = 0x80000000; nLow = 0x00000000; } + void SetNull() { nHigh = 0x00000000; nLow = 0x00000000; } + + int operator ! () const { return !nHigh && !nLow; } + + SbxINT64 &operator -= ( const SbxINT64 &r ); + SbxINT64 &operator += ( const SbxINT64 &r ); + SbxINT64 &operator /= ( const SbxINT64 &r ); + SbxINT64 &operator %= ( const SbxINT64 &r ); + SbxINT64 &operator *= ( const SbxINT64 &r ); + SbxINT64 &operator &= ( const SbxINT64 &r ); + SbxINT64 &operator |= ( const SbxINT64 &r ); + SbxINT64 &operator ^= ( const SbxINT64 &r ); + + friend SbxINT64 operator - ( const SbxINT64 &l, const SbxINT64 &r ); + friend SbxINT64 operator + ( const SbxINT64 &l, const SbxINT64 &r ); + friend SbxINT64 operator / ( const SbxINT64 &l, const SbxINT64 &r ); + friend SbxINT64 operator % ( const SbxINT64 &l, const SbxINT64 &r ); + friend SbxINT64 operator * ( const SbxINT64 &l, const SbxINT64 &r ); + friend SbxINT64 operator & ( const SbxINT64 &l, const SbxINT64 &r ); + friend SbxINT64 operator | ( const SbxINT64 &l, const SbxINT64 &r ); + friend SbxINT64 operator ^ ( const SbxINT64 &l, const SbxINT64 &r ); + + friend SbxINT64 operator - ( const SbxINT64 &r ); + friend SbxINT64 operator ~ ( const SbxINT64 &r ); + + static double GetMin() { return ((double)0x7FFFFFFF*(double)4294967296.0 + + (double)0xFFFFFFFF) + / CURRENCY_FACTOR; } + static double GetMax() { return ((double)0x80000000*(double)4294967296.0 + + (double)0xFFFFFFFF) + / CURRENCY_FACTOR; } +}; + +struct SbxUINT64 +{ + UINT32 nHigh; UINT32 nLow; + void Set(double n) + { + nHigh = (UINT32)(n / (double)4294967296.0); + nLow = (UINT32)(n - ((double)nHigh * (double)4294967296.0)); + } + + void Set(UINT32 n) { nHigh = 0; nLow = n; } + + void SetMax() { nHigh = 0xFFFFFFFF; nLow = 0xFFFFFFFF; } + void SetMin() { nHigh = 0x00000000; nLow = 0x00000000; } + void SetNull() { nHigh = 0x00000000; nLow = 0x00000000; } + + int operator ! () const { return !nHigh && !nLow; } + + SbxUINT64 &operator -= ( const SbxUINT64 &r ); + SbxUINT64 &operator += ( const SbxUINT64 &r ); + SbxUINT64 &operator /= ( const SbxUINT64 &r ); + SbxUINT64 &operator %= ( const SbxUINT64 &r ); + SbxUINT64 &operator *= ( const SbxUINT64 &r ); + SbxUINT64 &operator &= ( const SbxUINT64 &r ); + SbxUINT64 &operator |= ( const SbxUINT64 &r ); + SbxUINT64 &operator ^= ( const SbxUINT64 &r ); + + friend SbxUINT64 operator - ( const SbxUINT64 &l, const SbxUINT64 &r ); + friend SbxUINT64 operator + ( const SbxUINT64 &l, const SbxUINT64 &r ); + friend SbxUINT64 operator / ( const SbxUINT64 &l, const SbxUINT64 &r ); + friend SbxUINT64 operator % ( const SbxUINT64 &l, const SbxUINT64 &r ); + friend SbxUINT64 operator * ( const SbxUINT64 &l, const SbxUINT64 &r ); + friend SbxUINT64 operator & ( const SbxUINT64 &l, const SbxUINT64 &r ); + friend SbxUINT64 operator | ( const SbxUINT64 &l, const SbxUINT64 &r ); + friend SbxUINT64 operator ^ ( const SbxUINT64 &l, const SbxUINT64 &r ); + + friend SbxUINT64 operator ~ ( const SbxUINT64 &r ); +}; + +#endif + +#ifndef __SBX_SBXVALUES_HXX +#define __SBX_SBXVALUES_HXX + +class BigInt; +class SbxDecimal; + +struct SbxValues +{ + union { + sal_Unicode nChar; + BYTE nByte; + INT16 nInteger; + INT32 nLong; + UINT16 nUShort; + UINT32 nULong; + float nSingle; + double nDouble; + SbxINT64 nLong64; + SbxUINT64 nULong64; + sal_Int64 nInt64; + sal_uInt64 uInt64; + int nInt; + unsigned int nUInt; + String* pString; + SbxDecimal* pDecimal; + + SbxBase* pObj; + sal_Unicode* pChar; + BYTE* pByte; + INT16* pInteger; + INT32* pLong; + UINT16* pUShort; + UINT32* pULong; + float* pSingle; + double* pDouble; + SbxINT64* pLong64; + SbxUINT64* pULong64; + sal_Int64* pnInt64; + sal_uInt64* puInt64; + int* pInt; + unsigned int* pUInt; + void* pData; + }; + SbxDataType eType; + + SbxValues(): pData( NULL ), eType(SbxEMPTY) {} + SbxValues( SbxDataType e ): eType(e) {} + SbxValues( char _nChar ): nChar( _nChar ), eType(SbxCHAR) {} + SbxValues( BYTE _nByte ): nByte( _nByte ), eType(SbxBYTE) {} + SbxValues( short _nInteger ): nInteger( _nInteger ), eType(SbxINTEGER ) {} + SbxValues( long _nLong ): nLong( _nLong ), eType(SbxLONG) {} + SbxValues( USHORT _nUShort ): nUShort( _nUShort ), eType(SbxUSHORT) {} + SbxValues( ULONG _nULong ): nULong( _nULong ), eType(SbxULONG) {} + SbxValues( float _nSingle ): nSingle( _nSingle ), eType(SbxSINGLE) {} + SbxValues( double _nDouble ): nDouble( _nDouble ), eType(SbxDOUBLE) {} + SbxValues( int _nInt ): nInt( _nInt ), eType(SbxINT) {} + SbxValues( unsigned int _nUInt ): nUInt( _nUInt ), eType(SbxUINT) {} + SbxValues( const String* _pString ): pString( (String*) _pString ), eType(SbxSTRING) {} + SbxValues( SbxBase* _pObj ): pObj( _pObj ), eType(SbxOBJECT) {} + SbxValues( sal_Unicode* _pChar ): pChar( _pChar ), eType(SbxLPSTR) {} + SbxValues( void* _pData ): pData( _pData ), eType(SbxPOINTER) {} + SbxValues( const BigInt &rBig ); +}; + +#endif + +#ifndef __SBX_SBXVALUE +#define __SBX_SBXVALUE + +struct SbxValues; + +class SbxValueImpl; + +class SbxValue : public SbxBase +{ + friend class SbiDllMgr; // BASIC-Runtime, muss an aData ran + + SbxValueImpl* mpSbxValueImplImpl; // Impl data + + // #55226 Zusaetzliche Info transportieren + SbxValue* TheRealValue( BOOL bObjInObjError ) const; + SbxValue* TheRealValue() const; +protected: + SbxValues aData; // Daten + String aPic; // Picture-String + + virtual void Broadcast( ULONG ); // Broadcast-Call + virtual ~SbxValue(); + virtual BOOL LoadData( SvStream&, USHORT ); + virtual BOOL StoreData( SvStream& ) const; +public: + SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_VALUE,1); + TYPEINFO(); + SbxValue(); + SbxValue( SbxDataType, void* = NULL ); + SbxValue( const SbxValue& ); + SbxValue& operator=( const SbxValue& ); + virtual void Clear(); + virtual BOOL IsFixed() const; + + BOOL IsInteger() const { return BOOL( GetType() == SbxINTEGER ); } + BOOL IsLong() const { return BOOL( GetType() == SbxLONG ); } + BOOL IsSingle() const { return BOOL( GetType() == SbxSINGLE ); } + BOOL IsDouble() const { return BOOL( GetType() == SbxDOUBLE ); } + BOOL IsString() const { return BOOL( GetType() == SbxSTRING ); } + BOOL IsDate() const { return BOOL( GetType() == SbxDATE ); } + BOOL IsCurrency()const { return BOOL( GetType() == SbxCURRENCY ); } + BOOL IsObject() const { return BOOL( GetType() == SbxOBJECT ); } + BOOL IsDataObject()const{return BOOL( GetType() == SbxDATAOBJECT);} + BOOL IsBool() const { return BOOL( GetType() == SbxBOOL ); } + BOOL IsErr() const { return BOOL( GetType() == SbxERROR ); } + BOOL IsEmpty() const { return BOOL( GetType() == SbxEMPTY ); } + BOOL IsNull() const { return BOOL( GetType() == SbxNULL ); } + BOOL IsChar() const { return BOOL( GetType() == SbxCHAR ); } + BOOL IsByte() const { return BOOL( GetType() == SbxBYTE ); } + BOOL IsUShort() const { return BOOL( GetType() == SbxUSHORT ); } + BOOL IsULong() const { return BOOL( GetType() == SbxULONG ); } + BOOL IsInt() const { return BOOL( GetType() == SbxINT ); } + BOOL IsUInt() const { return BOOL( GetType() == SbxUINT ); } + BOOL IspChar() const { return BOOL( GetType() == SbxLPSTR ); } + BOOL IsNumeric() const; + BOOL IsNumericRTL() const; // #41692 Schnittstelle fuer Basic + BOOL ImpIsNumeric( BOOL bOnlyIntntl ) const; // Implementation + + virtual SbxClassType GetClass() const; + virtual SbxDataType GetType() const; + SbxDataType GetFullType() const; + BOOL SetType( SbxDataType ); + + virtual BOOL Get( SbxValues& ) const; + BOOL GetNoBroadcast( SbxValues& ); + const SbxValues& GetValues_Impl() const { return aData; } + virtual BOOL Put( const SbxValues& ); + + SbxINT64 GetCurrency() const; + SbxINT64 GetLong64() const; + SbxUINT64 GetULong64() const; + sal_Int64 GetInt64() const; + sal_uInt64 GetUInt64() const; + INT16 GetInteger() const; + INT32 GetLong() const; + float GetSingle() const; + double GetDouble() const; + double GetDate() const; + BOOL GetBool() const; + UINT16 GetErr() const; + const String& GetString() const; + const String& GetCoreString() const; + SbxDecimal* GetDecimal() const; + SbxBase* GetObject() const; + BOOL HasObject() const; + void* GetData() const; + sal_Unicode GetChar() const; + BYTE GetByte() const; + UINT16 GetUShort() const; + UINT32 GetULong() const; + int GetInt() const; + + BOOL PutCurrency( const SbxINT64& ); + BOOL PutLong64( const SbxINT64& ); + BOOL PutULong64( const SbxUINT64& ); + BOOL PutInt64( sal_Int64 ); + BOOL PutUInt64( sal_uInt64 ); + BOOL PutInteger( INT16 ); + BOOL PutLong( INT32 ); + BOOL PutSingle( float ); + BOOL PutDouble( double ); + BOOL PutDate( double ); + BOOL PutBool( BOOL ); + BOOL PutErr( USHORT ); + BOOL PutStringExt( const String& ); // mit erweiterter Auswertung (International, "TRUE"/"FALSE") + BOOL PutString( const String& ); + BOOL PutString( const sal_Unicode* ); // Typ = SbxSTRING + BOOL PutpChar( const sal_Unicode* ); // Typ = SbxLPSTR + BOOL PutDecimal( SbxDecimal* pDecimal ); + BOOL PutObject( SbxBase* ); + BOOL PutData( void* ); + BOOL PutChar( sal_Unicode ); + BOOL PutByte( BYTE ); + BOOL PutUShort( UINT16 ); + BOOL PutULong( UINT32 ); + BOOL PutInt( int ); + BOOL PutEmpty(); + BOOL PutNull(); + + // Special decimal methods + BOOL PutDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec ); + BOOL fillAutomationDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec ); + + virtual BOOL Convert( SbxDataType ); + virtual BOOL Compute( SbxOperator, const SbxValue& ); + virtual BOOL Compare( SbxOperator, const SbxValue& ) const; + BOOL Scan( const String&, USHORT* = NULL ); + void Format( String&, const String* = NULL ) const; + + // Schnittstelle fuer CDbl im Basic + static SbxError ScanNumIntnl( const String& rSrc, double& nVal, BOOL bSingle=FALSE ); + + // Die folgenden Operatoren sind zwecks einfacherem + // Zugriff definiert. Fehlerkonditionen wie Ueberlauf + // oder Konversionen werden nicht beruecksichtigt. + + inline int operator ==( const SbxValue& ) const; + inline int operator !=( const SbxValue& ) const; + inline int operator <( const SbxValue& ) const; + inline int operator >( const SbxValue& ) const; + inline int operator <=( const SbxValue& ) const; + inline int operator >=( const SbxValue& ) const; + + inline SbxValue& operator *=( const SbxValue& ); + inline SbxValue& operator /=( const SbxValue& ); + inline SbxValue& operator %=( const SbxValue& ); + inline SbxValue& operator +=( const SbxValue& ); + inline SbxValue& operator -=( const SbxValue& ); + inline SbxValue& operator &=( const SbxValue& ); + inline SbxValue& operator |=( const SbxValue& ); + inline SbxValue& operator ^=( const SbxValue& ); +}; + +inline int SbxValue::operator==( const SbxValue& r ) const +{ return Compare( SbxEQ, r ); } + +inline int SbxValue::operator!=( const SbxValue& r ) const +{ return Compare( SbxNE, r ); } + +inline int SbxValue::operator<( const SbxValue& r ) const +{ return Compare( SbxLT, r ); } + +inline int SbxValue::operator>( const SbxValue& r ) const +{ return Compare( SbxGT, r ); } + +inline int SbxValue::operator<=( const SbxValue& r ) const +{ return Compare( SbxLE, r ); } + +inline int SbxValue::operator>=( const SbxValue& r ) const +{ return Compare( SbxGE, r ); } + +inline SbxValue& SbxValue::operator*=( const SbxValue& r ) +{ Compute( SbxMUL, r ); return *this; } + +inline SbxValue& SbxValue::operator/=( const SbxValue& r ) +{ Compute( SbxDIV, r ); return *this; } + +inline SbxValue& SbxValue::operator%=( const SbxValue& r ) +{ Compute( SbxMOD, r ); return *this; } + +inline SbxValue& SbxValue::operator+=( const SbxValue& r ) +{ Compute( SbxPLUS, r ); return *this; } + +inline SbxValue& SbxValue::operator-=( const SbxValue& r ) +{ Compute( SbxMINUS, r ); return *this; } + +inline SbxValue& SbxValue::operator&=( const SbxValue& r ) +{ Compute( SbxAND, r ); return *this; } + +inline SbxValue& SbxValue::operator|=( const SbxValue& r ) +{ Compute( SbxOR, r ); return *this; } + +inline SbxValue& SbxValue::operator^=( const SbxValue& r ) +{ Compute( SbxXOR, r ); return *this; } + +#endif + +#ifndef __SBX_SBXVARIABLE_HXX +#define __SBX_SBXVARIABLE_HXX + +class SbxArray; +class SbxInfo; + +#ifndef SBX_ARRAY_DECL_DEFINED +#define SBX_ARRAY_DECL_DEFINED +SV_DECL_REF(SbxArray) +#endif + +#ifndef SBX_INFO_DECL_DEFINED +#define SBX_INFO_DECL_DEFINED +SV_DECL_REF(SbxInfo) +#endif + +class SfxBroadcaster; + +class SbxVariableImpl; + +class SbxVariable : public SbxValue +{ + friend class SbMethod; + + SbxVariableImpl* mpSbxVariableImpl; // Impl data + + SfxBroadcaster* pCst; // Broadcaster, falls angefordert + String maName; // Name, falls vorhanden + SbxArrayRef mpPar; // Parameter-Array, falls gesetzt + USHORT nHash; // Hash-ID fuer die Suche +protected: + SbxInfoRef pInfo; // Evtl. angeforderte Infos + UINT32 nUserData; // Benutzerdaten fuer Call() + SbxObject* pParent; // aktuell zugeordnetes Objekt + virtual ~SbxVariable(); + virtual BOOL LoadData( SvStream&, USHORT ); + virtual BOOL StoreData( SvStream& ) const; +public: + SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_VARIABLE,2); + TYPEINFO(); + SbxVariable(); + SbxVariable( SbxDataType, void* = NULL ); + SbxVariable( const SbxVariable& ); + SbxVariable& operator=( const SbxVariable& ); + + void Dump( SvStream&, BOOL bDumpAll=FALSE ); + + virtual void SetName( const String& ); + virtual const String& GetName( SbxNameType = SbxNAME_NONE ) const; + USHORT GetHashCode() const { return nHash; } + + virtual void SetModified( BOOL ); + + UINT32 GetUserData() const { return nUserData; } + void SetUserData( UINT32 n ) { nUserData = n; } + + virtual SbxDataType GetType() const; + virtual SbxClassType GetClass() const; + + // Das Parameter-Interface + virtual SbxInfo* GetInfo(); + void SetInfo( SbxInfo* p ); + void SetParameters( SbxArray* p ); + SbxArray* GetParameters() const { return mpPar; } + + // Sfx-Broadcasting-Support: + // Zwecks Einsparung von Daten und besserer DLL-Hierarchie + // erst einmal per Casting + SfxBroadcaster& GetBroadcaster(); + BOOL IsBroadcaster() const { return BOOL( pCst != NULL ); } + virtual void Broadcast( ULONG nHintId ); + + inline const SbxObject* GetParent() const { return pParent; } + inline SbxObject* GetParent() { return pParent; } + virtual void SetParent( SbxObject* ); + + static USHORT MakeHashCode( const String& rName ); +}; + +#ifndef SBX_VARIABLE_DECL_DEFINED +#define SBX_VARIABLE_DECL_DEFINED +SV_DECL_REF(SbxVariable) +#endif + +#endif + +#endif // _SBXVAR_HXX diff --git a/basic/inc/basic/testtool.hxx b/basic/inc/basic/testtool.hxx new file mode 100644 index 000000000000..fe23c3cb9188 --- /dev/null +++ b/basic/inc/basic/testtool.hxx @@ -0,0 +1,173 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: testtool.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: vg $ $Date: 2007-04-11 12:55:50 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef _BASIC_TESTTOOL_HXX_ +#define _BASIC_TESTTOOL_HXX_ + +#ifndef _SFXSMPLHINT_HXX +#include <svtools/smplhint.hxx> +#endif + +#ifndef _STRING_HXX //autogen +#include <tools/string.hxx> +#endif + +#define TESTTOOL_DEFAULT_PORT 12479 +#define UNO_DEFAULT_PORT 12480 +#define DEFAULT_HOST "localhost" + +#define TT_SIGNATURE_FOR_UNICODE_TEXTFILES "'encoding UTF-8 Do not remove or change this line!" + +#define ASSERTION_STACK_PREFIX "Backtrace:" + +// #94145# Due to a tab in TT_SIGNATURE_FOR_UNICODE_TEXTFILES which is changed to blanks by some editors +// this routine became necessary +BOOL IsTTSignatureForUnicodeTextfile( String aLine ); + +//#include "testapp.hxx" +#define ADD_ERROR_QUIET(nNr, aStr) \ +{ \ + ErrorEntry *pErr; \ + if ( BasicRuntimeAccess::HasRuntime() ) \ + { \ + BasicRuntime aRun = BasicRuntimeAccess::GetRuntime(); \ + xub_StrLen aErrLn = StarBASIC::GetErl(); \ + if ( 0 == aErrLn ) \ + aErrLn = aRun.GetLine(); \ + pErr = new ErrorEntry(nNr, aStr, \ + aErrLn, aRun.GetCol1(), aRun.GetCol2()); \ + } \ + else \ + { \ + pErr = new ErrorEntry(nNr, aStr); \ + } \ + P_FEHLERLISTE->C40_INSERT(ErrorEntry, pErr, P_FEHLERLISTE->Count());\ +} +// Irgendwann noch was mit der UID anfangen !! +#define ADD_ERROR(nNr, aStr) { \ + if ( !SbxBase::IsError() ) \ + SbxBase::SetError( nNr ); \ + ADD_ERROR_QUIET(nNr, aStr); \ +} + +#define POP_ERROR() P_FEHLERLISTE->DeleteAndDestroy(0) +#define GET_ERROR() P_FEHLERLISTE->GetObject(0) +#define IS_ERROR() ( P_FEHLERLISTE->Count() > 0 ) + +// bertragen des Fehlerlogs +enum TTLogType { LOG_RUN, LOG_TEST_CASE, LOG_ERROR, LOG_CALL_STACK, LOG_MESSAGE, LOG_WARNING, LOG_ASSERTION, LOG_QA_ERROR, LOG_ASSERTION_STACK }; + +struct TTDebugData +{ +public: + TTLogType aLogType; + String aMsg; + String aFilename; + xub_StrLen nLine; + xub_StrLen nCol1; + xub_StrLen nCol2; +}; + +struct TTLogMsg +{ +public: + String aLogFileName; + TTDebugData aDebugData; +}; + +// Zum bertragen der Fensterinformation aus der Testapp +struct WinInfoRec +{ +public: + String aUId; + String aKurzname; + String aSlotname; + String aLangname; + USHORT nRType; + String aRName; + BOOL bIsReset; +}; + +/// defines fr syntax Highlighting +#define TT_KEYWORD ((SbTextType)100) // Including locally executed commands like 'use' ... +#define TT_REMOTECMD ((SbTextType)101) // Remotely executed commands like 'nodebug' +#define TT_LOCALCMD ((SbTextType)102) // Locally executed commands like 'use' +#define TT_CONTROL ((SbTextType)103) // Possibly available control loaded by 'use' +#define TT_SLOT ((SbTextType)104) // Available Slots loaded by 'use' +#define TT_METHOD ((SbTextType)105) // Possibly allowed Method for controls +#define TT_NOMETHOD ((SbTextType)106) // No Possibly allowed Method for controls + +#define FILELIST1 ((SbTextType)111) // Symbols in file 1 +#define FILELIST2 ((SbTextType)112) // Symbols in file 2 +#define FILELIST3 ((SbTextType)113) // Symbols in file 3 +#define FILELIST4 ((SbTextType)114) // Symbols in file 4 + +/// defines fr hints vom TestToolObj an die Applikation +#define SBX_HINT_LANGUAGE_EXTENSION_LOADED SFX_HINT_USER06 +#define SBX_HINT_EXECUTION_STATUS_INFORMATION SFX_HINT_USER07 + +#define TT_EXECUTION_ENTERWAIT 0x01 +#define TT_EXECUTION_LEAVEWAIT 0x02 +#define TT_EXECUTION_SHOW_ACTION 0x03 +#define TT_EXECUTION_HIDE_ACTION 0x04 + +class TTExecutionStatusHint : public SfxSimpleHint +{ +private: + USHORT mnType; + String maExecutionStatus; + String maAdditionalExecutionStatus; + +public: + TYPEINFO(); + TTExecutionStatusHint( USHORT nType, sal_Char *pExecutionStatus, const sal_Char *pAdditionalExecutionStatus = "" ) + : SfxSimpleHint(SBX_HINT_EXECUTION_STATUS_INFORMATION) + , mnType( nType ) + , maExecutionStatus( pExecutionStatus, RTL_TEXTENCODING_ASCII_US ) + , maAdditionalExecutionStatus( pAdditionalExecutionStatus, RTL_TEXTENCODING_ASCII_US ) + {;} + + TTExecutionStatusHint( USHORT nType, const String &aExecutionStatus = String(), const String &aAdditionalExecutionStatus = String() ) + : SfxSimpleHint(SBX_HINT_EXECUTION_STATUS_INFORMATION) + , mnType( nType ) + , maExecutionStatus( aExecutionStatus ) + , maAdditionalExecutionStatus( aAdditionalExecutionStatus ) + {;} + + const String& GetExecutionStatus() const { return maExecutionStatus; } + const String& GetAdditionalExecutionStatus() const { return maAdditionalExecutionStatus; } + USHORT GetType(){ return mnType; } +}; + +#endif //#ifndef _BASIC_TESTTOOL_HXX_ diff --git a/basic/inc/basic/ttstrhlp.hxx b/basic/inc/basic/ttstrhlp.hxx new file mode 100644 index 000000000000..6d0d86d680de --- /dev/null +++ b/basic/inc/basic/ttstrhlp.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ttstrhlp.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: vg $ $Date: 2007-04-11 12:56:19 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef _BASIC_TTSTRHLP_HXX +#define _BASIC_TTSTRHLP_HXX + +#ifndef _STRING_HXX +#include <tools/string.hxx> +#endif + +#define CByteString( constAsciiStr ) ByteString( RTL_CONSTASCII_STRINGPARAM ( constAsciiStr ) ) +#define CUniString( constAsciiStr ) UniString( RTL_CONSTASCII_USTRINGPARAM ( constAsciiStr ) ) + +#define StartKenn CUniString("%") +#define EndKenn CUniString("%") +#define UIdKenn ( StartKenn.AppendAscii("UId") ) +#define MethodKenn ( StartKenn.AppendAscii("Method") ) +#define TypeKenn ( StartKenn.AppendAscii("RType") ) +#define SlotKenn ( StartKenn.AppendAscii("SlotId") ) +#define RcKenn ( StartKenn.AppendAscii("RCommand") ) +#define TabKenn ( StartKenn.AppendAscii("Tab") ) +#define MakeStringParam(Type,aText) ( Type.AppendAscii("=").Append( aText ).Append( EndKenn ) ) +#define MakeStringNumber(Type,nNumber) MakeStringParam (Type, UniString::CreateFromInt32(nNumber)) +#define UIdString(aID) MakeStringParam(UIdKenn,aID.GetText()) +#define MethodString(nNumber) MakeStringNumber(MethodKenn,nNumber) +#define TypeString(nNumber) MakeStringNumber(TypeKenn,nNumber) +#define SlotString(nNumber) MakeStringNumber(SlotKenn,nNumber) +#define RcString(nNumber) MakeStringNumber(RcKenn,nNumber) +#define TabString(nNumber) MakeStringNumber(TabKenn,nNumber) + +#define ResKenn ( StartKenn.AppendAscii("ResId") ) +#define BaseArgKenn ( StartKenn.AppendAscii("Arg") ) +#define ArgKenn(nNumber) ( BaseArgKenn.Append( UniString::CreateFromInt32(nNumber) ) ) +#define ResString(nNumber) MakeStringNumber(ResKenn,nNumber) +#define ArgString(nNumber, aText) MakeStringParam(ArgKenn(nNumber),aText) + +UniString GEN_RES_STR0( ULONG nResId ); +UniString GEN_RES_STR1( ULONG nResId, const String &Text1 ); +UniString GEN_RES_STR2( ULONG nResId, const String &Text1, const String &Text2 ); +UniString GEN_RES_STR3( ULONG nResId, const String &Text1, const String &Text2, const String &Text3 ); + +#define GEN_RES_STR1c( nResId, Text1 ) GEN_RES_STR1( nResId, CUniString(Text1) ) +#define GEN_RES_STR2c2( nResId, Text1, Text2 ) GEN_RES_STR2( nResId, Text1, CUniString(Text2) ) +#define GEN_RES_STR3c3( nResId, Text1, Text2, Text3 ) GEN_RES_STR3( nResId, Text1, Text2, CUniString(Text3) ) + +#define IMPL_GEN_RES_STR \ +UniString GEN_RES_STR0( ULONG nResId ) { return ResString( nResId ); } \ +UniString GEN_RES_STR1( ULONG nResId, const UniString &Text1 ) { return GEN_RES_STR0( nResId ).Append( ArgString( 1, Text1 ) ); } \ +UniString GEN_RES_STR2( ULONG nResId, const UniString &Text1, const UniString &Text2 ) { return GEN_RES_STR1( nResId, Text1 ).Append( ArgString( 2, Text2 ) ); } \ +UniString GEN_RES_STR3( ULONG nResId, const UniString &Text1, const UniString &Text2, const UniString &Text3 ) { return GEN_RES_STR2( nResId, Text1, Text2 ).Append( ArgString( 3, Text3 ) );} + +#endif + |