540 Commits
Author SHA1 Message Date
Andrea Gelmini 30cc365def Fix typos
Change-Id: I42e6c0c272cd5b83bb2747d938049a64d4b19936
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210443
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2026-09-03 08:50:28 +02:00
Tomaž Vajngerl 1ff770e5bf sc: bind the # operator to the reference it follows
The # postfix operator was parsed at the same level as the percent
sign, which is looser than the prefix operators. Because of this
=@A1# compiled to the spill range of an implicit intersection and
=-A1# to the spill range of a negated value. Neither of those means
anything, and OOXML writes the # around the reference alone in both
cases.

The # is now parsed right after the factor it follows, tighter than any
operator that can come before it. A whole range reference goes inside,
because the lexer reads A1:A3 as a single reference. The percent sign
stays above the reference operators, so =A1%# leaves the # with nothing
to bind to and doesn't parse, and the export drops such a # (OOXML has
no spelling for it either).

A blank between two operands is only the intersection operator if both
sides yield a reference. The # does, so the checks that keep the blank
alive and that keep the operator once the operands are known had to be
told about it.

The interpreter passes the spill range on as a matrix that carries the
range it was read from. The intersection, range and union operators
only took references and refused that, so PopReferenceOperand now
hands them the carried range as a double reference.

Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Change-Id: I1a587bf291ff639b326a366b8efc332106eb5fd3
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/10156
Tested-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit c589c34aaec00d60fc47f1933762b105f9d22de3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210293
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-31 17:35:25 +02:00
Tomaž Vajngerl 1ac50fddc7 sc: rewrite the token array into the OOXML shape
OOXML writes @ and # as calls and a reference union as a parenthesised
list, so for each of them we need to know how far the sub-expression
under it reaches. CreateStringFromTokenArray worked that out from the
text it had already written. The problem with this is that every pair
it spliced in shifted all the offsets that were still waiting behind
it, so it kept breaking.

Instead of patching the text, OOXMLRewriter builds a second
token array in the shape OOXML spells out and the writer walks that as
it stands. The call names and the parentheses are ordinary tokens, so
there is nothing to splice and no offsets to keep track of. It is the
same trick RewriteMissing already plays a few lines further up, and it
means the input and the output can be looked at side by side.

The # changes place, from behind its operand to a call in front of it,
so it gets an opcode of its own. _xlfn.ANCHORARRAY spells ocAnchorArray
now, and ocSpill keeps the native postfix spelling with no OOXML one at
all, so the postfix form cannot end up in a file by accident. The
import already rewrote the call back into the postfix operator and now
recognises it by opcode instead of by position. The @ stays
ocSingleValue, it is already in front of its operand so only the
parentheses are new.

The OFFSET() literal argument is swapped for the reference error in
the same pass, instead of the writing loop jumping over tokens.

A unit test drives the rewrite on its own: token array in, token array
out, one case per shape. The shapes that end up with nothing to wrap
are in there too - a lone @, one with a missing argument, and text that
never parsed - since those are the ones where dropping a token is the
only change.

Also drop the dead "@" and "#" rows from the OOXML symbol table, the
rows above them already have _xlfn.SINGLE and _xlfn.ANCHORARRAY.

Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Change-Id: I63944fb85b5c4388f304f7d94afd0b4f347d7782
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/10155
Tested-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 4feac84950f5b524d99e277481de50f7b45a8d2f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210292
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-08-31 15:56:50 +02:00
Xisco Fauli 0c91381485 loplugin:unusedmethods
Change-Id: I17586b49f970be17c5f6d2823d4a973521b2ed62
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209407
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-08-21 09:31:35 +02:00
Michael Weghorn 651bd99452 formula: Pass FormulaDlg's IControlReferenceHandler param by ref
... instead of by pointer.
Do the same for FormulaModalDialog.

Change-Id: I4698574b04a32daaa0c1c7c38d5b3ce3b9007f0d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209396
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2026-08-20 22:30:07 +02:00
Tomaž Vajngerl 44c66f0b84 sc: wrap the whole @ operand in _xlfn.SINGLE, or none of it
The @ operand walk on OOXML save took the token behind the @ as the
whole operand, so any operand longer than one token was cut apart by
the wrapper: a leading sign, a structured table reference, a range
built with the range operator, and a nested @ or # inside an
argument list all left parts of themselves outside.

The @ now writes no text of its own. The main token loop notes where
the wrapper has to go and which parenthesis scope the operand lives
in, and splices _xlfn.SINGLE(...) in once the operand ends. The #
splice already worked that way, so there is one walk with one set of
special cases and no recursion.

Prefix signs and whitespace go inside the wrapper with the operand,
and a sign moves the factor start past itself, so a # wraps the
reference it follows and leaves the sign outside. Table reference
brackets scope like parentheses, which keeps a multi-item reference
whole. AND and OR are written as a name with an argument list, so
such a name does not end the operand either and the whole call stays
inside.

An operand that writes no text leaves the wrapper out. One that is
exactly one parenthesised group lends its parentheses to the
wrapper, so a saved formula keeps its shape over round trips. Text
that never parsed takes no wrapper and drops a # behind it, the way
an ODF save leaves the @ out.

The error strings for tokens the writer cannot spell out sit in
AppendTokenOrError, which tests the cheap conditions first. The
whitespace opcode test moved to opcode.hxx as isWhitespaceOpCode,
replacing the private copies, and the operator range tests join it
there as isUnaryOperatorOpCode and isBinaryOperatorOpCode. Unit
tests pin the saved output for each operand shape.

Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Change-Id: I9b6c12bbc8d0ddb9efa043a2364d13c4699e7bd5
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9290
Tested-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit 2b8d9c58e8f7b5f138d44f41d756421c3f7932cd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209393
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-20 18:32:18 +02:00
Michael Weghorn a881b303b3 tdf#130857 formula: Only use selection indices if selection exists
The bool return value of weld::TextWidget::get_selection_bounds
indicates whether a text selection actually exists.

Only use the start and end indices from the out params
if that is the case and otherwise return a default-constructed
Selection object (i.e. one using start and end indices of 0).

Otherwise, this would result in an assertion due to the use of
invalid string indices as seen with the qt6 vcl plugin and native
widgets enabled (SAL_VCL_QT_USE_WELDED_WIDGETS=1) for the following
scenario with upcoming commit

    Change-Id: I10fcd9c326a047cf4abd34369f02be1847d77ae1
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Wed Jul 22 14:20:53 2026 +0200

        tdf#130857 qt weld: Support Calc "Edit Print Ranges" dialog

in place:

* start Calc
* "Format" -> "Print Ranges" -> "Edit..."
* click on the "Shrink" button in the "Print Range" section
* click anywhere in the sheet

Assertion:

    soffice.bin: /home/michi/development/git/libreoffice/sal/rtl/strtmpl.hxx:1059: void rtl::str::newReplaceStrAt(rtl_tString **, rtl_tString *, sal_Int32, sal_Int32, rtl_tString *) [rtl_tString = _rtl_uString]: Assertion `nIndex >= 0 && nIndex <= pStr->length' failed.

This is because QtInstanceEntry::get_selection_bounds
sets the indices to -1 if no selection exists.

Change-Id: Ifc8fd6f6a6d676fe26364da9077cb10acb439a5a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208474
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2026-07-25 10:34:14 +02:00
Tomaž Vajngerl 21b9909afa sc: add the ARRAYTOTEXT function
ARRAYTOTEXT returns a cell range or array as one text string,
taking the range and an optional format number.

Format 0 (or omitted) joins the values in row order with ", ".
Format 1 gives an array constant: braces around the array, ","
between columns, ";" between rows, and text quoted with any
inner double quote doubled. Any other format returns #VALUE!.

A number keeps its input-line text, a boolean reads TRUE or
FALSE in the current locale, an empty cell adds nothing, and an
error in a range lists as its error text while a reference to a
single error cell returns that error.

The function is wired up with its name tables, wizard entry,
parameter classification, and OOXML and binary filter mappings.

A self-checking OOXML workbook is verified after import and
after an XLSX and an ODS round trip, each with a recalc, and the
exported files are checked for the ARRAYTOTEXT formula. A ucalc
test covers the locale-dependent boolean text for a value and
a range.

Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Change-Id: I0cdd9737a51f402e39cf9a1346f4c5326680fe8f
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7219
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit f66673d65ee307f17512a4239dd4b52ac189ac20)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208395
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-07-22 08:05:35 +02:00
Noel Grandin 49044478b3 use more unique_ptr in FormulaTokenArray
Change-Id: Ife00f7e119e4870a3584ae7d766d9debd6220217
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/632
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit b80addae75093d947065f0e41e1a1aebd2c89a03)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208282
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-21 09:02:36 +02:00
Caolán McNamara 0500f647f3 crashtesting: fix ScLet/ScLambda crashes on a non-name parameter token
ScLet and ScLambda read the parameter-name token's string without checking
GetType() first, so a token that isn't a string name faults on load, e.g.
forums/xlsx/forum-mso-en4-789942.xlsx:

  #0  rtl::str::acquire (pThis=0x20d) at sal/rtl/strtmpl.hxx:735
  #6  std::vector<OUString>::push_back
  #8  ScInterpreter::ScLet at sc/source/core/tool/interpr1.cxx:10938
  #9  ScInterpreter::DispatchOpCode (eOp=ocLet)
  #13 ScFormulaCell::MaybeInterpret
  #15 ScCellFormat::GetString
  #17 ScColumn::GetRangeScriptType
  #24 GetOptimalHeightsInColumn

ScLet used to have this check until it was rewritten, the new ScLambda
never had it, since:

commit 6ad6aebb83305608788c878909cd77c29b298271
Date:   Sat Jun 20 23:50:39 2026 -0400

    Implemented LAMBDA and ISOMITTED for Calc

use the same fix as:

commit 4f5764a223f86ceea1eca70cbec55eb8aebea1f3
Date:   Tue May 5 11:45:29 2026 +0100

    crashtesting: fix ScLet/ScMatch/IterateParametersIf[s] crashes

Add a GetStringNameToken() helper for this and use it in ScLet, ScLambda
and the dynamic_cast calls in callable.cxx.

see also:

commit 65da502b7b40bd3bcad0cfd146716e815c72d48d
Date:   Thu Apr 16 12:31:01 2026 +0200

    reduce virtual calling in String*Token

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I7ce591bf5e53538aa947fafa9607b7339d715aaa
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/6107
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 8b1f9cc417d914d72ea223815e8306bcb07299ec)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207977
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-12 17:52:48 +02:00
Tomaž Vajngerl d9241ddd7a Import optional LAMBDA parameters written with the _xlop. prefix
The OOXML format marks an optional LAMBDA parameter with the _xlop.
prefix in the parameter list, while the body refers to the same
parameter through the _xlpm. prefix. Calc recognised only _xlpm., so an
optional parameter kept its prefix, did not match the bare name used in
the body, and lost the mark that made it optional. It failed to bind,
and a call that left it out reported an error.

Recognise _xlop. as a parameter marker and strip it to the bare name, so
the declaration and the body references match. Carry the optional mark
onto the parameter token so the compiled code treats it the same way as
the native square-bracket form.

Write an optional parameter back with the marker the grammar uses: the
_xlop. prefix in OOXML and square brackets in the native grammars.

Add a test that imports an optional parameter in the OOXML form and
checks that ISOMITTED sees it as omitted and that concatenating it
yields the other operand.

Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Change-Id: Ia1df0fa6ca498f4c607507b3a865b3b367e5c11a
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/5782
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
(cherry picked from commit f198d7a984654aabd5e988d3c327da5552bc68e0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207891
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-07-12 14:24:34 +02:00
Ben Urban 97b180f071 tdf#138749: Implemented support for optional parameters for LAMBDA
LAMBDA now supports optional parameters with the [name] syntax; all
such parameters must appear after all required parameters in the
parameter list.

Optional parameters use svMissing, for compatibility with ISOMITTED.

Change-Id: Ice026eeb6937dadd3b1ffd8c07e0d3ce88de9afc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207392
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-07-12 14:23:51 +02:00
Michael Weghorn f1f6a505a0 weld: Pass weld::TextWidget& in text change callback/handler
Switch the weld::Entry and weld::TextView handlers
that are called when the text changes due to user
interaction to pass a weld::TextWidget& param
instead of a weld::Entry& and weld::TextView&
one respectively.
Adjust related methods across the code base accordingly.

This unifies the behavior for both of these
weld::TextWidget subclasses and prepares for
deduplicating the logic and moving it to the
common base class in an upcoming commit.

That will also ensure they stay in sync.
(Change also motivated by the fact that their behavior was
differing before

    Change-Id: I03d2a13cd84d53d806eb9e363f49c4b6be28d938
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Thu Jul 9 13:08:58 2026 +0200

        tdf#130857 weld: Don't signal about programmatic TextView text change
.)

Change-Id: I5572fc88caf577fae9a23a39f1ec4f2179935a99
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207936
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2026-07-10 18:17:27 +02:00
Tomaž Vajngerl 6612d4f785 sc: add the # postfix operator for spilled-range references
A1# is the postfix counterpart of the @ prefix. When A1 is
the origin of a dynamic-array formula spilled into A1:A4, A1#
refers to the whole spill range, so SUM(A1#) totals the four
values and ROWS(A1#) returns 4.

The new opcode ocSpill sits in the unary-operator range. The
tokenizer produces it from a bare # after a reference or
value. Otherwise # stays the start of a #REF! or #NAME!
token. The compiler routes it through PostOpLine so it
follows its operand in the RPN.

ScSpilledRange pushes the spill range as an ScMatrixRangeToken
so aggregating functions see the whole range, and ISREF
reports it as a reference. A master yields its matrix. A
plain number, string, or non-master matrix slot yields the
the cell value.

A freshly typed =A1# counts as an array result, so it
promotes to a dynamic-array master and spills again. A cell
that does not promote collapses the range by implicit
intersection to the row-aligned value, or #VALUE! outside the
range, keeping that cell's number format.

Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Change-Id: Idf2752af3f7575f6bc95b940344aa365415e4a2f
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/5785
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
(cherry picked from commit 9b97b0fc91bce4b8726ea210347e8ea84270e148)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207904
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-07-10 01:08:46 +02:00
Ben Urban 76c9c81b02 Implemented functions which rely on callables
Add BYCOL(tdf#164508), BYROW(tdf#164509), MAKEARRAY(tdf#164511),
MAP(tdf#164512), REDUCE(tdf#164513), SCAN(tdf#161428) formula
functions, which are usually used together with LAMBDA and are
important for interoperability with other Office suites.

Change-Id: I7eb5a992a113638fdadf0cf61592c082094fb44f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205979
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-09 08:44:48 +02:00
Ben Urban 331e346fb1 Implemented LAMBDA and ISOMITTED for Calc
Added LAMBDA (tdf#138749) function
Added ISOMITTED (tdf#164510) function
Rewrote LET to work with the new LAMBDA

Change-Id: I45dbf18c43e56c788848f60cd8380dd8d7c476b5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206265
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-09 08:43:28 +02:00
Ben Urban 3bdd856e9f Implemented callables as first-class objects in Calc formulas
Three types of callables are available:

* Built-in functions (tdf#164507)

* External functions

* Macro functions

Change-Id: I6311c9412db650cfeb1100497e4ccdc39662c350
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206264
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-09 08:42:21 +02:00
Tomaž Vajngerl 0522c17c22 sc: round-trip the @ operator through XLSX as _xlfn.SINGLE
The OOXML spec writes =@(expr) as =_xlfn.SINGLE(expr). Calc
emitted the bare @ glyph on save and dropped the wrapper on
load, so =@(F3:F5+0) fell back to a non-array context after a
round trip and lost the authored value.

Map "_xlfn.SINGLE" to ocSingleValue in the OOXML symbol
table. The regular exporter walk now spells ocSingleValue as
"_xlfn.SINGLE" and the import compiler recognises the
wrapper, so a parenthesised operand round-trips with no
further work. A small exporter branch wraps bare and
function-call operands in the wrapper's own parentheses.

OOXML files in the wild put the @ operand inside a redundant
parenthesis pair, _xlfn.SINGLE((expr)). A post-compile pass
on import drops the inner pair so the cell reads back as
=@(expr). The helper takes a trigger-opcode list for reuse.

testSingleOperatorXlsxRoundTrip covers the export path,
testIntersectionOperatorXlsxRoundTrip covers the import strip
from a fixture file.

Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Change-Id: I2648da125945295fd8548842aba9c82978d96aa9
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/5573
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
(cherry picked from commit 5ac9db1f563bbde01f9e24fc9bbb8c3599eb0c06)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207789
Tested-by: Jenkins
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-08 23:47:16 +02:00
Stephan Bergmann 1df02d7afa Fix heap-buffer-overflow in formula::FormulaTokenArray::Add
ScTokenArray::Clone and CloneValue have always allocated the parse-token array
pCode to hold exactly nLen entries, but unlike Assign they left mbFinalized at
false.  And FormulaTokenArray::Add assumes that a non-finalized pCode has room
for at least MAX_FAST_TOKENS entries.  Which now started to break with
a21f6a3a0eae72fef90576d249d96dc00beeb2c5 "sc: round-trip dynamic-array masters
and @ through ODF",

> ==611420==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7befc900e420 at pc 0x7b8f762c6d53 bp 0x7ffdf0776f90 sp 0x7ffdf0776f88
> WRITE of size 8 at 0x7befc900e420 thread T0
>  #0 in formula::FormulaTokenArray::Add(formula::FormulaToken*) at engine/formula/source/core/api/token.cxx:772:25
>  #1 in ScTokenArray::AddRawToken(ScRawToken const&) at engine/sc/source/core/tool/token.cxx:2004:12
>  #2 in ScTokenArray::AddOpCode(OpCode) at engine/sc/source/core/tool/token.cxx:2224:12
>  #3 in (anonymous namespace)::prependImplicitIntersection(ScTokenArray&) at engine/sc/source/core/data/formulacell.cxx:1654:49
>  #4 in ScFormulaCell::ResolveImplicitIntersection(ScTokenArray&, ScDocument&, ScAddress const&) at engine/sc/source/core/data/formulacell.cxx:2716:9
>  #5 in ImportExcel::Formula(XclAddress const&, unsigned short, unsigned short, double, bool) at engine/sc/source/filter/excel/excform.cxx:127:17
>  #6 in ImportExcel::Formula25() at engine/sc/source/filter/excel/excform.cxx:72:5
>  #7 in ImportExcel8::Read() at engine/sc/source/filter/excel/read.cxx:1184:49
>  #8 in ScFormatFilterPluginImpl::ScImportExcel(SfxMedium&, ScDocument*, EXCIMPFORMAT) at engine/sc/source/filter/excel/excel.cxx:255:35
>  #9 in ScDocShell::ConvertFrom(SfxMedium&) at engine/sc/source/ui/docshell/docsh.cxx:1329:52
>  #10 in SfxObjectShell::DoLoad(SfxMedium*) at engine/sfx2/source/doc/objstor.cxx:777:27
>  #11 in ScFilterTestBase::loadDoc(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, int) at engine/sc/qa/unit/helper/scfiltertestbase.cxx:40:21
>  #12 in ScFiltersTest::load(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int) at engine/sc/qa/unit/filters-test.cxx:68:31
>  #13 in non-virtual thunk to ScFiltersTest::load(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int) at engine/sc/qa/unit/filters-test.cxx
>  #14 in test::FiltersTest::recursiveScan(test::filterStatus, rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int, bool) at engine/unotest/source/cpp/filters-test.cxx:132:20
>  #15 in test::FiltersTest::testDir(rtl::OUString const&, std::basic_string_view<char16_t, std::char_traits<char16_t>>, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int, bool) at engine/unotest/source/cpp/filters-test.cxx:157:5
>  #16 in ScFiltersTest::testCVEs() at engine/sc/qa/unit/filters-test.cxx:91:5
>
> 0x7befc900e420 is located 0 bytes after 64-byte region [0x7befc900e3e0,0x7befc900e420)
> allocated by thread T0 here:
>  #0 in operator new[](unsigned long) at /home/sberg/github.com/llvm/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:111:37
>  #1 in ScTokenArray::Clone() const at engine/sc/source/core/tool/token.cxx:1901:24
>  #2 in ImportExcel::Formula(XclAddress const&, unsigned short, unsigned short, double, bool) at engine/sc/source/filter/excel/excform.cxx:126:70
>  #3 in ImportExcel::Formula25() at engine/sc/source/filter/excel/excform.cxx:72:5

Signed-off-by: Stephan Bergmann <stephan.bergmann@collabora.com>
Change-Id: I2ce67e89c24fee8e1bdfa7baf40ce02783637254
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/4962
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
(cherry picked from commit e4161389322e3f096e3b1537058a94e0636eaeaa)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207469
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-07-08 18:00:08 +02:00
Ben Urban 58c2fbaea0 Fixed some typos in comments and metadata for LET
Removed LET from sc/README.md's list of functions supporting
wildcards and regular expressions, since it doesn't interact
with either.

Changed LET's return type from ForceArrayReturn to Value, since
it usually doesn't return an array.

Change-Id: I99168d274483ddea5ba338d4e019cf433fe88c45
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205977
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-06-29 14:45:57 +02:00
Tomaž Vajngerl 6f1fb25a94 sc: add @ prefix operator for opting out of array spill
The @ operator collapses an array operand to its upper-left value.
It is the implicit-intersection prefix used to opt a formula out
of the dynamic-array spill behaviour. =@SEQUENCE(4) returns 1
instead of the four-row spill.

The new ocSingleValue opcode joins the unary-operator range so the
existing compile and interpret machinery treats it like any other
unary prefix. The @ character stops being part of name syntax in
the OOXML grammar, so sheet names that contain @ have to be quoted
from now on.

In-session only for now. The operator is parsed and interpreted
but not yet serialised into XLSX or ODS.

Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Change-Id: I18cf56e34f933ebb7f6e43c157618c9fe28dbe0f
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/4172
Tested-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit fbd04d7c394ad7445a667bf63820f88551b176e1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206673
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-06-16 09:14:42 +02:00
Noel Grandin 716be93f00 drop the SC_OPCODE constants
now that we have moved the code to use the OpCode oc* constants

Change-Id: I00b0fe8f490803fc9a74f3c7a87d13da4b34ce58
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/1819
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit fc05fda4b467ce7932a6341c8e98469964abdac6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206193
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-06-08 10:09:40 +02:00
Noel Grandin 114bc67a2d Convert from using SC_OPCODE_ constants to use oc* constants
so that we can standardise on a single enum

Change-Id: I2c9347a5ee59c8b8f0bb199b22ea51ca94ecf8c3
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/1795
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 5b4826b51eee143a564dfa94ed50ab89cc36216b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206192
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-06-08 10:09:29 +02:00
Noel Grandin 0c55b6e0b3 rearrange OpCode order to match SC_OPCODE order
as a prelude to removing the SC_OPCODE constants and
just using a single enum for this stuff.

we need the order to match because when we switch
to using OpCode only, several parts of code check
for ranges of enum values.

Change-Id: I83cdca016b5fe9ab2486385593ab233eff393538
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/1767
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 4009c9873f1c32f23b43fd51bd15dc159bae5b98)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206191
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-06-08 10:09:19 +02:00
Michael Weghorn f26084217a weld: Move weld::Button to own header/Rename weld.hxx
In the past, weld.hxx used to contain the class
definitions for weld::Widget and all subclasses.

By now, weld::Widget and almost all subclasses have
been moved to separate headers, to make it easier
to keep the overview and to avoid having to
recompile ~all UI code when one class changes.

By now, only weld::Button is left in weld.hxx.
Rename the header to Button.hxx.
Drop weld.hxx includes and instead add Button.hxx
includes (or weld::Button forward declarations) where
weld::Button is used.
(Don't simply replace all weld.hxx includes with
Button.hxx ones, since many of them were for the
use of other widgets that have since been moved
to their own headers.)

Add further includes where needed now that the
(direct or transitive) includes of weld.hxx were removed.

Change-Id: I8ea6201446a418d5e38b46337059dcd517ee29d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205937
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2026-06-05 07:58:07 +02:00
Xisco Fauli 6f81bce807 loplugin:unusedmethods
Change-Id: I57a535f72e639a9b708c5c7dc1790e354d2d477e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205943
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-06-04 10:00:29 +02:00
Michael Weghorn 336f70f966 weld: Move weld::Label to own header
Move the class out of weld.hxx into its own header, in
order to make it easier to keep an overview and to avoid
having to recompile ~all UI code when the class is
modified.

Change-Id: Ide86f35543468a88288a068cc9f89eaf381ac52f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205763
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2026-05-27 22:24:37 +02:00
Tomaž Vajngerl 768a051ec5 sc: Preparation for dynamic-array spill handling
Add a compile-time flag on FormulaTokenArray for formulas that use
a dynamic array function (UNIQUE, FILTER, SORT, SORTBY, SEQUENCE,
RANDARRAY, DROP, EXPAND, HSTACK, VSTACK, TAKE, CHOOSECOLS,
CHOOSEROWS, TEXTSPLIT, TOCOL, TOROW, WRAPCOLS, WRAPROWS). Set by
the compiler when such an opcode appears. Later commits consume
this flag to decide whether a matrix formula is eligible for spill
or auto-resize.

Also fix GetMatrixFormulaCellToken - it used to hide the matrix
token whenever a result error was set, because GetType() returns
svError. Inspect mpToken directly so the token survives error
state. Later commits need the matrix dimensions of a #SPILL! cell
to be readable.

Change-Id: I63c196553762c77b9a64321a2fe9359ee06f6944
Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/1815
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 1ea485c5df618a7ff10c0b8b135d537ce06d94ed)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205684
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-25 16:29:59 +02:00
Noel Grandin 8f6c2c38eb reduce FormulaByteToken virtual calls
similar to
  commit f47fc9a67f16a3da1e5cbcc8b821682298ec90b3
  reduce ScRefListToken virtual calls

Push the Get/Set-Byte() methods down to the only subclasses
that actually use it.

Change-Id: I990e45baccb00657600ecf62004a67849ede2f62
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/1008
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit d3ab7f03ee98fb23ab1b9c6a0e5f18874603f46d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205601
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2026-05-24 10:28:55 +02:00
Noel Grandin e22c8988d2 prefix pc field in FormulaCompiler
Change-Id: I2b7b78d6a9df1103084ac4a50d39e452645b4e5f
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/1392
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 431e8c9e9a6a7e476e8240c6c8781e2344b558ea)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205600
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2026-05-24 09:05:43 +02:00
Noel Grandin 3a57fe4450 prefix fields in FormulaCompiler
Change-Id: Ib03b15f069d21dccaa585e0577c43c91fabb046c
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/1391
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit c1020ea6fe5e8eb85b756857b0e80bbe1d560c4d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205598
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2026-05-24 09:03:58 +02:00
Noel Grandin 1d8cf993df reduce Sc*Ref*Token virtual calls
similar to
  commit f47fc9a67f16a3da1e5cbcc8b821682298ec90b3
  reduce ScRefListToken virtual calls

Push the Get/Set-Ref*() methods down to the only subclasses
that actually use it.

Change-Id: Idf56c7c1fc2340438add93e11a549824461b80a8
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/1243
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 003c0007c13e443fe4e520d1b70586266abf7811)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205579
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2026-05-23 21:47:06 +02:00
Noel Grandin af6e41b327 reduce virtual calling in Sc*Ref*Token
similar to
  commit f47fc9a67f16a3da1e5cbcc8b821682298ec90b3
  reduce ScRefListToken virtual calls

Push the GetIndex() method down to the only subclasses
that actually use it.
And take the chance to rename them to something more meaningful.

Introduce an inbetween ScExternalToken class to represent
tokens that have an external file id.

Change-Id: If45e87a5bb66aeb1c65d82121b430b886b53f20b
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/955
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 7705899fa7bca501f331070f7969374fcf5f52e9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205576
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2026-05-23 13:14:34 +02:00
Noel Grandin 0bad6cbf40 reduce virtual calling in String*Token
similar to
  commit f47fc9a67f16a3da1e5cbcc8b821682298ec90b3
  reduce ScRefListToken virtual calls

Push the GetString() methods down to the only subclasses
that actually use it.

We change the inheritance hierarchy a little here
-class FORMULA_DLLPUBLIC FormulaStringOpToken final : public FormulaByteToken
+class FORMULA_DLLPUBLIC FormulaStringOpToken final : public FormulaStringToken
because FormulaStringOpToken and FormulaStringToken share
a type svString which makes it hard to decide which subclass we
are handling.
So now we can check for GetType() == svString and then
cast to FormulaStringToken safely.

Change-Id: I3f087d65a2297b2d8fb5213e81987e0001bc1c62
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/1152
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 8710f98c1565b1d8ecbbbec743b29bcbb38c5ce2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205569
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2026-05-23 09:01:44 +02:00
Michael Weghorn 1a3d6d5cdf weld: Move weld::Frame to own header
Move the class out of weld.hxx into its own header, in
order to make it easier to keep an overview and to avoid
having to recompile ~all UI code when the class is
modified.

Change-Id: Ia7bc570fcd463d9adcbcdad070250cec5bc3b949
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205488
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2026-05-22 21:56:45 +02:00
Noel Grandin 9cfdd6b430 reduce virtual calling in ScFormulaDoubleRefToken
similar to
  commit f47fc9a67f16a3da1e5cbcc8b821682298ec90b3
  reduce ScRefListToken virtual calls

Push the GetDoubleRef() methods down to the only subclasses
that actually use it.
Which means we can return a ref instead of a pointer,
since we now never return nullptr.

Change-Id: I4dfce551e985fe20db00d3a0694ed99f20f87731
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/1050
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 9aab43b4e3a68cd833eddfdd11086f03e55f2c1a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205508
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2026-05-22 20:28:02 +02:00
Noel Grandin 724306c6a5 reduce virtual calling in ScMatrix*Token
similar to
  commit f47fc9a67f16a3da1e5cbcc8b821682298ec90b3
  reduce ScRefListToken virtual calls

Push the GetMatrix() methods down to the only subclasses
that actually use it.

Change-Id: I52c17941a5ec015d56dd300f1421fe5a2bb8ad3c
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/954
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 8cbc57006c7836d8959add41cb6af68ef22a7a5f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205371
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-05-20 07:42:14 +02:00
Noel Grandin 140fbc4621 reduce virtual calling in FormulaDoubleToken
similar to
  commit f47fc9a67f16a3da1e5cbcc8b821682298ec90b3
  reduce ScRefListToken virtual calls

Push the GetDouble() methods down to the only subclasses
that actually use it.

Change-Id: I999eb613f958fb24947e7656fe0e31d41e8f3aa3
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/967
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 54ffe7987829ef4c406a99f272159f58a9f30581)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205300
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2026-05-19 07:40:43 +02:00
Noel Grandin 575cea002f reduce virtual calling in FormulaIndexToken
similar to
  commit f47fc9a67f16a3da1e5cbcc8b821682298ec90b3
  reduce ScRefListToken virtual calls

Push the GetSheet() method down to the only subclasses
that actually use it.

Change-Id: Ibaa3902cd097662127c5dd35af937a9163195a45
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/932
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 203fb0e436294f9f34a2bb9714efa72b9ec101fe)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205272
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-05-18 07:43:00 +02:00
Noel Grandin 83c887bdef reduce virtual calling in FormulaJumpToken
similar to
  commit f47fc9a67f16a3da1e5cbcc8b821682298ec90b3
  reduce ScRefListToken virtual calls

Push the GetJump() method down to the only subclass
that actually uses it.
And also make the GetJump() method have proper const semantics.

Change-Id: I4e7053bf18c9dedbacfc2608e5b2d5f7738487ca
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/910
Tested-by: Noel Grandin <noel.grandin@collabora.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 6e6129eb1cf13e813de17fdc41f59ee50a891762)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205271
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-05-17 23:16:23 +02:00
Noel Grandin 83dfd80774 reduce virtual calling in FormulaFAPToken
similar to
    commit f47fc9a67f16a3da1e5cbcc8b821682298ec90b3
    reduce ScRefListToken virtual calls

Push the GetFAPOrigToken() method down to the only subclass
that actually uses it.

Change-Id: Iac66fc21b71e2ecf08b7eb5669705797c393ca7e
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/909
Tested-by: Noel Grandin <noel.grandin@collabora.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 24cd3d084191af5f1f925d89ed99986dd8275e2f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205266
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2026-05-17 22:02:16 +02:00
Noel Grandin f8c6890b51 reduce virtual calling in ScJumpMatrixToken
similar to
  commit f47fc9a67f16a3da1e5cbcc8b821682298ec90b3
  reduce ScRefListToken virtual calls

Push the GetJumpMatrix() method down to the only subclass
that actually uses it.

Change-Id: I74f6bb889178a97a4c5fb7820cbd56173c370d8f
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/792
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 8ddef1a007ca1635a34aa423f68dcbebda286ceb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205263
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2026-05-17 18:22:06 +02:00
Noel Grandin ef144db15a reduce FormulaErrorToken virtual calls
similar to
    commit f47fc9a67f16a3da1e5cbcc8b821682298ec90b3
    reduce ScRefListToken virtual calls

Push the GetError() method down to the only subclasses
that actually use it.

Change-Id: I89625fea668f89d0be5c1c4f36cbb1676b050f9e
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/833
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 849a4167ab2ac248c8fcb93ea761f807324ec547)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205261
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2026-05-17 16:32:55 +02:00
Noel Grandin e8363140b8 reduce ScRefListToken virtual calls
The existing FormulaToken method call structure is weird.
Methods that can
only be usefully be implemented by subclasses should only
exist in those subclasses.

So start the process of pushing those virtual methods down to
subclasses, where they mostly no longer need to be virtual.

This means more casting of pointers and references to subclasses
so add some utility templates functions to make that less
verbose i.e. PopToken<T>

Also return more specific sub-class type in the subclass Clone
method.

Change-Id: I97722b1c9ef9cf952928777767552ac7a5f47b56
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/790
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Reviewed-by: Balázs Varga <balazs.varga@collabora.com>
(cherry picked from commit f47fc9a67f16a3da1e5cbcc8b821682298ec90b3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205258
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2026-05-17 14:37:10 +02:00
Noel Grandin 86e6220fff reduce FormulaDoubleToken virtual calls
similar to
  commit f47fc9a67f16a3da1e5cbcc8b821682298ec90b3
  reduce ScRefListToken virtual calls

Push the GetDoubleType() method down to the only subclasses
that actually use it.

Change-Id: I246421597fab589009ad2b5bbb62ba3b85abd9d8
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/823
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit e0e5eb845c542b2f67bf8e4287e9ee6b731f2a36)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205255
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2026-05-17 13:01:52 +02:00
Noel Grandin ac89efe483 reduce FormulaExternalToken virtual calls
similar to
  commit f47fc9a67f16a3da1e5cbcc8b821682298ec90b3
  reduce ScRefListToken virtual calls

Push the GetExternal() method down to the only subclass
that actually uses it.

Change-Id: I26281a30a8a8a32b4b6d28f3b5a24aa94814f953
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/822
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit f59c512a885ae4264ba9f7b8fe4d7b9574a2a0dc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205254
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2026-05-17 10:50:32 +02:00
Noel Grandin b96243ffd2 reduce FormulaSpaceToken virtual calls
similar to
  commit f47fc9a67f16a3da1e5cbcc8b821682298ec90b3
  reduce ScRefListToken virtual calls

Push the GetChar() method down to the couple of token
subclasses that actually use it.

Change-Id: I2b90a90e8ad1d374bd6a48fb4fcbeb20bf3d2858
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/821
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit c0770092833919f002f3872772247d814f8cff4f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205239
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2026-05-16 23:01:49 +02:00
Tomaž Vajngerl bcbd784ca8 sc: Add #SPILL! error if a Calc array formula spills (is blocked)
If there is content in the way where an array formula would write
it's result, don't just overwrite the content, but produce a spill
error instead (#SPILL!) in the first cell of the array.

Change-Id: Ic2c31d638e2d4e51078a466e7f7b6f04ca6de417
Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/1727
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit a564bb54cb40af3ccf1c8e6c9ba4c56ae8b56da4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204872
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-06 20:45:04 +02:00
Karthik Godha 1f5c17cc84 sc: Add new ocUDExternal token for user-defined functions
Excel uses "_xludf." prefix for formulas containing unkown external
functions. A new token ocUDExternal is created to handle unknown
external functions

bug-document: forum-mso-en4-352508.xls
Change-Id: If08469e496ff76bb8b912211bd82c67363711d74
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199631
Reviewed-by: Balazs Varga <balazs.varga@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204130
Tested-by: Jenkins
2026-04-23 12:44:43 +02:00
Noel Grandin 4b4be2f51d tdf#166226 avoid some allocation traffic
Shaves 5% off the load time

Change-Id: Ie8702b4a5c5d9d37b326e3532970ef26622c7cc1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202256
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2026-03-21 08:26:17 +01:00