41697 Commits
Author SHA1 Message Date
Bayram Çiçek f2531aab9b tdf#145726: Calc: print empty rows that carry a border
- a form with a header row and a hundred empty bordered rows below it
printed only the header row. Calc drops a run of 84 or more equally
formatted rows below the last cell with content, and everything under
it, so the print range ended at the last row with data. The borders
were on screen all along, so only printing, the print preview and the
PDF export showed it.

- the run is measured from the last row with data, so typing changed
the result. On a form whose borders end at row 100, text in row 16 left
84 rows below it and the borders stayed away, text in row 17 left 83
and the whole form printed.

- ScDocument::IsPrintEmpty prints a page that carries a border and no
content, and suppresses one carrying only a colour. A bordered run is
therefore kept now, unless it is wider than SC_VISATTR_BORDER_STOP in
its own length or in its distance below the data, which is the whole
column case i30830 is about. The length stays the same as the sheet is
filled in, the distance stops a chain of shorter bordered ranges
reaching the sheet end. Neither measure applies to a run under
SC_VISATTR_STOP rows, because a run that short was never dropped.

- the print range also sets where Ctrl+End lands, how far the desktop
scrolls and what range is written out on save, so all three grow with
it. In the browser the scroll extent comes from the cell area, so it
stays where it was.

- a run has to meet one more condition than before to be dropped, so no
document prints less than it did, and the ones hitting this bug print
more.

- the tests say a bordered form is printed, a colour under the content
does not pull the print area down, a border too wide or too far down
does not either, a frame round a whole column leaves the printout
ending at the last row with content, and a form is printed wherever the
content ends, including when a font change splits it in two.

Signed-off-by: Bayram Çiçek <bayram.cicek@collabora.com>
Change-Id: I44d041cdbbcde7bfa69b53035f5bebc8d59f9bdd
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/14112
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
(cherry picked from commit 00e5de0a8bd89e5f5c9f7b19fef85331354c4458)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211943
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-10-08 00:28:25 +02:00
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
Neil Roberts 13fb6e87c7 ScAutoFormatData: Use unique_ptr::get() instead of &*iter
Using &* can be problematic if the pointer is null. In this case I don’t
think it matters, but using unique_ptr::get() is probably easier to
understand anyway. This also paves the way for a later compiler plugin
to check for this.

Change-Id: I6b399d57cdf580d40721789bf3d6e7607c56fd6e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211751
Tested-by: Jenkins
Reviewed-by: Neil Roberts <nroberts@libreoffice.org>
2026-10-07 08:41:18 +02:00
Neil Roberts 711c6c0c5b ScDPSaveDimension: Use unique_ptr::get() instead of &*iter
Using &* can be problematic if the pointer is null. In this case I
don’t think it matters, but using unique_ptr::get() is probably
easier to understand anyway. This also paves the way for a later
compiler plugin to check for this.

Change-Id: I064def383ccf4b1ff263a70cd0c7775ff6fbbc8d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211750
Reviewed-by: Neil Roberts <nroberts@libreoffice.org>
Tested-by: Jenkins
2026-10-07 08:40:59 +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
Andreas Heinisch 970058a668 tdf#170842 - Check for missing table style info on plain database ranges
Change-Id: I8bed747726bd729fcef9b3845c8ba3e62f2ca2a7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211786
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Tested-by: Jenkins
2026-10-05 21:15:16 +02:00
Laurent Balland 24571d3635 tdf#173835 Include hidden sheets to show SelectAllSheets command
Follow-up commit ccbc8791e1
"Select All Sheets" command select visible and hidden sheets.
So the command should also be available when there are
some hidden sheets not selected

Change-Id: I3115385853e115d63eff91a800a2bf52c4157dc8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211774
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
2026-10-05 14:28:42 +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
Xisco Fauli 7003eb6fc6 fix headers
Change-Id: Ia2732cc041367bc113654bc424ea6621f3961e9f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211724
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-10-05 08:52:04 +02:00
Andreas Heinisch a56dd019a6 tdf#57274 - Link empty cells in paste special with paste all and link
Ignore the objects flag since ScViewFunc::PasteFromClip removes it.

Change-Id: Ica6961af920832de8cd16ecc945b0ea356fcc1b1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211628
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2026-10-03 20:10:40 +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
Noel Grandin 212d17f7ea add a non-const GetEditEngine() method to Outliner
to avoid const-casting all over the place

Change-Id: I75f3442341894dbe4e12cc7995669dc7f3bf63f7
Signed-off-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13354
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit 318e2cf839c6311d4a69572b4534f554bdda3f96)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211604
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-10-01 09:01:52 +02:00
Noel Grandin ce16bc37fd use more concrete UNO class in the form of ScModelObj
Change-Id: I9ad26f05635583e203ff338a88add65838c9188e
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/555
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 0a6ee7a99d6a5d624c4303256cc385ca6e23d456)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211619
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-10-01 09:01:29 +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
Aron Budea b46c38a45d sc: use conventional file name when exporting ctrl props to XLSX
Directory name is ctrlProps, but Excel normally names
the file ctrlPropN.xml. Doesn't cause an issue either way.

Change-Id: I81315e6b6e88aa66424c2a5c1e4a9dfb620b1296
Signed-off-by: Aron Budea <aron.budea@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13357
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
(cherry picked from commit 63039d5965de2939b40b6db5dff80c96f8d8fbb2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211522
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-28 22:03:53 +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
Laurent Balland ccbc8791e1 Related tdf#171207 Simplify context menu of sheet tabs
Follow-up of commit af745380b6
"Select All Tables" has no effect if only one sheet is visible
or if all sheets are already selected.
These cases are detected and the command is hidden.

Change-Id: Id55ae4d424777b54604eae2c3bc2e0c77cfd84ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211387
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
2026-09-28 18:31:51 +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
DrRobotto 3ca06ba114 tdf#133808 - Use cell counts in order to shrink entire columns/rows
Otherwise, entire ranges will never be shrunk leading to performance
issues.

Change-Id: If0c1d482ccaffd9446f0321782e3c0963514135f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211472
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2026-09-26 02:35:03 +02:00
Neil Roberts b991ec6042 tdf#173293 Use InvocationHelper in ooo.vba.excel.Application
ScVbaApplication now contains a comphelper::InvocationHelper member
which it forwards methods and properties to when ScVbaSWFunction doesn’t
recognise them. This makes it possible to access methods such as
getSelection when via the XInvocation such as when accessing the object
via pyuno.

Change-Id: I1481d4f2e613037ae9283bd86844bd4d805cd2bf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210131
Tested-by: Jenkins
Reviewed-by: Neil Roberts <nroberts@libreoffice.org>
2026-09-25 10:39:30 +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
Laurent Balland af745380b6 Add Go to Sheet to tabs context menu
Follow up of tdf#171207 to ease access when the number of sheets is high
Command is disable if there is only one visible sheet.
Same in menu Sheet > Navigate

Change-Id: I248ce773548747a615ad443d39352d040ba31813
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211223
Reviewed-by: Laurent Balland <laurent.balland@mailo.fr>
Tested-by: Jenkins
2026-09-23 20:58:37 +02:00
Caolán McNamara 19c1274daf crashtesting: don't thread a group with an uncalculated dependency
seen on converting forums/xlsx/forum-mso-en4-237685.xlsx to xls and
doing a hard recalculation of the reloaded export, which aborts with:

 soffice.bin: sc/inc/formulacell.hxx:514: void ScFormulaCell::MaybeInterpret():
 Assertion `!rDocument.IsThreadedGroupCalcInProgress()' failed.

 #11 ScFormulaCell::MaybeInterpret at sc/inc/formulacell.hxx:514
 #12 ScFormulaCell::IsEmpty at sc/source/core/data/formulacell.cxx:3218
 #13 ScRefCellValue::hasEmptyValue at sc/source/core/data/cellvalue.cxx:705
 #14 ScInterpreter::Compare at sc/source/core/tool/interpr1.cxx:881
 #15 ScInterpreter::ScNotEqual at sc/source/core/tool/interpr1.cxx:1162
 #16 ScInterpreter::DispatchOpCode at sc/source/core/tool/interpr4.cxx:3852
 #17 ScInterpreter::Interpret at sc/source/core/tool/interpr4.cxx:4414
 #18 ScFormulaCell::InterpretTail at sc/source/core/data/formulacell.cxx:2274
 #19 ScColumn::CalculateInThread at sc/source/core/data/column2.cxx:3270
 #20 ScTable::CalculateInColumnInThread at sc/source/core/data/table1.cxx:2740
 #21 ScDocument::CalculateInColumnInThread at sc/source/core/data/documen8.cxx:421
 #22 Executor::doWork at sc/source/core/data/formulacell.cxx:5541
 #23 comphelper::ThreadTask::exec at comphelper/source/misc/threadpool.cxx:320

lcl_InterpretSpan calculates the first cell of a dirty span with a
group call and the cells after it one at a time, and rechecks only
the cells it calculated one at a time.

The first cell can still be dirty when that call returns. The
dependency walk found a cycle, so the group was rejected, and that is
recorded on the group itself, as mbPartOfCycle and a meCalcState of
GroupCalcDisabled. Interpret then skips InterpretTail, so that only
the group which starts the cycle is calculated.

Both flags sit on the group that was rejected, while lcl_InterpretSpan
looks at the parent group. The bool it gets back says whether a group
interpret was done, not whether this cell was calculated, so the cell
has to be asked.

The rest of the span and the ungrouped cells have been checked for
exactly this since:

commit 4f36f2ccab
Date:   Fri Sep 4 15:51:07 2020 +0200

    detect if a cell still needs interpreting after Interpret()

so check the first cell too, and leave the group to the unthreaded
path when it was left uncalculated

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I3756ed54fbbb9caf48467e0faab5f5cdddb8e5da
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12674
Reviewed-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit e685bd07146af13db00f6b6811b74d2eba297d80)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211379
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-23 19:56:24 +02:00
DrRobotto 3eb431b90e tdf#162609 - Do not match error cells against numeric query items
Change-Id: I7dea4e56cfbd9516df02b308c5d1e444ac370105
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211325
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2026-09-23 16:58:05 +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
Bayram Çiçek 78cbe0b2fb tdf#171366: Calc: use the print dialog orientation on every page
- the printout lost rows when the user set Orientation to Landscape in
the File - Print dialog. Only the first page used the landscape paper.
The pages after it kept the portrait page breaks, so they took more rows
than fitted on the paper. The preview was correct, so only the paper and
the PDF showed the problem.

- ScModelObj::render() built a second ScPrintFunc after every page, so
that the document would hold the page style's page size again. That
object shared its page break vectors with m_pPrintState and recalculated
them for the portrait paper, so the next page read the wrong breaks.
render() now counts the pages once, after the last page.
  - "tdf#166107: remove unnecessary resetPrintArea()" added the second
  ScPrintFunc, https://gerrit.libreoffice.org/c/core/+/183948
  (eccf4cd57a)

- sc::PrintPageRanges kept its results in a shared_ptr and its input by
value. One copy could recalculate the shared result while another copy
still read its own input as a match. PrintPageRanges shares the input
along with the results now.

- added testTdf171366 to check that the print dialog and the page style
split the sheet at the same rows.

Signed-off-by: Bayram Çiçek <bayram.cicek@collabora.com>
Change-Id: Ifa5998278ff899e713b439e33ed04d76f109fbc5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210649
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Tested-by: Jenkins
2026-09-22 13:48:14 +02:00
Julien Nabet d635f53f71 replace character set by encoding (sc/part 4)
Change-Id: I87e068ea6c77a8c648d4d58142ffcbf862b30f3e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211271
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2026-09-21 18:41:15 +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
Mike Kaganski 5c7062bde2 tdf#171022 sc: name the element a cell's hyperlink points at
Give a cell a link to another sheet with Insert - Hyperlink. Export
it with File - Export as PDF, Tagged PDF on. veraPDF, on the PDF/UA-2
profile, fails clause 8.8 once per such link:

 Destination in Outline item, OpenAction or Link annotation is not a
 structure destination

The link annotation named a page and an area on it, and that is all:

 /Dest[28 0 R/XYZ 56.693 445.607 0]

I56c2f517977d4b876e463f4bcadc53f8ae444b08 ("tdf#171022 sc: name the
element an outline item points at") gave the export a list of
destinations to name an element for, resolved once the last page is
drawn. A hyperlink goes in that list too. The export now keeps each
cell's element as the cell is drawn, so a hyperlink onto a cell names
that:

 /A<</Type/Action/S/GoTo/D[28 0 R/XYZ 56.693 445.607 0]/SD[33 0 R/XYZ 56.693 445.607 0]>>

/SD names an element where /D names a page. Object 33 is that cell's
/S/TD, and its /Pg is that page. A sheet's /S/Worksheet has the
sheet's first page for its /Pg, so it can stand in only for a
destination there. A link onto a cell nothing was drawn for names the
sheet then, and keeps the plain destination on a later page. So does
a link to a sheet that prints nothing. The test document goes from
four failures of the clause to none.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I3b1dc51e9962ac19061934d447da9542ee56b0fd
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12393
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 51a84acd2fccf7120959ff7ff16a0549ddb34f58)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211172
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-21 00:21:06 +02:00
Mike Kaganski 9ec63cdce0 tdf#171022 sc: name the element an outline item points at
With Tagged PDF and Export outlines both on, export a two-sheet
spreadsheet with File - Export as PDF. veraPDF, on the PDF/UA-2
profile, gives two failures of clause 8.8, one per sheet:

 Destination in Outline item, OpenAction or Link annotation is not a
 structure destination

Each sheet's outline item named a page and an area on it, and that is
all:

 /Dest[1 0 R/XYZ 0 792 0]

Calc creates the outline item before drawing the sheet, and opens the
Worksheet element only while drawing. So the destination can't name
the element where it is made. The export state now outlives one
sheet: it keeps each sheet's element, and each destination with the
sheet it points at. The last page joins the two:

 /A<</Type/Action/S/GoTo/D[1 0 R/XYZ 0 792 0]/SD[5 0 R/XYZ 0 792 0]>>

Object 5 is the first sheet's /S/Worksheet, and the clause passes.
The Writer half is Ic76d80d46f130d549ebaacf175393a3d6ec77998
("tdf#171022 sw,vcl: name the element a link points at"), which added
the vcl call used here. A hyperlink to a cell still gets a plain page
destination, and needs its own change.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I56c2f517977d4b876e463f4bcadc53f8ae444b08
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12366
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 3571fc6be8f8e33ce25a1e83ac4d5dcd8da6494a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211171
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-21 00:20:59 +02:00
Michael Weghorn 153e3af7b4 sc a11y: Pass OAccessible to ScAccessibleDocument::RemoveChild
Pass param by the more concrete OAccessible instead
of using the abstract XAccessible UNO interface.

Change-Id: I8f7a2b22328da38e4d0d62b8c91bc45354a1bef9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211212
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2026-09-20 22:19:24 +02:00
Michael Weghorn f0581dd8da sc a11y: Return directly in ScAccessibleTableBase methods
Return a default-constructed empty reference directly
instead of first assigning it to a local XAccessible variable.

Change-Id: I8cfb0a22f189eb82643a2b865ccc3bf065cacf9a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211211
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2026-09-20 22:18:55 +02:00
Michael Weghorn a638e417c2 sc a11y: Use OAccessible in ScAccessiblePreviewTable::getAccessibleCellAt
Use more concrete type instead of the abstract
XAccessible UNO interface for the local variable.

Change-Id: I17149ff7a1be1e3ebf76d2a40f16df564d43437b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211210
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2026-09-20 22:18:38 +02:00
Michael Weghorn 9d8f019f2e sc a11y: Drop redundant OAccessible::getAccessibleContext call
It returns a reference to itself, so is not needed here.

Change-Id: If474740c54f50084ad6f32fde6727ef6df076a9c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211209
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2026-09-20 22:18:21 +02:00
Michael Weghorn 70003dfd3e a11y: Use OAccessible in ScAccessibleDocumentPagePreview::getAccessibleAtPoint
Use the more concrete OAccessible for the local variable
in ScAccessibleDocumentPagePreview::getAccessibleAtPoint instead
of the abstract XAccessible UNO interface.

Change-Id: I4a0df2d86fea83cb9524b61242781c8ae01fed2b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211208
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2026-09-20 22:18:03 +02:00
Michael Weghorn 36f1906093 sc a11y: Use OAccessible in ScAccessibleDocumentPagePreview::getAccessibleChild
Use the more concrete OAccessible for the local variable
in ScAccessibleDocumentPagePreview::getAccessibleChild instead
of the abstract XAccessible UNO interface.

Change-Id: If70ea4a5c3d2a8e038131899a068790e8956e008
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211207
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2026-09-20 22:17:44 +02:00
Michael Weghorn a7592df3d1 sc a11y: Return OAccessible in ScNotesChildren::Get{At,Child}
Return the more concrete OAccessible instead of the
abstract XAccessible UNO interface.

Change-Id: Iac67e2d64bf6cbfcba97d9c41e953ea3f5a1e823
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211206
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2026-09-20 22:17:27 +02:00
Michael Weghorn 11f46b5535 sc a11y: Use concrete type in ScAccessibleCsvRuler::getAccessibleRelationSet
... for the local variable instead of a reference to the abstract
XAccessible UNO interface.

Change-Id: I8237c5f2020f5cfd265a9587cbbed2db9f150fa4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211205
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2026-09-20 22:17:08 +02:00
Michael Weghorn d844d94a43 sc a11y: Hold reference to concrete class
... instead of one to the abstract XAccessibleContext UNO interface.

Change-Id: Ia4ca74e903bbaa510ead8661727f938898825b77
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211204
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2026-09-20 22:16:36 +02:00
Michael Weghorn d09b0d2b2d sc a11y: Use concrete type, drop redundant UNO query
Use a local variable of the specific ScAccessibleSpreadsheet
type instead of the abstract XAccessible UNO interface.
This drops the need to explicitly query for the
XAccessibleTable interface, as ScAccessibleSpreadsheet
is known to implement it.

Change-Id: I2c7ab68c699f22d919f75d12758cc0b062de4750
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211203
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2026-09-20 22:16:19 +02:00
Michael Weghorn 4dd19a1fb8 sc a11y: Don't make overrides of public a11y API methods private
In ScAccessibleSpreadsheet, keep the overrides of methods
defined in UNO accessibility interfaces public.

Otherwise, this would make it impossible to call them
when holding an object by an rtl::Reference<ScAccessibleSpreadsheet>,
while it would work when held e.g. as a
uno::Reference<XAccessibleTable>.

Change-Id: Ia3393b240ef1e0aa1b79b4a99cc6fac803537573
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211202
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2026-09-20 22:15:58 +02:00
Michael Weghorn dd4e8c4854 sc a11y: Use concrete type for local variable
Use the concrete type instead of the abstract XAccessible
UNO interface.

Change-Id: Ie8df5eb084c18048952ab4f291597540dac708f2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211201
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2026-09-20 22:15:37 +02:00
Michael Weghorn 289bf323bf sc a11y: Use concrete type for local vars in AccessiblePageHeader
Use the concrete type the children have for local variables
in 2 AccessiblePageHeader methods instead of the abstract
XAccessible UNO interface.

Change-Id: I592bea748c35559b9e6e56df343617aa41f3a8af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211178
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2026-09-20 22:10:15 +02:00
Andreas Heinisch 23ed6f4045 tdf#82008 - Simplify ScFilterDlg::LbSelectHdl
Change-Id: Ib2029c647d1146f72e0b690bf26c7f829c260624
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211149
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2026-09-19 11:09:12 +02:00
Balazs Varga 31e2c176d0 sc: XLOOKUP and XMATCH look for an empty cell again
An empty cell as the search value found nothing. XLOOKUP(;A1:H1;A1:H1)
with the argument left out does find the first empty cell, but a
reference to an empty cell took the string branch in ScXLookup() and
searched for "" instead, so SetQueryByEmpty() was never reached and
neither the range nor the matrix search could match. MSO returns the
row of the empty cell.

A search value that is empty now sets isEmptySearch however it
arrives, from a cell reference, from an external single reference, or
from a matrix element under a JumpMatrix, in ScXLookup() and
ScXMatch(). ScMatch() keeps its own behaviour, it has no empty search
at all. lcl_CompareMatrix2Query() reports an empty element as equal
when the query asks for empty, which is what its TODO asked for.

The search also stops at the first empty element now instead of
running to the end of the vector, so an entire external column that
holds a thousand cached rows costs a thousand comparisons and not a
million. One such array formula went from 24s to 2s.

Note: a search value that is an empty cell now finds the first empty
cell of the search range, so a document that showed a #N/A there
shows the matching value instead.

Change-Id: I487b31bc5a4fe1edd35df14db0ae8f1548f7406d
Signed-off-by: Balazs Varga <balazs.varga@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12616
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 1903238df9d450e8a1d62f442af1967fcbf3f111)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211107
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-18 16:16:22 +02:00
Balazs Varga a0f3d71b69 sc: fix missing error for an external range without an intersection
='file:///source.ods'#Sheet1.A1:A5 written in a row the range does
not cover showed the first cell of the range. A sheet local range
gives #VALUE! there, because DoubleRefToPosSingleRef() finds no
position and pushes nothing, while an external range went on to the
matrix path and the cell took the top left element of it.

Interpret() now sets NoValue for a range that the position does not
intersect, outside a matrix formula where the whole matrix is the
point. A document that cannot be reached reports its own error
before that, so an unresolved link still gives #REF! and not
a #VALUE!, which testExternalRefUnresolved checks.

MSO gives #VALUE! for =@'[source.xlsx]Sheet1'!A1:A5 in such a row.

Follow-up of commit: I68cc88b5bb533cfcd19537be6705e8a64834af64
(sc: take the implicit intersection of an external range)

Change-Id: Id619ec3285060ea42033ff2343ea7316f382c3d7
Signed-off-by: Balazs Varga <balazs.varga@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12615
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 895d3f3948cc7d407caaa0ebd7165ea48c44ec8c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211106
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-18 16:16:18 +02:00