diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2007-04-11 11:52:47 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2007-04-11 11:52:47 +0000 |
commit | e362167ba18d02fd9eea28677ad0a5a3c5c77de4 (patch) | |
tree | ea41d4a9cdc085a2e7657194b8357af9fab06316 /basic/inc | |
parent | 1253b6623aea1768651a6b1945229995e7a99009 (diff) |
INTEGRATION: CWS hedaburemove01 (1.1.2); FILE ADDED
2006/12/12 16:41:50 vg 1.1.2.1: #i72503# gathered global includes in one place
Diffstat (limited to 'basic/inc')
-rw-r--r-- | basic/inc/basic/sbmeth.hxx | 112 | ||||
-rw-r--r-- | basic/inc/basic/sbmod.hxx | 181 | ||||
-rw-r--r-- | basic/inc/basic/sbprop.hxx | 90 | ||||
-rw-r--r-- | basic/inc/basic/sbstar.hxx | 216 |
4 files changed, 599 insertions, 0 deletions
diff --git a/basic/inc/basic/sbmeth.hxx b/basic/inc/basic/sbmeth.hxx new file mode 100644 index 000000000000..10bf4db72ff1 --- /dev/null +++ b/basic/inc/basic/sbmeth.hxx @@ -0,0 +1,112 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sbmeth.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: vg $ $Date: 2007-04-11 12:52:00 $ + * + * 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 _SB_SBMETH_HXX +#define _SB_SBMETH_HXX + +#ifndef _ERRCODE_HXX //autogen +#include <tools/errcode.hxx> +#endif +#ifndef __SBX_SBXMETHOD_HXX //autogen +#include <basic/sbxmeth.hxx> +#endif +#include <basic/sbdef.hxx> + +class SbModule; +class SbMethodImpl; + +class SbMethod : public SbxMethod +{ + friend class SbiRuntime; + friend class SbiFactory; + friend class SbModule; + friend class SbClassModuleObject; + friend class SbiCodeGen; + friend class SbJScriptMethod; + friend class SbIfaceMapperMethod; + + SbMethodImpl* mpSbMethodImpl; // Impl data + + SbModule* pMod; + USHORT nDebugFlags; + USHORT nLine1, nLine2; + UINT32 nStart; + BOOL bInvalid; + SbMethod( const String&, SbxDataType, SbModule* ); + SbMethod( const SbMethod& ); + virtual BOOL LoadData( SvStream&, USHORT ); + virtual BOOL StoreData( SvStream& ) const; + virtual ~SbMethod(); + +public: + SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASICMETHOD,2); + TYPEINFO(); + virtual SbxInfo* GetInfo(); + SbxArray* GetLocals(); + SbxArray* GetStatics(); + SbModule* GetModule() { return pMod; } + UINT32 GetId() const { return nStart; } + USHORT GetDebugFlags() { return nDebugFlags; } + void SetDebugFlags( USHORT n ) { nDebugFlags = n; } + void GetLineRange( USHORT&, USHORT& ); + + // Schnittstelle zum Ausfuehren einer Methode aus den Applikationen + virtual ErrCode Call( SbxValue* pRet = NULL ); + virtual void Broadcast( ULONG nHintId ); +}; + +#ifndef __SB_SBMETHODREF_HXX +#define __SB_SBMETHODREF_HXX +SV_DECL_IMPL_REF(SbMethod) +#endif + +class SbIfaceMapperMethod : public SbMethod +{ + friend class SbiRuntime; + + SbMethodRef mxImplMeth; + +public: + TYPEINFO(); + SbIfaceMapperMethod( const String& rName, SbMethod* pImplMeth ) + : SbMethod( rName, pImplMeth->GetType(), NULL ) + , mxImplMeth( pImplMeth ) + {} + virtual ~SbIfaceMapperMethod(); + SbMethod* getImplMethod( void ) + { return mxImplMeth; } +}; + +#endif diff --git a/basic/inc/basic/sbmod.hxx b/basic/inc/basic/sbmod.hxx new file mode 100644 index 000000000000..096642f40589 --- /dev/null +++ b/basic/inc/basic/sbmod.hxx @@ -0,0 +1,181 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sbmod.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: vg $ $Date: 2007-04-11 12:52:25 $ + * + * 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 _SB_SBMOD_HXX +#define _SB_SBMOD_HXX + +#include <basic/sbdef.hxx> +#ifndef _SBX_SBXOBJECT_HXX //autogen +#include <basic/sbxobj.hxx> +#endif +#ifndef _SBXDEF_HXX //autogen +#include <basic/sbxdef.hxx> +#endif +#ifndef _RTL_USTRING_HXX +#include <rtl/ustring.hxx> +#endif + +class SbMethod; +class SbProperty; +class SbiRuntime; +class SbiBreakpoints; +class SbiImage; +class SbProcedureProperty; +class SbIfaceMapperMethod; + +struct SbClassData; +class SbModuleImpl; + +class SbModule : public SbxObject +{ + friend class TestToolObj; // somit knnen Module nach laden zur Laufzeit initialisiert werden + friend class SbiCodeGen; + friend class SbMethod; + friend class SbiRuntime; + friend class StarBASIC; + friend class SbClassModuleObject; + + SbModuleImpl* mpSbModuleImpl; // Impl data + +protected: + ::rtl::OUString aOUSource; + String aComment; + SbiImage* pImage; // das Image + SbiBreakpoints* pBreaks; // Breakpoints + SbClassData* pClassData; + + void StartDefinitions(); + SbMethod* GetMethod( const String&, SbxDataType ); + SbProperty* GetProperty( const String&, SbxDataType ); + SbProcedureProperty* GetProcedureProperty( const String&, SbxDataType ); + SbIfaceMapperMethod* GetIfaceMapperMethod( const String&, SbMethod* ); + void EndDefinitions( BOOL=FALSE ); + USHORT Run( SbMethod* ); + void RunInit(); + void ClearPrivateVars(); + void GlobalRunInit( BOOL bBasicStart ); // fuer alle Module + void GlobalRunDeInit( void ); + const BYTE* FindNextStmnt( const BYTE*, USHORT&, USHORT& ) const; + const BYTE* FindNextStmnt( const BYTE*, USHORT&, USHORT&, + BOOL bFollowJumps, const SbiImage* pImg=NULL ) const; + virtual BOOL LoadData( SvStream&, USHORT ); + virtual BOOL StoreData( SvStream& ) const; + virtual BOOL LoadCompleted(); + virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ); + virtual ~SbModule(); +public: + SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASICMOD,2); + TYPEINFO(); + SbModule( const String& ); + virtual void SetParent( SbxObject* ); + virtual void Clear(); + + virtual SbxVariable* Find( const String&, SbxClassType ); + + virtual const String& GetSource() const; + const ::rtl::OUString& GetSource32() const; + const String& GetComment() const { return aComment; } + virtual void SetSource( const String& r ); + void SetSource32( const ::rtl::OUString& r ); + void SetComment( const String& r ); + + virtual BOOL Compile(); + BOOL Disassemble( String& rText ); + virtual BOOL IsCompiled() const; + const SbxObject* FindType( String aTypeName ) const; + + virtual BOOL IsBreakable( USHORT nLine ) const; + virtual USHORT GetBPCount() const; + virtual USHORT GetBP( USHORT n ) const; + virtual BOOL IsBP( USHORT nLine ) const; + virtual BOOL SetBP( USHORT nLine ); + virtual BOOL ClearBP( USHORT nLine ); + virtual void ClearAllBP(); + + // Zeilenbereiche von Subs + virtual SbMethod* GetFunctionForLine( USHORT ); + + // Store only image, no source (needed for new password protection) + BOOL StoreBinaryData( SvStream& ); + BOOL StoreBinaryData( SvStream&, USHORT nVer ); + BOOL LoadBinaryData( SvStream&, USHORT nVer ); + BOOL LoadBinaryData( SvStream& ); + BOOL ExceedsLegacyModuleSize(); + void fixUpMethodStart( bool bCvtToLegacy, SbiImage* pImg = NULL ) const; +}; + +#ifndef __SB_SBMODULEREF_HXX +#define __SB_SBMODULEREF_HXX + +SV_DECL_IMPL_REF(SbModule) + +#endif + +class SbClassModuleImpl; + +// Object class for instances of class modules +class SbClassModuleObject : public SbModule +{ + SbClassModuleImpl* mpSbClassModuleImpl; + + SbModule* mpClassModule; + bool mbInitializeEventDone; + +public: + TYPEINFO(); + SbClassModuleObject( SbModule* pClassModule ); + ~SbClassModuleObject(); + + // Find ueberladen, um z.B. NameAccess zu unterstuetzen + virtual SbxVariable* Find( const String&, SbxClassType ); + + virtual void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& ); + + SbModule* getClassModule( void ) + { return mpClassModule; } + + void triggerInitializeEvent( void ); + void triggerTerminateEvent( void ); +}; + +#ifndef __SB_SBCLASSMODULEREF_HXX +#define __SB_SBCLASSMODULEREF_HXX + +SV_DECL_IMPL_REF(SbClassModuleObject); + +#endif + +#endif diff --git a/basic/inc/basic/sbprop.hxx b/basic/inc/basic/sbprop.hxx new file mode 100644 index 000000000000..d58b8269fac7 --- /dev/null +++ b/basic/inc/basic/sbprop.hxx @@ -0,0 +1,90 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sbprop.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: vg $ $Date: 2007-04-11 12:52:36 $ + * + * 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 _SB_SBPROPERTY_HXX +#define _SB_SBPROPERTY_HXX + +#ifndef __SBX_SBXPROPERTY_HXX //autogen +#include <basic/sbxprop.hxx> +#endif +#include <basic/sbdef.hxx> + +class SbModule; + +class SbProperty : public SbxProperty +{ + friend class SbiFactory; + friend class SbModule; + friend class SbProcedureProperty; + SbModule* pMod; + BOOL bInvalid; + SbProperty( const String&, SbxDataType, SbModule* ); + virtual ~SbProperty(); +public: + SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASICPROP,1); + TYPEINFO(); + SbModule* GetModule() { return pMod; } +}; + +#ifndef __SB_SBPROPERTYREF_HXX +#define __SB_SBPROPERTYREF_HXX +SV_DECL_IMPL_REF(SbProperty) +#endif + +class SbProcedureProperty : public SbxProperty +{ + bool mbSet; // Flag for set command + + virtual ~SbProcedureProperty(); + +public: + SbProcedureProperty( const String& r, SbxDataType t ) + : SbxProperty( r, t ) // , pMod( p ) + , mbSet( false ) + {} + TYPEINFO(); + + bool isSet( void ) + { return mbSet; } + void setSet( bool bSet ) + { mbSet = bSet; } +}; + +#ifndef __SB_SBPROCEDUREPROPERTYREF_HXX +#define __SB_SBPROCEDUREPROPERTYREF_HXX +SV_DECL_IMPL_REF(SbProcedureProperty) +#endif + +#endif diff --git a/basic/inc/basic/sbstar.hxx b/basic/inc/basic/sbstar.hxx new file mode 100644 index 000000000000..e1606ac69509 --- /dev/null +++ b/basic/inc/basic/sbstar.hxx @@ -0,0 +1,216 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sbstar.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: vg $ $Date: 2007-04-11 12:52:47 $ + * + * 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 _SB_SBSTAR_HXX +#define _SB_SBSTAR_HXX + +#ifndef _SBXCLASS_HXX //autogen +#include <basic/sbx.hxx> +#endif +#ifndef _SBX_SBXOBJECT_HXX //autogen +#include <basic/sbxobj.hxx> +#endif +#ifndef _RTL_USTRING_HXX +#include <rtl/ustring.hxx> +#endif +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#include <basic/sbdef.hxx> +#include <basic/sberrors.hxx> + +class SbModule; // fertiges Modul +class SbiInstance; // Laufzeit-Instanz +class SbiRuntime; // aktuell laufende Prozedur +class SbiImage; // compiliertes Image +class BasicLibInfo; // Infoblock fuer Basic-Manager +class SbiBreakpoints; +class SbTextPortions; +class SbMethod; +class BasicManager; + +class StarBASICImpl; + +class StarBASIC : public SbxObject +{ + friend class SbiScanner; + friend class SbiExpression; // Zugriff auf RTL + friend class SbiInstance; + friend class SbiRuntime; + + StarBASICImpl* mpStarBASICImpl; + + SbxArrayRef pModules; // Liste aller Module + SbxObjectRef pRtl; // Runtime Library + SbxArrayRef xUnoListeners; // Listener handled by CreateUnoListener + // Handler-Support: + Link aErrorHdl; // Fehlerbehandlung + Link aBreakHdl; // Breakpoint-Handler + BOOL bNoRtl; // TRUE: RTL nicht durchsuchen + BOOL bBreak; // TRUE: Break, sonst Step + BasicLibInfo* pLibInfo; // Infoblock fuer Basic-Manager + SbLanguageMode eLanguageMode; // LanguageMode des Basic-Objekts +protected: + BOOL CError( SbError, const String&, xub_StrLen, xub_StrLen, xub_StrLen ); +private: + BOOL RTError( SbError, xub_StrLen, xub_StrLen, xub_StrLen ); + BOOL RTError( SbError, const String& rMsg, xub_StrLen, xub_StrLen, xub_StrLen ); + USHORT BreakPoint( xub_StrLen nLine, xub_StrLen nCol1, xub_StrLen nCol2 ); + USHORT StepPoint( xub_StrLen nLine, xub_StrLen nCol1, xub_StrLen nCol2 ); + virtual BOOL LoadData( SvStream&, USHORT ); + virtual BOOL StoreData( SvStream& ) const; + +protected: + + virtual BOOL ErrorHdl(); + virtual USHORT BreakHdl(); + virtual ~StarBASIC(); + +public: + + SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASIC,1); + TYPEINFO(); + + StarBASIC( StarBASIC* pParent = NULL ); + + // #51727 SetModified ueberladen, damit der Modified- + // Zustand nicht an den Parent weitergegeben wird. + virtual void SetModified( BOOL ); + + void* operator new( size_t ); + void operator delete( void* ); + + virtual void Insert( SbxVariable* ); + using SbxObject::Remove; + virtual void Remove( SbxVariable* ); + virtual void Clear(); + + BasicLibInfo* GetLibInfo() { return pLibInfo; } + void SetLibInfo( BasicLibInfo* p ) { pLibInfo = p; } + + // Compiler-Interface + SbModule* MakeModule( const String& rName, const String& rSrc ); + SbModule* MakeModule32( const String& rName, const ::rtl::OUString& rSrc ); + BOOL Compile( SbModule* ); + BOOL Disassemble( SbModule*, String& rText ); + static void Stop(); + static void Error( SbError ); + static void Error( SbError, const String& rMsg ); + static void FatalError( SbError ); + static BOOL IsRunning(); + static SbError GetErrBasic(); + // #66536 Zusatz-Message fuer RTL-Funktion Error zugreifbar machen + static String GetErrorMsg(); + static xub_StrLen GetErl(); + // Highlighting + void Highlight( const String& rSrc, SbTextPortions& rList ); + + virtual SbxVariable* Find( const String&, SbxClassType ); + virtual BOOL Call( const String&, SbxArray* = NULL ); + + SbxArray* GetModules() { return pModules; } + SbxObject* GetRtl() { return pRtl; } + SbModule* FindModule( const String& ); + // Init-Code aller Module ausfuehren (auch in inserteten Doc-Basics) + void InitAllModules( StarBASIC* pBasicNotToInit = NULL ); + void DeInitAllModules( void ); + void ClearAllModuleVars( void ); + void ActivateObject( const String*, BOOL ); + BOOL LoadOldModules( SvStream& ); + + // #43011 Fuer das TestTool, um globale Variablen loeschen zu koennen + void ClearGlobalVars( void ); + + // Abfragen fuer den Error-Handler und den Break-Handler: + static USHORT GetLine(); + static USHORT GetCol1(); + static USHORT GetCol2(); + static void SetErrorData( SbError nCode, USHORT nLine, + USHORT nCol1, USHORT nCol2 ); + + // Spezifisch fuer den Error-Handler: + static void MakeErrorText( SbError, const String& aMsg ); + static const String& GetErrorText(); + static SbError GetErrorCode(); + static BOOL IsCompilerError(); + static USHORT GetVBErrorCode( SbError nError ); + static SbError GetSfxFromVBError( USHORT nError ); + static void SetGlobalLanguageMode( SbLanguageMode eLangMode ); + static SbLanguageMode GetGlobalLanguageMode(); + // Lokale Einstellung + void SetLanguageMode( SbLanguageMode eLangMode ) + { eLanguageMode = eLangMode; } + SbLanguageMode GetLanguageMode(); + + // Spezifisch fuer den Break-Handler: + BOOL IsBreak() const { return bBreak; } + + static Link GetGlobalErrorHdl(); + static void SetGlobalErrorHdl( const Link& rNewHdl ); + Link GetErrorHdl() const { return aErrorHdl; } + void SetErrorHdl( const Link& r ) { aErrorHdl = r; } + + static Link GetGlobalBreakHdl(); + static void SetGlobalBreakHdl( const Link& rNewHdl ); + Link GetBreakHdl() const { return aBreakHdl; } + void SetBreakHdl( const Link& r ) { aBreakHdl = r; } + + SbxArrayRef getUnoListeners( void ); + + static SbxBase* FindSBXInCurrentScope( const String& rName ); + static SbxVariable* FindVarInCurrentScopy + ( const String& rName, USHORT& rStatus ); + static SbMethod* GetActiveMethod( USHORT nLevel = 0 ); + static SbModule* GetActiveModule(); + + // #60175 TRUE: SFX-Resource wird bei Basic-Fehlern nicht angezogen + static void StaticSuppressSfxResource( BOOL bSuppress ); + + // #91147 TRUE: Reschedule is enabled (default>, FALSE: No reschedule + static void StaticEnableReschedule( BOOL bReschedule ); + + SbxObjectRef getRTL( void ) { return pRtl; } +}; + +#ifndef __SB_SBSTARBASICREF_HXX +#define __SB_SBSTARBASICREF_HXX + +SV_DECL_IMPL_REF(StarBASIC) + +#endif + +#endif + |