Lack of access to all functions in exposed interfaces?

229 views Asked by At

I have a rather fundamental issue with coding in OpenOffice/LibreOffice Basic that I can't seem to figure out. I don't always have access to all the functions I'm supposed to. Here's an example:

Sub TestSub
    Dim doc As Object
    doc = ThisComponent  'Note that we're in LibreOffice Writer

    MsgBox(doc.Text.Dbg_SupportedInterfaces)

    doc.Text.finishParagraph(Array())  'Works OK
    doc.Text.appendParagraph(Array())  'Error, property or method not found
End Sub

The doc.Text.Dbg_SupportedInterfaces property tells me that one of the interfaces that I am supposed to have access to is com.sun.star.text.XParagraphAppend, which is meant to expose both finishParagraph and appendParagraph, yet I only seem to have access to finishParagraph. Why is this? This isn't an isolated case - all over the place I see that I am meant to have access to functions that I don't have access to.

1

There are 1 answers

0
Axel Richter On BEST ANSWER

Openoffice and Libreoffice are different projects. That's why they will be developed different and they will become much more different in the future. With your example Libreoffice has no more appendParagraph but finishParagraphInsert. See: http://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1text_1_1XParagraphAppend.html

For BASIC development I recommend to use a debugging tool like XRAY. See: https://wiki.documentfoundation.org/Macros This tool will show only the properties and methods which are really there. Unfortunately there is even no more global index in API documentation of Libreoffice. So XRAY cannot link directly to the Libreoffice API documentation. Therefore at the moment I use the https://www.openoffice.org/api/docs/common/ref/index-files/index-1.html for both Openoffice and Libreoffice and check manually the Libreoffice API http://api.libreoffice.org/ if I am working on a macro for Libreoffice.