Impl. priorities:
    + Start tackling test/macro/interaction.
    + Customer documents
        + The 'Like' Operator seems quite popular, see Excels help for a fairly full-on detailed spec as to what it should do. In generaly though people seem to use it in a fairly simple regular-expression sorta way ( and thats what we should start with )

	    * basic/source/comp/token.cxx ( add Like definition to token table, the enum already exists )

            * basic/source/comp/exprnode.cxx
                SbiExprNode::FoldConstant() needs to be adjusted to handle the constant case, so a common like function needs to be available to both the compile and runtime stages to provide the functionality

            * basic/source/runtime/step0 we already have a StepLIKE stub, it needs to operate similar to the other operator code ( look at StepEQ, StepNE etc. ) seems all thats necessary is to pop the two items required off the stack

TODO (thinking):
    + TOREAD:
	+ extensions/source/ole/*
    	+ extensions/test/ole/OleClient/clientTest.cxx#507
		+ Property with argument - a nice key ...

    + More elegant hooks
	+ we should prolly hook through the XHierarchicalNameAccess
	  service 'theCoreReflection', cf. sbunoobj.cxx /SbUnoFactory/
	  sb.cxx /AddFactory/ 

    + Some references to '[]' syntax that still aren't fully understood ( see NonProblems 'Page 96; ' )
			 ./sbx/sbxexec.cxx:116:  if( *p == '[' )
			 ./sbx/sbxexec.cxx:152:  if( aCharClass.isAlpha( *p ) || *p == '_' || *p == '[' )
			 ./sbx/sbxexec.cxx:410:          if( *p++ != '[' )
				+ interesting 'Element'->Symbol->QualifiedName etc.
	+ Although simple shortcut range reference notation is supported other functionality offered by 'Evaluate' still missing. Need to look in sc to see if some reuse is possible in the code that handles/evaluates what you type into a Cell. see sc/source/core/interp* ?

		

    + Examine other special-cased interfaces:
	+ classes/propacc.cxx:129: Reference< XPropertySetInfo > etc.
	+ other instances of 'SbUnoObject' etc.

    + Improve hooks into StarBASIC
	not using 'ThisComponent' anymore =>
	    can remove that & use something more native ?

    + Events
    	+ Form-Controls
	    + some verification needed on some of the event params e.g. 
	        Object_KeyUp, Object_Key[Up | Down]  the value of KeyCode needs to be checked in VBA and OO to see if they corrolate
	    + Some events appear to need changes in the controls themselves
	        Object_Change ( for scroll its supported ) however afaik this is a generic event that is fired whenever the 'Value' of a control changes, there does not seem to be full support for this in OO
	        Object_DropButton, seems like there is no similar event in OO, again some changes to the control ( or control model ) would seem to be necessary	
	        Object_BeforeDropOrPaste ditto
	        Object_BeforeDragOver not sure if this is equiv to OO's mouse dragged, careful examination of the behavior needed.
        + UserForm-Controls ( OO Dialog controls )
    	    + code to catch capture the events and fire user defined VBA-like event handler functions is present in ( basic-source-classes-eventatt-cxx.diff ) this patch file is not enabled in apply as yet no testing done on this, it assumes that the translations for form-controls are also valid for the equiv. userform-controls. That assumption has not been tested. 

New Problems/Funnies Needs attention
====================================

* comparing a blank string ( temp var ) e.g. if Range("A2") = " " results in false if the cell actually contains a string " "

* handling of logical values in calc, no concept of true/false just the associated calc function e.g. { TRUE(), FALSE() }, additionally when interoperating with BASIC ( which has a built in boolean type ) problems occur ( In basic True is the result of and expression that evaluates to -1 ) Of course the problem is further compounded when you copy a cell that contains TRUE or FALSE ( only the intrinsic value is copied i.e. 0 or 1 ) a control associated with a cell ( linked cell ) sets the value to TRUE/FALSE ( which is always evaluated to the numeric value from the api )
	+ should be able to detect whether a cell contains a logical type via the formatting of the cell.... but when copying this formatting should be preserved. Calc really should have its own built in Boolean type ( should not be impossible to achieve ) need to open bug about this

* using Ranges.EntireColumn or Range.EntireRow and trying to pass the resulting
range into a worksheet fnction ( that accepts ranges ) e.g. COUNTA it thows an error ( a patch is forthcoming ) the code seems to be confused about MAXROWS and MAXROWCOUNT

* NonProblems:
===============

    + 'For Each wbk in Workbooks' vs. Application.Workbooks.Index(n)
	+ We have to export the 'XEnumerationAccess' interface to let
	  StarBasic iterate over the items ...
    + Arguments issue
	+ 99% solved with the 'compatibility' mode turned on
	    + not combat/coding complete: some Anys are
	      not optional.
    + Named arguments work well:
	+ We need to get the argument names right in the IDL though
    + polymorphic constructor story
	+ Range("A1:B2"), Range(Cell(1,1), Cell(3,5));
	+ Range just takes 2 Variants
	    + interestingly 1 is optional, 1 is not.
    + ActiveWorkbook.Close <- really a 3 argument method
    + collection objects; Worksheets, Workbooks etc. ( mostly implemented see sc/source/ui/vba/[vbaworkbooks.cxx | vbaworksheets.cxx ] 
    + create an object/declaration story:
	+ Dim a As Range
	+ FIXME: need to read up on how namespaces are
	  handled, wrt. Dim A as com.sun.star.sheet.Worksheet
	  etc. - possibly we can just do some 'Globals' magic
	  here.
	Note: this is handled by patches in patches/vba/vba-dim-and-constants-patch.diff see method ( checkUnoObjectType() defined in sbunoobj.cxx ) the namespace org.openoffice.vba is appended automatically and a sanity check to see if object implements the defined interface performed. The sanity check changes the uno type from Something to XSomething e.g. Dim a as Range will result in a queryInterface for 'org.openoffice.vba.XRange'

    + 'WorkSheets("sheet1")' 
	+ Now handled in vba-basic-collection.diff ( handled in CheckArray() 
function ( source/runtime/step2.cxx ) look for XCollection. So, any uno object
implementing XCollection if used with Object(something) syntax will result
in the Item ( XCollection ) method getting called with "something" as a 
parameter.
 
    + Examine other special-cased interfaces:
	+ runtime/step2.cxx:477: Reference< XIndexAccess > ... see above for
'WorkSheets("sheet1")' for an explanation
	+ runtime/runtime.cxx:1046: Reference< XEnumerationAccess > this is 
handling for 'foreach' syntax, an object that implements this interface can
be used in a foreach loop.

    + Page 96: 'Excel 2000 VBA'
	+ It is legal to have '[A1]' which evaluates to a 'Range'
	  via the 'Evaluate' method of 'Application'.
	+ '[]' is a special delimiter in ooo-basic to enclose variable names that contain spaces. source/comp/scanner.cxx ( circa. line 440 ) & basic/source/runtime/step2.cxx ( findElement() circa line 106 ) have been modified ( via vba-evaluate-support.diff ) to capture this syntax. Control is delegated to either ScVbaApplication::Evaluate() or ScVbaWorkSheet::Evaluate()

* Error Handling Comparison

two types of errors, these are displayed ( in msgbox ) from

sb.cxx 

StarBASIC::CError

and 

StarBASIC::RTError

the error code ( SbError ) is afaik actually a resource id, convertions to/from a human readable error code are achieved via

StarBASIC::GetSfxFromVBError & StarBASIC::GetVBErrorCode

the current error message can be retrieved via the Error RTL function 
the message associated with and error number can also be retrieved via the same function


Error setting seems quite ( unecessarily ) complex, there is both a SbIntstance::nErr and SbiRuntime::nError it appears though that SbiInstance::nErr is the "real" error ( see StarBASIC::GetErrBasic() ) but the setting seems only to be done in the middle of the Step routine in a nasty piece of logic. 

Behaviour

vba has a global error object, that object contains lots of pieces of info and the error info is persisted and isn't cleared unless the macro explicitly requests that either
   a) via On Error or Resume  statements
   b) Err.clear

starbasic has a global error number
errors are cleared if we use on error resume next ( eg. error is always cleared )

therefore, implementing ( doing so right now ) a compatible error object that
can be resolved when in Compatibility mode would seem to solve most of the problems here. Key abilities are
    + align the error persistence/clearing symantics of basic
    + allow user defined errors to be raised
* 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

    + Should we just hook off the global / ThisComponent object ?
      and slave to that ? (slower?)
    + mybasic.cxx Insert( (SbxObject*)xSbUnoObj ) - global ?
	    + sb.cxx ?

    + 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) ?

* Object model
    + we need to expose these things as Objects in the full sense,
    + or - at least, expose a load of 'typedef Range Object'
      type things - everything constructed via a factory anyway (!?)

--------------------------------------------------------------------------------------------
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) ?


Collection Support in basic

./source/classes/sb.cxx contains a factory for creating BasicCollection ( name Collection ) 

interesting bits

* basic/source/sample this contains some new definition for a custom 
Sample object [?] looks like you need to hack mybasic.cxx to get this working 
(so it says in the comments anyway ) but hacking sb.cxx would probably do the same 

   ** NOTE: come back to this, could be interesting.

BasicCollection has a factory entry in source/classes/sb.cxx:298 
        if( rClass.EqualsIgnoreCaseAscii( "Collection" ) )
        {
                String aCollectionName( RTL_CONSTASCII_USTRINGPARAM("Collection") );
                return new BasicCollection( aCollectionName );
        }

so a "Dim coll as Collection" should work

BasicCollection ( defined source/inc/sbunoobj.hxx, implemented in source/classes/sb.cxx )


usage standalone - the following works 

Sub Main
Dim coll as new Collection
coll.Add( Workbooks.Item(0) )
for each Item in coll 
    msgbox ( "name is " + item.name )
next Item
end sub


also interestingly something like
msgbox ( "name is " + coll(1).Name  also works :-)


Some Notes on Broadcast/Notify
==============================

At the heart of ooo-basic is the Broadcast/notification mechanism, this is used as a generic way to call methods of an object (sorta poor mans DII). Generally this is used as a way to delay ( or lazy initialize objects )

In general a SbxVariable is an object that needs a Broadcast in order for it
to have data available to it.

To facilitate this a SbxVariable has a SfxBroadcaster member "pCst".

In ooo-basic nearly every variable used in the runtime has been generated/returned a result of a Find method ( on a parent object or on the basic instance (StarBASIC) itself ). These variables are always SbxVariables. 

looking at the inheritance hierarchy:

SvRefBase<-SbxBase<-SbxValue<-SbxVariable
SbxVariable<-SbxMethod<-SbUnoMethod
SfxListener<-SbxVariable<-SbxObject
SbxObject<-SbUnoObject

All of uno methods & properties calls are handled by the SFX_NOTIFY method of the parent SbUnoObject.  Its not immediately obvious how a broadcast on an SbxVariable ( for example for a method ) can call the SFX_NOTIFY method of the SbUnoObject, there seems initially no relationship between the SbUnoMethod object and the SbUnoObject. There is in fact a relationship and it is setup as part of a Find call on the parent (SbUnoObject) object, this ends up calling SbxObject::QuickInsert() source/sbx/sbxobj.cxx:560 where it adds itself ( the parent object ) as a listener ( for broadcasts ) from the SbxVariable ( the method/property ) it inserts into itself.

How does the value of the SbxVariable change say for a property?
when the 'Broadcast' is called on SbxVariable it creats an SbxHint 
+ source/sbx/sbxvar.cxx
    pSave->Broadcast( SbxHint( nHintId, this ) );
passing itself ;-)

the corrosponding Notify ( SbUnoObject::SFX_NOTIFY ) extracts that via 
+ source/classes/sbunoobj.cxx:
    SbxVariable* pVar = pHint->GetVar();
and equates pVar to the result of whatever operation occurs ( e.g. result of a method call )


NOTE: Another interesting side-affect ( and  intentional ) is that if a copy is made of a SbxVariable ( say for a property ) then subsequent broadcasts ( for example SBX_HINT_DATACHANGED ) do not call notify on the parent object because when the SbxVariable is copied the broadcaster ( pCst ) is NULLED. This means that in the case of a property any assignments made do not result in an uno call, the sbxVariable ( SbUnoProperty ) values is modified locally only.



------------------------------
Forms control event handling: 
------------------------------

Events for form-controls and possibly for Dialogs ( UserForms ) are handled by the new service "org.openoffice.vba.VBAToOOEventDesc". This service is implemented in scripting/source/vbaevents/eventhelper.cxx ( from patches/vba/vbaevents-services-sources.diff ). In VBA events for form-controls are handled by vba eventhanldler functions defined by the user that satisfy a specific naming convention e.g. 'Private Sub object_KeyPress( ByVal KeyANSI As MSForms.ReturnInteger)' where object is the name of the control e.g. CommandButton1 which handles a KeyPress event on a control named 'CommandButton1'. ( for some more info on this have a look in events.txt in this dir, this file contains some info the VBA event handling functions ( params etc. ) & also some info on the equivulant OO ScriptEvents )

In OO, macro/event bindings for a formcontrol are specified via an XEventAttacherManager (for Form Controls ) or an XEventSupplier (for Dialogs/UserForms). Usually in OO these event/macro bindings are set up using the control property editor. The handling code for managing bindings defined is truely hideous and can be seen in extensions/source/propctrlr/formcontroller.cxx OPropertyBrowserController::ChangeEventProperty() method. For form controls the same EventAttacherManager is used to set up VBA-like bindings for the form control.

	fmctrler.cxx:1626 FormControlVBAHandler handler( m_xModelAsManager, xControl );
	fmctrler.cxx:1627 handler.createEventBindings(nPos);

the createEventBindings() method creates custom bindings for the control. The createEventBindings() method calls getEventDescriptions(const Reference< awt::XControl >& xControl ) ( part of the "org.openoffice.vba.VBAToOOEventDesc" service defined in scripting/source/vbaevents/eventhelper.cxx ) which returns Sequence< ScriptEventDescriptor > for the xControl thas is passed to the method. Each ScriptDescriptor in the sequence is defined to intercept a particular OOO event ( for more info see api ref doc for com/sun/star/script/ScriptEventDescriptor ). Complementing the createEvents is a special listener "org.openoffice.vba.EventListener" which can be registered for those events, the listener receives ScriptEvents ( OO events ) and tries to call the appropriate VBA-like handler ( if it exists ), it does all of the transformation of paramaters to be passed to the function etc. 

These bindings are not persisted and do not appear in the controls property-editor. Display and persistence is suppressed in extensions/source/propctrlr/formcontroller.cxx ( see logic tests for VBAInterop ) they exist in addition to any bindings made using the property editor.

The bindings are tagged with a specific type "VBAInterop" which flags them to be processed by a special handler ( additionally also allows them to be supressed in the property editor).

A custom script listener is created to handle the form control events of type "VBAInterop", the source code for the listener is in svx/source/form/fmundo.cxx:178. It is registered at svx/source/form/fmundo.cxx:882 This custom listener delegates to a special listener service "org.openoffice.vba.EventListener" again implemented in scripting/source/vbaevents/eventhelper.cxx 

---------------------------------
UserForms control event handling: 
---------------------------------

It is possible to reuse the services "org.openoffice.vba.EventListener" &  "org.openoffice.vba.VBAToOOEventDesc" the patch-file "basic-source-classes-eventatt-cxx.diff" contains code to enable that. It works slightly differently than code
for forms-controls. Dialogs use an XEventSupplier instead of an XEventAttacherManager ( an XEventSupplier for a control can be obtained from the 'getEventSupplier()' method of the "org.openoffice.vba.VBAToOOEventDesc" service. Assumptions are that the VBA-like function names and params are the same as those for the equivelant FormControls ( if thats not the case then eventhelper.cxx will have to handle that, the uno-interfaces won't need to change ).
 
---------------------------------------------

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.


A trace of the sb macro in execution [executed from ide with a breakpoint]:

#4  0x417057f4 in poll () from /lib/tls/libc.so.6
#5  0x422ec558 in g_main_context_iterate () from /opt/gnome/lib/libglib-2.0.so.0
#6  0x422ec6c3 in g_main_context_iteration () from /opt/gnome/lib/libglib-2.0.so.0
#7  0x41eb0b5e in GtkXLib::Yield () from ./libvclplug_gtk680li.so
#8  0x423bc4ef in X11SalInstance::Yield () from ./libvclplug_gen680li.so
#9  0x40174eb4 in Application::Yield () from ./libvcl680li.so
#10 0x4a10a263 in ModulWindow::BasicBreakHdl () from ./libbasctl680li.so
#11 0x4a1045ca in BasicIDEShell::CallBasicBreakHdl () from ./libbasctl680li.so
#12 0x4a130f40 in BasicIDEData::GlobalBasicBreakHdl () from ./libbasctl680li.so
#13 0x4a130de8 in BasicIDEData::LinkStubGlobalBasicBreakHdl () from ./libbasctl680li.so
#14 0x450ebd11 in StarBASIC::BreakPoint () from ./libsb680li.so
#15 0x45131322 in SbiRuntime::StepSTMNT () from ./libsb680li.so
#16 0x45128bca in SbiRuntime::Step () from ./libsb680li.so
#17 0x450f10ba in SbModule::Run () from ./libsb680li.so
#18 0x450f06cf in SbModule::Notify () from ./libsb680li.so
#19 0x4050b313 in SfxBroadcaster::Broadcast () from ./libsvl680li.so
#20 0x450f3d94 in SbMethod::Broadcast () from ./libsb680li.so
#21 0x40900b70 in SbxValue::Get () from ./libsvt680li.so
#22 0x4a121970 in BasicIDE::RunMethod () from ./libbasctl680li.so
#23 0x4a108833 in ModulWindow::BasicExecute () from ./libbasctl680li.so
#24 0x4a1088f2 in ModulWindow::BasicRun () from ./libbasctl680li.so
#25 0x4a10aed5 in ModulWindow::ExecuteCommand () from ./libbasctl680li.so
#26 0x4a105f72 in BasicIDEShell::ExecuteBasic () from ./libbasctl680li.so
#27 0x4a0fc122 in SfxStubBasicIDEShellExecuteBasic () from ./libbasctl680li.so
#28 0x44e98f93 in SfxDispatcher::Call_Impl () from ./libsfx680li.so
#29 0x44e9b7f9 in SfxDispatcher::PostMsgHandler () from ./libsfx680li.so
#30 0x44e9b70e in SfxDispatcher::LinkStubPostMsgHandler () from ./libsfx680li.so
#31 0x44ec103e in SfxHintPoster::Event () from ./libsfx680li.so
#32 0x44ec0fe9 in SfxHintPoster::LinkStubDoEvent_Impl () from ./libsfx680li.so
#33 0x40352bd8 in ImplHandleUserEvent () from ./libvcl680li.so
#34 0x403536f9 in ImplWindowFrameProc () from ./libvcl680li.so
#35 0x423b7ff9 in SalDisplay::DispatchInternalEvent () from ./libvclplug_gen680li.so
#36 0x41eb09ce in GtkXLib::userEventFn () from ./libvclplug_gtk680li.so
#37 0x422e8221 in g_idle_dispatch () from /opt/gnome/lib/libglib-2.0.so.0
#38 0x422e9e87 in g_main_context_dispatch () from /opt/gnome/lib/libglib-2.0.so.0
#39 0x422ec5c7 in g_main_context_iterate () from /opt/gnome/lib/libglib-2.0.so.0
#40 0x422ec6c3 in g_main_context_iteration () from /opt/gnome/lib/libglib-2.0.so.0
#41 0x41eb0b5e in GtkXLib::Yield () from ./libvclplug_gtk680li.so
#42 0x423bc4ef in X11SalInstance::Yield () from ./libvclplug_gen680li.so
#43 0x40174eb4 in Application::Yield () from ./libvcl680li.so
#44 0x40174dcb in Application::Execute () from ./libvcl680li.so
#45 0x0806f505 in desktop::Desktop::Main ()
#46 0x4017a973 in SVMain () from ./libvcl680li.so
#47 0x08068cdd in sal_main ()
#48 0x08068c8c in main ()


basctl\source\basicide\baside2.cxx
	+ handles the ide operations - compile-run-etc
	+ModulWindow::BasicExecute()

basctl\source\basicide\basobj3.cxx
	+BasicIDE::CreateMacro
	+BasicIDE::RunMethod
		and several other methods

basic\source\classes\sbxmod.cxx
	+SbModule is handled here
	+SbModule::Run
		+Implements a BASIC subroutine
	+SimpleTokenizer_Impl::setKeyWords
	+class SbMethod

sfx2/source/appl/appuno.cxx
	+loadMacro

basic/source/classes/sbunoobj.cxx
	+SbUnoObject
	+SbUnoFactory::CreateObject

sfx2/source/appl/appbas.cxx
	+SfxApplication::EnterBasicCall
	+GetBasic

basmgr.cxx
	+GetLib, StoreLib etc.

sfx2/source/notify/eventsupplier.cxx
	+SfxEvents_Impl::BlowUpMacro

basic/source/classes/eventatt.cxx
	+getModelFromBasic


-------------------
#5  0x4514d91d in SbUnoObject (this=0x48d81800, aName=@0xbfffa1a0,
    aUnoObj_=@0xbfffa210)
    at /home/mnicel/ooo-build-head/ooo-build/build/src680-m90/basic/source/class es/sbunoobj.cxx:2071
#6  0x451518fe in GetSbUnoObject (aName=@0xbfffa1a0, aUnoObj_=@0xbfffa210)
    at /home/mnicel/ooo-build-head/ooo-build/build/src680-m90/basic/source/class es/sbunoobj.cxx:2654
#7  0x44d69020 in SfxApplication::GetBasicManager (this=0x449b3870)
    at /home/mnicel/ooo-build-head/ooo-build/build/src680-m90/sfx2/source/appl/a ppbas.cxx:648
#8  0x44d69db5 in SfxApplication::GetBasic (this=0x449b3870)
    at /home/mnicel/ooo-build-head/ooo-build/build/src680-m90/sfx2/source/appl/a ppbas.cxx:731
#9  0x44d69e24 in SfxApplication::EnterBasicCall (this=0x449b3870)
    at /home/mnicel/ooo-build-head/ooo-build/build/src680-m90/sfx2/source/appl/a ppbas.cxx:753
#10 0x4820b742 in SvxImportMSVBasic::ImportCode_Impl () from ./libsvx680li.so
#11 0x4820a5a4 in SvxImportMSVBasic::Import () from ./libsvx680li.so
#12 0x4737bf74 in ImportExcel8::ReadBasic () from ./libsc680li.so
#13 0x47391a5b in ImportExcel8::Read () from ./libsc680li.so
#14 0x473704d7 in ScImportExcel () from ./libsc680li.so
#15 0x46ed3aa9 in ScDocShell::ConvertFrom () from ./libsc680li.so
#16 0x44e0ce46 in SfxObjectShell::DoLoad () at _hash_map.h:181
#17 0x44e56bda in SfxBaseModel::load () at _hashtable.h:151
#18 0x44e882f4 in SfxFrameLoader_Impl::load () at window.hxx:790
#19 0x453ead51 in framework::LoadEnv::impl_loadContent () from ./libfwk680li.so
#20 0x453e77ef in framework::LoadEnv::startLoading () from ./libfwk680li.so
#21 0x452c9c43 in framework::LoadDispatcher::dispatchWithNotification ()
   from ./libfwk680li.so
#22 0x452c9f74 in framework::LoadDispatcher::dispatch () from ./libfwk680li.so
#23 0x4547cd33 in framework::RecentFilesMenuController::ExecuteHdl_Impl ()
   from ./libfwk680li.so
#24 0x40352bd8 in ImplHandleUserEvent () from ./libvcl680li.so
#25 0x403536f9 in ImplWindowFrameProc () from ./libvcl680li.so
#26 0x423b7ff9 in SalDisplay::DispatchInternalEvent ()
   from ./libvclplug_gen680li.so
#27 0x41eb09ce in GtkXLib::userEventFn () from ./libvclplug_gtk680li.so
#28 0x422e8221 in g_idle_dispatch () from /opt/gnome/lib/libglib-2.0.so.0
#29 0x422e9e87 in g_main_context_dispatch ()
   from /opt/gnome/lib/libglib-2.0.so.0
#30 0x422ec5c7 in g_main_context_iterate ()
   from /opt/gnome/lib/libglib-2.0.so.0
#31 0x422ec6c3 in g_main_context_iteration ()
   from /opt/gnome/lib/libglib-2.0.so.0
#32 0x41eb0b5e in GtkXLib::Yield () from ./libvclplug_gtk680li.so
#33 0x423bc4ef in X11SalInstance::Yield () from ./libvclplug_gen680li.so
#34 0x40174eb4 in Application::Yield () from ./libvcl680li.so
#35 0x40174dcb in Application::Execute () from ./libvcl680li.so
#36 0x0806f505 in desktop::Desktop::Main ()
#37 0x4017a973 in SVMain () from ./libvcl680li.so
#38 0x08068cdd in sal_main ()
#39 0x08068c8c in main ()


---------------
sbxmod.cxx
	+SbModule::Find()
macrconf.cxx
	+SfxMacroConfig::Call
	+SfxQueryMacro
		gets the method
	+SfxQueryMacro_Impl

---------------
On executing a macro like this:

Sub Main
	Dim URLStr as String
	GlobalScope.BasicLibraries.LoadLibrary("Tools")
	URLStr = ThisComponent.getURL()
	msgbox FileNameOutOfPath(URLStr)
End Sub

sbunoobj.cxx/SbUnoObject::Find has the aUName values

as loadLibrary and getURL !?

---------------
trace when stopped in SbUnoObject::Find

#5  0x451673f3 in SbUnoObject::Find (this=0x489aa358, rName=@0xbfffda90, t=SbxCLASS_DONTCARE)
    at /home/mnicel/ooo-build-head/ooo-build/build/src680-m90/basic/source/classes/sbunoobj.cxx:2370
#6  0x4519fe86 in SbiRuntime::FindElement (this=0x5704caa8, pObj=0x489aa358, nOp1=32783, nOp2=12, nNotFound=87570,
    bLocal=0 '\0') at /home/mnicel/ooo-build-head/ooo-build/build/src680-m90/basic/source/runtime/step2.cxx:106
#7  0x451a1a2e in SbiRuntime::StepELEM (this=0x5704caa8, nOp1=32783, nOp2=12)
    at /home/mnicel/ooo-build-head/ooo-build/build/src680-m90/basic/source/runtime/step2.cxx:592
#8  0x45198e62 in SbiRuntime::Step (this=0x5704caa8)
    at /home/mnicel/ooo-build-head/ooo-build/build/src680-m90/basic/source/runtime/runtime.cxx:694
#9  0x45154041 in SbModule::Run (this=0x48976df8, pMeth=0x57048a68)
    at /home/mnicel/ooo-build-head/ooo-build/build/src680-m90/basic/source/classes/sbxmod.cxx:777
#10 0x451534b3 in SbModule::Notify (this=0x48976df8, rBC=@0x48971000, rHint=@0xbfffdd10)
    at /home/mnicel/ooo-build-head/ooo-build/build/src680-m90/basic/source/classes/sbxmod.cxx:524
#11 0x4050b313 in SfxBroadcaster::Broadcast () from ./libsvl680li.so
#12 0x45157852 in SbMethod::Broadcast (this=0x4895eed0, nHintId=65536)
    at /home/mnicel/ooo-build-head/ooo-build/build/src680-m90/basic/source/classes/sbxmod.cxx:1984
#13 0x40900b70 in SbxValue::Get () from ./libsvt680li.so
#14 0x4515762d in SbMethod::Call (this=0x4895eed0, pRet=0x570498a0)
    at /home/mnicel/ooo-build-head/ooo-build/build/src680-m90/basic/source/classes/sbxmod.cxx:1938
#15 0x56da6455 in basprov::BasicScriptImpl::invoke () from ./basprov680li.uno.so
#16 0x44e04a3b in SfxObjectShell::CallXScript (this=0x484b1120, rScriptURL=@0xbfffe2e0, aParams=@0xbfffe2d0,
    aRet=@0xbfffe310, aOutParamIndex=@0xbfffe2f0, aOutParam=@0xbfffe320)
    at /home/mnicel/ooo-build-head/ooo-build/build/src680-m90/sfx2/source/doc/objmisc.cxx:1439
#17 0x44d5fdb2 in SfxApplication::OfaExec_Impl (this=0x44667880, rReq=@0xbfffe5b0)
    at /home/mnicel/ooo-build-head/ooo-build/build/src680-m90/sfx2/source/appl/appserv.cxx:1034
#18 0x44d53478 in SfxStubSfxApplicationOfaExec_Impl () at resid.hxx:116
#19 0x44ec7013 in SfxDispatcher::Call_Impl () at solar.h:293
#20 0x44ec8194 in SfxDispatcher::_Execute () at solar.h:293
#21 0x44ed7300 in SfxBindings::Execute_Impl () at solar.h:293
#22 0x44ec045d in SfxDispatchController_Impl::dispatch () at solar.h:293
#23 0x44ebe6e9 in SfxOfficeDispatch::dispatch () at solar.h:293
#24 0x453b67aa in framework::MenuBarManager::Select () from ./libfwk680li.so
#25 0x453b5f00 in framework::MenuBarManager::LinkStubSelect () from ./libfwk680li.so
#26 0x402f53b1 in Menu::Select () from ./libvcl680li.so
#27 0x402f9384 in Menu::ImplCallSelect () from ./libvcl680li.so
#28 0x402f9366 in Menu::LinkStubImplCallSelect () from ./libvcl680li.so
#29 0x40352bd8 in ImplHandleUserEvent () from ./libvcl680li.so
#30 0x403536f9 in ImplWindowFrameProc () from ./libvcl680li.so
#31 0x423b7ff9 in SalDisplay::DispatchInternalEvent () from ./libvclplug_gen680li.so
#32 0x41eb09ce in GtkXLib::userEventFn () from ./libvclplug_gtk680li.so
#33 0x422e8221 in g_idle_dispatch () from /opt/gnome/lib/libglib-2.0.so.0
#34 0x422e9e87 in g_main_context_dispatch () from /opt/gnome/lib/libglib-2.0.so.0
#35 0x422ec5c7 in g_main_context_iterate () from /opt/gnome/lib/libglib-2.0.so.0
#36 0x422ec6c3 in g_main_context_iteration () from /opt/gnome/lib/libglib-2.0.so.0
#37 0x41eb0b5e in GtkXLib::Yield () from ./libvclplug_gtk680li.so
#38 0x423bc4ef in X11SalInstance::Yield () from ./libvclplug_gen680li.so
#39 0x40174eb4 in Application::Yield () from ./libvcl680li.so
#40 0x40174dcb in Application::Execute () from ./libvcl680li.so
#41 0x0806f505 in desktop::Desktop::Main ()
#42 0x4017a973 in SVMain () from ./libvcl680li.so
#43 0x08068cdd in sal_main ()
#44 0x08068c8c in main ()
-------------------------------------------------

Defining the interface and generating the code.

XWorkBook.idl
	-interface for WorkBook

	-under offapi/org/openoffice/vba/

generating source code. (manual invokation; yet to integrate with make)

idlc -C -I <path to solver/680/unxlngi4.pro/idl> XWorkBook.idl

>> that generates XWorkBook.urd

then, creating registry database,

regmerge vba.rdb /UCR XWorkBook.urd

>> should /UCR be used or something else? /UCR is the default key for type descriptions

cppumaker -BUCR -Torg.openoffice.vba.XWorkBook vba.rdb

>>generates XWorkBook.hdl and XWorkBook.hpp under org/openoffice/vba/ -- with the make integration this should go into unxlngpro4/ ??

[gave an error saying: cppumaker ERROR: cannot dump Type 'com/sun/star/uno/RuntimeException' ??]

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

Generating with makefiles:

- Have the .idl files under offapi/org/openoffice/vba

- create, offapi/org/openoffice/vba/makefile.mk

	- specify the idl files in there, and define PACKAGE as org/openoffice/vba

- update offapi/prj/d.lst to deliver the .idl files

- update offapi/util/makefile.mk

	-to create vba.db, the unoidl db of type UCR

- update offuh/prj/d.lst

	-to deliver the .hdl and .hpp created out of the .rdb from offapi

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

basic/ notes:

    Incoming byte stream into ->
	basic/source/comp/token.cxx
    split into tokens; eg. 'EQ' -> ( cf. token.hxx (SbiToken) )
        basic/source/comp/parser.cxx
    compiled into expressions, eg. SbiParser::Symbol,
    '_PUT', or '_SET' -> and whacked on a byte-stack
	basic/source/runtime/runtime.cxx
    executed as a byte-code: ->
	basic/source/runtime/step0.cxx
    eg. StepPUT() / StepSET()

    parser.cxx:
	+ SbiParser
	    + inherits from Tokenizer
		+ simple peek/next stream of tokens.
	    + stores macro-level-details:
		+ SbiParseStack *pStack - block stack
		+ SbiProcDef *pProc - proceedure
		+ SbiExprNode *pWithVar - 'with' var.
		+ ...
		+ SbiCodeGen aGen - byte code generator.
		+ SbiSymPool *pPool - pool of string/symbols
	    + [ is passed everywhere ]
	+ SbiToken
	    - an integer representing an op or a string ... (?)
	    + 'aSym' - the string symbol ...
	+ to read & compile an Expression we do:
	    SbiExpresion aFoo( this, SbFOO );
	    aFoo.Gen(); <-- this does all the work.
		+ calls 'Gen' on the SbiExprNode:: pExpr (exprgen.cxx)
	



---- UNO Interfaces used in basic/ ----

These interfaces look particularly interesting docs from:
com/sun/star/bridge/oleautomation/PropertyPutArgument.idl:

/** contains a value that is used as argument in a &quot;property put&quot
    operation on a Automation object.
    <p>
    If a Automation object is converted into a UNO object by a scripting
    bridge, such as
    <type scope="com::sun::star::bridge::oleautomation">BridgeSupplier</type>,
    then it is accessed through the 
    <type scope="com::sun::star::script">XInvocation</type> interface.
    The methods
    <member scope="com::sun::star::script">XInvocation::setValue</member>
    and
    <member scope="com::sun::star::script">XInvocation::getValue</member>
    are used to access properties which do not have additional
    arguments. To access a property with additional arguments, the
    method
    <member scope="com::sun::star::script">XInvocation::invoke</member>
    has to be used. The method implementation must decide, if the
    property is to be written or read so it can perform the proper
    operation on the Automation object. To make this decision, the
    caller has to provide the information if the current call is
    intended to be a write or read operation. This is done by
    providing either instances of <type>PropertyPutArgument</type> or
    <type>PropertyGetArgument</type> as arguments to
    <member scope="com::sun::star::script">XInvocation::Invoke</member>. 

    @since OOo 1.1.2
*/
com/sun/star/script/XInvocation.idl

 bridge::oleautomation::NamedArgument
 bridge::oleautomation::Date
 bridge::oleautomation::Decimal
 bridge::oleautomation::Currency
 bridge::XBridge 
 bridge::XBridgeFactory
 script::XAllListener 
 i18n::XCalendar 
 XComponent 
 uno::XComponentContext 
 XContainer
 XContainerListener 
 XContentProvider 
 XContentProviderManager 
 XControl
 XControlContainer 
 XControlModel 
 container::XEnumeration 
 container::XEnumerationAccess 
 XEventAttacher 
 XEventListener 
 container::XHierarchicalNameAccess 

 XImplementationRegistration 
 XIndexAccess 
 XInputStream 
 XInputStreamProvider 
 XIntrospection 
 XIntrospectionAccess 
 XInvocation 
 XInvocationAdapterFactory 
 XLibraryContainer 
 XMaterialHolder 
 XMultiComponentFactory
 lang::XMultiServiceFactory 
 XNameAccess 
 XNameContainer 
 XOutputStream 
 XSeekable 
 XServiceInfo 
 XSimpleFileAccess 
 XSimpleRegistry 
 XTypeConverter 
 XTypeDescription 
 XTypeProvider 
 XVetoableChangeListener 
 XWindow 

Interesting:
 XExactName - used for case insensitivity ...

Not likely interfaces:
 reflection::XIdlArray
 reflection::XIdlClass 
 reflection::XIdlField
 reflection::XIdlMethod 
 reflection::XIdlReflection 
 script::XScriptEventsAttacher 
 script::XScriptEventsSupplier 
 script::XScriptListener 
 script::provider::XScriptProvider 
 script::provider::XScriptProviderFactory 
 script::provider::XScriptProviderSupplier 
 script::provider::XScript
 beans::XPropertyAccess 
 beans::XPropertyChangeListener 
 beans::XPropertySet
 beans::XPropertySetInfo 
 XStarBasicAccess 
 XStarBasicDialogInfo 
 XStarBasicLibraryInfo 
 XStarBasicModuleInfo 

Unlikely looking interfaces:
 frame::XModel 
 XStream 
 XTextOutputStream 
 XToolkit
 io::XActiveDataSource 




