8055 Commits
Author SHA1 Message Date
Michael Meeks e1b35f0bb1 sc: forward declare ScDrawView in tabview.hxx.
tabview.hxx included drawview.hxx for a std::unique_ptr<ScDrawView> member
and an accessor that returns the raw pointer. Neither needs the complete
type, and the destructor of ScTabView is already out of line. The include
dragged svx/fmview.hxx, svx/view3d.hxx, svx/svdview.hxx and the rest of the
svx view class chain into the 200 translation units that include the view
shell headers.

tabvwsh.hxx and tabview.hxx now include the small headers they used through
that chain, and the files that call into the draw view include drawview.hxx
themselves.

clang -ftime-trace says around 2% of the module build time saved here.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I198b19e74f6ad56090b987880a063dc9ee677cda
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12683
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit a7fd69666ea5fb4d26dfad0d286f6c1f3bcd3144)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211884
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-10-07 12:18:06 +02:00
Caolán McNamara 59caa00aba put refreshing database range imports under the link update control
like area links, sheet links, DDE and data mappings, so the refresh
timer waits until link updates are allowed, and a database range that
re-imports on a refresh delay counts as an external link so the
update links infobar is offered for it

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I470e80249cdbf5c4c65c7888e9873515b238d1a6
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13975
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 783c4ec2b092231fce5e87cb1a7451773cea7018)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211797
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-10-06 09:57:15 +02:00
Caolán McNamara 0eaa944aa5 put calc pivot table database sources under link control
like refreshing database range imports, so a pivot table whose source
is a database document named by URL, rather than a registered data
source, waits until link updates are allowed before it opens it, and
counts as an external link so the update links infobar is offered

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I90a921ef6c4346da53f4cb28f099518221bd87f7
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/14114
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 0d27a2394257fe817160ed4092aecd4168b792e5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211721
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-10-05 08:55:31 +02:00
Julien Nabet 2bcd6f7063 tdf#144175: Remove strings from l10n in html export
+ convert datetime to ISO format

Result:
        <!-- Doc.Information -->
        <!-- Printed: by Firstname Lastname on 2026-10-01T21:31:34,817333179 -->

For the change of lcl_AddStamp, I used GPT 5.6 Luna.

Change-Id: Ia73e9c00f17653aa5ab491c4bbc1d3d933105836
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211696
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2026-10-02 10:21:17 +02:00
Caolán McNamara 51744f6265 don't load the document Basic to parse formula names during ODF import
While macros are not yet allowed, a called name is kept as a macro
call if the document has Basic libraries at all.

A cell macro call now decides the macro mode before it loads the
document Basic.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I2f33b51490db8515cd74d5e753bb9a18c5e6a587
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13626
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit d17fd31994d71c28f503bb3cc93471c307756627)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211523
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-30 08:44:12 +02:00
Xisco Fauli 9c14148d06 Revert "tdf#173608: reapply "sc: Fix backward reference when copying a sheet""
This reverts commit c2e373869e.

The issue is still reproducible as I tested it incorrectly

Change-Id: Ie54d49a8ef730e4c91fdc855c6f477465ae99ad6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211559
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-29 15:59:05 +02:00
Xisco Fauli a05828e021 Revert "tdf#173608: sc: fix relative sheet refs of a sheet copied before its source"
This reverts commit a1e5a20bd9.

The issue is still reproducible as I tested it incorrectly

Change-Id: I04c0e18ace65649b816ebbcb4ae16edbefc1a193
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211558
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-29 15:58:47 +02:00
Michael Meeks 645434b713 sc: include sheetlimits.hxx instead of document.hxx in tokenarray.hxx.
ScTokenArray only uses ScDocument through references, so the header needs
a forward declaration. The rtl::Reference<ScSheetLimits> member with the
defaulted copy constructor still needs the small sheetlimits.hxx. This
removes document.hxx from the 15 translation units that reached it only
through tokenarray.hxx, about one second of compile time each.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Ie467d7297f7b02ed474114e7840e0ec52f1624aa
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12679
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 3c5d299ff6f767841bd8a781ca3ca200a8f12d2e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211315
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-28 21:33:17 +02:00
Tomaž Vajngerl a1e5a20bd9 tdf#173608: sc: fix relative sheet refs of a sheet copied before its source
Copying a sheet to a position at or before its source left the
relative sheet references in the copy pointing at the wrong
sheets, one or two places too far to the right. CopyTab moves the
source index by one when the new sheet is inserted before it, and
AdjustRelativeTabRefs received that moved index. The offsets in
the cloned formulas still count from the position that the source
had before the insert.

Pass the source position from before the insert instead, which is
the same one that CopyTab already gives to the range name copy.

This follows "sc: Fix backward reference when copying a sheet"
(Ie32d0ceac34525ccaf13aed8fb9630ae42d4225e), which fixed copies
placed after the source.

Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Change-Id: I063818265e0d56498bc9e09f04f85d3f5191b4d2
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13662
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 2539d0afe0d68409f5e43b2d92c4d85b697566cd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211515
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-28 17:38:38 +02:00
Xisco Fauli c2e373869e tdf#173608: reapply "sc: Fix backward reference when copying a sheet"
This reverts commit 3da93d717e.

tdf#173608 is going to be fixed in a follow-up patch

Change-Id: Ib742c5df90f26e0be05ed0dfa696ff2f398000eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211514
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-28 17:38:33 +02:00
Xisco Fauli 3da93d717e tdf#173608: Revert "sc: Fix backward reference when copying a sheet"
The reverted commit changed the way references are handled when
copying sheets in order to mimic how Excel behaves.
However, LibreOffice behaves differently (tested back to
LibreOffice 3.3) so the change might break the workflow of
many users (https://xkcd.com/1172/)
The proper way to address this would be by adding a new
config option, so users can choose how LibreOffice behaves,
but that needs to be implemented in a different patch.

This reverts commit 5cefed66bc.

Change-Id: I16636e80de52328ef4c89a11da899b9e33b6aa00
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211421
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-24 16:13:59 +02:00
Michael Meeks 94a89768af sc: forward declare ScDrawLayer in document.hxx.
document.hxx included drwlayer.hxx, and with it svx/fmmodel.hxx,
svx/svdmodel.hxx, svx/svdundo.hxx, svx/xtable.hxx and editeng/outliner.hxx,
in all 700 translation units that use ScDocument. The only place in the
header that needed the complete type was the inline destructor of
sc::DrawUndoGuard, which now lives in documen9.cxx next to
ScDocument::BeginDrawUndo. The ScObjectHandling enumeration, used as a
default argument of SetLayoutRTL, moves to types.hxx so that both headers
can see it.

The files that used the drawing layer or the svx model classes through this
include now include drwlayer.hxx themselves, and a few headers that relied
on the same chain for TranslateId, Idle or SvStream get the header or
forward declaration they need.

clang -ftime-trace suggests this is 6% of the sc build time.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Id723c46ef0c881428ab1d9a2e9a642713a92e79e
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12681
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 3e8fd8cd92ff57aaef5ba9d4b71933700ee3f83b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211316
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-22 21:02:36 +02:00
Andreas Heinisch eb7f840b0d tdf#43003 - Matrix formulas must respect AutoCalculate
Since cb884d1bdf matrix cells ignored the document's AutoCalculate
setting. This caused them to recalculate on cell access while normal
formulas waited for a recalc.

Exempting only follow-up cells does not work either. They can read a
stale matrix from the origin and clear their dirty flag.

Drop the exemption entirely. F9 enables AutoCalculate, so ScMatRef
recalculates the origin when needed.

Change-Id: Ie7e9c05d7a74f92672180c64f0b154f03babdfa5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211287
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Tested-by: Jenkins
2026-09-21 18:30:23 +02:00
Mike Kaganski cfbbd638ab tdf#168638 sc: tag a database range's labels as TH
Mark a table with Data - Define Range and the option "Contains
column labels", and export with File - Export as PDF and Tagged PDF
on. Every cell of the range comes out the same:

 <</Type/StructElem/S/TD /P 7 0 R /Pg 1 0 R /K[9 0 R ]>>

so nothing in the file marks the row that names the columns.

The label cells are TH now:

 <</Type/StructElem/S/TH /P 7 0 R /Pg 1 0 R /A <</O/Table/Scope/Column>> /K[9 0 R ]>>

A range sorted left to right holds its labels in the first column and
gets /Scope/Row there. A range Calc defines itself for a sort or an
AutoFilter counts the same, on the header row it guessed.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I5f4d3ec709f330604d518e1bf0c89c1655b18816
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12657
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 8a524317421379ba257fcfba04f63f06da7cdcc1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211174
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-21 00:21:15 +02:00
Mike Kaganski fe55fbaa27 sc: tag a sheet the page range starts inside
Export a two-sheet spreadsheet with File - Export as PDF and a page
range that leaves out the second sheet's first page - "1;3" where
that sheet spans pages 2 and 3. The file gets one bookmark where it
should get two, the second sheet having none. Switch Tagged PDF on as
well and it also carries one Worksheet element, holding both sheets:

 5 0 obj<</Type/StructElem/S/Worksheet/P 4 0 R/Pg 1 0 R/K[6 0 R 22 0 R]>>

where 6 is the first sheet's table and 22 the second sheet's.

The per-sheet work ran on

 nRenderer == nTabStart || bIsFirstPage

but the renderer index is the page's own index in the document and a
page outside the range is never rendered at all, so a sheet whose
first page is left out never reaches it. It asks whether the sheet
changed since the last rendered page now.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I158feb5ca4a6f4501e6dfdf5234c8fdf75b8ee40
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12571
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 49e441a059f98d703ce2bddd5b0eabf80b7144aa)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211173
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-21 00:21:10 +02:00
Balazs Varga 54378c2b97 sc: take the implicit intersection of an external range
=@'file:///source.ods'#Sheet1.B:B showed the first cell of the
column and not the one in the formula's own row. ScSingleValue
leaves an external range on the stack unchanged, and Interpret ends
with it on the matrix path, so the result became the top left
element of a matrix over the whole range.

A sheet local range takes a position dependent implicit intersection
in both places, with DoubleRefToPosSingleRef. An external range now
does the same through PopExternalDoubleRefPushSingleRef, which reads
the position from ScCompiler::ExternalDoubleRefToPosSingleRef.

Where the position does not intersect the range nothing changes,
so an unresolved link keeps its own error instead of turning into
a #VALUE!, as testExternalRefUnresolved expects. The external and
the sheet local case still differ there (TODO).

Follow-up of commit: I3baf826177fbeeb4616f407d653f1457a2fbfa8f
(sc: don't build a JumpMatrix for an entire external column)

Change-Id: I68cc88b5bb533cfcd19537be6705e8a64834af64
Signed-off-by: Balazs Varga <balazs.varga@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12614
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 596a329b2f0e888047069b442f4da507a0c668f8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211105
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-18 14:24:12 +02:00
Balazs Varga 1d901c0707 sc: don't build a JumpMatrix for an entire external column
A file with XLOOKUP over entire external columns did not finish
loading. ConvertMatrixParameters turns a scalar Value parameter into
a matrix, and an external reference comes back at its full MAXROW+1
height, so every formula cell ran the function body over a 1048576
row JumpMatrix. It is not XLOOKUP only, every function with a
ForceArray parameter somewhere goes through that conversion, VLOOKUP
and MATCH among them.

The svDoubleRef case takes a position dependent implicit
intersection outside array context, and leaves the token for the
function that pops it to resolve with DoubleRefToPosSingleRef. No
function does that for an external reference, so svExternalDoubleRef
now resolves it, from the shape of the range.
DoubleRefToPosSingleRefScalarCase cannot do it, because it asks
whether the formula position lies within the range, which means
nothing across two documents.

Also in array context, where the JumpMatrix stays, an entire column
or row is trimmed to the data area first, like the svDoubleRef case
does with ScDocument::ShrinkToDataArea. The new
ScExternalRefManager::shrinkToDataArea asks the source document when
it is already loaded, and the cached ranges otherwise. Trimming on
its own does not help, because the JumpMatrix only shrinks to the
data extent and the body still runs once per row.

Change-Id: I3baf826177fbeeb4616f407d653f1457a2fbfa8f
Signed-off-by: Balazs Varga <balazs.varga@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12613
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 504cb9b329a5a4ce4f4c6ec53bde99c5e8c3de0c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211104
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-18 14:20:33 +02:00
Michael Weghorn 2647004df6 sc: Pass XModel3 to ScUnoAddInCall::SetCaller
Switch the method param to the XModel3 interface
from the very basic XInterface type. This drops
the need to explicitly cast/query to avoid
ambiguity in the callers where the passed object
multi-inherits the XInterface interface/base class.

This also prepares for switching the return type
of SfxObjectShell::GetBaseModel to a reference of
the concrete SfxBaseModel in an upcoming commit (without
introducing ambiguity due to multi-inheritance from
XInterface in places using only an XInterface
reference).

Change-Id: I97e060136b02f3eb1e652cff4021e57a85677e19
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211052
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2026-09-17 14:51:23 +02:00
Noel Grandin fcf0bcc0f9 Hold EditTextObject by value in OutlinerParaObjData, not by pointer
OutlinerParaObjData is already ref-counted data, no need
for further indirection.

Unfortunately, this sets off a larger chain of changes
than I would have preferred, but we end up storing
EditTextObject on the stack much more than before, so
that worked out well.

Change-Id: Ie7d0ccfbfeec4e6935f2ed6b8ad48aadfe1bac20
Signed-off-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/10973
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit fbf7d1bc7142d3f0e4e5f959983dea065afc5ea3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210927
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-14 16:27:02 +02:00
Andrea Gelmini f1c58464ac Fix typos
Change-Id: I38b80f7bbf93192b7e2e00a426b72b77eb33bf1c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210568
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-09-10 21:28:54 +02:00
Andrea Gelmini b4db35eeb2 Fix typos
Change-Id: I1ab57e8e234c6bb25627f16c61d2e0e867b7ea04
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210177
Tested-by: Jenkins
Reviewed-by: Andrea Gelmini <andrea.gelmini@gelma.net>
2026-09-08 22:48:42 +02:00
Julien Nabet e808025d6f tdf#146404: Fix number Format Code when reopen ods/fods
As Eike indicated in https://bugs.documentfoundation.org/show_bug.cgi?id=146404#c4
COLOR format codes are preserved in ods/fods format.
The pb was the missing map back.
Indeed, we had the mapping for [COLOR<something>] => Color value (eg: "ffaa16")
but not the reverse mapping Color value => [COLOR<something>]

Eike had provided the right code pointer in xmlnumfi.cxx.
First, I thought using PaletteManager but this one is in svx and svx shouldn't be used in xmloff
(dependency pb).
Then I used ChatGpt (GPT-5.6 Luna) and it pointed the right process.
It just consisted to use a similar callback system (DECL_LINK, IMPL_LINK, LINK) of GetUserDefinedColor.

In addition, by testing all this, I noticed that maList in XColorList::GetIndexOfColor was empty.
So I added the Load call in case mbListDirty is true.

Change-Id: I0ef6b5901f2e4c757e88994412dbf79a13100ffd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210518
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2026-09-07 10:17:29 +02:00
Noel Grandin 1b276f9265 merge the outliner ParagraphData information into the regular EditTextObject
as part of the process of merging the Outliner code into the normal EditEngine paths.

So instead of keeping a bunch of information "on the side" and then having to merge information
from multiple sources, it all lives where it logically belongs.

Also take the chance to rename the depth/getdepth/setdepth
fields and methods to NumberingDepth, which makes the purpose
more obvious.

Change-Id: I314673ee1b9efa14f178ac34a122995a554cd788
Signed-off-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/10551
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit 284bbe0af12b96844976f30bb35ade3a327ea76d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210503
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-05 00:09:20 +02:00
Samuel Mehrbrodt 307f955adf cool#15780 sc: don't export an invalid totals row to XLSX
A table's totals row exported even when the table had no header, or
when its only content was a plain number wrongly declared as a text
label. Excel rejected both cases and repaired the file on open.

Only export a totals row when the table has a header and a column
actually shows a real label or total. Otherwise leave the row as
plain data, matching what Excel itself does when it repairs such a
file.

Signed-off-by: Samuel Mehrbrodt <samuel.mehrbrodt@collabora.com>
Change-Id: I6dc84680780805d8cfe666d681a62a9a907605d2
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/10367
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
(cherry picked from commit cfb01061aec26a218dcd1e4b5cccad395d2a5489)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210453
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-03 12:11:34 +02:00
Tomaž Vajngerl 850bbbc51a sc: keep a spilled range's place through an operator
A # spilled range travels as a matrix that carries the range it was
read from, so a plain cell can reduce it to the value of the row it
lines up with. Every operator dropped that range on the way through
GetMatrix and PushMatrix, so =A1#% on a master spilling 1, 2 and 3
came out as 0.01 instead of the row-aligned 0.02.

The range is now noted when a matrix operand that carries one is
popped, and put back on a result of the same shape - those are the
only way in and out. The note only lasts for one token, and two
operands with different ranges cancel it. Functions don't get it,
because something like SORT is free to move the values around.

The values of such a result are the operator's own, not the cells'.
So ScMatrixRangeToken now answers the two questions separately: the
range says where the values sit, and a second flag says whether the
values are still the ones the cells hold.

Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Change-Id: Ie4851dcc208f20220f07cd75a691aee88cfdc5ac
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/10158
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
(cherry picked from commit a393976584be143df7cb40623f31322e46889756)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210301
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-31 20:27:00 +02:00
Andrea Gelmini edd6d7c239 Fix typo in code
Change-Id: I48be673d5c256b6e892050a99ababa8b14c0ef36
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210149
Tested-by: Jenkins
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-08-29 16:11:29 +02:00
Andrea Gelmini 3968c6ebcb Fix typos
Change-Id: I0d45e4d6ece2ece63fe209126f05113969cda7fb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210176
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2026-08-29 16:08:23 +02:00
Andrea Gelmini c9ed8c555e Fix typos
Change-Id: I1ab57e8e234c6bb25627f16c61d2e0e867b7ea05
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210178
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2026-08-28 09:07:40 +02:00
Krunal Baraskar ff95e14a30 tdf#121759 Add Enable toggle to Insert Header/Footer dialog
Implemented the fix suggested in comment#33 of tdf#99296

Added a new "Enable" checkbox (checkBTN_ENABLE_HF) to
headerfootercontent.ui, placed left of the "Preset" line.

Added ToggleEnableHdl in scuitphfedit.cxx to dynamically disable/gray
menu options when disabled.

Updated "FillItemSet" to utilize a purely boolean toggle.

The changes below were made using AI assistance for code review (Claude Opus 5).

Dropped editeng/ulspitem.hxx, nothing references SvxULSpaceItem.

Used ScResId(STR_HF_ENABLE_HEADER / _FOOTER) instead of string
concatenation.

Removed the SID_HFEDIT disabling in GetStatePageStyle, as on/off is now
set inside the dialog.

Removed m_bHeaderOn, m_bFooterOn and GetPageOnFromPageStyleSet, left
unreachable by the above.

Removed the on/off branching in ExecutePageStyle, as ScHFEditActiveDlg
re-derives the shared left/right setting itself.

Restored two internal-child entry blocks on the font combos that a Glade
re-save had dropped.

Change-Id: I59a56ee74f74375a58fcaad38dae626e071ca5f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/203405
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
2026-08-27 11:19:39 +02:00
Andrea Gelmini fe914e74f5 Fix typos
Change-Id: If42f02957a45b296dd5ab524a1cca85f94d5cded
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209906
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-08-25 09:13:46 +02:00
Caolán McNamara 8749466df2 sc: convert remaining raw ScPatternAttr* class members to CellAttributeHolder
We have added various workarounds for ScPatternAttr use after free
issues since:

  commit 2e1f9da8a6
  Date:   Sat Dec 23 15:52:06 2023 +0100
      Decouple ScPatternAttr from SfxItemPool

separated ScPatternAttr from SfxItemPool.

Prior to that an ScPatternAttr was an SfxPoolItem held in the doc's
SfxItemPool which kept every item alive for the document's whole
lifetime, so any raw const ScPatternAttr* was basically safe.

The various workarounds for the new behaviour were:

  commit dca19993a4c732e95b9a47e1abdcaad6efbeebe9
  Date:   Sat Jan 6 14:40:28 2024 +0100
      tdf#159042: crash after changing cell style (if direct formatting done)

  commit 19437715eb415fe2c40b8b40dbe04ddca28f9a35
  Date:   Thu Sep 12 12:06:28 2024 +0100
      null pattern deref seen in ScViewData::SetEditEngine

  commit e384f2e8de9603ee65a3edc6dcb50b07116ee4fc
  Date:   Mon Mar 10 14:45:22 2025 +0000
      crashtesting: crash on reimport of xlsx output of forum-pl-2758.ods

  commit 7999585bd8378f1a8d04ea2a9a93a8e0bf4d8eb6
  Date:   Fri May 9 08:50:17 2025 +0100
      crash on null pattern de-ref

  commit 1bf9bbea96
  Date:   Tue Oct 28 16:53:49 2025 +0300
      tdf#169115: sc: fix use-after-free bug in ScDocument::FillInfo

  commit 9f366af81478ad218dc2ef2e37423a9ebcc84e73
  Date:   Sat Apr 25 14:47:02 2026 +0200
      ScPatternAttr use-after-free

  commit 20fe691a18fb35120d0765dd1519acd6d2986c38
  Date:   Tue Apr 28 08:33:34 2026 +0200
      ScPatternAttr use-after-free (2)

This commit picks the class member fields that are still raw
ScPatternAttr* and converts them to CellAttributeHolder:

  ScUsedAreaIterator::pPattern and pFoundPattern
  ScInputHandler::pLastPattern
  LotAttrCol::ENTRY::pPattAttr
  ScPatternCache::Entry::pPattern

The CalcAll() workaround from 9f366af81478 then doesn't seem to be needed(?)

A new compiler plugin catches class member fields of raw type
ScPatternAttr pointer.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ibb9f28b8fcaa5470c7a82eee52900c2d60434e41
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/3163
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 9c7b6313a29067bf0eef12884fc3ce7efb0374e5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209822
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-08-25 08:52:44 +02:00
Andreas Heinisch d43befdf16 tdf#132518 - Group pivot date field values in dropdown filter
Change-Id: I636f6f28e3e2cfaed1e01a6d4ee3a1604cf5d16b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209534
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Tested-by: Jenkins
2026-08-24 13:08:48 +02:00
Andrea Gelmini e23d303e84 Fix typos
Change-Id: I072de892e090245a28101de7755dd4186cae8ad2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209497
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-08-23 11:29:48 +02:00
Caolán McNamara 744b0e2a99 sc: take std::unique_ptr<ScRangeData> in ScRangeName::insert
insert always took ownership of the raw pointer, so make that
visible in the signature and drop the manual delete branches
the callers no longer need

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Iaf52cee659c297190d75e70c15a667bd6209d1a2
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9245
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 8ba26c1cf0cc930973dd29e13fe2ccb1fe5c4311)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209454
Tested-by: Jenkins
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-21 16:26:22 +02:00
Caolán McNamara 97d726a023 ScRangeName::insert: update an existing same-name entry in place
inserting under a name that is already present used to erase the old
map node and add a new one, so the container ended up with a different
object for the same name.

so move the values of the new entry into the existing one instead, and
return the surviving entry rather than a bool so callers continue with
the one object that now holds the values.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ib8a5a949caccf5b3ebcf24d9109848b0eac42694
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9244
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 4ebe359891e7eafb0f456bc7abc760872a6df5e9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209453
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-21 16:26:15 +02:00
Noel Grandin 37d0bc1d77 return by ref from ScDocument::GetRangeName
to make it obvious that it never returns nullptr

Change-Id: I8218f921583c49fcbd57a1693716317423a9febe
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/941
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit 8a63916739a316a9432b47862d2212c1e689f9cf)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209451
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-21 16:26:06 +02:00
Dr. David Alan Gilbert 2c9e44601d tdf#100244,126710:sc:Create MemberSlimArray
Allocate and fill in the mpaMemberSlimArray.
In the eager init case, where everything is initially allocated
as Slim results, it uses less memory just to create a simple
linear array rather than storing a pointer for each one.

Fixup the promotion code to move between the arrays rather
than change the pointer in the MemberArray.

On tdf#126710 this saves ~11.5GB (maxresident)
   tdf#100244 (full case) this saves about 6.3GB (max resident)

In tdf#126710's case, the 'virt' column in top appeared to save
even more; possibly due to large reallocations in the vector that's
been removed?

Change-Id: I7681304310e060da191edc1fb243900ce59193a7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209101
Tested-by: Jenkins
Reviewed-by: David Gilbert <freedesktop@treblig.org>
2026-08-21 14:38:10 +02:00
Dr. David Alan Gilbert 01a57e7bbd tdf#100244,126710:sc:Declare and use linear member array
Define mpaMemberSlimArray as a span of ScDPResultMemberSlim's,
we'll use this in future instead of the Vector that might
hold pointers to any subclass of ScDPResultMember.

Make GetMember and GetMemberCount reference it.

The actual allocation of the array comes later.

Change-Id: Id2abf23e72a92fee0dc3e4326370692a3567dafd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209098
Tested-by: Jenkins
Reviewed-by: David Gilbert <freedesktop@treblig.org>
2026-08-21 14:37:28 +02:00
Dr. David Alan Gilbert 91cbdc057d tdf#100244,126710:sc:Use GetMember() in most places
Use GetMember() for most cases rather than directly
accessing the member array, since soon we'll have
two member arrays.

Change-Id: I76eca012af6743b29de1e53e96a2ff46187f8a8a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209097
Tested-by: Jenkins
Reviewed-by: David Gilbert <freedesktop@treblig.org>
2026-08-21 14:27:21 +02:00
Tomaž Vajngerl 2795944b41 sc: stop writing pivot table cell styles to the document
The pivot table output set pivot table specific cell styles on its
cells ("Pivot Table Value", "Pivot Table Result", ...) and created
them in the document on first use. Remove this, so adding a pivot
table no longer adds any cell styles.

The attributes that these styles carried are applied as direct
formatting instead. The member cells are aligned to the left, and
the subtotal and grand total labels and results are bold. The left
alignment is also what makes the member indents visible, an indent
has no effect in a centered cell. The style name mapping in
stylehelper.cxx stays, so documents that already contain these
styles keep working.

Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Change-Id: Ib33d170d2da38a60c0739eda8fa79ce4f1fcf745
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/8254
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
(cherry picked from commit fee8a092ac3388c873d2b0763f7ce3d8cd032b76)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209431
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-08-21 10:32:29 +02:00
Tomaž Vajngerl 0753600cc2 sc: draw all pivot table output formatting in one class
The formatting of the pivot table output was spread across
ScDPOutput: cell styles and frames were applied inline while the
table content was written, and ScDPOutputImpl drew the block
frames.

Add sc::pivot::StyleOutput, which handles all the drawing. ScDPOutput
now only records the sections of the table (layout geometry, field
cells, member spans, subtotal and grand total rows and columns,
indents and expand or collapse buttons). The cell styles are applied
while the sections are recorded, at the same points where they were
applied before, so they always come before any direct formatting
(number formats, pivot table format attributes) reaches the cells.
The block frames, the indents and the expander buttons are then drawn
by apply() in one pass over the collected sections. The drawn output
stays the same as before, and a different look, like the OOXML pivot
table styles, can later be drawn from the same sections.

Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Change-Id: Ia628de6badf511d299f36bf474194ecad17a9c56
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/8253
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
(cherry picked from commit 9f5a36c822b170835c55143716be9eca28ac3e91)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209430
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-21 10:32:13 +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
Tomaž Vajngerl cd0b10a6fb sc: make LAMBDA and callable evaluation more robust
Follow-up hardening for the recently added first-class callables
(LAMBDA, LET and macros).

Bound the nesting depth of callable evaluation. A lambda body runs in a
fresh nested interpreter that does not pass through the per-cell
recursion counter, so a lambda that ends up calling itself could keep
nesting. Cap the depth at the same limit used for ordinary formula cell
evaluation and return an error once it is reached.

When cloning a lambda body, skip an empty or inverted token span and
copy only the tokens that are actually present, so no uninitialized slot
is ever handed to the new token array.

Cast a callable to its concrete type directly instead of doing a runtime
type check on every call, since the opcode already identifies the type.
Widen the parameter and argument counts from short.

Rewrite the copied macro comments in plain English and remove the
commented-out matrix callable code and its declaration.

Add tests for a terminating self-referential lambda and for a lambda
that would otherwise recurse without bound.

Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Change-Id: Ib520c48b5fa726f883ba4595d61786b45eeedbf5
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7114
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 5b8c9b85c20257449907c8c69c0145ccdb017b03)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208345
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-08-19 08:39:59 +02:00
Neil Roberts 3a0fabe6d9 sc: Fix typo in strings for the BYROW and BYCOL funcs
Change-Id: Iea0a266647a8d568470ba27b2375588114fdcc15
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209131
Reviewed-by: Benjamin Urban <urbanben2513@gmail.com>
Tested-by: Jenkins
Reviewed-by: Neil Roberts <nroberts@libreoffice.org>
2026-08-15 09:04:48 +02:00
Julien Nabet 01df62abe0 Related tdf#150928: replace character set by encoding (sc/part 2)
Change-Id: I0e934158eb9defb01b678628cf6e34a595e21980
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209093
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-08-14 22:00:32 +02:00
Neil Roberts 317f8e9dff tdf#173124 Split string for CSV column types into separate strings
This string is a confusing mix of several strings seperated by
semicolons. It seems quite easy for translators to misunderstand so
let’s just split them out into actual separate strings and add a
comment.

The patch below recently changed the string so it will now have to be
translated again. For the previous string, it looks like there are
mistakes in the translation for Persian and Tibetan which seem to have
replaced the semicolons with a different symbol.

commit 77ea61b986
Author: Heiko Tietze <tietze.heiko@gmail.com>
Date:   Fri Aug 7 08:02:20 2026 +0200

    Resolves tdf#172980 - Rename 'Hide' to 'Skip' in CSV import dialog

Change-Id: Ic05abf5943d75ecadf312d898b46b9a79bb6bbac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209108
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Reviewed-by: Neil Roberts <nroberts@libreoffice.org>
2026-08-13 14:22:10 +02:00
Stanislav Horacek 33b183d2fa fix context of strings for BYROW function
Change-Id: Ia43d839a7746cbdad7e405a5fbad0a3b81591f67
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209092
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2026-08-13 04:11:42 +02:00
Dr. David Alan Gilbert b5b7c96470 tdf#100244,126710: sc:Remove unused CheckShowEmpty declaration
ScDPResultMemberFull::CheckShowEmpty(..) is declared but
never implemented - but there is a base class implementation
which is fine.
All existing calls are on ScDPResultMember* so don't hit a problem
but if something tries to call it on a ScDPResultMemberFull* it
tries to call the missing function.

Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
Change-Id: I8350517e87ed118e0065412f16aa6053f3bbda9b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209014
Tested-by: Jenkins
Reviewed-by: David Gilbert <freedesktop@treblig.org>
2026-08-12 18:35:00 +02:00
Olivier Hallot 373c8e2aa1 Rewrite LAMBDA function definition
+ Make it more direct
+ Leave extra properties to the Help page

Change-Id: I6b03c622db30cb8c613c13eb3c54964e690ed243
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209074
Reviewed-by: Hossein <hossein@libreoffice.org>
Tested-by: Jenkins
2026-08-12 08:29:40 +02:00
Julien Nabet e375f54fe7 Related tdf#150928: replace character set by encoding (sc/part 1)
Change-Id: Ic4c289021a924b932d44c443a808f84b35f3f600
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209069
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-08-11 12:09:57 +02:00