Developing extension on LibreOffice for Pardus OS

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
ilker
Posts: 4
Joined: Thu May 21, 2020 2:41 pm
Location: Ankara / Türkiye

Developing extension on LibreOffice for Pardus OS

Post by ilker »

Hello there.

I want to develop an extension(Add-in / Add-on).
This extension will works on Pardus operating system.
With all the content, this extension must make an http request while saving the doc.
Is it possible to do that ? And how i to do that ?
I will use windows for the development environment. I need a cross platform solution(for run this extension in windows and Pardus).

I will be grateful if you could help me.

Thanks.
LibreOffice : Version: 6.4.3.2 (x64)
User avatar
Lupp
Volunteer
Posts: 3548
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Developing extension on LibreOffice for Pardus OS

Post by Lupp »

ilker wrote:...make an http request while saving the doc.
This looks very unspecific to me. Might you be more precise, please.
Shall the request use a software assigned to html-calls on the system?
Can you get your response using WEBSERVICE() and FILTERXML()?
...
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
ilker
Posts: 4
Joined: Thu May 21, 2020 2:41 pm
Location: Ankara / Türkiye

Re: Developing extension on LibreOffice for Pardus OS

Post by ilker »

Hi Lupp.
Thank you for the answer.

In this section(while saving the doc), I would like to call a .asmx(c#) Web Service.
I would like to get whole doc content string, and send a .asmx webservice as parameter.
Can LibreOffice run a http request directly with extension ?

If it can, I need a solution to run this extension on the pardus, regardless of the programming language.

Thanks.
LibreOffice : Version: 6.4.3.2 (x64)
User avatar
Lupp
Volunteer
Posts: 3548
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Developing extension on LibreOffice for Pardus OS

Post by Lupp »

Please don't misunderstand the fact that I answered as a claim to be an expert in the field. My experiences are very few and rather old.
However, you can use the function WEBSERVICE() to get the stream.
If it is well-formed XML you can apply FILTERXML() with XPath filters (queries) to it. Both functions were probably implemented in LibreOffice for compatibility with MS-Office. There they may only be available in Excel. Since LibO is "monolithic" you can use standard functions of Calc in every situation as soon as you have created a FunctionAccess service. Of course, you may also evluate the stream you got by WEBSERVICE() in a different way.
Raw frame of an example:

Code: Select all

Sub example()
fa = CreateUnoService("com.sun.star.sheet.FunctionAccess")
url = "https://server.domain.tld?service..."
xPathQuery = "..."
response = fa.callFunction("WEBSERVICE", Array(url))
selection = fa.callFunction("FILTERXML" , Array(response, xPathQuery))
End Sub
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
User avatar
robleyd
Moderator
Posts: 5079
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Developing extension on LibreOffice for Pardus OS

Post by robleyd »

Also posted on AskLibreOffice
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
ilker
Posts: 4
Joined: Thu May 21, 2020 2:41 pm
Location: Ankara / Türkiye

Re: Developing extension on LibreOffice for Pardus OS

Post by ilker »

Lupp wrote:Please don't misunderstand the fact that I answered as a claim to be an expert in the field. My experiences are very few and rather old.
However, you can use the function WEBSERVICE() to get the stream.
If it is well-formed XML you can apply FILTERXML() with XPath filters (queries) to it. Both functions were probably implemented in LibreOffice for compatibility with MS-Office. There they may only be available in Excel. Since LibO is "monolithic" you can use standard functions of Calc in every situation as soon as you have created a FunctionAccess service. Of course, you may also evluate the stream you got by WEBSERVICE() in a different way.
Raw frame of an example:

Code: Select all

Sub example()
fa = CreateUnoService("com.sun.star.sheet.FunctionAccess")
url = "https://server.domain.tld?service..."
xPathQuery = "..."
response = fa.callFunction("WEBSERVICE", Array(url))
selection = fa.callFunction("FILTERXML" , Array(response, xPathQuery))
End Sub
Hi Lupp.

Where does this piece of code you write belong to (looks like vba)? Where can I write and how can I use this piece of code you provided? As I said, I will install and use this extension in pardus.

Thank you very much for your valuable help.
LibreOffice : Version: 6.4.3.2 (x64)
User avatar
Zizi64
Volunteer
Posts: 11358
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Developing extension on LibreOffice for Pardus OS

Post by Zizi64 »

looks like vba
It is absolutely not a VBA code. It is StarBasic code with some calling of API functions. API: Application Programming Interface. It is an excellent feature of the AOO/LO.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
Posts: 11358
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Developing extension on LibreOffice for Pardus OS

Post by Zizi64 »

Where can I write and how can I use this piece of code you provided? As I said, I will install and use this extension in pardus.
Do not try to create an extension, if you not know how you can use the sample code.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
ilker
Posts: 4
Joined: Thu May 21, 2020 2:41 pm
Location: Ankara / Türkiye

Re: Developing extension on LibreOffice for Pardus OS

Post by ilker »

Hi Zizi64.

First of all, thank you for your response.
I'm a little newbie in programming with LibreOffice, not programming :)
I understand the code snippets written by lupp, yes, but I don't know exactly where to write this code. Is there a section in Libreoffice where I can write plugins?
LibreOffice : Version: 6.4.3.2 (x64)
User avatar
robleyd
Moderator
Posts: 5079
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Developing extension on LibreOffice for Pardus OS

Post by robleyd »

You might care to look at https://wiki.documentfoundation.org/Dev ... evelopment as a starting point; another useful reference will be the SDK and LO api pages.
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
User avatar
Lupp
Volunteer
Posts: 3548
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Developing extension on LibreOffice for Pardus OS

Post by Lupp »

Somebody may be interested in the example I made for myself (to refresh a little bit my poor knowledge in the xml field) with LibreOffice 6.4.3.2 (also tested with V 7.0.0.0.alpha1). AOO cannot run the code due to lacking used Calc functions.
There may be a way to get the xml stream with the help of the dispatcher...
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
Post Reply