In the LO Basic code below, I dimension a variable called objDocBuilder
and then use it to instantiate an object of the type com.sun.star.xml.dom.DocumentBuilder
.
'Declarations
Dim objDocBuilder As Variant
[...]
'Create the UNO service and get it into the object variable
objDocBuilder=CreateUnoService("com.sun.star.xml.dom.DocumentBuilder")
I can confirm that the precise object type is com.sun.star.xml.dom.DocumentBuilder
by creating a watch (1) for the variable objDocBuilder
and then instantiating the object (2):
I understand from another thread that it is possible to use code completion in the LO Basic IDE with UNO objects. It says:
When typing the method’s name, and pressing the Tab key once, it will complete the selected entry, pressing the Tab key again will cycle through the matches with the longest prefix. For example, when aVar.aMeth is typed, it will cycle through aMeth1, aMethod2, aMethod3 entries, and other entries are not hidden.
Example:
Dim aPicker As com.sun.star.ui.dialogs.XFilePicker
is a valid variable definition, its methods can be accessed via the dot (".") operator:
aPicker.getDisplayDirectory()"
The sample code shown here does work. As it says in Help it only applies to Methods and to objects of a UNO extended type and does not work on a generic Object or Variant Basic type so I guess that it is working as specified.
I can confirm that this works as described by typing the following code into the IDE:
When I type aPicker followed by a period, a small window opens up showing me (what appear to be) the available methods (properties do not seem to be in this list, and at this time I am not sure whether this is because the XFilePicker
object has no public properties or whether they are just not shown).
Since this seems to work, I came to the conclusion that it should also be possible to use code completion in the same manner with the code in my first example above if I declare the variable objDocBuilder
as com.sun.star.xml.dom.DocumentBuilder
instead of Variant
like this:
'Declarations
Dim objDocBuilder As com.sun.star.xml.dom.DocumentBuilder
This, however, seems to cause the following error:
When switching back and forth between the different libraries and modules, I also see the following, more explicit, error message:
Does anyone know why this is happening?