Commit Graph
8003 Commits
Author SHA1 Message Date
Andrea Gelmini 3ff64935b4 Fix typos
Change-Id: I48e41434d3f451725a724cd86750731a9fc67fcc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210569
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-09-10 16:00:26 +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
Justin Luth 3487e467f0 tdf#160921 tdf#163088 sc GetNeededSize: setSubpixelPositioning
This fixes a 24.2 regression from Khalid's commit 4b743de97f.

The problem I'm trying to fix is that setting optimal column width
is not necessarily providing enough width to avoid seeing '###'.

The reason is that GetOptimalColumnWidth calls GetTextWidth
with MapMode disabled, so no subpixel calculations were done.

However LayoutString does have MapMode enabled,
so it calculates a different length than what optimal column got.

Surely that must always be wrong. But Khalid's similarly more-correct
commit triggered a lot of 'regressions'. However, this should be
moving in the right direction as tdf#168002 suggests
that mbSubpixelPosition should always be true in the future.

Since it is needed for width, it seems reasonable that it should
also be done for height...

Change-Id: I30590ebba8b3027c5214ee075a1a258d3a61b8c7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210438
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
2026-09-03 20:03:09 +02:00
Ben Urban e1d69c4592 tdf#127808, tdf#173380: sc: Fix dynamic arrays for LAMBDA and LET
* Recognize LAMBDA during dynamic array analysis; LAMBDA
never produces an array, but it can be part of a formula
that generates one.

* Fix handling of LET; subexpressions before the last should
not affect the result, unless we are willing to to a more
thorough analysis.

* Update test to check for the new behavior.

* Account for svExternalDoubleRef.

Change-Id: Ia9a4761079de986906ac70252066d8d9b4655f59
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210461
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-03 19:42:45 +02:00
Xisco Fauli 64a367ebf1 cid#1696360: Silence Dereference after null check
I tried to workaround it in
commit e3a3958242
Author: Xisco Fauli <xiscofauli@libreoffice.org>
Date:   Fri Jul 10 15:16:47 2026 +0200

    cid#1696360: silence Dereference after null check

which later got reverted in
commit d4b4b6e24d
Author: Xisco Fauli <xiscofauli@libreoffice.org>
Date:   Mon Aug 24 10:49:25 2026 +0200

    cid#1696360: Dereference after null check

Change-Id: I311834328b23af62a88d37ecca9ce118005642a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210369
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-02 01:02:42 +02:00
Noel Grandin 3b52fbc96f merge EditTextObjectImpl into EditTextObject
this is a weird kind of pimpl pattern, lets just simplify it.

Which means we can remove the Clone() method in favour
of a normal copy constructor.

Change-Id: Ib5793c66df4729f48def8b3cead0f39f2ba94830
Signed-off-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/10550
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit dd8a795b5aed4c44e11eef86eaf19b1f88edf0f8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210320
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-01 15:40:01 +02:00
Xisco Fauli 1c9dc99eec cid#1695404: silence Use after free
Change-Id: I62650493ac4e77f81004dad30743d45fc914c728
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210283
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-31 16:12:41 +02:00
Andrea Gelmini 53d4a4de52 Fix typo in code
Change-Id: I2b9e20d3548ac4b3d743efda4ccad644eb0835dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210148
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2026-08-29 15:55:59 +02:00
Andrea Gelmini 0ba789a027 Fix typos
Change-Id: I0af4d3788a2220e88b2f4e0f66eafd05eef33d80
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210181
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2026-08-29 15:36:21 +02:00
Justin Luth 769601079f tdf#131430 sc ReplaceAllStyle: save range to undo
Before, it generally wasn't saving ANYTHING
because rMark is normally not marked,
and even if it is, it could be random.
The only time rMark means anything is if rSearchItem.GetSelection().

But even that doesn't help because the undo has no idea of range.
ScUndoReplace::Undo attempts to undo the entire document,
so definitely more than bOnlyMarked needs to be included.

In fact, even sheets that don't even have a match
need to be backed up. Entirely.

This seriously needs to be looked at by a Calc Pro
who could optimize this by passing rMatchedRanges
to ScUndoReplace. And only CopyToDocument a RangeList.
But of course, there is also bMatchedRangesWereClamped...
which thankfully doesn't affect styles, only text.

Change-Id: I2087e255e3e4b3387b388e1f2d28c19717e50342
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210247
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
2026-08-29 02:45:18 +02:00
Andrea Gelmini 9cfefaf90a Fix typos
Change-Id: I04037b6e2bd89d4583d06a2ebf19e8ae02eea4e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210180
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-08-29 00:16:36 +02:00
Andrea Gelmini 14022fd7d9 Fix typos
Change-Id: Ifdabd2826fa1f147aedf38945409c2192c989d77
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210073
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2026-08-27 14:01:20 +02:00
Xisco Fauli d4b4b6e24d cid#1696360: Dereference after null check
Change-Id: Ife149117926942f9a71c7187a7784024a9def9df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209825
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-25 15:29:20 +02:00
Andrea Gelmini 9877f8b813 Fix typos
Change-Id: I1af507bb568eb9220b7215224f7233e1d31129ba

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209783
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2026-08-25 14:52:31 +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 efa5936282 Fix typos
Change-Id: I1af507bb568eb9220b7215224f7233e1d31129b3

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209782
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-08-24 08:47:27 +02:00
Andrea Gelmini 0a1edd986f Fix typos
Change-Id: I361629b370a17a89f5e7a0f5aa3ec3ee716700d3

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209784
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2026-08-24 08:42:12 +02:00
Andrea Gelmini 955424ce1e Fix typos
Change-Id: Ieaa2c41a98b3b90ff3817f86c18472e8f2459602
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209498
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2026-08-22 13:45:25 +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 0d5f7da5a9 tdf#100244,126710:sc:Make FindMember check Slim array as well
Make FindMember check the MemberSlimArray prior to checking the main
MemberArray.

Change-Id: Ib5c91fad563d5f7b9f41a6759585268dcfc0e375
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209100
Tested-by: Jenkins
Reviewed-by: David Gilbert <freedesktop@treblig.org>
2026-08-21 14:38:03 +02:00
Dr. David Alan Gilbert 0a7c0f8aa1 tdf#100244,126710:sc: Template lcl_SearchMember
Convert lcl_SearchMember to use a templated core since
we're soon going to have two different types to iterate over
(One of which is a pointer, the other an object, hence
needing to parameterise the get function as well).

Change-Id: I4df6a011015ca917f5ad015393ff0f65b2a32ca9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209099
Reviewed-by: David Gilbert <freedesktop@treblig.org>
Tested-by: Jenkins
2026-08-21 14:37:51 +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
Dr. David Alan Gilbert a25675d5ed tdf#100244,126710:sc:Use GetMemberCount()
Use GetMemberCount() rather than accessing maMemberArray.size()
directly in most cases, since we're going to have two different
arrays.

Change-Id: I35541b84e3e1704c9725491444b076c05197aa27
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209096
Tested-by: Jenkins
Reviewed-by: David Gilbert <freedesktop@treblig.org>
2026-08-21 14:24:45 +02:00
Dr. David Alan Gilbert ef0e16d59a tdf#100244,126710:sc:Use find_if in ScDPResultDimension::FindMember
The hand coded linear array search in FindMember can be replaced with
std::ranges::find_if.
Note: A few months ago I added a comment saying I thought the 'IsNamedItem' check
above wass probably always true - it turns out it's not - which causes the linear
array to be used!

(I can't say I understand the case IsNamedItem is false, here, it
triggers in the tdf#126710 test)

Change-Id: Ia87998f910d1bbf9f120d70acf096d17d4ce4211
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209095
Reviewed-by: David Gilbert <freedesktop@treblig.org>
Tested-by: Jenkins
2026-08-21 14:24:23 +02:00
Tomaž Vajngerl 5826712e95 sc: draw all pivot table frames with one thin line width
The block frames of the pivot table output used a 1pt line inside
the table and a 2pt line on the outer edges of the table, and the
field cell frames used the 1pt line. Draw all of them with the
thin line width (0.75pt) instead, which is close to the line width
that the default OOXML pivot table style uses, so the whole table
uses one slim border.

Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Change-Id: Iec99b6890ffa5c8dfc699a30e2fc58d452e5d9ff
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/8255
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
(cherry picked from commit 411cfdb91ee02a10361c3d72e13bd64161bba4d5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209432
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-21 10:32:40 +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
Andrea Gelmini 12051c954c Fix typos
Change-Id: I73c907ed17d513e9d07859bbb6bf1f149a0d7828
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209377
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-08-20 18:54:20 +02:00
Caolán McNamara 9f9e3ad8bb crashtesting: drop assert now, fires on bogus cases
and not on any real case

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: If0cd87752beac5560ca96db279e5e4ba2fe327f0
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9150
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit dc4606362eb6852828b114ef05f29545f4855fd9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209312
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-08-19 12:58:27 +02:00
Michael Meeks 17a184f8b4 cool#16004 detect and don't include filter / pivot headers into calc sorting.
This seems to provide a very good hint that something is a header.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: If26a8e7aeceadff804d6d38c310bcab6ab26efca
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/6644
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
(cherry picked from commit e87f0e8c2b98e439c130e6f06d98faa61b0d0299)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209258
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-18 16:40:06 +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
Christian Lohmaier 56dbcb043e sc: silence warning C6011: Dereferencing NULL pointer 'pCode'
E: /jenkins/workspace/lo_tb_master_win_analyze/sc/source/core/data/formulacell.cxx(2746): error C2220: the following warning is treated as an error
E: \jenkins\workspace\lo_tb_master_win_analyze\sc\source\core\data\formulacell.cxx(2705) : warning C6011: Dereferencing NULL pointer 'pCode'. : Lines: 2681, 2690, 2705
Change-Id: Ic8439d98216efca22c91354ebe285d1d5cfd95d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209077
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2026-08-11 16:19:33 +02:00
Dr. David Alan Gilbert 19b0757c54 tdf#126710: sc:Remove pResultData from ScDPResultMemberSlim
pResultData is constant in ScDPResultDimension, so we don't need
to store it in ScDPResultMemberSlim, just ask the dimension.

Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
Change-Id: I0b9f9081c9ffcc0c285e546a4cfb2784315d0c3d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208635
Tested-by: Jenkins
Reviewed-by: David Gilbert <freedesktop@treblig.org>
2026-08-02 16:32:48 +02:00
Caolán McNamara ad9e26606f sc: fold hasExternalContentLinks into one hasUpdatableLinks predicate
At this point every link that can be in the list is already either
one of the things specifically checked for, or is an obscure corner
case that if it does start to appear in the list should be checked.

So collapse this to its simpler reality.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I6103819c5f93f7d32caa6a47e0f147db2de744c8
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/7236
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7532
(cherry picked from commit ebe9aa73a61045e47d22eddbe454ada2c3dfca21)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208772
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-29 12:54:35 +02:00
Caolán McNamara ced55a8844 sc: gather the external-link checks into one HasExternalLinks
merge the various individual link checks into one HasExternalLinks
check.

Keep the DocumentLinkManager hasDdeLinks special case, and change
the other to be hasExternalContentLinks

ScDocument::HasAreaLinks is only called when we're asking about
HasExternalLinks so fold that in and bring some of the sprawling crazy
under control

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I6cf35d7ef7ae1c53ad9e87e0b36849ded4ae8323
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/7235
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7381
(cherry picked from commit f15965091e84bb5d51a7e4809089d493f74f2c10)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208771
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-29 12:54:15 +02:00
Caolán McNamara bef421f6d0 crashtesting: clone a matrix cell's result when it's not refcounted
A matrix formula cell holds the "top-left" result of its matrix in the
reference-counted xUpperLeft of ScMatrixFormulaCellToken.

CloneUpperLeftIfNecessary cloned that only for svDouble; other types
were kept by shared reference.

But threaded group calculation switches every token in the group's shared pCode
to RefCntPolicy::None while worker threads interpret it, on the basis that
interpreting only reads pCode, since:

commit 791a2489ee
Date:   Sun Mar 24 21:31:38 2024 +0000

    Related: tdf#160056 elide ref counting for initial tokens

A matrix formula whose result is a string constant from its own pCode
broke that: the pCode token was taken as the upper left during the None
window, so its IncRef was a no-op.

At teardown the matrix released it and freed a token the pCode array
still pointed at.

Where the uncounted reference is taken:

    #1 boost::intrusive_ptr<formula::FormulaToken const>::operator=
         boost/smart_ptr/intrusive_ptr.hpp:121
    #2 ScMatrixFormulaCellToken::Assign         sc/source/core/tool/token.cxx
    #3 ScFormulaResult::SetToken                sc/source/core/tool/formularesult.cxx:206
    #4 ScFormulaResult::Assign                  sc/source/core/tool/formularesult.cxx:171
    #5 ScFormulaCell::InterpretTail             sc/source/core/data/formulacell.cxx:2476
    #6 ScColumn::CalculateInThread              sc/source/core/data/column2.cxx:3266
    #7 ScTable::CalculateInColumnInThread       sc/source/core/data/table1.cxx:2715
    #8 ScDocument::CalculateInColumnInThread    sc/source/core/data/documen8.cxx:420
    #9 ...Executor::doWork()                    sc/source/core/data/formulacell.cxx:5437
    #10 comphelper::ThreadTask::exec

Clone the upper left when it is svDouble (as before) or not reference counted
(RefCntPolicy::None). The clone is a counted token the cell owns, so no
reference into pCode is taken during the threaded window. The non-threaded
path is unchanged.

Also assert in HandleStuffAfterParallelCalculation that a matrix result's
upper left does not alias the cell's own pCode.

Found with an ASan+UBSan build reloading crashtest document
forum-mso-en4-676909.

The original motivating tdf#160056 benchmark document never visits this
clone branch, so that case remains unchanged.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ibd9e93aa9e59fabb99941a92a16aef247f7ae160
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/5638
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 2a70b7a75ce8768e077ea42175e59465d3adba31)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208769
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-29 11:46:30 +02:00
Andreas Heinisch 7634d01f6f tdf#152327 - Preserve current tab selection when replacement selection is empty
Otherwise, the current tab will be cleared and the inserted cell value
will be silently dropped.

Change-Id: I0e27d1944d148afdf06cdac469db74140b5274c0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208535
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2026-07-28 10:03:37 +02:00
Xisco Fauli 4326e7d4a5 tdf#170494: Revert "optimize relative conditional formatting effort"
This reverts commit 7ca98e3865.

Change-Id: Ic7c89ecbfbfa3472410a19655fa3c38fa9cf25af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208639
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-27 13:58:15 +02:00
Caolán McNamara cb5895ad7b create the fill bitmap link tracker in SdrModel::SetLinkManager
merge this common setup

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I9efdc64155ed45580fb0ccc122a723fe10f4322c
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/3551
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit edecf78ffe05453017d3d7b9fef5dcd145fbf56b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208577
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-25 01:48:33 +02:00
Caolán McNamara b8831b8cbc register calc XATTR_FILLBITMAP URLs as SvBaseLinks via SdrObject ItemChange
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I977cd234b2be9d792b1762bd6f943b2361b586c3
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/3508
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit b08bffeeeba27e0e10664e5f4cbd9c16ca567ae3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208574
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-25 01:48:06 +02:00
Ben Urban 2d4a1434e4 tdf#172815: Change MAP() function UI wording
Change-Id: I3ebd0f063da6c53f916145c1d231638cda0501ec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208349
Reviewed-by: Olivier Hallot <olivier.hallot@libreoffice.org>
Tested-by: Jenkins
2026-07-23 14:37:13 +02:00
Mike Kaganski 35a685a006 tdf#123974 tdf#150910 sc: keep the target's direct cell protection on paste
A Ctrl+V changes a cell's content, not whether it is locked. Copying a
protected cell onto a cell the user had directly unprotected used to carry
the Protected flag along, so the target could no longer be edited, the
opposite of what Excel does and what tdf#123974 asks for.

Throughout this change "the cell's protection" means the protection set as
direct formatting on the cell itself. Protection can also come from a cell
style, and conditional formatting sets protection precisely by applying
such a style; those two are one and the same mechanism and, as noted at
the end, are deliberately left untouched here.

The two reports in this area pull in opposite directions: tdf#123974 wants
the direct flag dropped on paste, tdf#150910 wants it always retained, and
they were noted as contradictory. A rule gated on sheet protection (drop
the direct flag only when the sheet is protected and the target was
unprotected) was considered and rejected, because its outcome depends on
the order of otherwise unrelated steps: directly unprotecting a cell,
pasting into it, then protecting the sheet would re-lock it, while
protecting the sheet first and pasting after would not. That is impossible
to explain to a user.

Instead treat a cell's direct protection as a property of the cell that an
interactive paste never changes. Snapshot the destination's directly set
cell protection before the paste and restore it afterwards, so the pasted
attributes overwrite everything except that lock state. Routing both the
replicated-single-row fast path and the general path through the same
restore also removes the single-row versus multi-row inconsistency of
tdf#150910, which shared the same root cause.

Only directly applied protection is preserved. Protection that instead
comes from a cell style, including a style applied dynamically by
conditional formatting, is not touched and keeps following the usual paste
(in theory this could be extended to the effective protection if a need
shows up). The programmatic copyRange path is left unchanged and still
copies attributes verbatim; only an interactive paste opts in. A moved
cell (cut and paste) keeps its own protection and is excluded.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I3a1ec141c3ec698858ca8d058e6d9b1e9126402f
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7069
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 39f30bd4b532f7575957210b644216afa14ac28b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208344
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-07-22 14:01:57 +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
Caolán McNamara 4aba7e41c1 put calc external data mappings under link update control
register each mapping as a LinkManager link, so its refresh goes through
the same update control as sheet links and area links. Wait until after
the infobar-controlled update mode is known to update.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I6710d4bdf3de6e002365d75c911b69076a054da8
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/7058
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit b72d760465c857eb5dd10cdc45b107c49bb0caec)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208319
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-07-21 08:59:06 +02:00