Apache OpenOffice (AOO) Bugzilla – Issue 75053
Language binding support for service contstructors
Last modified: 2017-05-20 11:31:34 UTC
UNO "new style" service constructors service S: X { ctor([in] T1 a1, ...) raises (E1, E2); }; are currently a thin wrapper around com.sun.star.lang.XMultiComponentFactory.createInstanceWith[ArgumentsAnd]Context, where the Arguments-version internally uses com.sun.star.lang.XInitialization. That has at least two drawbacks: 1 Multiple constructors need to have different argument signatures (this is even enforced in UNOIDL and idlc), so that the service implementation can discriminate the various constructors. 2 XInitialization is called on a completed object, so implementations need to take care of their potentially half-initialized state, which makes them more complex than necessary.
...the idea is to improve this by offering direct support in the UNO language bindings (like mapping UNO service constructors directly to Java class constructors).
Just a note/suggestion about -2- which might be helpful: Omitting the need to implement lang::XInitialization, I have developed a solution in comphelper/servicedecl.hxx some time ago. The factory object maps all IDL ctors (with arguments) to a single C++ ctor(args, context). Together with a type-safe helper to unwrap the arguments (comphelper/unwrapargs.hxx), implementing a service ctor is pretty slim and all init code could be done in the ctor.
set target to 3.x according to http://wiki.services.openoffice.org/wiki/Target_3x
Reset assigne to the default "issues@openoffice.apache.org".