no, you cannot add functions to the Standard library using an
extension. You'll have to develop an Add-in (in C++, Java or
Python).
if issue http://qa.openoffice.org/issues/show_bug.cgi?id=53615
(allow other libraries) is solved, things will become easier.
It is an issue from 2005, so it seems I shouldn't hold my breath
for a solution... ?
Ask Niklas...
No quick solution in sight. We don't want to load and search all
libraries, and we don't have any additional information available
besides the function name.
Niklas
Basic supports the syntax: library-name-dot-function-name, like
MyLib.MyFunc. Maybe Calc could, too? Basic Runtime isn't smart enough
to try to load the library for you, but Calc could be made that smart.
That solution gets a vote from me - allowing library.function syntax in
a cell would feel natural to me; at least that is what I tried as soon
as I had put my function in my own library.
An alternative could be to allow an extension to add a module to the
standard library, to e.g. add appropriate wrapper functions to surface
library functions to Calc. If the reason for not allowing this is to
avoid excessive initialization on startup, you could perhaps constrain
extension modules so they are not allowed to have a Main sub ? That
would be OK for a module that only consists of wrapper functions. But
having to add special logic for special extension modules makes the
above solution sounds far more clean and simple...
However - a crucial feature (for me at least) that must also be
supported is proper integration into the function wizard. If this won't
work for Basic add-ins that will be reason enough for me to go the
Python or Java route anyway.
I have tried defining a function called "TestFunction" in the Standard
library that just multiplies the input number by 20. Works fine as a
cell function. I then tried to make an .XCU file that defines that there
is a function called "TestFunction" and that it has a single parameter
called X (using the example from
http://specs.openoffice.org/sdk/tools/spec_uno-skeletonmaker.odt as a
template). The .XCU file was then installed by hitching a ride via an
otherwise unrelated example extension. "TESTFUNCTION" is now listed in
the function wizard but refuses to work (no parameters listed - even
though I have listed the X parameter in the .XCU file) and I can no
longer use "TestFunction" as a cell function (Err:504). Removing the
extension and thereby the .XCU file removes "TESTFUNCTION" from the
function wizard and restores "TestFunction" as a working cell function.
Is the .XCU example that I used as a template incomplete or outdated or
is it not possible to add a Basic function to the list in the function
wizard ?
Cheers
-- Jan
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]