Hi Ariel,

after returning from Christmas holiday I've had a look at the problem
in the meantime. Thanks for your helpful test macros.


>   css.container.EnumerableMap is a new-style service, with constructors, and
> AFAIK, new-style service constructors are now (I don't recall since when)
> supported in OOo Basic;

Since OOo 3.2, see http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Basic/Instantiating_UNO_Services#Using_new-style_service_constructors


> AFAIK UNO type is mapped to com.sun.star.reflection.XIdlClass
> http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Basic/Mapping_of_Simple_Types

The idea is correct but a look at the impletation shows that this map-
ping unfortunately only works in one direction. A UNO type coming in-
to Basic is mapped to XIdlClass but not the other way round. This is
wrong of course and I've decided to fix this immediately.


>    Dim aKeyType, aValueType
>    aKeyType = oReflection.getType(aData(0)(0))
>    aValueType = oReflection.getType(aData(0)(1))
>    
>    Dim aMap        
>    aMap = com.sun.star.container.EnumerableMap.create(aKeyType,aValueType)

I see this as minimum solution as it just completes the type/XIdlClass
mapping, but it only works, if the target type is "type" and not if the
target type is "any", because then it cannot be decided if the "any" is
expected to be of type "type" or of type "XIdlClass".


> Then I tried the CreateUnoValue, with no luck...
>
> aArgs(0) = CreateUnoValue("type",aKeyType)

So this also has to be supported to allow the macro programmer to force
type "type" for interfaces working with "any".


Problem: This is not very convenient, as the CoreReflection service
is needed to get XIdlClass. Probably in most cases the macro program-
mer knows in advance which types he wants to use. Each type has a
unique name, so it also makes sense to accept the type name, both in

    CreateUnoValue( "type", <UNO type name> )

as in

    MyUnoObj.MethodWithTypeParameter( <UNO type name> )


So also the following will be supported:

    aLongType = CreateUnoValue( "type", "long" )

or as in our case with fixed target type "type":

    aMap = com.sun.star.container.EnumerableMap.create( "long", "string" )


I think this is more elegant and matches the usual Basic philosophy
trying to perform sensible conversions automatically.

Regards

Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org

Reply via email to