diff options
Diffstat (limited to 'basic/source/classes/sb.cxx')
-rw-r--r-- | basic/source/classes/sb.cxx | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index c5ac53c43092..7f7ac8784742 100644 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -49,12 +49,17 @@ #include "disas.hxx" #include "runtime.hxx" #include <basic/sbuno.hxx> +#include <basic/sbobjmod.hxx> #include "stdobj.hxx" #include "filefmt.hxx" #include "sb.hrc" #include <basrid.hxx> #include <vos/mutex.hxx> +#include <com/sun/star/script/ModuleType.hpp> +#include <com/sun/star/script/ModuleInfo.hpp> +using namespace ::com::sun::star::script; + // #pragma SW_SEGMENT_CLASS( SBASIC, SBASIC_CODE ) SV_IMPL_VARARR(SbTextPortions,SbTextPortion) @@ -485,6 +490,7 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule ) } } } + SetModuleType( com::sun::star::script::ModuleType::Class ); } SbClassModuleObject::~SbClassModuleObject() @@ -682,6 +688,7 @@ StarBASIC::StarBASIC( StarBASIC* p, BOOL bIsDocBasic ) SetParent( p ); pLibInfo = NULL; bNoRtl = bBreak = FALSE; + bVBAEnabled = FALSE; pModules = new SbxArray; if( !GetSbData()->nInst++ ) @@ -782,7 +789,34 @@ SbModule* StarBASIC::MakeModule( const String& rName, const String& rSrc ) SbModule* StarBASIC::MakeModule32( const String& rName, const ::rtl::OUString& rSrc ) { - SbModule* p = new SbModule( rName ); + ModuleInfo mInfo; + mInfo.ModuleType = ModuleType::Normal; + return MakeModule32( rName, mInfo, rSrc ); +} +SbModule* StarBASIC::MakeModule32( const String& rName, const ModuleInfo& mInfo, const rtl::OUString& rSrc ) +{ + + OSL_TRACE("create module %s type mInfo %d", rtl::OUStringToOString( rName, RTL_TEXTENCODING_UTF8 ).getStr(), mInfo.ModuleType ); + SbModule* p = NULL; + switch ( mInfo.ModuleType ) + { + case ModuleType::Document: + // In theory we should be able to create Object modules + // in ordinary basic ( in vba mode thought these are create + // by the application/basic and not by the user ) + p = new SbObjModule( rName, mInfo, isVBAEnabled() ); + break; + case ModuleType::Class: + p = new SbModule( rName, isVBAEnabled() ); + p->SetModuleType( com::sun::star::script::ModuleType::Class ); + break; + case ModuleType::Form: + p = new SbUserFormModule( rName, mInfo, isVBAEnabled() ); + break; + default: + p = new SbModule( rName, isVBAEnabled() ); + + } p->SetSource32( rSrc ); p->SetParent( this ); pModules->Insert( p, pModules->Count() ); @@ -958,6 +992,12 @@ SbxVariable* StarBASIC::Find( const String& rName, SbxClassType t ) } pNamed = p; } + // Only variables qualified by the Module Name e.g. Sheet1.foo + // should work for Documant && Class type Modules + INT32 nType = p->GetModuleType(); + if ( nType == com::sun::star::script::ModuleType::Document || nType == com::sun::star::script::ModuleType::Form ) + continue; + // otherwise check if the element is available // unset GBLSEARCH-Flag (due to Rekursion) USHORT nGblFlag = p->GetFlags() & SBX_GBLSEARCH; |