Commit Graph
1878 Commits
Author SHA1 Message Date
Caolán McNamara b14f8b9dfa stop the fill-bitmap link listening to its host's SvtBroadcaster
It's annoyingly difficult to remove the links from the broadcaster,
drop that approach and do it a more direct and less reentrant way.

Get ~SwFormat and SwContentNode::ImplDestroy to report the death to the
tracker instead.

A flag on SwDoc keeps the common no-links case in those destructors to a
single test.

During ~SwDoc the hosts stay silent: the links administration manager
can already be unreachable through the half-destroyed document, and
~FillBitmapLinkTracker releases whatever is left without touching the
dead hosts.

SwContentNode::ImplDestroy skips disconnected nodes, the stack-built
working copies like SwTextNode::Update's SwContentNodeTmp that have no
nodes-array and no SwDoc. A node deleted for real still reaches its
SwDoc, since SwNodes::RemoveNode deletes nodes while they are still in
the array.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ibbf15e4e17a7a08aa029c9d5df8f40b7a4a13e04
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/4282
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 38ac5c0e6c7baf4de27498e5428d6279c753c97e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208603
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-25 15:26:55 +02:00
Caolán McNamara 928a715ddf register writer XATTR_FILLBITMAP URLs as SvBaseLinks via SwFormat...
...and SwContentNode

rather than digging around via pool ItemSurrogates for these writer
elements

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I4222cc9aeda1335252f48c4242edfc5fc71a60f0
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/3471
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit d8a09afac6108d7ba23b253ed83b564af8a31c55)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208082
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-25 01:47:59 +02:00
Mike Kaganski 26b8e7da32 tdf#163949 Find Previous now highlights text in every frame
When a document had several frames each containing a match, using Find
Previous only ever selected the match in the last frame; earlier frames
were skipped ("Find Next" and "Find All" were fine).

Backward text search walks the node array through SwNodes::GoPrevSection.
Since 691cfd22c6 ("tdf#159565: make sure to
handle leading hidden section correctly", 2024-02-14) that function stops
at the start of the current global section (here, a fly's start node), so
once the search stepped into a frame it could not move back into an
earlier one and got stuck in the last frame reached. GoPrevious got an
opt-in canCrossBoundary flag back then, but GoPrevSection did not.

Give GoPrevSection the same canCrossBoundary flag (default false, so plain
backward moves keep respecting section boundaries), and let the search
iterator in GetNode() opt in: it walks a range that is already bounded by
the PaM's mark, so crossing fly / header / footer / footnote boundaries
within that range is both wanted and safe. This also restores backward
Find across multiple headers, footers and footnotes. Forward search uses
GoNextSection, which was never limited - which is why Find Next and Find
All kept working.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I0c0971013d2fab19dac1de1e252586d7ea554c2b
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7060
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 051e00083683db002942b94d0323c5d8fd13e6d4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208242
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-07-19 02:08:36 +02:00
Caolán McNamara 0fc4bfb611 Removed unused bUpdateGrfLinks param from LinkManager::UpdateAllLinks
Change-Id: Ie9d364feab5bbb623fff3277375e65e8b7f412a4
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/2387
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 41c0c39fbd9edd117b241f0f311000c074d9a8fc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205493
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-22 09:36:27 +02:00
Julien Nabet 95c28f1faa Related tdf#164685: Cleanup class SfxItemSetFixed (sw remnants)
Change-Id: Ideb392dadad9dabc08d978bdc23ecc4cc671c7c3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/203940
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2026-04-20 12:29:03 +02:00
RashmiVid 9f2e368e76 tdf#145538 Use range based for loops in tblafmt.cxx and ndtbl1.cxx
Replace index basedloops with range based loops where safe.
No functional change intended.

Change-Id: I9b6ed9a03d4a35d809f3049c371efa7d1f43e060
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202787
Reviewed-by: Dmitriy Usov <du@thesec.net>
Tested-by: Jenkins
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
2026-03-31 17:35:47 +02:00
Michael Weghorn 7a7b9039b3 sw: Return reference in SwCellFrame::GetTabBox
Change-Id: I7d258afa33539b132b03e9b7b8c352356bfc026e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200930
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2026-03-04 12:08:24 +01:00
Noel Grandin 5505d3bc4d loplugin:constparams
Change-Id: I33c701be5a441c1121b797f1eb5a8bda6fc3f89b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200927
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2026-03-04 11:29:39 +01:00
Kashif 05007e451c tdf#158237 sw: use contains() instead of find() != end()
Change associative container's find() and end() comparisons to the simpler
C++20 contains() method to improve readability.

Change-Id: Ia35944a323dfeb640d3de335380a3002152a993a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199637
Tested-by: Jenkins
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Reviewed-by: Simon Chenery <simon_chenery@yahoo.com>
2026-03-03 20:12:09 +01:00
Noel Grandin 2e063bf91b speed up SfxItemIter
take some branches out of the hot path, which means
converting some places to for loops.

Change-Id: Idcac06f27761994e2554f723662f242a38d3778c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199853
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2026-02-21 12:38:26 +01:00
Caolán McNamara af326f015f cid#1681350 Uninitialized scalar field
since:

commit 513bfbd476
Date:   Wed Aug 20 15:58:21 2025 +0530

    Writer: Adapt 'SvxAutoFormat'

Change-Id: I3277fcaded1b7fb32260a1e38c5160b303912676
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199749
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2026-02-19 21:02:04 +01:00
karthik 4e3dfc1460 sw: Fix memory leak in lcl_SetDfltBoxAttr
`DfltBoxAttrMap_t` is no longer needed as cache. This is related to
513bfbd476

Change-Id: I5115502c69dc7f33d8c70541c8f36e8860e5282e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199512
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
2026-02-17 09:51:09 +01:00
Mike Kaganski c6661190de enable-msvc-analyze: C6011: Dereferencing NULL pointer
C:\lo\core\sw\source\core\docnode\ndtbl.cxx(4208) : warning C6011:
Dereferencing NULL pointer 'pAutoFormat'. .: Lines: 4196, 4197, 4200,
4201, 4202, 4201, 4202, 4201, 4205, 4207, 4208, 4209, 4208, 4219, 4205,
4207, 4208

Change-Id: I09e5c714e8762602118332368c13f43b64a64360
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198901
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2026-02-08 14:20:59 +01:00
Karthik 513bfbd476 Writer: Adapt 'SvxAutoFormat'
Adapt Writer to use new 'SvxAutoFormat' and retire Writer specific
'AutoFormat' dialog and preview.

Change-Id: I272ff0d4415d9f13402374c8ad7b6721ed749931
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190027
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Tested-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
2026-02-04 14:02:26 +01:00
Noel Grandin 26d80567e7 tdf#148218 reduce OUString allocations in SwScanner::NextWord
since we only use one break-iterator these days,
expose a additional C++ interface to that, as well as the existing UNO interface,
and add a method which allows us to avoid allocating an OUString when calling endOfScript().

Shaves off 20% of the temporary allocations.

Change-Id: I7092affc1820555353e8bf6498e11c9eff42cfad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198276
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2026-01-29 08:44:35 +01:00
Miklos Vajna 58d677055d cool#13988 sw redline render mode: handle anchored images
Once a non-standard redline render mode is set, either the inserts or
the deletes are "omitted" (painted in a semi-transparent way), but
nothing happens with images.

The standard redline render mode already had a way to cross out deleted
images, which gives us a starting point.

So use that info to render deleted flys in grayscale, and do the same
for inserted images, depending on if "omit of inserts" or "omit of
deletes" was requested.

The test simply asserts if the pixel at the center is gray-ish, which
detects the unwanted colors. The alternative would be to go via
BitmapEx::ModifyBitmapEx() and basegfx::BColorModifier_gray, but then
the bitmap checksum didn't match for me, even if the result was visually
the ~same. (I.e. the idea could have been to see if a 2nd "gray" filter
has any effect: if no changes, then the input was grayscale.)

Change-Id: I3484b3b122d42006b44617b6df5bc9a5631b9266
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197674
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2026-01-20 18:32:46 +01:00
Noel Grandin d11198b7bd convert RES_POOL* constants to scoped enum
Add a new UNKNOWN constant instead of using USHRT_MAX.

Not sure about the naming of the ZERO constant. Maybe
it should be DEFAULT.

Change-Id: Ia1d0c0e0036c3dbd52cb4cdd935d0c736dcea5fd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197455
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2026-01-20 11:53:19 +01:00
Gabor Kelemen b63115f3fa tdf#146619 Use more forward declarations in include/vcl/[d-g]*
Found after running bin/find-unneeded-includes --headersfwd include/vcl/[d-g]*

This shaves off about 150M input

Change-Id: I2b15257451d4b392dca3e5d07f4a443ee653b04c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196395
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen <gabor.kelemen@collabora.com>
2026-01-11 21:38:37 +01:00
Mike Kaganski 7f198b27f4 Drop class utl::MediaDescriptor, and use comphelper::SequenceAsHashMap
utl::MediaDescriptor was just a SequenceAsHashMap with a few added
methods. It made it more difficult to assign a SequenceAsHashMap to
MediaDescriptor, without real upsides. In many places, the class was
used not as media descriptor, but just as helper to create sequences.

This change puts the string constants and the former methods into a
namespace utl::MediaDescriptor.

It would be also good to drop comphelper::NamedValueCollection, which
is basically a twin of comphelper::SequenceAsHashMap (TODO).

Change-Id: Ia9b69c5a2ad153ecc654944c419c1880252ed86e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195163
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2025-12-06 18:18:32 +01:00
Caolán McNamara eea32fef2b lcl_CalcSubColValues always derefences its third argument
Change-Id: If88e21a96ebc14e39ca212fff7f30cb909d16fad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195072
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
2025-12-06 12:12:29 +01:00
Caolán McNamara a853ff78e0 lcl_CalcCellFit always dereferences its first argument
Change-Id: I4fb7ae6e39617f74413cd1399bfc0a08f67be4ec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195071
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
2025-12-06 12:12:15 +01:00
Caolán McNamara 95c335e665 SwRectFnSet always dereferences its argument
Change-Id: I2e8e140facde68af53de35a629395365ce9f8bb4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195069
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2025-12-05 15:28:17 +01:00
Caolán McNamara c2d149357c cid#1660226 silence Uncaught exception
and

cid#1659881 Uncaught exception
cid#1482285 Uncaught exception
cid#1448465 Uncaught exception
cid#1421098 Uncaught exception
cid#1421084 Uncaught exception
cid#1400542 Uncaught exception
cid#1399276 Uncaught exception
cid#1399221 Uncaught exception
cid#1399212 Uncaught exception

Change-Id: I448e698047a6d2db7b0ac7575a54473fc5e88cc9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194394
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2025-11-23 17:55:06 +01:00
Justin Luth 6ef29b80c9 tdf#145689 sw: transfer breaks to table-in-table
A table is allowed to specify a page break.

If a table-in-table is the first thing in cell A1,
then (only) that table-in-table is checked for the page breaks,
so transfer page breaks when inserting a table-in-table.

make CppunitTest_sw_htmlimport CPPUNIT_TEST_NAME=testTdf155011

Change-Id: Iae6d54aa2c7c33e07cdd235ff347a9d0fde3dc65
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191050
Reviewed-by: Justin Luth <jluth@mail.com>
Tested-by: Jenkins
2025-09-17 02:25:19 +02:00
Michael Stahl fc53ab8e76 sw: floating table split
The problem is that the Table Split feature on a floating table results
in 2 tables inside 1 frame, which then cannot be exported to DOCX as a
floating table.

Split the fly frame in this case, and add an anchor node because every
floating table needs its own anchor node.

Change-Id: I7444a75a953fcea60ffc92c2fa7eaca1b044f54b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190009
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 6f55b9a74f8fdd8609e1aa72388a5f8b97dfcea0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190075
Tested-by: Jenkins
2025-09-03 11:22:11 +02:00
Mike Kaganski be6aa7ca0a tdf#168070: SwFindDocShell may need an interaction handler
It may attempt to open the passed document, and then it would create
an SfxMedium, that will define how to interact e.g. on errors. When
caller has an interaction handler, it should pass it.

Change-Id: Icd0881ecf31b1e1a4731e1776413c1f62803c256
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190173
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2025-08-25 17:13:00 +02:00
Michael Stahl 7c9b5d56f0 sw: fix rounding problem in lcl_SetTableBoxWidths2()
Prevents bunch of warnings like:

    swnewtable.cxx:2525: Line width differs from table width: 14148 current [0]: 14144

Change-Id: Ic24096d91ad6646635038a06b74251e3bcbad134
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188152
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit 65987cb2f8ed6b6cf67032cbce4c5e58f2577803)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188202
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Tested-by: Jenkins
2025-07-23 12:48:25 +02:00
Noel Grandin 9b79ae1161 loplugin:blockblock
found with a modified copy of this plugin

Change-Id: Ib2ca97c7479abdf1a375e2700f9c947e1101f0e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188065
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2025-07-19 19:11:16 +02:00
Xisco Fauli 3e86a87950 SwAttrPool: pass SwDoc by ref
After
commit ca6b1677cc
Author: Xisco Fauli <xiscofauli@libreoffice.org>
Date:   Tue Jun 3 11:59:57 2025 +0200

    sw: no need to create a dummy attr pool

Change-Id: Iadc9df6ffab9f479355cd3e2c649a2d3f9c1dbfb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186203
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2025-06-05 14:10:51 +02:00
Caolán McNamara 31055d3b22 use shallow copy of default AutoFormatTable
Change-Id: I958f0b6329c4d55af61a94e641bd328abe08dad7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186063
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
2025-06-01 20:57:46 +02:00
Caolán McNamara 375b9d26bb SwTableAutoFormatTable ctor is always followed by Load
so call that from the ctor

Change-Id: Ic071be84cedb8b131339030d294bbf4690902ac8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186036
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2025-05-31 22:20:53 +02:00
Gabor Kelemen 44fc341843 Remove obsolete fw declarations from sw/ (part 1)
found with bin/find-unneeded-includes --fwdecl

checked sw/inc, sw/source/core/ so far

Change-Id: I1fdf17d09e40a76b17e356ac45cebec568c698f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183908
Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
Tested-by: Jenkins
2025-05-15 08:45:58 +02:00
Miklos Vajna ca7a6a57ad tdf#166319 sw interdependent redlines: handle format on top of insert
Open the bugdoc, the DOCX file has an insert with a format on top of the
middle, but the format is lost in Writer.

The first problem is that we tried to create an insert on top of format
(while in DOCX the format is always inside the insert/delete), fix that
by changing the order of redline creation in
DomainMapper_Impl::CheckRedline(). The original motivation is no longer
relevant after commit b3567d7e1f
(tdf#165322 sw: apply formatting for multiple redlines in SwRedlineItr,
2025-02-25) Writer core to handle the rendering of format on top of
insert/delete.

The other problem is that in case we try to append a format redline on
top of insert ("AB" is an insert and the format would affect "B"), then
we simply deleted the (candidate) format redline -- change this to
handle this similar to delete on top of insert.

CppunitTest_sw_ooxmlexport8's testN830205 would now create an unsorted
redline table on file open, so make sure SwDoc::TextToTable() resorts
the table after splitting the redlines.

Change-Id: Iada13204892ffccfe09bc2c28bf0c563db6e1ab9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184752
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2025-04-29 12:49:01 +02:00
Noel Grandin ac3b217a43 Make UINames and Programmatic Names typesafe
by wrapping up OUStrings inside some type-safe wrappers
to make it obvious in the code what kind of name we
are dealing with.

The new classes are in sw/inc/names.hxx

Note that I spun the names for table formats out into
their own name class TableStyleName, becuase they
are weird. Most of the time they are UINames, but
not always.

Change-Id: Iaf320639fd1aae8ba0f99866ff206906544c42be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178839
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2025-04-16 16:33:12 +02:00
Noel Grandin 0e9e0f720f loplugin:constparam in sw
Change-Id: Ic169c3c090d5617fb22d9dbb6c09dc3ec69e57fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183431
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2025-03-28 10:47:46 +01:00
Oliver Specht ff81c82851 tdf#158709 Update cell formula if cells change from value to text
Modification of cells that are part of formulas notify
also if numeric content is changed to text - even if they have
 multiple paragraphs.

Change-Id: Ifb6a35f4c162388d4fadd73e5207a6d3719a9a04
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180013
Tested-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
2025-03-26 15:24:49 +01:00
Miklos Vajna 2d73d37875 tdf#165701 sw: fix unexpected list level change on inserting new bullet
Go to the end of the 3rd paragraph of the bugdoc, press Enter, list
level of both the old and new paragraphs change from 5 to 4,
unexpectedly.

It seems what happens is that the paragraph in question has a style
which has its outline level set to 4. So once the node is split, the
newly inserted node will host the old text (so need to set the style on
it to the old style, which sets list level to the outline level from the
style as a side effect) and the old node will host what looks like a new
bullet point on the UI, so there we need to set the paragraph style to
the follow style. This second set-style also drops the list level direct
formatting and takes the outline level from the style.

Fix the problem by keeping the old scenario (paragraph style with a
different follow style) unchanged, since a different list level on an
actual paragraph style change can be expected -- but avoid setting a
list level when this is a simple node split with just the same style on
both nodes. That's not seen as an explicit "set style" by the user, so
changing the list level there is confusing.

In fact the list level is fine after copying the text node's item set
from the old node to the new node, just make sure that
SwTextNode::ChgTextCollUpdateNum() doesn't set a new list level in the
"effectively no style change" case. Make sure to not set a new list
level at both places (SwTextNode::MakeNewTextNode() does this for the
previous node, SwTextNode::ChgFormatColl() does this for the next node).

Change-Id: Ifdf9048f01fef7bb8e99098ebeb5d1ec339fdaa6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182869
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-03-13 16:35:19 +01:00
Noel Grandin d883aab37d loplugin:constantparam
Change-Id: Iba5ce1d44e52610e985e97d299571cf3387d938a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182180
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2025-02-25 19:37:56 +01:00
Michael Stahl 8712673a44 sw: use same paragraph properties as Word for hidden text
This is a follow-up to commit 2bcfb7231b
"tdf#152872 sw: conditionally hide paragraph breaks".

Word determines the paragraph properties differently depending on
whether paragraphs are merged by hidden text (where the first paragraph
containing non-hidden text wins) or delete redlines (where the last
paragraph wins).

This fixes the hidden text situation while leaving the delete redline
situation as it is.

The problem is that CheckParaRedlineMerge() only considers hidden text
on the paragraph end marker (RES_PARATR_LIST_AUTOFMT) but not elsewhere
in the paragraph, so there are extents for the hidden text.

The actual hiding of that is done via ScriptInfo::m_HiddenChg, which
cannot be removed and replaced by merging because it is required for
Writer's notion of hidden paragraphs in SwTextFrame::IsHiddenNowImpl().

* FindParaPropsNodeIgnoreHidden() skips over nodes that contain only
  hidden text in case hidden text isn't shown

* factor out ScriptInfo::InitScriptInfoHidden() because it is now needed
  to find the pParaPropsNode, but the rest of InitScriptInfo() requires
  the pParaPropsNode...

* testTdf152872 requires changes as it was relying on ControlCharacters
  alone toggling the merging

list of commits that tweaked setting pParaPropsNode:
58353884dc (related: tdf#130685) sw: adapt definition of sw_redlinehide index 0
b86ff2c6a8 tdf#118699 sw_redlinehide: need some more changes to use the last node
fa5eb82b39 tdf#118699 change tracking: don't number empty lines
beec159458 tdf#125319 sw_redlinehide: handle empty paragraphs more like Word
c20308f1b9 sw_redlinehide_4b: surprising discoveries

Change-Id: If0e49a4d105dbf7d71e753967f36f2ec56f21f1d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181918
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Tested-by: Jenkins
2025-02-20 17:27:12 +01:00
Michael Stahl b5967157b3 tdf#156348 sw: fix crash on converting text to table with SwSetExpField
The problem is that the table node only gets a SwFrameFormat assigned at
the end of the operation after all the nodes have been split etc., and
moving a field into a newly split node calls
sw::FindNeighbourFrameForNode() which needs to handle table node without
SwFrameFormat now when going backwards (not when going forwards because
the table node is always before the nodes in the table).

(regression from commit 9dc6e2c906)

Change-Id: Ia0c1f7d7b14f525aa8de4a2b6492c39b59f31052
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180914
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Tested-by: Jenkins
2025-01-29 19:43:42 +01:00
László Németh c377f4f038 tdf#121119 master docs at-page anchor: clean-up renaming
Add file name only to the objects anchored at page, not
to all of them.

Follow-up to commit 2f135fa82c
"tdf#121119 master docs at-page anchor: fix missing images",
commit fb4197ed81
"tdf#121119 master docs at-page anchor: fix duplicated images"
and commit 47d596688f
"tdf#121119 master docs at-page anchor: fix runtime duplicated images".

Change-Id: If851818731e87225d53370978a92c02cfb5d7189
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180678
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-01-24 07:40:34 +01:00
László Németh 47d596688f tdf#121119 master docs at-page anchor: fix runtime duplicated images
Asking for "All" update of the master document resulted
duplicated objects anchored at page, loading the subdocuments
again, which contained the images originally.

Follow-up to commit 2f135fa82c
"tdf#121119 master docs at-page anchor: fix missing images"
and commit fb4197ed81
"tdf#121119 master docs at-page anchor: fix duplicated images".

Change-Id: I4c76c325963cd740906045653fc90055ce1840c6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180628
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2025-01-23 17:30:57 +01:00
László Németh fb4197ed81 tdf#121119 master docs at-page anchor: fix duplicated images
Skip saving images anchored at page in the master document,
if they are imported from subdocuments to avoid their duplication
during the round-trip/update of the linked subdocuments.

Follow-up to commit 2f135fa82c
"tdf#121119 master docs at-page anchor: fix missing images".

Change-Id: I731026bee01576fe66c9d677b53c7f85a53230fa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180627
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-01-23 17:29:39 +01:00
László Németh 2f135fa82c tdf#121119 master docs at-page anchor: fix missing images
Images and other objects anchored at pages weren't imported
from the subdocuments, resulting broken master document.

Subdocuments are imported as sections of the master document,
but their objects anchored at page need a document-level copy,
not a section one. To calculate the new document-level page
number of the copied object, store and sum the page count
meta data of the previous subdocuments, added to the subdocument-
level page number of the object.

Note: the recent solution doesn't calculate with the own text
content of the master document yet. As a workaround, to get
the original page number exactly, store everything in subdocuments
before the objects anchored at page.

The problem is inherited from OpenOffice.org, see ooo#19131.

Change-Id: I0be80bb27442565764142d2b23b0f56a3421c035
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180626
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2025-01-23 17:28:07 +01:00
Caolán McNamara 9723eab349 cid#1641353 COPY_INSTEAD_OF_MOVE
Change-Id: I9037272d4f6ff2e2008d6e13e8021551e5cab1af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180530
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2025-01-21 09:42:34 +01:00
Noel Grandin f60995e97f pass param by reference in GoNext/GoPrevious
to enforce that they are never nullptr

Change-Id: I973dcc143b5334c3060a0f815474e569deae4c27
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180459
Tested-by: Jenkins
Reviewed-by: Ashod Nakashian <ash@collabora.com>
2025-01-20 17:19:23 +01:00
rafaelhlima 7afd95daf2 tdf#164685 Cleanup SfxItemSetFixed
Cleanup of class SfxItemSetFixed as described in the bug ticket.

Change-Id: I0704ab45624217a8d00a942e0e8d6d6276934306
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180255
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Tested-by: Jenkins
2025-01-20 12:38:28 +01:00
Noel Grandin 79d6de8f87 Make Programmatic Names typesafe
by creating a wrapper class, to make it obvious in the code what kind of
name we are dealing with.

The new class is in sw/inc/names.hxx

Change-Id: Ifb3e598d497f098cf1fce71b87c5e0da9f8a7151
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180406
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2025-01-20 12:08:36 +01:00
Noel Grandin 384c21f893 convert RES_UPDATE_ATTR to SfxHint
Change-Id: I4d5da5ba4e65ddbce2cb05bdfda34eb582c52d59
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179843
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2025-01-16 21:08:27 +01:00
Noel Grandin f5a23e690d missing return statement in SwSectionFormat::SwClientNotify
regression from
    commit da758c4d15
    Author: Noel Grandin <noelgrandin@gmail.com>
    Date:   Sun Jan 5 13:23:59 2025 +0200
    convert RES_OBJECTDYING to SfxHint

Change-Id: I4fdfd2ffe1d395d28b0eadd61613dbee2dc3de51
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180333
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2025-01-16 10:40:46 +01:00