Page 1 of 1
Hyperlink to C++ Addin Function
Posted: Sat Jan 26, 2013 3:52 pm
by saleem145
Hello,
How do I insert a hyperlink to a C++ Addin function that takes two arguments??
Thanks,
Saleem
Re: Hyperlink to C++ Addin Function
Posted: Sat Jan 26, 2013 5:22 pm
by karolus
Hallo
In 'my' ~
/user/Scripts/python/setsheetcontent2.py file are the 2 Functions:
Code: Select all
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
=HYPERLINK("vnd.sun.star.script:setsheetcontent2.py$test?language=Python&location=user¶ms=42;88")
that print as expected into Terminal:
Karolus
Re: Hyperlink to C++ Addin Function
Posted: Sat Jan 26, 2013 6:09 pm
by saleem145
how about c++ function
Re: Hyperlink to C++ Addin Function
Posted: Sat Jan 26, 2013 6:14 pm
by Villeroy
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
Re: Hyperlink to C++ Addin Function
Posted: Sat Jan 26, 2013 6:45 pm
by saleem145
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
Re: Hyperlink to C++ Addin Function
Posted: Sat Jan 26, 2013 7:12 pm
by Villeroy
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
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