Calc Add-in Java extension: assign function to a new category

Mikhail Zemlyanukha gmixaz at gmail.com
Wed Aug 5 04:30:46 PDT 2015


Hi Eike,

Thank you for the feedback. I know about http://ask.libreoffice.org/
and posted few questions there but didn't get any answers. Seems that
my questions are too specific for that site.

Stackoverflow seems to have even less LibO-related auditory though. I
would prefer to use SO since it is commonly used among developers.

About the topic - I'm developing set of worksheet functions for my
customer, to his financial data in oracle database. The functions are
used to prepare statistical reports. The functions were originally
developed as MS Excel C/C++ AddIn (XLL) a decade ago, and now they
would like to migrate to LibO. The functions are specific to
customer's domain and its database.

I would prefer to keep all functions (about 50) in separate category
(and it was so in Excel). This issue is not critical though, I can use
a prefix in function names. Not ideal, but acceptable.

Now I am facing another issue that _is_ critical - I need to return
arrays from a worksheet function (for array formula as described here
https://help.libreoffice.org/3.3/Calc/Array_Functions). I see that
there's 'sequence' keyword in UNO IDL language to define arrays
(http://www.openoffice.org/udk/java/man/map_idl_to_java.html#Mapping
of sequence) so I tried to define a function returning a
single-dimensional array of doubles:

sequence < double > MyFunc(
     [in] com::sun::star::beans::XPropertySet xOptions,
     [in] string txtStr
);

IDLC compiles this code OK, but the function is not registered with
engine - I see from logs that getProgrammaticCategoryName is called
for all functions except MyFunc. But if I redefine MyFunc to return a
single double value, it is called. So I assume there's some problem
with arrays.

I asked this question on IRC channel, and was pointed to
sc/source/core/tool/interpr4.cxx ScInterpreter::ScExternal() source
code, and I'm going to investigate that myself. But any info on the
matter is welcome. An example with a worksheet function returning
array would be ideal.

Regards,
Mike

On Wed, Aug 5, 2015 at 1:47 PM, Eike Rathke <erack at redhat.com> wrote:
> Hi Mikhail,
>
> On Monday, 2015-08-03 00:53:40 +0300, Mikhail Zemlyanukha wrote:
>
>> In LibO Calc Java extension, in XAddIn interface there're 2 functions:
>> getProgrammaticCategoryName() and getDisplayCategoryName(). From
>> Javadoc I see that getProgrammaticCategoryName must return one of
>> existing categories, while I would like to have a new one.
>>
>> It is not clear if getDisplayCategoryName can return a new category.
>> But it is not called anyway, as I can see from logs.
>
> getProgrammaticCategoryName() is called though, if you take a look at
> the existing Add-Ins, for example scaddins/source/datefunc/datefunc.cxx,
> you'll see that getDisplayCategoryName() calls
> getProgrammaticCategoryName(), or returns identical names as in
> scaddins/source/analysis/analysis.cxx
>
> The getDisplayCategoryName() probably was meant to return translated
> category names for localized Add-Ins, but..
>
> The categories are maintained in Calc and are translated for localized
> UI languages. If an unknown category is returned, the categorization
> falls back to the general Add-In category.
>
>> Is it possible to create a new category?
>
> Only if Calc and the Function Wizard are adapted to handle yet unknown
> categories. What category do you have in mind anyway?
>
>> I posted this question at stackoverflow too:
>> http://stackoverflow.com/q/31777014/1028256
>
> Btw, we have our own Ask instance running at http://ask.libreoffice.org/
>
>   Eike
>
> --
> LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
> GPG key "ID" 0x65632D3A - 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 2D3A
> Better use 64-bit 0x6A6CD5B765632D3A here is why: https://evil32.com/
> Care about Free Software, support the FSFE https://fsfe.org/support/?erack


More information about the LibreOffice mailing list