summaryrefslogtreecommitdiff
path: root/patches/vba/vba-symbol-searchhack-for-thisworkbook.diff
diff options
context:
space:
mode:
Diffstat (limited to 'patches/vba/vba-symbol-searchhack-for-thisworkbook.diff')
-rw-r--r--patches/vba/vba-symbol-searchhack-for-thisworkbook.diff46
1 files changed, 46 insertions, 0 deletions
diff --git a/patches/vba/vba-symbol-searchhack-for-thisworkbook.diff b/patches/vba/vba-symbol-searchhack-for-thisworkbook.diff
new file mode 100644
index 000000000..acf36d09c
--- /dev/null
+++ b/patches/vba/vba-symbol-searchhack-for-thisworkbook.diff
@@ -0,0 +1,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 )
+ {