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>
+ endianness must be remembered when it was present in the csv.
(I took example on 509ab788ba
tdf#82254 - Don't remove UTF-8 BOM from CSV when saving file
except QA test. I don't know how to do it)
Change-Id: I5043fa20c44e2e08bb43fbae0838b5d3d2f46575
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208981
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
When the user types a formula that returns an array (UNIQUE,
TRANSPOSE, a range plus a range, ...) and presses Enter, the
cell now becomes a dynamic-array master. The array result
spills into the empty cells to the right and below the typed
cell. The user no longer has to press Ctrl+Shift+Enter to get
array behaviour.
Formulas loaded from a file and formulas created from a macro
keep their old single-value behaviour, so existing documents
are not affected.
A new per-cell bit, mbAutoDynamicArrayEligible, marks a cell
as allowed to promote. The view code sets it on freshly typed
formulas. The importers and the macro entry path leave it off.
When such a cell first calculates, the formula tokens are
walked in execution order to ask the question: does this
formula produce an array result? If yes, the cell switches to
dynamic-array master mode before the calculation runs, so the
array result is kept and the cells to the right and below get
filled in.
The walk tracks whether the value sitting on the stack at each
step is an array or a scalar:
- Pushing a multi-cell range or an inline matrix puts an
array on the stack.
- An operator like + or * keeps the result an array if any
operand was an array.
- A function known to return an array (UNIQUE, TRANSPOSE,
MMULT, SEQUENCE, ...) puts an array on the stack. Other
functions reduce to a scalar.
- Branching functions like IF, CHOOSE, IFERROR and LET do
not fit this simple model, so the walk gives up and the
cell stays a plain single-cell formula.
A formula that begins with the @ implicit-intersection
operator (=@UNIQUE(...)) opts out of promotion. Cells that
are part of a formula group share a single compiled formula
and stay single-cell so the group is not broken.
Ctrl+Shift+Enter still produces a classic static array master.
The shortcut now routes straight to the matrix-entry code, so
the auto-detect described above does not interfere.
The formula compiler has an optimization that rewrites a
multi-cell range as a single-cell pick when the formula sits
in a single-cell context. For example =A1:A4 typed in row 2
becomes =A2 before evaluation. That is the long-standing
implicit-intersection rule.
For typed input the optimization has to be off, otherwise the
multi-cell range disappears from the formula before the walk
can see it. The optimization stays in place everywhere else,
and the engine still applies implicit intersection at run
time when the cell remains a plain single-cell formula.
XLSX export
XLSX marks a dynamic-array master with cm="1" on the cell.
The exporter used to fall back to "matrix master plus a
dynamic-array function" when the explicit flag was missing.
The fallback is now removed. Every cell that should export as
dynamic carries the flag explicitly, set by the importer or
by the UI entry path.
One trade-off: a Ctrl+Shift+Enter (CSE) array of a dynamic-
array function imported from an XLSX file that has no cm="1"
marker no longer round-trips as dynamic. The cell flag is now
the single source of truth.
Tests
Tests cover the array-intent walk for =MINVERSE(...), ={1;2},
={1;2}+3, ={1;2}+{3;4}, ={1;2}+A1, =ABS({-1;-2}), =A1:A2,
=A2:A5+B2:B5, a long chain of binary additions over the same
range, a range times a scalar, =IF(...) with array branches,
and =SUM(...) over a range as the scalar case.
Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Change-Id: Icb4b5e108634cd1529ac829cb34865c56ed8ec02
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/4684
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit c3d67d3ec81621c385744fac7fd7a722084a122f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207219
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Calc's .uno:InsertThreadedComment slot mutated the note model directly
(GetOrCreateNote, SetText, SetThreadedCommentData, KitCommentNotify) and
never set the document-modified flag, so SFX did not broadcast
.uno:ModifiedStatus. The handler also did not register undo, so the
insert could not be rolled back. The same handler dropped the
SvtUserOptions fallback when the Author arg was passed but empty (the
ternary checked has-arg, not non-empty-value), letting the author land
as "Unknown Author" instead of the per-view WOPI UserFriendlyName.
Mirror ScDocFunc::ReplaceNote: a new InsertThreadedCommentOperation
runs inside ScDocShellModificator, releases any existing note (rescuing
its ScNoteData and a clone of its threaded payload), creates the new
note, builds the threaded payload plus the person-list entry, registers
ScUndoReplaceNote, and does the necessary finalizing calls. The author
resolution now uses the default-then-fallback chain so an empty Author
arg still routes through SvtUserOptions before the catch-all.
Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I42304b9467e8b290316b0fa8ba3c80c8fc0d9c35
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/4142
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit d0935091c608f7184d00669b85f98e5b4b5fe1b4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207111
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
Introduce a per-cell bit on ScFormulaCell that marks a matrix master
as dynamic. A matrix master with the flag set recomputes its range
at interpret time so the result grows or shrinks with the source
data. A matrix master without the flag is a static array master and
keeps its declared range frozen.
SetDynamicArrayMaster(true) on a plain single-cell formula promotes
the cell to a 1x1 matrix master so the first interpret expands it
through the auto-resize gate. Callers that opt a NONE cell into the
dynamic-array path only have to flip the one flag.
ScFormulaCell::InterpretTail uses the flag as the single opt-in for
the auto-resize path. The path fires when the cell has the dynamic
flag, or when the cell is currently in spill state and needs to
re-check on the next interpret. Static masters entered through
ScDocFunc::EnterMatrix or ScDocument::InsertMatrixFormula keep the
flag false so their declared range is the user's intent and never
changes underneath them.
InsertMatrixFormula and EnterMatrix grow a new bDynamicArrayMaster
parameter so callers can choose. The existing spill tests opt in
to keep their auto-resize behaviour. The two contraction tests in
uicalc2 entered their matrix masters with Ctrl+Shift+Enter, which
no longer drives auto-resize, so insertArrayToCell grows an opt-in
bDynamicArrayMaster parameter and those two tests pass true to
flip the master into the dynamic gate after entry.
The paste path in cliputil.cxx re-creates a matrix master at the
destination via ScDocFunc::EnterMatrix. The call now reads the
source cell's dynamic-array flag and passes it on, so a dynamic
master pasted to a new location stays a dynamic master and the
auto-resize gate keeps firing.
Importers (XLSX cm, ODS coext:spill) and the UI entry path will
set the flag in the follow-up commits.
Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Change-Id: Ie6fbf6972aa796f3833b726ea0184fc34ed92a3d
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/4173
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 006b0c6577c4e35087595cb92b629757c8c4d166)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206674
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
In the past, weld.hxx used to contain the class
definitions for weld::Widget and all subclasses.
By now, weld::Widget and almost all subclasses have
been moved to separate headers, to make it easier
to keep the overview and to avoid having to
recompile ~all UI code when one class changes.
By now, only weld::Button is left in weld.hxx.
Rename the header to Button.hxx.
Drop weld.hxx includes and instead add Button.hxx
includes (or weld::Button forward declarations) where
weld::Button is used.
(Don't simply replace all weld.hxx includes with
Button.hxx ones, since many of them were for the
use of other widgets that have since been moved
to their own headers.)
Add further includes where needed now that the
(direct or transitive) includes of weld.hxx were removed.
Change-Id: I8ea6201446a418d5e38b46337059dcd517ee29d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205937
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
Move the class out of weld.hxx into its own header and
source file, in order to make it easier to keep an overview
and to avoid having to recompile ~all UI code when the class
is modified.
Change-Id: I91bae842e5b18a83db45de12150c21f75e537fb9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205900
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Deleting the master cell of an expanded matrix tore the matrix
down and dropped the master from the tracking set. After Undo the
cells came back but the tracking did not, so a subsequent blocker
write into a reference cell didn't collapse the matrix to #SPILL!.
The delete operations now capture every tracked master position
that falls inside the deleted range and hand it to the Undo class
ScUndoDeleteContents. When Undo happens, after restoring the cells,
the captured positions are re-marked in the expanded matrix
tracking set.
+ Added test which reflects this scenario
Change-Id: I85d2d6e804214be5c0ca630288989b3605a809b0
Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/3012
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 46eef59b28e6f10377de0d2203c7b224be862c40)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205923
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Pressing Delete or typing a value into the master cell of a
multi-cell matrix used to refuse this with a pop-up error message.
Now both gestures replace the whole matrix: Delete clears it,
typing puts the new value at the master and the reference cells
are removed. The matrix is torn down before the write so no
reference cells are left orphaned.
DeleteContentOperation expands a single-cell mark on a master
to the full matrix range before its editable check, so the
protection check no longer sees a fragment. Single cell writes go
through a new demolish-matrix-master helper before writing,
wrapped in a list action so undo rolls the whole gesture back
together.
Change-Id: Ie61f30f32a028ed358e6cd208e1580665a81b615
Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/3007
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 839e3e00f4262b7fad163c14f164524307657dd2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205918
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Typing into a cell covered by an expanded matrix (TRANSPOSE,
SEQUENCE, UNIQUE, ...) used to show an pop-up message that part of
an array can not be changed. Now the input is accepted. The typed
value lands in the cell, becoming a blocker, and the matrix master
collapses to #SPILL!. Multi-cell edits and edits to the master cell
still hit the matrix protection.
Track every multi-cell matrix master at creation so spill resolution
finds it when a blocker appears inside its declared range, and let
the runtime spill check fire on conventional matrix formulas in this
code path to recover from a blocker.
Change-Id: I658c0a432a9aaab5668e474b6af537eedd1f6e1d
Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/3006
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit e68735089715e37982a49286ed39486241c79cae)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205917
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Undo/Redo of operations that restore a blocker inside a previously
expanded dynamic array, or that clear a blocker outside one, didn't
reconcile the matrix master's spill state. The master listens to
its inputs but not to its own declared output range, so the matrix
would stay expanded over a restored blocker (or stay #SPILL! after
a redo that cleared the blocker).
Track expanded dynamic array origins in maExpandedDynamicArrays.
Extend ResolveSpilledOutputs with an inverse pass that walks the
set, detects a foreign cell inside the declared range via the new
HasMatrixBlocker helper, drops the reference cells, collapses the
master back to 1x1, and re-interprets so the runtime spill check
re-raises #SPILL!.
Invoke spill reconciliation from ScUndoDeleteContents and
ScUndoSetCell on both Undo and Redo so it reconciles the data
change.
Added common test cases:
- formula expansion gets blocked by a blocker, blocker is removed,
formula output expands, undo this, redo this
- formula expansion gets blocked by a blocker, data is changed so
the blocker doesn't block anymore and the formula output is
expanded, undo this, redo this
Change-Id: Idae7d7cc3bc7abc7016a847d3768cde21d1d0b3c
Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/2650
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 98859b6eb4c89d3b7833ab27eafc0cd8320308f0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205757
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
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>
Detect a blocked spill at interpretation time. When a 1x1-declared
matrix formula that uses a dynamic-array function produces a result
larger than its declared dimensions, check the expansion area for
blocking cells and set FormulaError::Spill if any are found.
Track spilled formula cells at document level - spilled formulas
only listen to their dependency range, not to cells in their
(blocked) spill area, so they aren't notified when a blocker is
cleared. ScDocShell::ResolveSpilledOutputs (renamed) is called
from the Set*/Delete*/Move* cell operations to re-check spilled
cells after any user edit that might have freed a blocker.
Without auto-expand yet: a formula that loses its blocker
re-interprets to NONE and shows its scalar upper-left. The
matrix does not grow to fill the range in this commit.
Change-Id: Ief252a47e5625f72ef6fe52d3bd0afae2d1ee768
Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/1816
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit ea20a2c90a264b34a930a5d4bb1118be7ed4836e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205685
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Replace the error message dialog with the same #SPILL! mechanism
used for array formulas when the pivot table output is blocked.
The pivot table configuration is still applied, but the output
cell shows #SPILL! error until the blocking cells are cleared.
Also includes:
- Auto resolve spilled pivot tables after delete, cut, move, paste
- Add sc::UndoSpillPivotTable, so when undoing we can recover back
to the spill error and delete the pivot table output (if present)
- Skip spill check during import to preserve cached output
Change-Id: Icf7d89c088b9d8a9d255945aa6235c91f602d4a9
Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/1750
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 94299df72efeddb3d5af31396f5008300d66a90d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205683
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
DataPilotUpdateOperation was delegating when certain conditions
were met to other pivot table operations and when the conditions
didn't apply, it used a unique kind of replace pivot table
operation. This isn't ideal (especially the delegation part), so
this change creates a new operation ReplacePivotTableOperation,
which has the replace logic. Then the DataPilotUpdateOperation is
completely removed. The delegation logic is now moved back into
ScDBDocFunc::DataPilotUpdate method. This is a much leaner solution
than it was before.
This should be pure refactoring only.
Change-Id: I102bc93e1ade0e315cd918499d83733bb475e1e5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201698
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202118
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
(cherry picked from commit 8f4d3dd386f2d9b5129c69497543aa0fdaa247ec)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205607
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
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
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>
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