Hyperlink to C++ Addin Function

Java, C++, C#, Delphi, ??? - Using the UNO bridges

Hyperlink to C++ Addin Function

Postby saleem145 » Sat Jan 26, 2013 3:52 pm

Hello,

How do I insert a hyperlink to a C++ Addin function that takes two arguments??

Thanks,

Saleem
OpenOffice 3.4.0
Mac OS X 10.5.8
saleem145
 
Posts: 130
Joined: Mon Jul 02, 2012 4:47 pm

Re: Hyperlink to C++ Addin Function

Postby karolus » Sat Jan 26, 2013 5:22 pm

Hallo
In 'my' ~/user/Scripts/python/setsheetcontent2.py file are the 2 Functions:
Code: Select all   Expand viewCollapse view
def test(*args):
    params = parameter_from_string(args[0])
    print 'arg_1: {0}\narg_2: {1}'.format(*params)

def parameter_from_string( string ):
    return string.split('params=')[1].split(';')
 


from Calc executing test with :
Code: Select all   Expand viewCollapse view
=HYPERLINK("vnd.sun.star.script:setsheetcontent2.py$test?language=Python&location=user&params=42;88") 


that print as expected into Terminal:
Code: Select all   Expand viewCollapse view
arg_1: 42
arg_2: 88



Karolus
AOO4, Libreoffice - 5.1 … 5.3.2.2 on Linux Mint17
User avatar
karolus
Volunteer
 
Posts: 852
Joined: Sat Jul 02, 2011 9:47 am

Re: Hyperlink to C++ Addin Function

Postby saleem145 » Sat Jan 26, 2013 6:09 pm

how about c++ function
OpenOffice 3.4.0
Mac OS X 10.5.8
saleem145
 
Posts: 130
Joined: Mon Jul 02, 2012 4:47 pm

Re: Hyperlink to C++ Addin Function

Postby Villeroy » Sat Jan 26, 2013 6:14 pm

By mere definition an "addin" is meant to be a collection of additional cell functions for the Calc component. Such a function is usable in formula context, it takes arguments and it returns one number or one text value or mutiple values in array context.
I assume that you don't mean addin functions since a hyperlink can not return any value.

Most extensions add functionality by other means. Then they are called "addon".
Taking my SpecialCells extension as an example, I can call both services DialogCellFormatRanges and DialogCellContents with a service: URL:
service:name.AndreasSaeger.SpecialCells.DialogCellFormatRanges
service:name.AndreasSaeger.SpecialCells.DialogCellContents

Same with MRI:
service:mytools.Mri
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 28431
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Hyperlink to C++ Addin Function

Postby saleem145 » Sat Jan 26, 2013 6:45 pm

Karolus has answered my question but in python -- I just want the C++ equivalent to his answer -- the URL in this case is not clear to me....

I am not referring to calling C++ functions -- the function I would like to call when someone click on the hyperlink has a return type of void and takes in two arguments....it changes some static variables and changes the behavior of my addin....

Saleem
OpenOffice 3.4.0
Mac OS X 10.5.8
saleem145
 
Posts: 130
Joined: Mon Jul 02, 2012 4:47 pm

Re: Hyperlink to C++ Addin Function

Postby Villeroy » Sat Jan 26, 2013 7:12 pm

karolus calls a Python macro which is a completely different thing.
That routine would be called like this:
vnd.sun.star.script:Library.Module.RoutineName?language=Python&location=application&arg1=blah&arg2=123
As far as I know, you can not write any macros in C++ but you can call a macro which instaciates your addon.

Hyperlink triggers macro, macro preprocesses some arguments and triggers the add-on:
Code: Select all   Expand viewCollapse view
def RoutineName(*args):
    srv = MyOffice.createUnoService("MyAddOn.MyService")
    params = parameter_from_string(args[0])
    srv.trigger(params)


or you call your add-on directly through a service: URL
service:MyAddon.MyService?arg1=blah&arg2=123
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 28431
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany


Return to External Programs

Who is online

Users browsing this forum: No registered users and 1 guest

cron