Commit Graph
568 Commits
Author SHA1 Message Date
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
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
Tomaž Vajngerl e703f728ff sc: wrap the # operator in _xlfn.ANCHORARRAY on XLSX export
XLSX stores the # spilled-range operator as the prefix call
_xlfn.ANCHORARRAY(<ref>). The exporter emitted the bare #
glyph, which older readers reject.

The operand is already in the buffer when the parse walk
reaches ocSpill, so CreateStringFromTokenArray keeps a
per-parenthesis-depth stack of where the current factor
began. ocSpill splices _xlfn.ANCHORARRAY( at that position
and closes at the buffer's end.

For =@A1# the # binds tighter than @, giving the nested form
_xlfn.SINGLE(_xlfn.ANCHORARRAY(A1)). EmitSingleValueOperandOOXML
splices ANCHORARRAY around the operand and consumes the
trailing ocSpill, so the main loop does not wrap it again in
the wrong order.

Tests check the ANCHORARRAY form in the saved XML and
round-trip an imported spill formula through save and reload.

Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Change-Id: I9e92350d2574adeebf44fae903ee32dd63654d7c
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/5789
Tested-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit 89715a92489305230b52f2874d768dc117a71eee)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207907
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-07-10 01:09:50 +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
Tomaž Vajngerl 14d723ea36 sc: let @ collapse arrays from range arithmetic, not just functions
The @ operator collapses an array operand to its upper-left
value. A function operand like SEQUENCE pushes a matrix and @
collapses it. A range arithmetic operand like (B2:B3+0) does
implicit intersection first and hands @ a scalar, so @ has
nothing to collapse.

Mark @'s operand as ForceArray in the parameter classifier and
wrap UnaryLine in a CurrentFactor scope so the classification
reaches the nested operators. Range arithmetic inside @ then
materialises as a matrix and reaches @ for the upper-left pick.

testSingleValueOperator covers @ on a range expression and a
chained @ binary.

Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Change-Id: I7f59bfa1efbceeceb9a3d7f71a0243e9a521b24a
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/5517
Tested-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit 4148cbecbdaa3164c53d3869252a3ca714ba5726)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207868
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-09 17:08:49 +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
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 5286d91e80 sc: round-trip dynamic-array masters and @ through ODF
Import classifies each formula cell:
- Plain non-array, no coext:spill: the import-time walk over
  the freshly compiled RPN decides if the formula intends an
  array. If yes, prepend @ at the front of the parse and at
  the back of the RPN.
- Plain non-array + coext:spill="true": a master saved while in
  spill state. Comes back at 1x1 with the dynamic flag, the
  position marked spilled. The next interpret re-checks the
  blockers.
- Array formula (matrix dims): static array master by default.
  coext:spill="true" promotes it to a dynamic-array master.
  Legacy Ctrl+Shift+Enter (CSE) arrays without the marker keep
  their static iteration-and-pad behaviour.

Export reverses:
- ODF always strips @ on save. The @ is an in-memory marker
  only. OOXML and the UI grammar keep it.
- Dynamic master: coext:spill="true" in extended ODF, matrix
  dims as before. In spill state, write as plain non-array with
  coext:spill="true".
- Static array master: matrix dims, no coext:spill.

GetFormula skips the {} wrapping for dynamic-array masters so
they read back as plain formulas. Static array masters keep {}.

XML_SPILL is added to the xmloff token machinery and the ODF
extension schema (OpenDocument-v1.4+libreoffice-schema.rng)
gains coext:spill on table-cell.

Tests cover each import shape, the FODS export of regular and
spilled masters, the @ insertion on CompileXML, and the @
stripping at the formula-compiler level. ArrayFormulasStatic.ods
is a legacy fixture whose B1 = AND(C4:C52) summarises 49 per-row
value checks. The test runs the grid on import and after an ODS
round trip and confirms plain bare-range cells gain @ while the
five matrix masters stay static, keep their {} wrapping, and
get no coext:spill in the saved XML.

Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Change-Id: Ib8ae345528185c824415ec5d039b6d5cf0d7eac8
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/4663
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
(cherry picked from commit a21f6a3a0eae72fef90576d249d96dc00beeb2c5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207171
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-06-24 00:04:16 +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
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
Caolán McNamara 9bdfe90546 crashtesting: fix FormulaCompiler::Factor crashes
crash on loading bugtrackers/xls/ooo25114-1.xls (etc)

 #0  0x00007f118813ea61 in rtl::OUString::equalsAsciiL (this=<optimized out>,
     asciiStr=0x7f118814e760 "com.sun.star.sheet.addin.Analysis.getRandbetween",
     asciiStrLength=48) at engine/include/rtl/ustring.hxx:1255
 #1  0x00007f118813ff1a in rtl::operator==<char const [49]> (rString=<optimized out>,
     literal=...) at engine/include/rtl/ustring.hxx:2130
 #2  0x00007f118813c2a8 in formula::FormulaCompiler::Factor (this=0x7f11697fbe10)
     at engine/formula/source/core/api/FormulaCompiler.cxx:1743
 #3  0x00007f118813d274 in formula::FormulaCompiler::CompileTokenArray (this=0x7f11697fbe10)
     at engine/formula/source/core/api/FormulaCompiler.cxx:2429
 #4  0x00007f450a8dfe4a in ScFormulaCell::ScFormulaCell (this=0x7f4504e5a260, ...)
     at engine/sc/source/core/data/formulacell.cxx:701
 #5  0x00007f451675c6fe in ImportExcel::Formula (this=0x7f4504444ef0, ...)
     at engine/sc/source/filter/excel/excform.cxx:150

since:

commit f59c512a885ae4264ba9f7b8fe4d7b9574a2a0dc
Date:   Mon Apr 13 15:36:11 2026 +0200

    reduce FormulaExternalToken virtual calls

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I1d578b329d120fb55f3ad47ea5d1acdfed6a5cdc
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/2010
(cherry picked from commit 796aee17c6a78ac725eaa35270add93335412559)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205959
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-06-03 20:33:00 +02:00
Noel Grandin 62f1a275e1 ofz#516502581 Heap-buffer-overflow
regression from
  commit 726a1ff3abce3a4eff5dd115182b15eccb653568
  reduce FormulaByteToken virtual calls

Change-Id: Ica3e5a6c32f03cfdb215eb3ab78d74284e951094
Signed-off-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/3497
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 15d5ebba4151353127ddcb41aa2824dbe283788f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205883
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-06-01 20:50:20 +02:00
Tomaž Vajngerl 50e2176ab5 sc: Auto-expand and contract dynamic array formulas
Grow or shrink a matrix formula's declared dimensions to match its
interpreted result size. With this, clearing a blocker lets the
array spill across its full range; shrinking the source data
removes the stale trailing cells. Blocking an already-expanded
array collapses it back to the origin with #SPILL!.

Deferred resize queue: inserting or deleting cells inline from
Interpret (or during grid-repaint iteration) would invalidate the
caller's iterator. Queue resizes in the document and drain them
from safe points, guarded by a MatrixResizeGuard helper around
each cell-iteration scope.

Change-Id: I74376427e707fd84c36034fe6a64105e4a5f74fa
Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/1817
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 76b6825e4d237869cb32889b250277be693a2c5f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205686
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-25 16:30:27 +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
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 9cbc2fde79 sc: Error constants are parsed incorrectly
This is a regression from 2302e1d6e7ac1591266d14c7bb63724442003659,
before the commit, error constants were parsed as ocBad opcode which was
handled by the compiler. After the commit error constants parsed as
ocPush with `svError`, this was not handled in the compiler.

bug-document: forum-mso-en4-90234.xlsx
Change-Id: I7ce11644219c42dd4eae673b32d07880d7f7e926
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/1302
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Reviewed-by: Balázs Varga <balazs.varga@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 3ede05ee4c0fa34b3fdc718d4f22714ea903d373)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204849
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-05-06 10:57:05 +02:00
Karthik af11368710 sc: Use "#REF!" for invalid ocPush tokens
Invalid ocPush tokens are not handled in the FormulaCompiler

bug-document: forum-mso-de-103430.xlsx
Change-Id: I1e0cb7d5db7f0050c7d553ba30049737015f666b
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/747
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 0a8c627e725fb4c9666aa7307db15a5515958485)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204494
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-04-29 10:36:55 +02:00
Ujjawal Kumar bdd8e304ee XLSX: Export reference arg as #REF! for offset func if it has illegal param
Bug document: fdo85685-1.ods

The above document contains formulas like `OFFSET("'discussion calls'!cat",0,2)`
which when exported to xlsx produces error due to the first arg being a string.

Export the above formula as `OFFSET(#REF!,0,2)`.

Also export #REF! for numbers as the first argument as they also
produce illegal parameter error.

Change-Id: I2c908e20876d95b7474b6610c138175368c2f28c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202496
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Balazs Varga <balazs.varga@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/162
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
(cherry picked from commit 3b50ad3cd2f62333ae4b799d2dde5041647cae64)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204493
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-04-29 10:36:47 +02:00
Ujjawal Kumar 8d967b051c XLSX: fix export of #NAME? followed by a ref in formulas
Bug document: ooo88173-1.ods

Make sure to not write #NAME?ref. Instead replace
it with just #NAME?

The above document when exported to xlsx produces an
invalid OOXML formula "#NAME?C7". This is due to the
original document containing a conditional formatting
having the formula "cell-content()!=#NAME?[.$C7]".

Change-Id: If0d4cd1986e8a79f312923e1b9e0d00974b609fd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202223
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202709
(cherry picked from commit 71d551828bf8f79426981b89ad7e66ca43329826)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204492
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-04-29 10:36:31 +02:00
Karthik Godha d2ef7090de sc: Include error constants in OpCodeMap
When importing formulas of data validataion, we use a custom OpCodeMap
which doesn't include error constants. Because of this invalid
external references are not properly being imported which was fixed
with (e3d17e1abca66cb01f7420fb8003eefd573b00e9)

bug-document: forum-de2-6391.xlsx
Change-Id: I3a79910d7dad95009ea4de6a36f181d76680d320
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/59
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Balázs Varga <balazs.varga@collabora.com>
(cherry picked from commit 2302e1d6e7ac1591266d14c7bb63724442003659)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204475
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-04-28 09:46:39 +02:00
Karthik Godha 0ff5e85c73 XLSX: Use "#REF!" for invalid user-defined functions
This is a regression from bce84f279755171addf29b61f4e8b09e89026c44,
for empty user-defined functions use "#REF!"

bug-document: forum-mso-de-49320.xls
Change-Id: I67d43b8adaf53c1d54aaf91db58dfff3b005310d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201983
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
(cherry picked from commit 66e7fb01de87ad8cb15fe56539549eca158e7ab6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202812
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204260
Tested-by: Jenkins
2026-04-25 10:19:05 +02:00
Aron Budea d7b20f68c1 formula: check if next token exists before dereferencing
Can cause crash with a number of XLS files, eg. ooo40608-1.xls,
fdo58541-1.xls, forum-mso-en4-73512.xls

Happens since bce84f279755171addf29b61f4e8b09e89026c44.

Change-Id: If7def874f7c10701a921ed947620afd14da43b69
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201814
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Balazs Varga <balazs.varga@collabora.com>
(cherry picked from commit 3fdf14069f6629cc9662eb693c2935036d8b8f7b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202647
Reviewed-by: Aron Budea <aron.budea@collabora.com>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204259
Tested-by: Jenkins
2026-04-24 16:00:24 +02:00
Karthik Godha e60a3cb6d7 XLSX: Excel needs atleast 4 arguments in ACCRINTM function
In LO, ACCRINTM function is valid with just 3 argumnets, but Excel needs
atleast 4 arguments.

https://support.microsoft.com/en-us/office/accrintm-function-f62f01f9-5754-4cc4-805b-0e70199328a7

bug-document: ooo70041-3.xls
Change-Id: Ib1eb9dc30e407c33f8044dfef621edb7480e28ed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202856
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204228
Tested-by: Jenkins
2026-04-24 14:16:33 +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
Karthik Godha 3fecafa693 XLSX: Infinte loop during formula creation
This is related to b58f026ebd91a9eda62cccb188b559bd4f2d70cf, condition
for invalid external refs is not handled properly.

Change-Id: I597a02fdee967f170b09ffe2b529dc114491291a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199632
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
(cherry picked from commit 5465c05150db3ff476bed27f573571c38d7ba249)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200609
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204121
Tested-by: Jenkins
2026-04-22 20:03:58 +02:00
Karthik Godha 634ef3b31d sc: Invalid external refs in conditional formatting
Use "#REF!" for invalid external refs in formulas. The bug-file contains
invalid external ref in it's conditional formatting.

bug-document: forum-mso-en4-335846.xls
Change-Id: I19f179e0b4cff8ca6db3de8678e01d287fbbe61b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199444
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
(cherry picked from commit b58f026ebd91a9eda62cccb188b559bd4f2d70cf)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200408
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204094
Tested-by: Jenkins
2026-04-22 17:16:04 +02:00
Balazs Varga 6a69c9e2ac tdf#78486 sc: add pivot table calculated field support (core + OOXML)
Introduce calculated field infrastructure across the pivot table stack:
cache (ScDPCache::CalculatedField), filtered cache, data sources
(ScSheetDPData, ScDatabaseDPData, ScDPGroupTableData), result
calculation (ScDPTabRes), dimension supplier (ScDPSource), and
save/restore (ScDPDimCalcSaveData). Add new ocDPFieldName opcode
and formula compiler support for pivot field references.
Handle OOXML import/export of pivot calculated fields.

Change-Id: I42d094122d547b8ee9a2b63f809bdb13127f8f01
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197913
Tested-by: Jenkins
Reviewed-by: Balazs Varga <balazs.varga@collabora.com>
2026-03-13 08:05:40 +01:00