Commit Graph
260 Commits
Author SHA1 Message Date
Ujjawal Kumar cb2bc2ba0e WordML import: fix huge recursion depth in replace-spaces
Bug document: fdo67478-1.doc

The replace-spaces template consumed one pair of spaces per recursion
level. WordML documents with very long space runs (e.g. 61000
consecutive spaces) exceeded libxslt's 3000 depth limit, causing an
import error.

Consume the entire consecutive space run in a single call by using
translate() to find the first non-space character, counting all leading
spaces at once, and emitting a single <text:s text:c="N"/> element.
Recursion depth is now bounded by the number of separate space runs,
not the total number of spaces.

Change-Id: Ifb11a61a2e89274684e1d6d38920c8792598fa43
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/62
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 7ba970bce9e1200e5712afe76ec3a85056be9263)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204666
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-02 17:46:23 +02:00
Justin Luth 7701e0ac7e tdf#171433 starmath ooxmlimport: handleSetString must encloseOrEscape
This fixes a 25.8.5 regression from
    tdf#169843 math: OOXML set letter not interpreted correctly

make CppunitTest_sw_ooxmlexport27 \
    CPPUNIT_TEST_NAME=testTdf171433_equation

make CppunitTest_sw_ooxmlimport2 \
    CPPUNIT_TEST_NAME=testTdf169843_set_letter_formula

Change-Id: I5f2757e1b9023f226f6c8dc14376e170f41f4c3d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202320
Reviewed-by: Justin Luth <jluth@mail.com>
Tested-by: Jenkins
2026-03-23 16:39:04 +01:00
Xisco Fauli d420dc43ed CppunitTest_sw_apitests: split into different targets
so it can benefit from parallelism

Change-Id: I9cd5fbba4ea2438ed43825cc845a559f17b32162
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199600
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-02-18 21:17:03 +01:00
Xisco Fauli 045c51c2cc sw: move trackedChanges uitests to their own place
Change-Id: I38c7d9e2765d79b5eeaa770c3e9d6c972c735242
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199046
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-02-10 14:13:05 +01:00
Tamás Zolnai a1f1204dd2 Add unit tests for page line-spacing in preparation for future development.
Change-Id: I1dd4ccb22316ae5f9a2aa7c8b8a8d9494dd3e00b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197361
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai <zolnaitamas2000@gmail.com>
2026-01-15 20:09:52 +01:00
Caolán McNamara 63ee5211a4 move writer tests using CJK fonts to new target
where adding a new cjk font to the bundled fonts triggers
an abort from:
gb_CppunitTest_set_non_application_font_use,...,abort

because the docs require glyph fallback to render, but without a CJK
font in the application fonts glyph fallback doesn't actually happen.
But once one is added, then the fallback is detected and the check
fires.

Change-Id: If02a2c1eefd6f5b6e4a19ca46f359cce466662f1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195597
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2025-12-14 21:20:05 +01:00
Xisco Fauli ede0de1361 sw_layoutwriter3: split it two
it already has 104 tests

Change-Id: I210940c7128b19ac11a2864acdf2a51de741e363
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194443
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2025-11-24 20:26:48 +01:00
Xisco Fauli cab1e6298d sw_ooxmlexport12: split in two
it already has 94 tests

Change-Id: I7e2f9d120cf9fce101d374f51a5d45ea65b6c2f1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194265
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2025-11-21 10:00:32 +01:00
Tamás Zolnai d74bf7117b tdf48245, tdf126493: Fix snap to grid accuracy in Writer
In case of Writer the grid has a different origion, than for other
applications (Impress, Calc, Draw). For writer there are multiple grids
(one grid per page). Replicate the behavior of the grid drawing code
to identify the proper grid origin. See SdrPageView::DrawPageViewGrid().

The grid is drawn in the user area, but use the wider "paper rect"
to identify the correct grid frame for snapping. So there isn't an
abrupt change in snapping behavior when an object moves outside the
printing area (partly or entirely).

Do some extensive testing of snap to grid functionality. There were
no tests for it yet.

Change-Id: I844024be411d7b90dfc288a056187f003995f019
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192280
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
2025-10-14 12:58:47 +02:00
Justin Luth d008800730 tdf#167760 tdf#162326 limit reset para list attrs on style apply
Problem: applying any para style
was removing all numbering or bullets.

This fixes a 25.2 regression from
commit 075560420a
  tdf#162326 reset paragraph list attributes on style apply

The problem is that bResetListAttrs was already set to true,
but the conditions under which bResetListAttrs applies
were changed by the above commit
so now it affects situations it was never intended to match.

Specifically, this was the condition that changed:
-    && pFormat->GetItemState(RES_PARATR_NUMRULE) == SfxItemState::SET
+    && pCNd->GetTextNode()->IsInList()

So two changes need to happen here:
1.) bResetListAttrs needs to only be set
under the existing comment's stated condition (docst.cxx/doc.hxx)
that the para style itself contains a numbering rule.

2.) When the control key is held down,
then bRestListAttrs needs to be set to true
(which is the stated intention of the above commit).

Possibly #1 should also be done for SwDocShell::MakeInlineHeading,
but that entire concept is just weird... so who knows.

make CppunitTest_sw_uiwriter11 \
    CPPUNIT_TEST_NAME=testTdf167760_numberedPara

Change-Id: Iae646124a8a434dd3b49a75caeae4bb360396a49
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190309
Reviewed-by: Justin Luth <jluth@mail.com>
Tested-by: Jenkins
2025-08-28 12:29:12 +02:00
Mike Kaganski 4e92716130 Loading documents with restricted fonts: add unit tests
Change-Id: I04e4bad97f1fe19532fa1d896774567fb82d1b68
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189439
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2025-08-12 20:56:37 +02:00
Mike KaganskiandUjjawal Kumar c808b72852 tdf#160734: Markdown export: basic elements
Handle headings and some formatting: bold, italic, hyperlinks.
Escape special characters.

Unit test framework is created by Ujjawal Kumar.

Co-authored-by: Ujjawal Kumar <randomforest33@gmail.com>

Change-Id: I378f8a349c4df2c93598acb4e792080e5b410c71
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187589
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2025-07-10 09:45:56 +02:00
Xisco Fauli 0be7618a89 CppunitTest_sw_ooxmlexport26: rename it to CppunitTest_sw_ooxmlexport_de_locale
to make it clear it uses LO_TEST_LOCALE=de

Change-Id: Ieb786add9b66ae25567d0b9024386642fd73f4ed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187271
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2025-07-02 14:13:02 +02:00
Oliver Specht 80877c7dc4 tdf#166850 Apply converted style name to StyleRef field
As a result of e45f187870362ed4448f4a9fb96883b8431887fb the StyleRef
field needs to use the modified style name with (suffix " (user)")
The related JUnit test requires a German locale to detect the
related issue. Otherwise there is no suffix that needs to be
applied to the field.

Change-Id: Iad4257568ad05900df63a6098ba81e926df701e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186150
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Tested-by: Jenkins
2025-06-05 10:26:14 +02:00
Justin Luth 5c7b3f5dc1 tdf#166544 writerfilter page break: field-end counts as a character run
For compat14, page breaks that are not the first run
do not apply the top margin after the page break.
That makes sense. The top margin has already been applied
before the break.

The end marker of a field (ToC, legacy text form field, hyperlinks...)
must be treated as one of these character runs,
since MS Word doesn't apply the top margn in these instances.

The bug report contains examples for ToC and formfield,
so I used the hyperlink example as my unit test.

make CppunitTest_sw_ooxmlexport25 \
    CPPUNIT_TEST_NAME=testTdf166544_noTopMargin_fields

Change-Id: Ia3efced0d301c2345667937521beb8e7c895d326
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185375
Reviewed-by: Justin Luth <jluth@mail.com>
Tested-by: Jenkins
2025-05-16 01:57:57 +02:00
Xisco Fauli 27731badb6 CppunitTest_sw_ooxmlexport9: split in two
it already has 99 tests

Change-Id: I285ab56f70f3170e9ea547a8cae2d3754a1846ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184242
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2025-04-16 08:43:21 +02:00
Xisco Fauli 4e9b9eacad CppunitTest_sw_ooxmlexport14: split in two
It already has 101 tests

Change-Id: Icc874cad81c18b8ced2827a01ded9a5cdf6b29f6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184241
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2025-04-16 08:43:14 +02:00
Xisco Fauli 1152ed5c97 CppunitTest_sw_odfexport2: split in two
At least on my computer it takes
real	7m16,468s
user	9m17,205s
sys	0m11,565s

Change-Id: Ia199aa53e7b3e9fe52c6d255002c8c8d36b125ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182784
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2025-03-11 20:56:19 +01:00
Xisco Fauli ddaea18557 CppunitTest_sw_odfexport: split in two
at least in my computer it takes
real	6m36,775s
user	8m36,325s
sys	0m11,136s

Change-Id: I2c2167949f1cf1e9d46645cf26428677ab079133
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182781
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2025-03-11 16:18:14 +01:00
Miklos Vajna ce5527f0fe CppunitTest_sw_uiwriter5: extract CppunitTest_sw_uiwriter10 from this
uiwriter5 is so large that trying to build it by now fails with:

{standard input}: Assembler messages:
{standard input}:327871: Warning: end of file not at end of a line; newline inserted
{standard input}:328313: Error: no such instruction: `_zn11__gnu_debug16_error_formatter10_parameterc2in9__gnu_cxx17__normal_iteratoripkpn2sw4mark8markbaseenst9__cxx19986vectoris8_sais8_eeeeenst7__debug6'
g++-12: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[1]: *** [/home/vmiklos/git/libreoffice/core/solenv/gbuild/LinkTarget.mk:339: /home/vmiklos/git/libreoffice/core/workdir/CxxObject/sw/qa/extras/uiwriter/uiwriter5.o] Error 1

Change-Id: Iede9ef1e4302af7b1d84c35c88b371a57f28b2d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182777
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2025-03-11 15:26:43 +01:00
Xisco Fauli 44a17ea1ce CppunitTest_sw_rtfimport: split in two
it already has 109 tests

Change-Id: I0fe53be21ac15f49157087991f56a4ba40975c24
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182772
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2025-03-11 14:34:36 +01:00
Justin Luth 60788682d3 tdf#165642 docx export glossary: RT endnotes.xml/footnotes.xml too
settings.xml might refer to endnotePr
(in which case there must be an endnotes.xml file)
and / or footnotePr
(in which case there must be a footnotes.xml file)
so round-trip these 2 files also if they exist in the glossary folder.

Otherwise MS Word complains about invalid content.

For this particular unit test it went bad in LO 7.4.4,
but in other circumstances, it already goes bad in LO 4.3.

make CppunitTest_sw_ooxmlexport22 \
    CPPUNIT_TEST_NAME=testTdf165642_glossaryFootnote

Change-Id: Ib4c2513fa915fc4de4aee056b67a5936be5c52a1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182674
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
2025-03-09 00:46:50 +01:00
Xisco Fauli e8a7423baa CppunitTest_sw_htmlexport: split in two
It already had 114 tests

Change-Id: I16bddb42364c542fb2b5e115672096984b29e975
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176847
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-11-20 17:00:44 +01:00
Xisco Fauli f41701a71b CppunitTest_sw_layoutwriter2: split in two
It already had 109 tests

Change-Id: I52e7416091bb3ffa80c39a1409dc283771f7d9ba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176710
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2024-11-18 13:59:06 +01:00
Xisco Fauli 3e7c9028de CppunitTest_sw_layoutwriter3: split in two
it already has 133 tests

Change-Id: Idb67ab8af7ead44db1330a0437cc099c39b65cd3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175073
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2024-10-17 14:41:34 +02:00
Xisco Fauli 93987194f5 tdf#92029: sw_autocorrect: Add unittest
Change-Id: I7ac855ac826353869c3a905ea70448d0c8dc1b76
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169711
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-06-28 21:24:13 +02:00
Adam Seskunas 3e7de6b1bc tdf#144576 Copy a table from Writer to plain text editor as a Matrix
sw ascii filter
 - check for table nodes, output them seperately with formating
   to be displayed as a matrix when copy/pasted to a text file

sw qa filter ascii
 - add new test suite along with test to check for correct output

Change-Id: I8ca31bced3860e8e9752db8530ea6caaf31f2e5e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164833
Reviewed-by: Hossein <hossein@libreoffice.org>
Tested-by: Jenkins
2024-05-14 18:56:44 +02:00
Miklos Vajna 01dcc9a652 tdf#160833 DOCX import: use the DoNotMirrorRtlDrawObjs compat flag
The bugdoc has a shape which should be on the right page margin, but it
was on the left page margin.

Use the new compat flag to have a layout that matches Word.

This way we don't need to unmap the tweaked position at export time (a
limitation that the DOC filter has).

Change-Id: I38dfae370f275d9f0897198e7b0569f2d91dd352
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166993
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2024-05-02 12:08:31 +02:00
Noel Grandin 828c1999e0 move writerfilter inside sw
writerfilter wants to convert incoming RTF and OOXML files into
writer's document model. But it currently has to do so by
manipulating the limited subset that we expose through the UNO
API.

This is both slower and less accurate than having access
to the full document model.

So move it inside, and then we can strip out various hacks, and
optimise imports.

Change-Id: Ie1114d28130ef5f9a786531bc552cb8ee7768015
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165953
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-04-18 09:16:12 +02:00
Miklos Vajna 7d1e5fdf4b CppunitTest_sw_tiledrendering2: extract one test from the old, large suite
Not a split, to avoid too many conflicts while cherry-picking, but at
least create a new suite where next tests can be added without too much
build time after source code edits.

Change-Id: I0fb95e91ca9289aad25f72b0faa5f8eca3c6c06a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163582
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2024-02-19 11:30:33 +01:00
Justin Luth ad0266eb84 tdf#153909 docx import: wrap through shapes shouldn't FollowTextFlow
This resolves a NISZ 6.4.0 regression from
commit 27d04f6dbf
    tdf#119038 DOCX: fix FollowTextFlow handling

MSO is all over the place in how they implement layoutInCell
(aka FollowTextFlow in LO). There are lots of compat15 differences
for this, but I don't notice compat coming into play with this bug.

For reference, see commit e993638d5e
Author: Miklos Vajna on Mon Jan 24 12:53:25 2022 +0100
    DOCX import: fix <wp:anchor layoutInCell="1"> with <wp:wrapNone>

I'm sure this is the WRONG code spot for handling FollowTextFlow,
but anywhere else and we lose the "it came from a vml shape"
limiting information, so I'm not going to try to relocate this code.

Inline (as-character) shapes ignore layoutInCell,
so the type of anchor (floating or inline) shouldn't matter
and therefore doesn't need to be part of the if () clause.

The header can be special (in compat14 it means everything
is wrap through), but at least in this case it is not limited
to IsInHeaderHeader. Using a non-header as the unit test.

make CppunitTest_sw_ooxmlexport21 \
    CPPUNIT_TEST_NAME=testTdf153909_followTextFlow

The first patchset contains a list of all of the unit tests
that were impacted by this patch: nothing interesting.

Change-Id: I0c4c7924833550533ad1b0b7609840a666d4d589
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162324
Reviewed-by: Justin Luth <jluth@mail.com>
Tested-by: Jenkins
2024-01-20 00:10:10 +01:00
Justin Luth 9b32a016e3 tdf#158785 partial revert "enable hyperlink to be detected
... at the end of text"

This reverts lpranam's 7.2.0 regressive
commit 3233db0913.

The character after a hyperlink should not offer
to CTRL-click or jump to the hyperlink target.

make CppunitTest_sw_uiwriter9 CPPUNIT_TEST_NAME=testTdf158785

Change-Id: I3f5398cc3a4f29ddf1c50764c311046713d39439
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161042
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
2023-12-21 13:13:02 +01:00
Justin Luth 798649ec30 tdf#158583 tdf#158586 RTF writerfilter: only startRun for real frame
This fixes a LO 7.6.4 regression of a lost page break,
as well as another example where part of the paragraph moves to next page,
from mstahl's commit 4e2f2489c4

It seems likely that the run should only be checked
when we know that there is a real frame here,
which essentially becomes a run for most purposes
(except perhaps for page breaks - as seen for DOCX).

This code block was introduced with
commit 0d9132c504
Author: Miklos Vajna on Sat Mar 24 13:04:54 2012 +0100
    fdo#47036 fix RTF import of shapes inside text frames
    at the start of the doc
and in the other block of touched code, it did test inFrame.

The unit test works when compiling right after the regression,
but has broken because of tdf#153194.

Since this will get backported way back and all over,
it is a good time to introduce rtfexport8.

make CppunitTest_sw_rtfexport8 CPPUNIT_TEST_NAME=testTdf158586_0
make CppunitTest_sw_rtfexport8 CPPUNIT_TEST_NAME=testTdf158586_1

Change-Id: Ib4b75efb8422d96e693da337cbef97520e975f3f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160655
Reviewed-by: Justin Luth <jluth@mail.com>
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-12-19 08:55:59 +01:00
Tomaž Vajngerl 9e876c164a sw: move header/footer tests to own class in core tests
In addition add some more basic header/footer tests.

This makes refactoring of header and footer OOXML import
much easier.

Change-Id: I5b3b3714656ba2f7b1dda8d8f067c3bfe68857a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159946
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-11-28 04:02:22 +01:00
Matt K b6e273aaaf tdf#156243 Fix off-by-one bug for autocorrect
This change removes the "-1" from the code
that applies the autocorrection so that the entire
string to be autocorrected is replaced, instead
of leaving off the last character.  Also,
the starting character of the string is
preserved (i.e. non-bold if changing to bold)
by adding 1 to the start position; this is
for the case when the user cancels the
autocorrect dialog.

Change-Id: Ibe500a1ba0ca5b12ec9c918b51353074b8dd12ec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154685
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-11-25 12:41:49 +01:00
Xisco Fauli 1171335759 CppunitTest_sw_ooxmlexport5: split into two
It already has 105 tests

Change-Id: I06bd3740f5b3f368017fefd06fda099891834114
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158668
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2023-10-31 08:43:11 +01:00
Miklos Vajna 7c15750cec tdf#155510 ODT import: ignore props of covered table cells, unless in comp mode
The problem was that the A5 cell on page 2 used to have a solid
background, but this was lost after commit
1001dbaef4 (ODT import: handle style name
of covered cells, 2021-03-19).

Covered cell formatting was interesting for cell borders, in Word compat
mode the covered cell can have its own border style, so e.g. there is
left border on a vertically merged cell till its center, but not after
its center.

Fix the problem by limiting the import of covered cell formatting to the
case when the TABLE_ROW_KEEP compat flag is on, to keep both native ODT
and ODT-from-Word documents happy.

If there is a need, some smarter way of merging properties could be
implemented in the future.

Change-Id: Icc1e6f48d9f5a0379d9a9052a1f5b9ae3f294477
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155957
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-08-23 08:03:59 +02:00
Tomaž Vajngerl 17105fc44b sw: remove char color GrabBag and fix export, fix tint/shade calc.
Don't store values from grab bag when exporting character theme
colors and tint/shade values. The values could be wrong now and
aren't needed anyway as we support the values in the model.
Add proper export support for char color theme information with
correct conversion of values into tint/shade values in 0-255
inverted interval.
This also fixes the import of tint/shade values whcih calculation
was slightly off. We divided by 256 instead of 255, which
introduced an error.

In addition introduce ThemeColorUsage enum, which marks if the
theme color type has a specific "usage" - text or background. This
is determined on import if the theme type is background{1,2} or
text{1,2}. This is then taken into account on export, so the
exact type is preserved.

Change-Id: I0022a159397fd0c3d39a118a7149bb2488dfc149
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152705
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-06-08 07:45:13 +02:00
Xisco Fauli 436c280392 CppunitTest_sw_ooxmlexport10: split in two
it already has 104 tests

Change-Id: Ib3b4bf342af73aaf3c925d79bd0a06cee4853c93
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150234
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2023-04-11 22:38:49 +02:00
Xisco Fauli 8bc0c30130 CppunitTest_sw_rtfexport: split in two
it already has 109 tests

Change-Id: I1e7adf3fa9c1cdb22fb1402306c2f9478d94038c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149546
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2023-03-24 17:09:48 +00:00
Xisco Fauli 92598f5a5e CppunitTest_sw_layoutwriter: split in two
it already has 110 tests

Change-Id: I4f218c873b5771e46cd2037249f0bb9db5f6b808
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148554
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2023-03-09 19:09:45 +00:00
Xisco Fauli a42a80bd96 CppunitTest_sw_rtfexport5: split in two
it already has 121 tests

Change-Id: I7d7726b9f1c65d3f719517ab1a568cd888b2833b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148042
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2023-03-01 20:52:59 +00:00
Miklos Vajna e32dfaf155 sw floattable: teach the UI about SwFormatFlySplit
- in SwFramePage, add a new m_xFlySplitCB and bind it to the flysplit
  from the UI description

- map RES_FLY_SPLIT from the doc model to this new weld::CheckButton

- disable the widget for anchor types other than to-para, also
  completely hide it, unless a frame contains a single table, which
  simplifies Word filters

- add UITest for this

Change-Id: I9ef44b5c66679b04c4818dc343870b92f1b6386d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148030
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2023-03-01 09:52:53 +00:00
Miklos Vajna 3282508f8d sw floattable: add ImportFloatingTableAsSplitFly expert setting
Mapping DOCX floating tables to Writer split flys is still disabled by
default, but now the environment variable affects the DOCX import
instead of affecting the Writer item pool's default.

This allows mixing ImportFloatingTableAsSplitFly=true and =false tests
in the same suite, so the sw/CppunitTest_sw_core_layout_flycnt.mk
boilerplate can be dropped.

It also allows overwriting this default from an xcu file (expert config,
or the XCU file in online.git) for testing / demo purposes.

Also extend the layout representation comment / doc a bit.

Change-Id: I239e9c6e9d9c8748ed0846ae336c9c818d59f180
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147191
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2023-02-17 09:12:28 +00:00
Miklos Vajna 995198bfff sw floattable: handle table-in-fly in SwFrame::GetNextFlyLeaf()
Trying to lay out a split fly that contains a table resulted in a stack
overflow.

The reason for this was that SwObjectFormatter::FormatObjsAtFrame_() has
a loop that will format all objects of the current fly frame, but we
managed to anchor the follow fly into itself.

Fix the problem by improving SwFrame::GetNextFlyLeaf(), somewhat based
on how SwFrame::GetNextSctLeaf() has special cases for tables. This way
once we split the fly frame, we'll try to move the follow anchor frame
to the next page's body frame, and not to a child of the follow fly
itself.

Also add a first floattable testcase, we can already assert that the
table is split correctly. Do this in a separate suite for now, since the
pool's default SwFormatFlySplit is only created once, so
SwFormatFlySplit::SetForce(false) doesn't have the wanted effect. The
anchor's text is still on both pages, should be on page 2 only.

Change-Id: Ie2ce75dbace5d9716008351aedb6a8989036badb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146854
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2023-02-13 15:04:12 +00:00
Tomaž Vajngerl 8640e24b12 tdf#66580 added hybrid PDF test cases
Change-Id: I2a58e6cd5b40266b3c55729febb7006c7a7b4170
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146068
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-01-25 14:56:26 +00:00
Miklos Vajna dd775cd630 sw, .uno:InsertSection: add a new Content parameter and accept HTML there
When Zotero uses refmarks to represent citations, then a section is used
for the bibliography. While it was possible to insert refmarks with a
given name & content, inserting a section with a provided HTML content
was not possible.

A section (and not a refmark) is needed for the bibliography, as a
refmark is a text attribute, so it must start and end in the same
paragraph.

Fix this by adding a new, optional Content parameter to
.uno:InsertSection, which allows providing multi-paragraph, formatted
text.

This is somewhat similar to what commit
fa82e151d8 (sw, .uno:InsertBookmark: add a
new BookmarkText parameter and accept HTML there, 2022-12-06) did for
the bookmark case.

Change-Id: I0ccbc8a765fed4e019783d0b743c1cd2d0596093
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145188
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2023-01-09 12:25:12 +00:00
Tomaž Vajngerl df9f3f3fd8 sw: support for reading back theme color from OOXML
OOXML supports theme colors and tint/shade value that additionally
changed the theme color. Read back which theme color + tint/shade
value was applied in the resulting color and add this attributes
as properties to be used by writer.
In sidebar theme panel the changing the theme colors now doesn't
takes this into account and changes the colors correctly.

Change-Id: I3a2d49d485fd37a1611483ee0bb5e6034ac5f88e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143697
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-12-25 02:06:58 +00:00
Xisco Fauli 042bf6f00c Revert: "split sw_filters unit test"
This commit reverts 1c2ea35b98

it shouldn't be needed anymore after
cdac145768 "reduce cost of
SwpHints::Check"

Change-Id: I32a1d963f7bf90838c68db3bfefc8c8750e94128
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143417
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-12-05 13:23:48 +00:00
Miklos Vajna 1a94cd8257 sw content controls: add rendering for the alias
- add a new SwFrameMenuButtonBase subclass to show the title/alias of
  the content control under the cursor, if it's non-empty

- hide it when leaving the content control

- set its label to the alias from SwContentControl

- set the position similar to footer frame menu buttons, at the first
  text portion of the content control

- make the label clickable and bind the handler to the content control
  properties dialog

Change-Id: Ia35f0cc59c70910fb88719b207ef9e498d6760d3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141441
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2022-10-17 11:45:49 +02:00