1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
--- basic.orig/inc/sbmod.hxx 2006-11-10 14:45:23.000000000 +0000
+++ basic//inc/sbmod.hxx 2006-11-14 16:42:41.000000000 +0000
@@ -79,6 +79,7 @@ protected:
SbiImage* pImage; // das Image
SbiBreakpoints* pBreaks; // Breakpoints
SbClassData* pClassData;
+ bool bThisWorkBook; // Should really subclass the module
SB_DLLPRIVATE void StartDefinitions();
SB_DLLPRIVATE SbMethod* GetMethod( const String&, SbxDataType );
--- basic.orig/source/classes/sbxmod.cxx 2006-11-10 14:45:23.000000000 +0000
+++ basic/source/classes/sbxmod.cxx 2006-11-14 17:46:08.000000000 +0000
@@ -80,6 +80,7 @@
#include <stdio.h>
+static const String sThisWorkbook( RTL_CONSTASCII_USTRINGPARAM("ThisWorkbook"));
TYPEINIT1(SbModule,SbxObject)
TYPEINIT1(SbMethod,SbxMethod)
@@ -237,10 +238,13 @@ extern "C" int CDECL compare_strings( co
SbModule::SbModule( const String& rName )
: SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("StarBASICModule") ) ),
- pImage( NULL ), pBreaks( NULL ), pClassData( NULL )
+ pImage( NULL ), pBreaks( NULL ), pClassData( NULL ), bThisWorkBook( false )
{
SetName( rName );
SetFlag( SBX_EXTSEARCH | SBX_GBLSEARCH );
+ if ( rName.EqualsIgnoreCaseAscii( sThisWorkbook ) )
+ bThisWorkBook = true;
+
}
SbModule::~SbModule()
@@ -415,6 +423,10 @@ void SbModule::Clear()
SbxVariable* SbModule::Find( const XubString& rName, SbxClassType t )
{
+ // searching for ThisWorkbook from withing the module ThisWorkbook
+ // will find itself otherwise
+ if ( SbiRuntime ::isVBAEnabled() && bThisWorkBook && rName.EqualsIgnoreCaseAscii( sThisWorkbook ) )
+ return NULL;
SbxVariable* pRes = SbxObject::Find( rName, t );
if( !pRes && pImage )
{
|