Hi Mikhail, On Friday, 2015-08-21 16:37:21 +0300, Mikhail Zemlyanukha wrote:
In my LibO Calc Java extension I have a worksheet function receiving an argument declared as 'any' type in IDL, so I can detect a missing parameter. But I would like to detect also an empty cell, if that parameter holds a cell reference.
You could declare a parameter of type table::XCellRange, which gets such cell range object passed. From that you could obtain, via XCellRangesQuery interface's queryContentCells(), a sheet::XSheetCellRanges object. Note that there is also XCellRangesQuery::queryEmptyCells() but that regards cells that hold only a note/annotation as non-empty, which may not be what you want. At least in theory from looking at the source code, I didn't try..
Seems that I can't do that because the function receives a Double value 0.0 for an empty cell. When I pass a cell range, I do receive a 2-dimensional array of values (of type String) with empty strings (not null) so I can't check if a cell is empty either.
"pass a cell range" is the parameter declared as receiving the XCellRange I mentioned?
I see there's ISBLANK() builtin worksheet function, is my understanding correct that such functionality is not available via Java UNO API, but is available for built-in functions using some other API (not UNO). Is it available for C/C++ extensions?
C/C++ UNO API is the same as for Java.
I understand this that formula engine evaluates parameters before passing them to a function, so a cell reference to an empty cell gets converted to a double 0.0 value
... if the parameter is declared as double or double[][] or a single cell reference passed to any[][].
(while for a range empty cells are converted to strings, that's a bit strange, but it's another story).
Yes, that's somewhat inconsistent, if we're talking about the any[][] getting a range reference passed. On the other hand, there are no cells with an empty string content unless it is a formula cell with an empty string result.
Why empty cells are not converted to java null values, or Any data type, which can hold Void value (this is the case for a missing parameter)?
Why? Because. I don't know. Maybe an empty Any might had been better in this case.
Is there any any info about Calc's function evaluation engine I can read, only source code? ))
The Add-In calls are in sc/source/core/tool/interpr4.cxx ScInterpreter::ScExternal(), XCellRange and XCellRanges objects in sc/source/ui/unoobj/cellsuno.cxx ScCellRangeObj and ScCellRangesObj. Hope that helps 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
Attachment:
pgpk5yM7cBHlg.pgp
Description: PGP signature