Ask Your Question
0

Call LibreOffice from Gambas

asked 2017-08-17 00:40:01 +0200

owlbrudder gravatar image

This may be impossible, but I will ask anyway.

Elsewhere on this forum a user asked the question "How to call LibreOffice from Visual Basic" and the answer was:

REM Instantiate OOo: this line is mandatory with VB for OOo API 
oSM = CreateObject ("com.sun.star.ServiceManager") 
REM Create the first and most important service 
oDesk = oSM.createInstance ("com.sun.star.frame. Desktop ")

My question is "How is "com.sun.star.ServiceManager" made known to VB?" There seems to be a missing declaration describing how to find it. Is this set up in environment variables perhaps?

My objective is to control LO from Gambas. In Gambas, I can call into shared libraries like so:

Extern getgid() As Integer In "/usr/lib64/libc:6"

Public Sub Form_Open()
  Dim intGid As Integer
  intGid = getgid()
  TextBox1.Text = "GID = "
  TextBox1.Insert(CStr(intGid))
End

As you can see, I have to declare a function and its location (which .so file) before I can call it. Is this even possible with LO? Are methods etc. contained in discrete files, or am I wasting my time trying?

Kind regards, Doug

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2017-08-17 05:38:09 +0200

robleyd gravatar image

updated 2017-08-17 05:39:12 +0200

This isn't a direct answer to your question, but might help you get on the right track until someone else, with more knowledge than I have, responds.

Given you are using Linux (Fedora) you can find the libraries in /opt/openoffice4/program; you can then play around with nm or objdump (see the relevant man pages for more info) to expose the functions in the shared libraries. I suspect the libraries you want to investigate will be the *uno.so libs.

If this answer helped you, please accept it by clicking the check mark ✔ to the left and, karma permitting, upvote it. If this resolves your problem, close the question, that will help other people with the same question.

edit flag offensive delete link more

Comments

Thanks robleyd. Scanning the .so files as you suggest is a good idea and I am planning to do so. It is a bit of a jigsaw to piece together the list of files and their contents, but, hey, that's what an RDBMS is for! "8-)

owlbrudder gravatar imageowlbrudder ( 2017-08-19 08:16:12 +0200 )edit
0

answered 2017-08-20 06:08:50 +0200

owlbrudder gravatar image

If there is any way to use the LibreOffice shared libraries externally, I have not been able to find it. The .so files look to me like C++ classes. Unless someone is able to tell me otherwise, I will stop wasting my time looking for a way to control LO from Gambas.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-08-17 00:40:01 +0200

Seen: 259 times

Last updated: Aug 20 '17