* VBA compatibility thoughts:

    + Basic types
    + Syntactic issues
    + Annoyances
    + Global objects / object model


* Basic types
#    + missing 'Date' type
	
	+ types manipulation:
	+ script/basic/source/classes/sb.cxx
		+ class SbTypeFactory
	+ script/basic/source/classes/sbunoobj.cxx
		+ types conversion
	+ svtools/inc/sbxdef.hxx
		+ defines data types (SbxDataType)
	+ svtools/source/sbx/
		+ sbx types implementation
		+ SbxDATE is a 'Date' type
		+ ./sbxdate.cxx
			+ handles 'Date' type
		+ should we add types here?
		
* Syntactic issues
	+ StarBasic - very global keywords cf. tokenizer
	+ do we tolerate eg. 'Option' as a method
	    + does MS.
    + Investigate operators: ':=' vs. '=' eg.

	+ Syntactic manipulation
	+ script/basic/source/classes/sbxmod.cxx
		+ Keywords list and tokenizer class
	+ script/basic/source/comp/parser.cxx
		+ defines statements functions
		+ implements the parser
		+ should add more statements?
	+ script/basic/source/comp/
		+ implements statements functions
		+ compiler implementation

* Annoyances
    + lots of errors on load cause massive dialog spewage
	+ extremely annoying.

* Global objects / object model

    + VBA has _lots_ of global / implicit objects

    + StarBasic seems to have 1: 'ThisComponent' / 'StarDesktop'
	+ ThisComponent usage / setup:
	    + framework/sfx2/source/appl/appbas.cxx	    x1
	    + framework/sfx2/source/control/macrconf.cxx    x4
	    + framework/sfx2/source/appl/appuno.cxx	    x6
	    + framework/sfx2/source/doc/objxtor.cxx	    x5
	    + framework/sfx2/source/doc/sfxbasemodel.cxx    x4
	    + script/basic/source/classes/eventatt.cxx	    x1
	    + sw/sw/source/ui/wizard/wizgo3.cxx		    x1
	+ StarDesktop usage / setup
		+ framework/sfx2/source/appl/appbas.cxx     x1
		+ framework/sfx2/source/control/macrconf.cxx    x1

    + 'ThisComponent' / 'StarDesktop' manipulation:
	+ appuno.cxx (loadMacro)
	    + push/pop 'ThisComponent'
		       + for load time method emission.
	+ macrconf.cxx (ExecuteMacro)
	    + push/pop 'ThisComponent'
	+ macrconf.cxx (CheckMacro)
		+ checks macros libraries, including 'StarDesktop'
		+ checks for macro errors like NO_METHOD
	+ appbas.cxx (GetBasicManager)
	    + sets global variables - library bits etc.
	      including 'ThisComponent' & 'Desktop'
		pBas->Insert(unoObj)
		(StarBASIC *pBas: pImp->pBasicMgr->GetLib(0))
	+ objxtor.cxx (InitBasicManager_Impl)
	    + create BasicManager, init 'ThisComponent'
		+ very similar to (GetBasicManager!?)
	+ objxtor.cxx (SfxObjectShell:SetWorkingDocument)
	    + sets ThisComponent nasty global variable
	    + GetWorkingDocument returns it ...
	+ sfxbasemodel.cxx (dispose)
	    + unsets global 'ThisComponent' if it is us.
	+ script/basic/source/classes/eventatt.cxx
	    + missing in OOO_1_1_1
	+ sw/sw/source/ui/wizard/wizgo3.cxx
	    + auto-creates a macro used in 


	+ Should be able to do all this off
	  the 'ThisComponent' (surely?)
	+ Global objects
	    + Selection
	    + ActiveCell
	    + WorksheetFunction.<ws fns>
	+ Global functions
	    + Range("")

	+ StarBasic Global function and property manipulation
	+ script/basic/source/runtime/stdobj.cxx
		+ defines globals functions and properties
		+ add here new global functions ?
		+ should add here Range("") function ?
	+ script/basic/source/runtime/props.cxx
		+ implements globals properties
	+ script/basic/source/runtime/methods.cxx
		+ implements most of globals functions
	+ script/basic/source/runtime/methods1.cxx
		+ implements remaining globals functions 
		
	+ svtools/inc/sbxobj.hxx, sbxvar.hxx
	    + interestingly SbxValue has a Date type. **
	    + SbxVariable has a 'Get/Set' UserData
	      method pair [ UINT32 !? ]

	+ Need to pass context through execution - somehow,
	  'This Sheet', 'This Workbook' etc.
		SbxStar::Insert / Remove.
		SbxObjectRef xUnoObj = GetSbUnoObject( DEFINE_CONST_UNICODE("ThisComponent"), aAny );
	+ Do this in interpr4.cxx (ScMacro) ?


	+ More dynamic than the 'GetBasicManager' scope.


	+ Can we have an 'VBA Interfaces' interface on
	  'ThisComponent' ? or grab it from the
	  basic Model (?)



    + We need to provide new (compatible) UNO interfaces
	+ we need to beef up the global/implicit object support

    + On-load global dereference failure case:

	A run-time rather than parse-time problem (thankfully):

#13 0x4356c455 in OfficeApplication::GlobalBasicErrorHdl () from ./libofa645li.so
#14 0x4356c2fc in OfficeApplication::LinkStubGlobalBasicErrorHdl () from ./libofa645li.so
#15 0x4461e05c in StarBASIC::RTError () from ./libsb645li.so
#16 0x4465abb6 in SbiInstance::Abort () from ./libsb645li.so
#17 0x4465be8a in SbiRuntime::Step () from ./libsb645li.so
#18 0x446215df in SbModule::Run () from ./libsb645li.so
#19 0x44620aad in SbModule::Notify () from ./libsb645li.so
#20 0x40410e50 in SfxBroadcaster::Broadcast () from ./libsvl645li.so
#21 0x44626343 in SbMethod::Broadcast () from ./libsb645li.so
#22 0x4074debf in SbxValue::Get () from ./libsvt645li.so
#23 0x44626109 in SbMethod::Call () from ./libsb645li.so
#24 0x443ea77d in SfxMacroConfig::Call () from ./libsfx645li.so
#25 0x4431a2e1 in SfxObjectShell::CallBasic () from ./libsfx645li.so
#26 0x456d96f1 in ScInterpreter::ScMacro () from ./libsc645li.so
#27 0x456dc09b in ScInterpreter::Interpret () from ./libsc645li.so
#28 0x4560758d in ScFormulaCell::Interpret () from ./libsc645li.so
#29 0x456097d0 in ScFormulaCell::GetErrCode () from ./libsc645li.so
#30 0x45679005 in ScCellFormat::GetString () from ./libsc645li.so
#31 0x455dc37c in ScDocument::GetCellScriptType () from ./libsc645li.so
#32 0x455dc4e1 in ScDocument::GetScriptType () from ./libsc645li.so
#33 0x455b71fc in ScColumn::HasEditCells () from ./libsc645li.so
#34 0x455ba81d in ScColumn::GetOptimalHeight () from ./libsc645li.so
#35 0x455e6b5b in ScTable::SetOptimalHeight () from ./libsc645li.so
#36 0x455c7d76 in ScDocument::SetOptimalHeight () from ./libsc645li.so
#37 0x452f22f3 in ScDocShell::AdjustRowHeight () from ./libsc645li.so
#38 0x454b9a2d in ScModelObj::AdjustRowHeight () from ./libsc645li.so
#39 0x4577c9e8 in ImportExcel::AdjustRowHeight () from ./libsc645li.so
#40 0x45774591 in ImportExcel8::Read () from ./libsc645li.so
#41 0x45784135 in ScImportExcel () from ./libsc645li.so
#42 0x452e1aa0 in ScDocShell::ConvertFrom () from ./libsc645li.so
#43 0x4431f81b in SfxObjectShell::DoLoad () from ./libsfx645li.so
#44 0x442a1fa0 in LoadEnvironment_Impl::Load () from ./libsfx645li.so
#45 0x442a38a4 in LoadEnvironment_Impl::LoadDataAvailable () from ./libsfx645li.so
#46 0x442a3a54 in LoadEnvironment_Impl::LoadDataAvailable () from ./libsfx645li.so
#47 0x442a1434 in LoadEnvironment_Impl::Start () from ./libsfx645li.so
#48 0x4437f684 in SfxFrameLoader_Impl::load () from ./libsfx645li.so
#49 0x44ee3656 in framework::BaseDispatcher::implts_loadIt () from ./libfwk645li.so
#50 0x44ee9e3e in framework::BlankDispatcher::dispatch () from ./libfwk645li.so
#51 0x44edf258 in framework::BaseDispatcher::dispatchWithNotification () from ./libfwk645li.so
#52 0x44ef60f8 in framework::Desktop::loadComponentFromURL () from ./libfwk645li.so
#53 0x0807b8ac in desktop::DispatchWatcher::executeDispatchRequests ()
#54 0x08072997 in desktop::OfficeIPCThread::ExecuteCmdLineRequests ()
#55 0x080697ef in desktop::Desktop::OpenClients ()


--------------------------------------------------------------------------------------------
sfx2/source/appl/appbas.cxx 
	+ SfxApplication::GetBasicManager()
		now gets the BasicManager thru GetAppBasicManager()
			[GetSbData()->pAppBasMgr]

basic/source/basmgr/basmgr.cxx
	+ BasicManager class

basic/source/classes/sbintern.cxx
	+ defines SbiGlobals
	    which has:
		-SbiInstance* pInst - all active run time instances
		-SbiFactory* pSbFac - StarBASIC Factory
		-SbUnoFactory*	pUnoFac	- Factory for UN Structs with DIM AS NEW ONE ??
		-SbTypeFactory*	pTypeFac - Factory for user defined types
		-SbClassFactory* pClassFac - Factory for user defined classes 
						(based on class modules)
		-SbOLEFactory* pOLEFac - Factory for OLE types
		-SbModule* pMod - Up-to-date active module
		-SbModule* pCompMod - Up-to-date compiled modules
		-short	nInst - Number of BASICs
		-Link	aErrHdl - global Error-Handler
		-Link	aBreakHdl - globaler Break-Handler
		-SbError nCode - current error code
		-xub_StrLen nLine - current line
		-xub_StrLen nCol1,nCol2 - current columns (of, to)
		-BOOL bCompiler - Flag for compiler error
		-BOOL bGlobalInitErr - With the GlobalInit a compiler error arose
		-BOOL bRunInit - TRUE, if RunInit of the basic is active
		-String aErrMsg - Buffer for GetErrorText()
		-SbLanguageMode	eLanguageMode - Flag for Visual basic Script mode
		-SbErrorStack* pErrStack - Stack for the in the event of an error diminished 										SbiRuntime chain ??
    		-::utl::TransliterationWrapper* pTransliterationWrapper - For StrComp
		-BOOL bBlockCompilerError;
    		-BasicManager* pAppBasMgr;


basic/source/classes/sb.cxx
	+ class StarBASIC
	+ sbClassFactory
	     Factory class to create class objects (type command) ?

---------------------------------------------

Some notes on VBA to SB (StarBasic) [from VbaStartBasicXref.pdf]

Though syntactically equivalent, both VBA and SB are not compatible
becuase of the differences in the Object Model followed.
SB has an object-oriented model where are excel macros are object-like
model and not fully object-oriented. 

a typical mapping eg.

In Excel, to determine the number of rows in the range, one can access the range
property using Range("MyTable").Rows.Count, Range("MyTable") is a named Range.

To determine the same - the number of rows in a range of cells, SB call would 
look like
ThisComponent.CurrentController.ActiveSheet.getCellRangeByName("MyTable").getRows.getCount()

Specific object types like Worksheet, Workbook, Range etc. in addition to Object 
in Excel where only generic Object type available in SB.
set statement is enforced in VBA and SB supports that.

