Apache OpenOffice (AOO) Bugzilla – Issue 110821
extensions: automation bridge/ooo-basic doesn't understand com default method
Last modified: 2017-05-20 10:22:08 UTC
COM objects can have default members, those members can be properties or methods, already for vba support in basic we have a concept of default members & default properties ( exposed via XDefaultMethod & XDefaultProperty ) this loosely maps to the COM concept of default members ( note: we have a default method to fake use of properties that take parameters which of course is an alien concept for uno ) The automation bridge though cannot tell basic about these default members, the (tobe attached) patch exposes the missing information about the default member to basic. This allow constructs like Sheets(1).Cells(L, 1) = rs.Fields("PartNo#") to work. In the example line above rs is a ADODB.Recordset object ( returned from the automation bridge ) Fields("PartNo#") calls a default member called 'Item' ( the collection iterator method ) with the index "PartNo#" this returns a 'Field' object which has a default 'property' value which is assigned to the Range returned from "Sheets(1).Cells(L, 1)" - I will attach a sample document containing the above example. Naturally when running on windows ( without the patch ) the test document fails miserably, with the patch you should get a message box telling you "looped 9 times" and the cells A1:B9 should contain values like those below A | B ========================= 20090324 073237 | M0103A 20090324 033719 | M0104A 20090324 033733 | M0104A 20090324 033740 | M0104A 20090324 033757 | M0104A 20090324 033757 | M0104A 20090324 033757 | M0104A 20090324 033803 | M0104A 20090324 033810 | M0104A
Created attachment 68891 [details] patch
Created attachment 68892 [details] test doc and test data
.
STARTED, 3.x
The function SAL_CALL IUnknownWrapper_Impl::initialize( must catch the BridgeRuntimeError which may be thrown, for example when calling getTypeInfo. BridgeRuntimeError does not inherit Exception. If ITypeInfo::GetDocumentation returns a string for the default property/function and still there is no VARDESC or FUNCDESC available, then this sound for me that ITypeInfo does not work properly. In this case the functions getDefaultMethodName and getDefaultPropertyName should throw an exception, so that OOo can show a message box indicating that the automation object is broken.
put myself on CC
@jl >The function >SAL_CALL IUnknownWrapper_Impl::initialize [...] >BridgeRuntimeError does not inherit Exception indeed it does not ( and I didn't notice that ) so I think that is a nice catch, thanks !! >In this case the functions getDefaultMethodName and getDefaultPropertyName >should throw an exception. I think I have to disagree a little here ( but only in the implementation ) I think in the case where you do get a String back ITypeInfo::GetDocumentation ( and no VARDESC or FUNCDESC available ) we should just propagate the error from the initialize method ( I don't think it is necessary to involve the XDefaultxxx facet in this at all ) is that ok for you? if so (please let me know) I will regenerate the patch based on the f/b ( but give me a day or so as I am a little busy )
OK.
Created attachment 70184 [details] updated patch
I made the latest patch slightly stricter ( I no longer eat the final Exception in the initialise method ) I hope this isn't too punitive ( COM objects I think can be a bit flacky ) Also I wasn't able to test the patch :-/ ( but then again only a couple of lines were changed )
Created attachment 70185 [details] patch ( with correct mime type )
OOo 3.3, FIXED
Verified in CWS mib17