2007-04-11 11:52:47 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 10:22:41 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2007-04-11 11:52:47 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2007-04-11 11:52:47 +00:00
|
|
|
*
|
2008-04-11 10:22:41 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2007-04-11 11:52:47 +00:00
|
|
|
*
|
2008-04-11 10:22:41 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2007-04-11 11:52:47 +00:00
|
|
|
*
|
2008-04-11 10:22:41 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2007-04-11 11:52:47 +00:00
|
|
|
*
|
2008-04-11 10:22:41 +00:00
|
|
|
* OpenOffice.org 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 version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2007-04-11 11:52:47 +00:00
|
|
|
*
|
2008-04-11 10:22:41 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2007-04-11 11:52:47 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _SB_SBMOD_HXX
|
|
|
|
#define _SB_SBMOD_HXX
|
|
|
|
|
2010-07-01 16:23:26 +02:00
|
|
|
#include <com/sun/star/script/XInvocation.hpp>
|
2007-04-11 11:52:47 +00:00
|
|
|
#include <basic/sbdef.hxx>
|
|
|
|
#include <basic/sbxobj.hxx>
|
|
|
|
#include <basic/sbxdef.hxx>
|
|
|
|
#include <rtl/ustring.hxx>
|
2010-07-05 13:58:36 +02:00
|
|
|
#include <vector>
|
2007-04-11 11:52:47 +00:00
|
|
|
|
|
|
|
class SbMethod;
|
|
|
|
class SbProperty;
|
|
|
|
class SbiRuntime;
|
|
|
|
class SbiBreakpoints;
|
|
|
|
class SbiImage;
|
|
|
|
class SbProcedureProperty;
|
|
|
|
class SbIfaceMapperMethod;
|
2010-06-15 20:02:53 +02:00
|
|
|
class SbClassModuleObject;
|
2007-04-11 11:52:47 +00:00
|
|
|
|
|
|
|
struct SbClassData;
|
|
|
|
class SbModuleImpl;
|
|
|
|
|
|
|
|
class SbModule : public SbxObject
|
|
|
|
{
|
2009-04-25 00:18:20 +00:00
|
|
|
friend class TestToolObj; // allows module initialisation at runtime
|
2007-04-11 11:52:47 +00:00
|
|
|
friend class SbiCodeGen;
|
|
|
|
friend class SbMethod;
|
|
|
|
friend class SbiRuntime;
|
|
|
|
friend class StarBASIC;
|
|
|
|
friend class SbClassModuleObject;
|
|
|
|
|
|
|
|
SbModuleImpl* mpSbModuleImpl; // Impl data
|
2010-07-05 13:58:36 +02:00
|
|
|
std::vector< String > mModuleVariableNames;
|
2007-04-11 11:52:47 +00:00
|
|
|
|
|
|
|
protected:
|
2010-07-01 16:23:26 +02:00
|
|
|
com::sun::star::uno::Reference< com::sun::star::script::XInvocation > mxWrapper;
|
2009-04-25 00:18:20 +00:00
|
|
|
::rtl::OUString aOUSource;
|
|
|
|
String aComment;
|
|
|
|
SbiImage* pImage; // the Image
|
|
|
|
SbiBreakpoints* pBreaks; // Breakpoints
|
|
|
|
SbClassData* pClassData;
|
2010-03-09 10:00:03 +00:00
|
|
|
BOOL mbVBACompat;
|
2010-03-02 12:39:31 +00:00
|
|
|
INT32 mnType;
|
|
|
|
SbxObjectRef pDocObject; // an impl object ( used by Document Modules )
|
|
|
|
bool bIsProxyModule;
|
2007-04-11 11:52:47 +00:00
|
|
|
|
|
|
|
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();
|
2009-04-25 00:18:20 +00:00
|
|
|
void GlobalRunInit( BOOL bBasicStart ); // for all modules
|
2007-04-11 11:52:47 +00:00
|
|
|
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();
|
2010-03-09 10:00:03 +00:00
|
|
|
SbModule( const String&, BOOL bCompat = FALSE );
|
2007-04-11 11:52:47 +00:00
|
|
|
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();
|
|
|
|
|
2009-04-25 00:18:20 +00:00
|
|
|
// Lines of Subs
|
2007-04-11 11:52:47 +00:00
|
|
|
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;
|
2010-06-15 20:02:53 +02:00
|
|
|
BOOL IsVBACompat() const;
|
|
|
|
void SetVBACompat( BOOL bCompat );
|
|
|
|
INT32 GetModuleType() { return mnType; }
|
|
|
|
void SetModuleType( INT32 nType ) { mnType = nType; }
|
2010-03-02 12:39:31 +00:00
|
|
|
bool GetIsProxyModule() { return bIsProxyModule; }
|
2010-07-05 13:58:36 +02:00
|
|
|
void AddVarName( const String& aName );
|
2010-07-27 17:12:01 +02:00
|
|
|
void RemoveVars();
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > GetUnoModule();
|
2010-06-15 20:02:53 +02:00
|
|
|
bool createCOMWrapperForIface( ::com::sun::star::uno::Any& o_rRetAny, SbClassModuleObject* pProxyClassModuleObject );
|
2007-04-11 11:52:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#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();
|
|
|
|
|
2009-04-25 00:18:20 +00:00
|
|
|
// Overridden to support NameAccess etc.
|
2007-04-11 11:52:47 +00:00
|
|
|
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
|