https://bugs.documentfoundation.org/show_bug.cgi?id=174283

            Bug ID: 174283
           Summary: Add-In functions that return an array should spill
                    like built-in array functions
           Product: LibreOffice
           Version: 27.2.0.0 alpha0+ master
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: medium
         Component: Calc
          Assignee: [email protected]
          Reporter: [email protected]

Description:
A function from a UNO Add-In that is declared to return an array (sequence<
sequence< any > >, or one of the typed sequences) never spills when it is typed
into a cell and confirmed with Enter. The cell shows only the top-left value of
the result. To see the whole result the user has to select a range of the right
size first and enter the formula as an array formula with Ctrl+Shift+Enter.

Calc's own array functions spill since dynamic arrays were added: a typed
formula is promoted to a dynamic array when its tokens show it returns an array
(rpnIntendsArrayResult in sc/source/core/data/formulacell.cxx). An Add-In call
(ocExternal) is always treated as returning a single value there, whatever the
function declares, so it is never promoted.

The decision has to be made before the call, because array mode changes how the
arguments are evaluated; the declared return type of the Add-In function is
known at that point.

Proposed change: 
Treat an Add-In call as returning an array when its declared return type is an
array sequence or sheet::FormattedResult. A function declared to return any
stays a single value, so existing Add-Ins behave as before.

Steps to reproduce: 
   1. Install GNU Octave and the octave-calc extension
(extensions.libreoffice.org).
      Its OCTAVE function is declared to return sequence< sequence< any > >.
   2. Type `=OCTAVE("magic", 3)` into an empty cell and press Enter.
   3. Type `=SEQUENCE(3, 3)` into another empty cell and press Enter.

Actual result: the OCTAVE cell shows only 8, the top-left value of the 3 by 3
result. SEQUENCE spills into 3 by 3 cells.

Expected result: the OCTAVE result spills into the 3 by 3 range, as SEQUENCE
does.

Additional Info: I will submit a patch for this.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to