core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-03-15 Thread Jaume Pujantell (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf165059_broken.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport12.cxx  |   39 +++-
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx  |   13 ++
 sw/source/filter/ww8/docxattributeoutput.cxx|   91 +---
 sw/source/filter/ww8/docxattributeoutput.hxx|8 +
 5 files changed, 94 insertions(+), 57 deletions(-)

New commits:
commit a084789fadeb4d4f81bd68f4ed20cdd5fd19661c
Author: Jaume Pujantell 
AuthorDate: Tue Mar 4 23:04:42 2025 +0100
Commit: Xisco Fauli 
CommitDate: Sat Mar 15 17:54:41 2025 +0100

tdf#165059 sw fix not valid moveFrom/moveTo tag

According to the ISO standard, w:moveFrom/To elements are only permitted
within a move*RangeStart/End section. If not inside such delimited range
only w:ins and w:del are valid.

We still write w:move* in paragraph properties outside of move*Range.
This is technically also not valid, but lots of tests seem to have
documents with this, and it is outside the scope of the bug.

Change-Id: Iaf097b8b017aac1f6182a91abe464433e7664620
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182503
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182633
Reviewed-by: Jaume Pujantell 
Tested-by: Jenkins
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182639

diff --git a/sw/qa/extras/ooxmlexport/data/tdf165059_broken.docx 
b/sw/qa/extras/ooxmlexport/data/tdf165059_broken.docx
new file mode 100644
index ..548d4d9c7414
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf165059_broken.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
index 7eb8f39f4137..e34b17467348 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
@@ -1229,28 +1229,23 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf145720)
 loadAndSave("tdf104797.docx");
 xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr);
 // These were 0 (missing move*FromRange* elements)
-assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:moveFrom/w:moveFromRangeStart", 1);
+assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]//w:moveFromRangeStart", 1);
 assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:moveFromRangeEnd", 1);
-assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[2]/w:moveTo/w:moveToRangeStart", 1);
+assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]//w:moveToRangeStart", 1);
 assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:moveToRangeEnd", 1);
 
 // paired names
-assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:moveFrom/w:moveFromRangeStart", "name",
-u"move471382752");
-assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[2]/w:moveTo/w:moveToRangeStart", "name",
+assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:moveFromRangeStart", 
"name",
 u"move471382752");
+assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:moveToRangeStart", 
"name", u"move471382752");
 
 // mandatory authors and dates
-assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:moveFrom/w:moveFromRangeStart", "author",
-u"Tekijä");
-assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[2]/w:moveTo/w:moveToRangeStart", "author",
-u"Tekijä");
+assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:moveFromRangeStart", 
"author", u"Tekijä");
+assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:moveToRangeStart", 
"author", u"Tekijä");
 // no date (anonymized change)
 // This failed, date was exported as w:date="0-00-00T00:00:00Z", and later 
"1970-01-01T00:00:00Z"
-assertXPathNoAttribute(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:moveFrom/w:moveFromRangeStart",
-   "date");
-assertXPathNoAttribute(pXmlDoc, 
"/w:document/w:body/w:p[2]/w:moveTo/w:moveToRangeStart",
-   "date");
+assertXPathNoAttribute(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:moveFromRangeStart", "date");
+assertXPathNoAttribute(pXmlDoc, 
"/w:document/w:body/w:p[2]/w:moveToRangeStart", "date");
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testTdf150166)
@@ -1553,11 +1548,10 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf132271)
 loadAndSave("tdf149388.docx");
 xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr);
 // import change tracking in floating tables
-assertXPath(pXmlDoc, "//w:del", 1);
-assertXPath(pXmlDoc, "//w:ins", 1);
-// tracked text moving recognized during the import
-assertXPath(pXmlDoc, "//w:moveFrom", 1);
-assertXPath(pXmlDoc, "//w:moveTo", 1);
+assertXPath(pXmlDoc, "//w:del", 2);
+assertXPath(pXmlDoc, "//w:ins", 2);
+assertXPath(pXmlDoc, "//w:moveFrom", 0);
+assertXPath(pXmlDoc, "//w:moveTo", 0);
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testTdf149388_fly)
@@ -1578,11 +1572,10 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf1

core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-03-13 Thread Michael Stahl (via logerrit)
 sw/qa/extras/rtfexport/data/noparaborder.rtf|   35 
 sw/qa/extras/rtfexport/rtfexport3.cxx   |   23 +
 sw/source/writerfilter/rtftok/rtfdispatchsymbol.cxx |3 +
 3 files changed, 60 insertions(+), 1 deletion(-)

New commits:
commit 30385a6d670365652f7f91c034c2028664206751
Author: Michael Stahl 
AuthorDate: Wed Mar 12 14:59:16 2025 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Thu Mar 13 16:42:51 2025 +0100

tdf#164945 writerfilter: RTF import: fix erroneous default paragraph...

... properties in empty table cell.

The problem is that for an empty table cell, there is a sequence of
buffer entries SETSTYLE, PROPS, SETSTYLE, PROPS, and the 2nd PROPS
sets a default value of the LN_CT_PrBase_pBdr SPRM, and that overwrites
the rdrs value that was contained in the 1st PROPS.

All these buffer entries originate in ST_StyleType_character when 
buffering the character properties, then no
paragraph properties will be generated in getProperties() for the 2nd
PROPS.

(regression from commit 6f42a2c8631bace1caa4fac0b3ea554942f1fca3)

Change-Id: Iefb939d8d8dace6dc58cb665b4bd1575f09701c1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182835
Reviewed-by: Michael Stahl 
Tested-by: Jenkins
(cherry picked from commit 1a7346e7f14b54cf5d9b74798d41cff2a3a05872)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182859
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/qa/extras/rtfexport/data/noparaborder.rtf 
b/sw/qa/extras/rtfexport/data/noparaborder.rtf
new file mode 100644
index ..4c6322ffa88e
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/noparaborder.rtf
@@ -0,0 +1,35 @@
+{ 
tf1deflang1025nsinsicpg1252\uc1deff0\deff0\stshfdbch31505\stshfloch46\stshfhich46\stshfbi0\deflang1031\deflangfe1041
 hemelang1031hemelangfe1041  hemelangcs0
+{onttbl{0bidi romancharset0prq2{\*\panose 02020603050405020304}Times New 
Roman{\*alt Arial};}
+{35bidi swisscharset128prq2{\*\panose 020b0400}Yu Gothic{\*
alt ?a?S?V?b?N};}
+{46bidi swisscharset0prq2{\*\panose 020b0604020202020204}Liberation Sans;}
+{dbminor31505bidi swisscharset128prq2{\*\panose 020b0400}Yu 
Gothic{\*alt ?a?S?V?b?N};}
+}
+{\*\defchp s24\kerning2\lochf46\hichf46\dbchf31505 }{\*\defpap \ql \li0 
i0\sa160\sl278\slmult1
+\widctlpar\wrapdefaultspalphaspnumaautodjustright in0\lin0\itap0 }
oqfpromote {\stylesheet{\ql \li0 
i0\sa160\sl278\slmult1\widctlpar\wrapdefaultspalphaspnumaautodjustright 
in0\lin0\itap0  tlchcs1 f0fs24lang1025 \ltrchcs0 
+s24\lang1031\langfe1041\kerning2\loch46\hichf46\dbchf31505+s11 
srowd   rftsWidthB3 rpaddl108   rpaddr108   rpaddfl3
rpaddft3rpaddfb3rpaddfr3blind0  blindtype3  
svertalt \ql \li0 i0\sa160\sl278\slmult1
+\widctlpar\wrapdefaultspalphaspnumaautodjustright in0\lin0\itap0  tlchcs1 
f0fs24lang1025 \ltrchcs0 s24\lang1031\langfe1041\kerning2\loch
46\hichf46\dbchf31505+Normal Table;}
+{\s36\q \li0 i0\widctlparrdrbrdrsrdrw10rsp20 \wrapdefaultspalphaspnum
aautodjustright in0\lin0\itap0  tlchcs1 f0fs24lang1025 \ltrchcs0 
+s24\lang1031\langfe1041\kerning2\loch46\hichf46\dbchf31505+
+\paperw11906\paperh16838\margl1417\margr1417\margt1417\margb1134\gutter0\ltrsect
 
+\deftab708\widowctrltnbjenddoc\hyphhotz425   rackmoves0  
rackformatting1\donotembedsysfont1 elyonvml0\donotembedlingdata0\grfdocevents0
alidatexml1\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0
+\showxmlerrors1
oxlattoyenxpshrtn
oultrlspc\dntblnsbdb
ospaceforul
ormshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1417\dgvorigin1417\dghshow1\dgvshow1
+\jexpandiewkind1iewscale270\pgbrdrhead\pgbrdrfoot\splytwnine
tnlytwnine\htmautsp
olnhtadjtbl\useltbalnlntblind\lytcalctblwd\lyttblrtgr\lnbrkrule
obrkwrptbl\snaptogridincellllowfieldendsel\wrppunct
+sianbrkrule
ewtblstyruls
ogrowautofit\usenormstyforlist
oindnmbrtselnbrelev
ocxsptable\indrlsweleven
oafcnsttblfelev\utinl\hwelev\spltpgpar
otcvasp
otbrkcnstfrctbl
otvatxbx\krnprsnet+{\*\wgrffmtfilter 2450}
ofeaturethrottle1\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\headery708
ootery708+
+\ltrrowrowd \irow0\irowband0\lastrow \ltrrow
+   s35 rgaph70 rleft-108   rftsWidth1  rftsWidthB3 
rautofit1   rpaddl108   rpaddr108   rpaddfl3rpaddft3
rpaddfb3rpaddfr3bllkhdrrows bllkhdrcols bllknocolband   
blind0  blindtype3 +rdrtbl +\s36\qc \li0 
i0\widctlpar\intblrdrbrdrsrdrw10rsp20 \wrapdefaultspalphaspnum
aautodjustright in0\lin0\yts35  tlchcs1 f0fs24lang1025 \ltrchcs0 
+
s24\lang1031\langfe1041\kerning2\lochf46\hichf46\dbchf31505+\wrapdefaultspalphaspnum
aautodjustright in0\lin0\yts35 { tlchcs1 f0 \ltrchcs0 
\hichf46\dbchf31505\loch46 xxx}{ tlchcs1 f0 \ltrchcs0 +\q

core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-03-11 Thread Michael Stahl (via logerrit)
 sw/qa/extras/layout/data/section-break-hidden-paragraphs.rtf |   68 +++
 sw/qa/extras/layout/layout2.cxx  |   44 +++
 sw/source/core/text/porlay.cxx   |   15 ++
 sw/source/core/text/txtfrm.cxx   |   13 +-
 4 files changed, 134 insertions(+), 6 deletions(-)

New commits:
commit 0feaab07b63e6ff7f3d50099d987f79148f22c45
Author: Michael Stahl 
AuthorDate: Fri Mar 7 19:05:15 2025 +0100
Commit: Thorsten Behrens 
CommitDate: Tue Mar 11 23:06:14 2025 +0100

sw: layout: hide text frame before table like Word

There are several empty paragraphs before a table, all have the
paragraph end marker hidden, and the first one is preceded by a section
break, which is represented as a break item on the first text node in
Writer.

Word hides the paragraphs, so that the following table starts at the top
of the page.

Writer merges the paragraphs into one text frame, but it is not
considered hidden because it doesn't contain any hidden characters; if
you insert a character into a paragraph, the merged text frame will
disappear!

The first idea was to adapt SwTextFrame::IsHiddenNowImpl() to check if
there isn't any text in the text frame and the paragraph end marker is
hidden.

But it turns out that the problem is more general: it's a problem of the
sw_redlinehide merging, because an un-merged paragraph is hidden via a
check of RES_CHRATR_HIDDEN in SwScriptInfo::selectHiddenTextProperty().

It's a bit nonobvious why this didn't work, and how it would interact
with delete redlines, but 2 problems are that the case of the empty text
frame needs a special case handling to get to this check in
selectHiddenTextProperty(), and then GetBoundsOfHiddenRange() doesn't
assign its outparameters in the special case of the empty paragraph; it
looks like the values in m_HiddenChg should be 0, 0 then.

Change-Id: I2ba85e98c02fb69159ee7ba77a7e4694fdf6fd52
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182642
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 7a9a1e8ef5ad9dd3e9b7d286a8f85d2f18088d29)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182773
Reviewed-by: Thorsten Behrens 

diff --git a/sw/qa/extras/layout/data/section-break-hidden-paragraphs.rtf 
b/sw/qa/extras/layout/data/section-break-hidden-paragraphs.rtf
new file mode 100644
index ..f8526dafe5ea
--- /dev/null
+++ b/sw/qa/extras/layout/data/section-break-hidden-paragraphs.rtf
@@ -0,0 +1,68 @@
+{ 
tf1deflang1025nsinsicpg1252\uc1deff31507\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi31507\deflang2057\deflangfe1028
   hemelang2057hemelangfe1028  hemelangcs1025
+{onttbl{1bidi swisscharset0prq2{\*\panose 020b0604020202020204}Arial;}
+{14bidi nilcharset136prq2{\*\panose 02010601000101010101}PMingLiU{\*alt 
Arial Unicode MS};}{34bidi romancharset0prq2{\*\panose 
02040503050406030204}Cambria Math;}
+{37bidi swisscharset0prq2{\*\panose 020f0502020204030204}Calibri;}{294
bidi nilcharset136prq2{\*\panose }@PMingLiU;}
+{lomajor31500bidi romancharset0prq2{\*\panose 02020603050405020304}Times 
New Roman{\*alt Arial};}{dbmajor31501bidi nilcharset136prq2{\*\panose 
02010601000101010101}PMingLiU{\*alt Arial Unicode MS};}
+{himajor31502bidi swisscharset0prq2{\*\panose 
020f0302020204030204}Calibri Light;}{bimajor31503bidi romancharset0
prq2{\*\panose 02020603050405020304}Times New Roman{\*alt Arial};}
+{lominor31504bidi romancharset0prq2{\*\panose 02020603050405020304}Times 
New Roman{\*alt Arial};}{dbminor31505bidi nilcharset136prq2{\*\panose 
02010601000101010101}PMingLiU{\*alt Arial Unicode MS};}
+{himinor31506bidi swisscharset0prq2{\*\panose 
020f0502020204030204}Calibri;}{biminor31507bidi swisscharset0
prq2{\*\panose 020b0604020202020204}Arial;}{305bidi swisscharset238prq2 
Arial CE;}
+{306bidi swisscharset204prq2 Arial Cyr;}{308bidi swisscharset161prq2 
Arial Greek;}{309bidi swisscharset162prq2 Arial Tur;}{310bidi swiss
charset177prq2 Arial (Hebrew);}
+{311bidi swisscharset178prq2 Arial (Arabic);}{312bidi swisscharset186
prq2 Arial Baltic;}{313bidi swisscharset163prq2 Arial (Vietnamese);}{635
bidi romancharset238prq2 Cambria Math CE;}
+{636bidi romancharset204prq2 Cambria Math Cyr;}{638bidi roman
charset161prq2 Cambria Math Greek;}{639bidi romancharset162prq2 Cambria 
Math Tur;}{642bidi romancharset186prq2 Cambria Math Baltic;}
+{643bidi romancharset163prq2 Cambria Math (Vietnamese);}{665bidi swiss
charset238prq2 Calibri CE;}{666bidi swisscharset204prq2 Calibri Cyr;}{
668bidi swisscharset161prq2 Calibri Greek;}
+{669bidi swisscharset162prq2 Calibri Tur;}{670bidi swisscharset177
prq2 

core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-03-07 Thread Oliver Specht (via logerrit)
 sw/qa/extras/rtfimport/data/165483.rtf|   12 +
 sw/qa/extras/rtfimport/rtfimport.cxx  |   12 +
 sw/source/writerfilter/dmapper/DomainMapper.cxx   |   11 
 sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx |   51 +++---
 sw/source/writerfilter/rtftok/rtfsprm.cxx |9 +++
 5 files changed, 80 insertions(+), 15 deletions(-)

New commits:
commit 480b3ba0e1e596547f2c1bbac132406567ec346d
Author: Oliver Specht 
AuthorDate: Thu Feb 27 11:18:23 2025 +0100
Commit: Christian Lohmaier 
CommitDate: Fri Mar 7 19:57:59 2025 +0100

tdf#165483 style inherits only repated properties

Each attribute a style inherits from a parent style needs to be
repeated at that style. Otherwise it is overwritten by a default
attribute.

Change-Id: I9cef60b0d1eaa16d212f091434e9896bfd4a44c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182284
Tested-by: Gabor Kelemen 
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen 
(cherry picked from commit 38464825c8c80eed0d9b328a89cd96eb27175a0e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182630
Reviewed-by: Christian Lohmaier 

diff --git a/sw/qa/extras/rtfimport/data/165483.rtf 
b/sw/qa/extras/rtfimport/data/165483.rtf
new file mode 100755
index ..1c6eec96cdc9
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/165483.rtf
@@ -0,0 +1,12 @@
+{ tf1nsi
+{\stylesheet{s36 Normal;}
+{\*s11\sl400\slmult1\sa100 \snext11 \ssemihidden \sunhideused Normal 
Table;}
+{  s12\sl400\slmult1\sa100 \snext11 \ssemihidden \sunhideused Normal Table 
Copy;}
+{  s96 \sbasedon12\snext196 Based On Table Normal Copy;}
+}
+{\s96 This text should have single line spacing and no spacing below 
paragraph. This text should have single line spacing and no spacing below 
paragraph. This text should have single line spacing and no spacing below 
paragraph. This text should have single line spacing and no spacing below 
paragraph. \par }
+{\s96 This text should have single line spacing and no spacing below 
paragraph. This text should have single line spacing and no spacing below 
paragraph. This text should have single line spacing and no spacing below 
paragraph. This text should have single line spacing and no spacing below 
paragraph. \par }
+{\s96 This text should have single line spacing and no spacing below 
paragraph. This text should have single line spacing and no spacing below 
paragraph. This text should have single line spacing and no spacing below 
paragraph. This text should have single line spacing and no spacing below 
paragraph. \par }
+{\s96 This text should have single line spacing and no spacing below 
paragraph. This text should have single line spacing and no spacing below 
paragraph. This text should have single line spacing and no spacing below 
paragraph. This text should have single line spacing and no spacing below 
paragraph. \par }
+
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 6b854306dbe3..6a79ac33d5a2 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1995,6 +1995,18 @@ CPPUNIT_TEST_FIXTURE(Test, test165333Tdf)
 CPPUNIT_ASSERT_EQUAL(false, getProperty(xRun2, u"CharHidden"_ustr));
 }
 
+CPPUNIT_TEST_FIXTURE(Test, test165483Tdf)
+{
+createSwDoc("165483.rtf");
+uno::Reference const xRun1(
+getRun(uno::Reference(getParagraphOrTable(1), 
uno::UNO_QUERY), 1));
+uno::Reference xStyle(
+getStyles(u"ParagraphStyles"_ustr)->getByName(u"Based On Table Normal 
Copy"_ustr),
+uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty(xRun1, 
u"ParaBottomMargin"_ustr));
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty(xStyle, 
u"ParaBottomMargin"_ustr));
+}
+
 // tests should only be added to rtfIMPORT *if* they fail round-tripping in 
rtfEXPORT
 } // end of anonymous namespace
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/writerfilter/dmapper/DomainMapper.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper.cxx
index c743f19aa542..2d18e995af0e 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper.cxx
@@ -4252,8 +4252,9 @@ void DomainMapper::ResetStyleProperties()
 pContext->Insert(ePropertyId, uno::Any(0l));
 }
 break;
+case PROP_PARA_BOTTOM_MARGIN:
 case PROP_PARA_RIGHT_MARGIN:
-pContext->Insert(ePropertyId, uno::Any(0l));
+pContext->Insert(ePropertyId, 
uno::Any(sal_Int32(0)));
 break;
 case PROP_PARA_LAST_LINE_ADJUST:
 case PROP_PARA_ADJUST:
@@ -4268,6 +4269,14 @@ void DomainMapper::ResetStyleProperties()
 case PROP_FILL_COLOR:
 p

core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-03-07 Thread Mike Kaganski (via logerrit)
 sw/qa/extras/htmlexport/data/img_with_border.fodt |   24 ++
 sw/qa/extras/htmlexport/htmlexport2.cxx   |   14 
 sw/source/filter/html/htmlflywriter.cxx   |3 ++
 3 files changed, 41 insertions(+)

New commits:
commit 02b17fe003c34481ba166b1f9d493662e372682e
Author: Mike Kaganski 
AuthorDate: Fri Mar 7 16:55:18 2025 +0500
Commit: Xisco Fauli 
CommitDate: Fri Mar 7 19:19:03 2025 +0100

ReqIF export: avoid writing border properties

Change-Id: I05e7ba3fda54300f99fd2121aaa5d167dd27851c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182617
Reviewed-by: Mike Kaganski 
Tested-by: Jenkins
(cherry picked from commit 75135c6c7d43b9d4f979a026cdd2529209cb9dea)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182634
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/htmlexport/data/img_with_border.fodt 
b/sw/qa/extras/htmlexport/data/img_with_border.fodt
new file mode 100644
index ..fd3fbfe36dcd
--- /dev/null
+++ b/sw/qa/extras/htmlexport/data/img_with_border.fodt
@@ -0,0 +1,24 @@
+
+
+
+ 
+  
+   
+  
+ 
+ 
+  
+   
+  
iVBORw0KGgoNSUhEUgEBCAIAAACQd1PeAXNSR0IArs4c6QRnQU1B
+   AACxjwv8YQUJcEhZcwAADsMAAA7DAcdvqGQYdEVYdFNvZnR3YXJlAFBhaW50Lk5F
+   VCA1LjEuNBLfpoMAAAC2ZVhJZklJKgAIBQAaAQUAAQAAAEobAQUAAQAAAFIo
+   AQMAAQIxAQIAEFoAAABphwQAAQAAAGoAYAEAAABgAQAA
+   AFBhaW50Lk5FVCA1LjEuNAADAACQBwAEMDIzMAGgAwABAQWgBAABlAAA
+   AAACAAEAAgAEUjk4AAIABwAEMDEwMADX5rshveZftAxJREFUGFdj
+   +P//PwAF/gL+pzWBhABJRU5ErkJg
+  
+ 
+
+  
+ 
+
\ No newline at end of file
diff --git a/sw/qa/extras/htmlexport/htmlexport2.cxx 
b/sw/qa/extras/htmlexport/htmlexport2.cxx
index 550c9644af97..75ee544f5875 100644
--- a/sw/qa/extras/htmlexport/htmlexport2.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport2.cxx
@@ -1622,6 +1622,20 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testReqifNoTargetInA)
 assertXPathNoAttribute(pXmlDoc, "//reqif-xhtml:a", "target");
 }
 
+CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifNoObjectBorderExport)
+{
+// Given a document with an image with black border
+createSwDoc("img_with_border.fodt");
+
+// When exporting to XHTML:
+ExportToReqif();
+
+// Check that there's no 'font' element that used to be exported, 
containing the border color:
+xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile();
+// Without the accompanying fix in place, this test would have failed
+assertXPath(pXmlDoc, "//reqif-xhtml:font", 0);
+}
+
 } // end of anonymous namespace
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/filter/html/htmlflywriter.cxx 
b/sw/source/filter/html/htmlflywriter.cxx
index 0ff0183248e9..a67f71ee584a 100644
--- a/sw/source/filter/html/htmlflywriter.cxx
+++ b/sw/source/filter/html/htmlflywriter.cxx
@@ -1353,6 +1353,9 @@ SwHTMLWriter& OutHTML_ImageStart( HtmlWriter& rHtml, 
SwHTMLWriter& rWrt, const S
 }
 }
 
+if (rWrt.mbReqIF)
+nFrameOpts &= ~HtmlFrmOpts::Border;
+
 // ..
 sal_uInt16 nBorderWidth = 0;
 const SvxBoxItem* pBoxItem;


core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-03-07 Thread Justin Luth (via logerrit)
 sw/qa/extras/layout/data/tdf164907_rowHeightAtLeast.docx |binary
 sw/qa/extras/layout/layout4.cxx  |7 +
 sw/source/core/layout/tabfrm.cxx |   21 ++-
 3 files changed, 27 insertions(+), 1 deletion(-)

New commits:
commit 2a47fa27a1ce9bf115ab9f060c61217a51da644a
Author: Justin Luth 
AuthorDate: Mon Feb 24 18:54:08 2025 -0500
Commit: Christian Lohmaier 
CommitDate: Fri Mar 7 14:22:13 2025 +0100

tdf#164907 sw: Calculate row height adds border if 'atLeast' set #2

The idea in 25.2 commit 4f5b896d004af023f210f235aeafa9abc50068d2
was to add the border line's width to the atLeast row height.
However, the function used also included the border spacing,
which is not (really) correct.

[It appears that the BOTTOM border padding should be added,
 but that is true for both the atLeast and the 'exact' cases,
 so that change should be handled separately.]

In MS Word, the bottom border of one row
is also the top border of the next row (IsCollapsedBorders()).
The bottom border line width seems to be irrelvant
in regards to the height of the row,
so the fact that the code only adds the top border seems correct.
The last row puts the bottom border _below_ the row.

make CppunitTest_sw_layoutwriter4 \
CPPUNIT_TEST_NAME=TestTdf164907_rowHeightAtLeast

Change-Id: I756d38109a724d06e6230f5607b80a0bdc059bc6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182139
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit e9ed6f1d2cc145e7514bf0a27b8c77f370ceab2d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182379
Tested-by: Christian Lohmaier 
Reviewed-by: Christian Lohmaier 

diff --git a/sw/qa/extras/layout/data/tdf164907_rowHeightAtLeast.docx 
b/sw/qa/extras/layout/data/tdf164907_rowHeightAtLeast.docx
new file mode 100644
index ..e42a7e34d405
Binary files /dev/null and 
b/sw/qa/extras/layout/data/tdf164907_rowHeightAtLeast.docx differ
diff --git a/sw/qa/extras/layout/layout4.cxx b/sw/qa/extras/layout/layout4.cxx
index 36af7e749aae..eb9abea5a538 100644
--- a/sw/qa/extras/layout/layout4.cxx
+++ b/sw/qa/extras/layout/layout4.cxx
@@ -1610,6 +1610,13 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, 
TestTdf155229RowAtLeast)
 CPPUNIT_ASSERT_EQUAL(sal_Int32(15494), nTableHeight);
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, TestTdf164907_rowHeightAtLeast)
+{
+createSwDoc("tdf164907_rowHeightAtLeast.docx");
+
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, TestTdf157829LTR)
 {
 // Verify that line breaking inside a bidi portion triggers underflow to 
previous bidi portions
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 9588dc60f073..7195dd82392e 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -213,6 +213,7 @@ static bool lcl_InnerCalcLayout( SwFrame *pFrame,
 // cell height.
 static SwTwips lcl_CalcMinRowHeight( const SwRowFrame *pRow,
  const bool _bConsiderObjs );
+static sal_uInt16 lcl_GetLineWidth(const SwRowFrame& rRow, const 
SvxBoxItemLine& rLine);
 static sal_uInt16 lcl_GetTopSpace( const SwRowFrame& rRow );
 
 static SwTwips lcl_CalcTopAndBottomMargin( const SwLayoutFrame&, const 
SwBorderAttrs& );
@@ -4994,7 +4995,7 @@ static SwTwips lcl_CalcMinRowHeight( const SwRowFrame* 
_pRow,
 if (bMinRowHeightInclBorder)
 {
 //get horizontal border(s)
-nHeight += lcl_GetTopSpace(*_pRow);
+nHeight += lcl_GetLineWidth(*_pRow, SvxBoxItemLine::TOP);
 }
 }
 }
@@ -5040,6 +5041,24 @@ static SwTwips lcl_CalcMinRowHeight( const SwRowFrame* 
_pRow,
 return nHeight;
 }
 
+// Calculate the maximum border-line thickness (CalcLineWidth) of all the 
cells in the row
+static sal_uInt16 lcl_GetLineWidth(const SwRowFrame& rRow, const 
SvxBoxItemLine& rLine)
+{
+sal_uInt16 nBorderThickness = 0;
+for (const SwCellFrame* pCell = static_cast(rRow.Lower()); pCell;
+  pCell = static_cast(pCell->GetNext()))
+{
+sal_uInt16 nTmpWidth = 0;
+const SwFrame* pLower = pCell->Lower();
+if (pLower && pLower->IsRowFrame())
+nTmpWidth = lcl_GetLineWidth(*static_cast(pLower), rLine);
+else
+nTmpWidth = 
pCell->GetFormat()->GetAttrSet().GetBox().CalcLineWidth(rLine);
+nBorderThickness = std::max(nBorderThickness, nTmpWidth);
+}
+return nBorderThickness;
+}
+
 // #i29550#
 
 // Calculate the maximum of (TopLineSize + TopLineDist) over all lowers:


core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-03-06 Thread Jonathan Clark (via logerrit)
 sw/qa/core/uwriter.cxx  |   14 -
 sw/qa/extras/uiwriter/uiwriter9.cxx |   41 
 sw/source/core/inc/scriptinfo.hxx   |  103 +--
 sw/source/core/text/itradj.cxx  |  283 +--
 sw/source/core/text/porlay.cxx  |  327 +---
 sw/source/core/text/porlay.hxx  |   14 -
 sw/source/core/text/portxt.cxx  |   15 -
 sw/source/core/txtnode/fntcache.cxx |   24 +-
 sw/source/core/txtnode/justify.cxx  |   40 
 sw/source/core/txtnode/justify.hxx  |   12 +
 10 files changed, 162 insertions(+), 711 deletions(-)

New commits:
commit 5c30681cab383ffe1a67101fad54bc084613a4fb
Author: Jonathan Clark 
AuthorDate: Mon Mar 3 09:51:39 2025 -0700
Commit: Adolfo Jayme Barrientos 
CommitDate: Thu Mar 6 21:19:22 2025 +0100

tdf#165540 sw: Fix kashida insertion position data corruption

This change greatly simplifies the Writer kashida justification
implementation. As part of this change, a number of string index
invalidation bugs have been fixed by virtue of the implementation no
longer needing to store or reference those indices.

Change-Id: Ibd96963c98cc74462ae55501c0a0a1b944d8bcc0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182507
Tested-by: Jenkins
Reviewed-by: Jonathan Clark 
(cherry picked from commit ef31a26abc5ff4851be5360fd8ecd325132c5592)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182587
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index 4f08ced0995e..b70e19e7ddb4 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -131,7 +131,6 @@ public:
 void test64kPageDescs();
 void testTdf92308();
 void testTableCellComparison();
-void testTdf156211();
 void testFillRubyList();
 void testSetRubyList();
 
@@ -171,7 +170,6 @@ public:
 CPPUNIT_TEST(test64kPageDescs);
 CPPUNIT_TEST(testTdf92308);
 CPPUNIT_TEST(testTableCellComparison);
-CPPUNIT_TEST(testTdf156211);
 CPPUNIT_TEST(testFillRubyList);
 CPPUNIT_TEST(testSetRubyList);
 CPPUNIT_TEST_SUITE_END();
@@ -1975,18 +1973,6 @@ void SwDocTest::tearDown()
 BootstrapFixture::tearDown();
 }
 
-void SwDocTest::testTdf156211()
-{
-SwScriptInfo oSI;
-oSI.SetNoKashidaLine(TextFrameIndex{ 89 }, TextFrameIndex{ 95 });
-
-CPPUNIT_ASSERT(!oSI.IsKashidaLine(TextFrameIndex{ 95 }));
-
-oSI.ClearNoKashidaLines();
-
-CPPUNIT_ASSERT(oSI.IsKashidaLine(TextFrameIndex{ 95 }));
-}
-
 void SwDocTest::testFillRubyList()
 {
 SwNodeIndex aIdx(m_pDoc->GetNodes().GetEndOfContent(), -1);
diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx 
b/sw/qa/extras/uiwriter/uiwriter9.cxx
index 382089d01256..06714fd6d79d 100644
--- a/sw/qa/extras/uiwriter/uiwriter9.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter9.cxx
@@ -1051,44 +1051,17 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf164140)
 = 
dynamic_cast(*pWrtShell->GetLayout()->GetLower()->GetLower()->GetLower());
 const SwScriptInfo* pSI = pTextFrame.GetScriptInfo();
 
-// Prior to editing, the three complete lines should be flagged as 
no-kashida:
-auto stBeforeLines = pSI->GetNoKashidaLines();
-
-CPPUNIT_ASSERT_EQUAL(size_t(4), stBeforeLines.size());
-auto stBeforeIt = stBeforeLines.begin();
-CPPUNIT_ASSERT_EQUAL(sal_Int32(0), std::get<0>(*stBeforeIt));
-CPPUNIT_ASSERT_EQUAL(sal_Int32(88), std::get<1>(*stBeforeIt));
-++stBeforeIt;
-CPPUNIT_ASSERT_EQUAL(sal_Int32(88), std::get<0>(*stBeforeIt));
-CPPUNIT_ASSERT_EQUAL(sal_Int32(180), std::get<1>(*stBeforeIt));
-++stBeforeIt;
-CPPUNIT_ASSERT_EQUAL(sal_Int32(180), std::get<0>(*stBeforeIt));
-CPPUNIT_ASSERT_EQUAL(sal_Int32(269), std::get<1>(*stBeforeIt));
-++stBeforeIt;
-CPPUNIT_ASSERT_EQUAL(sal_Int32(269), std::get<0>(*stBeforeIt));
-CPPUNIT_ASSERT_EQUAL(sal_Int32(312), std::get<1>(*stBeforeIt));
+// Prior to editing, there should be no kashida
+auto stBeforeKashida = pSI->GetKashidaPositions();
+CPPUNIT_ASSERT_EQUAL(size_t(0), stBeforeKashida.size());
 
 // Insert text at the beginning of the document
 pWrtShell->Insert(u"A"_ustr);
 
-// After editing, the three complete lines should still be flagged as 
no-kashida
-auto stAfterLines = pSI->GetNoKashidaLines();
-
-// Without the fix, this will be 2
-CPPUNIT_ASSERT_EQUAL(size_t(4), stAfterLines.size());
-
-auto stAfterIt = stAfterLines.begin();
-CPPUNIT_ASSERT_EQUAL(sal_Int32(0), std::get<0>(*stAfterIt));
-CPPUNIT_ASSERT_EQUAL(sal_Int32(89), std::get<1>(*stAfterIt));
-++stAfterIt;
-CPPUNIT_ASSERT_EQUAL(sal_Int32(89), std::get<0>(*stAfterIt));
-CPPUNIT_ASSERT_EQUAL(sal_Int32(181), std::get<1>(*stAfterIt));
-++stAfterIt;
-CPPUNIT_ASSERT_EQUAL(sal_Int32(181), std::get<0>(*stAfterIt));
-CPPUNIT_ASSERT_EQUAL(sal_Int32(270), std::get<1>(*stAfterIt));
-++stAfterIt;
-CPPUNIT_ASSERT_EQUAL(sal_Int32(270), std::get<0>(*stA

core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-03-06 Thread László Németh (via logerrit)
 sw/qa/extras/layout/data/tdf164905.docx |binary
 sw/qa/extras/layout/layout3.cxx |   16 
 sw/source/core/text/itradj.cxx  |   11 +++
 3 files changed, 23 insertions(+), 4 deletions(-)

New commits:
commit e336b24a99cd2bfc70d27a26274dc43e21fc60b2
Author: László Németh 
AuthorDate: Mon Mar 3 13:50:22 2025 +0100
Commit: Xisco Fauli 
CommitDate: Thu Mar 6 15:54:05 2025 +0100

tdf#164905 tdf#164499 sw smart justify: fix overlapping text in ToC

Unnecessary calculation with the width of the glue portions resulted
bad ToC, i.e. text lines with tabulators got overlapping text.

Regression from commit 857dd6000c877f2c6d8bb73806a8557fa0baea73
"tdf#161810 sw smart justify: fix overhanging lines containing tabs".

Revert only the calculation, but not the unit test, which is still
correct, according to commit ed7fbfce0b434f7d2a5542483d2838af51958e34
"tdf#164499 sw smart justify: disable in tabulated lines to fix ToC".

Change-Id: I3fe6d0d56ea8593ddee23d3c4063024762b65bab
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182433
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 434af9dea64f95e1d5f93a5563106b9124bb17af)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182437
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/layout/data/tdf164905.docx 
b/sw/qa/extras/layout/data/tdf164905.docx
new file mode 100644
index ..9dca805ae13d
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf164905.docx differ
diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index 5460eae5199a..1b2f2c28271d 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -488,6 +488,22 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf161810)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf164905)
+{
+createSwDoc("tdf164905.docx");
+// Ensure that all text portions are calculated before testing.
+SwViewShell* pViewShell = 
getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
+CPPUNIT_ASSERT(pViewShell);
+pViewShell->Reformat();
+
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+// This was 9 (resulting broken ToC layout)
+assertXPath(pXmlDoc, "//SwGluePortion", 3);
+// For example, it was an unnecessary glue portion here
+assertXPath(pXmlDoc,
+
"/root/page/body/section[2]/txt[1]/SwParaPortion/SwLineLayout/SwGluePortion", 
0);
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf163149)
 {
 createSwDoc("tdf163149.docx");
diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx
index 002d43f296d9..a0836bb02170 100644
--- a/sw/source/core/text/itradj.cxx
+++ b/sw/source/core/text/itradj.cxx
@@ -61,9 +61,10 @@ void SwTextAdjuster::FormatBlock( )
 const SwLinePortion *pPos = m_pCurr->GetNextPortion();
 while( pPos && bSkip )
 {
-if( // don't calculate with the terminating space,
+if( !pPos->InGlueGrp() &&
+// don't calculate with the terminating space,
 // otherwise it would result justified line mistakenly
-pPos->GetNextPortion() || !pPos->IsHolePortion() )
+( pPos->GetNextPortion() || !pPos->IsHolePortion() ) )
 {
 nBreakWidth += pPos->Width();
 }
@@ -426,8 +427,6 @@ void SwTextAdjuster::CalcNewBlock( SwLineLayout *pCurrent,
 
 while( pPos )
 {
-nBreakWidth += pPos->Width();
-
 if ( ( bDoNotJustifyLinesWithManualBreak || bDoNotJustifyTab ) &&
  pPos->IsBreakPortion() && !IsLastBlock() )
 {
@@ -552,6 +551,10 @@ void SwTextAdjuster::CalcNewBlock( SwLineLayout *pCurrent,
 else
 ++nGluePortion;
 }
+else
+{
+nBreakWidth += pPos->Width();
+}
 GetInfo().SetIdx( GetInfo().GetIdx() + pPos->GetLen() );
 if ( pPos == pStopAt )
 {


core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-03-06 Thread Jonathan Clark (via logerrit)
 sw/qa/core/uwriter.cxx|4 -
 sw/qa/extras/uiwriter/data/tdf164140.fodt |  117 ++
 sw/qa/extras/uiwriter/uiwriter9.cxx   |   51 +
 sw/source/core/inc/scriptinfo.hxx |   25 --
 sw/source/core/text/itradj.cxx|   91 +++
 sw/source/core/text/porlay.cxx|   21 +
 sw/source/core/text/porlay.hxx|   12 +++
 7 files changed, 281 insertions(+), 40 deletions(-)

New commits:
commit 039ff3ff709e8a91d11317dd2170ecae075a0598
Author: Jonathan Clark 
AuthorDate: Thu Feb 27 00:55:11 2025 -0700
Commit: Xisco Fauli 
CommitDate: Thu Mar 6 15:27:36 2025 +0100

tdf#164140 sw: Fix invalid string indices in kashida justification

During layout, Writer has to mark certain lines and positions as
ineligible for kashida. These lines and positions are stored using
string indices on a per-paragraph basis.

This change fixes a bug causing corruption of these kashida
ineligibility indices during editing. Writer tries to reuse the existing
layouts of lines whenever possible. Since these kashida indices are
computed at the same time as layout, and the paragraph-relative subrange
of a line may be different after inserting or deleting text in previous
lines, the stored indices would point to different parts of the
paragraph string than intended.

Change-Id: Idb67d0a217841dc0743ed716ef8214d10e7b560b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182286
Tested-by: Jenkins
Reviewed-by: Jonathan Clark 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182335

diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index abfce2412516..4f08ced0995e 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -1982,9 +1982,9 @@ void SwDocTest::testTdf156211()
 
 CPPUNIT_ASSERT(!oSI.IsKashidaLine(TextFrameIndex{ 95 }));
 
-oSI.ClearNoKashidaLine(TextFrameIndex{ 0 }, TextFrameIndex{ 89 });
+oSI.ClearNoKashidaLines();
 
-CPPUNIT_ASSERT(!oSI.IsKashidaLine(TextFrameIndex{ 95 }));
+CPPUNIT_ASSERT(oSI.IsKashidaLine(TextFrameIndex{ 95 }));
 }
 
 void SwDocTest::testFillRubyList()
diff --git a/sw/qa/extras/uiwriter/data/tdf164140.fodt 
b/sw/qa/extras/uiwriter/data/tdf164140.fodt
new file mode 100644
index ..ec37896c25b7
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf164140.fodt
@@ -0,0 +1,117 @@
+
+http://www.w3.org/TR/css3-text/"; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xforms="http://www.w3.org/2002/xforms"; 
xmlns:dom="http://www.w3.org/2001/xml-events"; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:drawooo="http://openoffice.org/2010/draw"; 
xmlns:oooc="http://openoffice.org/2004/calc"; 
xmlns:dc="http://purl.org/dc/elements/1.1/"; xmlns:c
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table"; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report"; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office"; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:
 meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.4" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
2025-02-27T01:08:55.794571331PT1M23S3LibreOfficeDev/25.8.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/d09f3f24c38eda633825f4ac214731db06bc9a9a2025-02-27T01:18:29.823738756
+ 
+  
+  
+  
+  
+  
+ 
+ 
+  
+   
+   
+
+   
+   
+  
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+  
+   
+
+ 
+

core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-03-06 Thread Michael Stahl (via logerrit)
 sw/qa/extras/layout/data/table-in-section-truncated.fodt |  161 +++
 sw/qa/extras/layout/layout.cxx   |   38 +++
 sw/source/core/layout/tabfrm.cxx |   13 +
 3 files changed, 210 insertions(+), 2 deletions(-)

New commits:
commit fa64e572cd1abcaff82867eceda74374836697c5
Author: Michael Stahl 
AuthorDate: Thu Feb 27 19:44:26 2025 +0100
Commit: Xisco Fauli 
CommitDate: Thu Mar 6 15:09:32 2025 +0100

sw: layout: fix truncation of table in section

There is a table in a section, split across 2 pages; now insert a page
break that moves the section to page 2.

In SwTabFrame::MakeAll(), on page 2, first the follow is joined, which
grows the table frame but shrinks the section frame (removing the
follow's height), then the table's upper is grown to LONG_MAX but with
bTst=true so it doesn't actually change or invalidate the section frame,
then in lcl_RecalcRow() almost no growth happens because the table
frame already has accounted for the height of most of the table content.

The section frame remains too small for the table, and the content is
truncated... this problem can already be reproduced in OOo 3.3.

When GetUpper()->Grow() returns some space, invalidate the upper if it's
a section frame, then the next round will format the section.

(Simply calling Grow() with bTst=false results in an opposite problem,
where the section is too large.)

Change-Id: I3cb3a5a38fbd7996fa9fcea9a6036f4260451a95
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182331
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 154b58cfd76a8ad670d4aa25874eed66e3398a3e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182351
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/layout/data/table-in-section-truncated.fodt 
b/sw/qa/extras/layout/data/table-in-section-truncated.fodt
new file mode 100644
index ..238dcd18b1fb
--- /dev/null
+++ b/sw/qa/extras/layout/data/table-in-section-truncated.fodt
@@ -0,0 +1,161 @@
+
+http://openoffice.org/2009/office"; 
xmlns:css3t="http://www.w3.org/TR/css3-text/"; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:rpt="http://openoffice.org/2005/report"; 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:dc="http://purl.org/dc/eleme
 nts/1.1/" xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 xmlns:drawooo="http://openoffice.org/2010/draw"; 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer"; 
xmlns:oooc="http://openoffice.org/2004/calc"; 
xmlns:tableooo="http://openoffice.org/2009/table"; 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0
 " xmlns:dom="http://www.w3.org/2001/xml-events"; 
xmlns:xforms="http://www.w3.org/2002/xforms"; office:version="1.2" 
office:mimetype="application/vnd.oasis.opendocument.text">
+ 
2025-02-27T18:20:34.0010950282025-02-27T18:27:39.896741375PT6M11S4CIB_OfficeDev/6.4.0.24$Linux_X86_64
 
LibreOffice_project/f75130dcf240f3fe0d11d4374e1ad4e36d92e416
+ 
+  
+  
+  
+ 
+ 
+  
+   
+   
+
+   
+   
+  
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+  
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+  
+  
+  
+  
+ 
+ 
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+
+   
+ 

core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-03-03 Thread Michael Stahl (via logerrit)
 sw/qa/extras/uiwriter/data/tdf165351.fodt |  158 ++
 sw/qa/extras/uiwriter/uiwriter9.cxx   |   18 +++
 sw/source/core/layout/frmtool.cxx |5 
 3 files changed, 181 insertions(+)

New commits:
commit dfeee3e279ba5838af61326f3b9c340c16a7e768
Author: Michael Stahl 
AuthorDate: Fri Feb 28 19:19:28 2025 +0100
Commit: Xisco Fauli 
CommitDate: Mon Mar 3 15:53:13 2025 +0100

tdf#165351 sw: fix crash after Undo of inserting table row...

... if an existing row of the table has a drawing object anchored to it
as character, and the table is in a fly frame.

The problem is that the SwTextFrame inside the table cell doesn't have
the mbInfFly flag set, because SetInfFlags() was called too early, when
the frame was attached to its SwCellFrame but the SwCellFrame didn't
have an upper yet:

 0  SwFrame::SetInfFlags () at sw/source/core/layout/findfrm.cxx:1600
 1  SwFrame::IsInSct () at sw/source/core/inc/frame.hxx:1009
 2  SwFrame::FindSctFrame () at sw/source/core/inc/frame.hxx:1178
 3  SwFrame::IsHiddenNow () at sw/source/core/layout/trvlfrm.cxx:1734
 4  SwTextFrame::IsHiddenNowImpl () at sw/source/core/text/txtfrm.cxx:1514
 5  SwTextFrame::Prepare (ePrep=PrepareHint::FlyFrameAttributesChanged) at 
sw/source/core/text/txtfrm.cxx:3031
 6  SwAnchoredDrawObject::InvalidateObjPos () at 
sw/source/core/layout/anchoreddrawobject.cxx:595
 7  SwFrame::AppendDrawObj () at sw/source/core/layout/fly.cxx:2803
 8  AppendObj () at sw/source/core/layout/frmtool.cxx:1079
 9  AppendObjsOfNode () at sw/source/core/layout/frmtool.cxx:1277
 10 AppendObjs () at sw/source/core/layout/frmtool.cxx:1330
 11 InsertCnt_() at sw/source/core/layout/frmtool.cxx:1666
 12 SwCellFrame::SwCellFrame () at sw/source/core/layout/tabfrm.cxx:5729
 13 SwRowFrame::SwRowFrame () at sw/source/core/layout/tabfrm.cxx:4627
 14 lcl_InsertRow () at sw/source/core/frmedt/tblsel.cxx:2053
 15 FndBox_::MakeFrames () at sw/source/core/frmedt/tblsel.cxx:2402
 16 SaveTable::CreateNew () at sw/source/core/undo/untbl.cxx:1100
 17 SwUndoTableNdsChg::UndoImpl () at sw/source/core/undo/untbl.cxx:1783

Reset flags in InsertCnt_().

(regression from commit 0a3f5169acc6708c352cad0fa07fdb4af8c8b2dd)

Change-Id: I048196278b314ea516bd5a4877b3e86f696dfce0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182367
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 641cb041a55aae30c629a80e134efc493027f0c4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182430
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/uiwriter/data/tdf165351.fodt 
b/sw/qa/extras/uiwriter/data/tdf165351.fodt
new file mode 100644
index ..0bd7a24a9a1a
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf165351.fodt
@@ -0,0 +1,158 @@
+
+http://www.w3.org/TR/css3-text/"; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xforms="http://www.w3.org/2002/xforms"; 
xmlns:dom="http://www.w3.org/2001/xml-events"; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:drawooo="http://openoffice.org/2010/draw"; 
xmlns:oooc="http://openoffice.org/2004/calc"; 
xmlns:dc="http://purl.org/dc/elements/1.1/"; xmlns:c
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table"; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report"; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office"; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:
 meta:1.0" 
xmlns:loext="urn:org:documentfoundation:name

core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-03-03 Thread Jaume Pujantell (via logerrit)
 sw/qa/core/objectpositioning/data/as_char_image.docx |binary
 sw/qa/core/objectpositioning/objectpositioning.cxx   |   23 +++
 sw/source/core/crsr/crsrsh.cxx   |   13 ++
 sw/source/core/text/itrcrsr.cxx  |7 -
 4 files changed, 36 insertions(+), 7 deletions(-)

New commits:
commit 3fb0973b7b5620e637c04b067a870fb611be4b35
Author: Jaume Pujantell 
AuthorDate: Tue Nov 19 16:26:24 2024 +0100
Commit: Michael Stahl 
CommitDate: Mon Mar 3 12:49:05 2025 +0100

tdf#163890 sw: fix anchor inserted shape to paragraph

Since the commit 651527b4efe9700c8c8dff58ce5aa86ad5681f16 "sw: fix
double-click opening frame dialog, not graphic dialog on images", when
GetModelPositionForViewPoint is called on an "as-char" graphic it
returns the graphic node. This makes inserted shapes anchor to page as a
fallback since they don't find a text node to anchor to.

With this change, the function returns the anchor text node as before if
the caller explicitly asks for only text frames.

This change breaks testTdf157129 in sw_uiwriter8. After pasting content
ending with a hidden paragraph, SwCursorShell::UpdateCursorPos() should
only move the cursor outside the hidden content. Before this change, the
call to GetLayout()->GetModelPositionForViewPoint didn't change the
cursor position because SwTextCursor::GetModelPositionForViewPoint
called pFlyPor->GetFlyCursorOfst and returned success even when it
failed to get a text node and therefore the cursor didn't change. Now it
finds a valid text node and changes the cursor to that. But this is the
wrong behavior, GetModelPositionForViewPoint should not be called if a
non-hidden paragraph can trivially be found.

Change-Id: I8cf9f0c7dcfe6f4be46435c8506e67606ce8fe9c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176775
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins CollaboraOffice 
(cherry picked from commit 7ee34038b12c18b34261beb303f1f945d690761c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176863
Tested-by: Jenkins
(cherry picked from commit dd5f718c4b621313c406ea6ed4d7141b8db78e61)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182421
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/core/objectpositioning/data/as_char_image.docx 
b/sw/qa/core/objectpositioning/data/as_char_image.docx
new file mode 100644
index ..e5e02d2168e1
Binary files /dev/null and 
b/sw/qa/core/objectpositioning/data/as_char_image.docx differ
diff --git a/sw/qa/core/objectpositioning/objectpositioning.cxx 
b/sw/qa/core/objectpositioning/objectpositioning.cxx
index 565a3fe4fca6..ae228ebaf7fb 100644
--- a/sw/qa/core/objectpositioning/objectpositioning.cxx
+++ b/sw/qa/core/objectpositioning/objectpositioning.cxx
@@ -12,6 +12,7 @@
 #include 
 #include 
 
+#include 
 #include 
 
 #include 
@@ -489,6 +490,28 @@ CPPUNIT_TEST_FIXTURE(Test, 
testDoNotCaptureDrawObjsOnPageDrawWrapNone)
 // some <1px difference).
 CPPUNIT_ASSERT_GREATER(nPage2Top - MINFLY, nDrawObjTop);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testInsertShapeOnAsCharImg_tdf16890)
+{
+// Given a document with an image anchored as character
+createSwDoc("as_char_image.docx");
+SwDoc* pDoc = getSwDoc();
+
+// Insert a shape over it
+uno::Sequence aArgs(
+comphelper::InitPropertySequence({ { "KeyModifier", uno::Any(KEY_MOD1) 
} }));
+dispatchCommand(mxComponent, ".uno:BasicShapes.rectangle", aArgs);
+
+// Check that hte new shape is anchored at para (i.e. has an anchor node)
+const auto& rFrmFormats = *pDoc->GetSpzFrameFormats();
+CPPUNIT_ASSERT_EQUAL(size_t(o3tl::make_unsigned(2)), rFrmFormats.size());
+auto pShape = rFrmFormats[1];
+CPPUNIT_ASSERT(pShape);
+// Without the accompanying fix in place, this test would have failed with:
+// assertion failed
+// - Expression: pShape->GetAnchor().GetAnchorNode()
+CPPUNIT_ASSERT(pShape->GetAnchor().GetAnchorNode());
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index f2945f306a2c..54f03657ef53 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -1851,11 +1851,6 @@ void SwCursorShell::UpdateCursorPos()
 
 if (isInHiddenFrame(pShellCursor) && !ExtendedSelectedAll())
 {
-SwCursorMoveState aTmpState(CursorMoveState::SetOnlyText);
-aTmpState.m_bSetInReadOnly = IsReadOnlyAvailable();
-GetLayout()->GetModelPositionForViewPoint( pShellCursor->GetPoint(), 
pShellCursor->GetPtPos(),
- &aTmpState );
-pShellCursor->DeleteMark();
 // kde45196-1.html: try to get to a non-hidden paragraph, there must
 // be one in the document body
 while (isInHiddenFrame(pShellCursor))
@@ -1872,6 +1867,14 @@ void SwCursorShell::UpdateCursorPos()
  

core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-02-26 Thread László Németh (via logerrit)
 sw/qa/extras/layout/data/tdf164903.docx  |binary
 sw/qa/extras/layout/layout5.cxx  |   12 
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |   13 +
 3 files changed, 25 insertions(+)

New commits:
commit 9c7539af6810b51b3be8c738e702622658cf1d23
Author: László Németh 
AuthorDate: Tue Feb 25 02:43:06 2025 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Wed Feb 26 13:24:20 2025 +0100

tdf#164903 sw inline heading: fix DOCX layout by zeroing top margin

Skip top margin of the paragraph of the inline heading by
direct paragraph formatting to fix DOCX layout interoperability.

Regression from commit 56588663a0fddc005c12afaa7d3f8874d036875f
"tdf#131728 sw inline heading: fix DOCX paragraph layout
interoperability".

Change-Id: I9fb485b08b4f3fd7506562e636151ccb6ee7b0a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182138
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 33e54802ee31d4c76e7e41b714f5bfeed484bbd2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182172
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/qa/extras/layout/data/tdf164903.docx 
b/sw/qa/extras/layout/data/tdf164903.docx
new file mode 100644
index ..a7f7f4dac518
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf164903.docx differ
diff --git a/sw/qa/extras/layout/layout5.cxx b/sw/qa/extras/layout/layout5.cxx
index f749d188694d..8bed38e930a4 100644
--- a/sw/qa/extras/layout/layout5.cxx
+++ b/sw/qa/extras/layout/layout5.cxx
@@ -1219,6 +1219,18 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf164932)
 assertXPath(pDump, "//SwLineLayout", 2);
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf164903)
+{
+// ignore top margin of inline heading, like MSO does
+createSwDoc("tdf164903.docx");
+auto pDump = parseLayoutDump();
+auto nInlineHeadingHeight
+= getXPath(pDump, "/root/page[1]/body/txt[6]/infos/bounds", 
"height").toInt32();
+// This was 493 (adding top margin to the height of the Inline Heading 
frame)
+CPPUNIT_ASSERT_GREATER(sal_Int32(250), nInlineHeadingHeight);
+CPPUNIT_ASSERT_LESS(sal_Int32(260), nInlineHeadingHeight);
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf135991)
 {
 createSwDoc("tdf135991.odt");
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index 9f7b2b0219b3..c5982ec10090 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -2802,6 +2802,19 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap, con
 // its default "anchored as character" setting
 
xFrameProps->setPropertyValue(getPropertyName(PROP_ANCHOR_TYPE), 
uno::Any(text::TextContentAnchorType_AS_CHARACTER));
 
+// tdf#164903 empty top and bottom margins to emulate 
the behaviour of style separators
+uno::Reference 
xParaEnumAccess(xFrame, uno::UNO_QUERY);
+if ( xParaEnumAccess.is() && 
!pParaContext->isSet(PROP_PARA_TOP_MARGIN) )
+{
+uno::Reference xParaEnum 
= xParaEnumAccess->createEnumeration();
+if ( xParaEnum.is() )
+{
+uno::Reference 
xParaProps(xParaEnum->nextElement(), uno::UNO_QUERY);
+if ( xParaProps.is() )
+
xParaProps->setPropertyValue(u"ParaTopMargin"_ustr, uno::Any(sal_Int32(0)));
+}
+}
+
 m_StreamStateStack.top().bIsInlineParagraph = false;
 m_StreamStateStack.top().bIsPreviousInlineParagraph = 
true;
 }


core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-02-26 Thread Michael Stahl (via logerrit)
 sw/qa/extras/layout/layout2.cxx  |   13 +
 sw/source/core/text/redlnitr.cxx |   10 ++
 2 files changed, 23 insertions(+)

New commits:
commit c73a02e5da639a1372ee9f00237ba0d27b7110d5
Author: Michael Stahl 
AuthorDate: Wed Feb 19 16:20:56 2025 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Wed Feb 26 13:20:51 2025 +0100

sw: fix bug with redline following fieldmark or hidden break

It is now possible for HideIterator to move to another node without a
redline being involved, but if this happens and there was no redline on
the previous node, GetRedlinePos() had already returned
SwRedlineTable::npos and now no redlines can be found in the new node.

(regression from commit 657de5fba12b0e9afcdee361654d2a2d0dbd7311)

Change-Id: I536b2660c97501be896203403cdd5e2f2015e816
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181946
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 21bc6e075d8b004bce7bf7d9305f5fdcff2df24d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182192
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index ae4c53826379..a9cd34f17432 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -978,6 +978,19 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testHiddenParaProps)
 CPPUNIT_ASSERT_EQUAL(
 SvxAdjust::Left,
 
pTextFrame->GetTextNodeForParaProps()->GetSwAttrSet().Get(RES_PARATR_ADJUST).GetAdjust());
+
+dispatchCommand(mxComponent, u".uno:ShowTrackedChanges"_ustr, {});
+
+pTextFrame = dynamic_cast(pBody->GetLower());
+for (int i = 0; i < 18; ++i)
+{
+pTextFrame = dynamic_cast(pTextFrame->GetNext());
+}
+// the problem was that this redline (following hidden) wasn't merged
+CPPUNIT_ASSERT_EQUAL(u"10 visible, hidden-merge, visible, delete-merge, 
visible"_ustr,
+ pTextFrame->GetText());
+pTextFrame = dynamic_cast(pTextFrame->GetNext());
+CPPUNIT_ASSERT_EQUAL(u"abcdefghi"_ustr, pTextFrame->GetText());
 }
 
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf151954)
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index 7de60b24c406..60545116aa21 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -78,6 +78,7 @@ private:
 /// current start/end pair
 SwPosition const* m_pStartPos;
 SwPosition const* m_pEndPos;
+SwNode const* m_pCurrentRedlineNode;
 
 public:
 SwPosition const* GetStartPos() const { return m_pStartPos; }
@@ -95,6 +96,7 @@ public:
 , m_RedlineIndex(isHideRedlines ? m_rIDRA.GetRedlinePos(rTextNode, 
RedlineType::Any) : SwRedlineTable::npos)
 , m_pStartPos(nullptr)
 , m_pEndPos(&m_Start)
+, m_pCurrentRedlineNode(&rTextNode)
 {
 }
 
@@ -108,6 +110,14 @@ public:
 assert(m_pEndPos);
 if (m_isHideRedlines)
 {
+// GetRedlinePos() returns npos if there is no redline on the
+// node but something else could have merged nodes so search again!
+if (m_RedlineIndex == SwRedlineTable::npos
+&& &m_pEndPos->GetNode() != m_pCurrentRedlineNode)
+{
+m_RedlineIndex = m_rIDRA.GetRedlinePos(m_pEndPos->GetNode(), 
RedlineType::Any);
+m_pCurrentRedlineNode = &m_pEndPos->GetNode();
+}
 // position on current or next redline
 for (; m_RedlineIndex < m_rIDRA.GetRedlineTable().size(); 
++m_RedlineIndex)
 {


core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-02-26 Thread Michael Stahl (via logerrit)
 sw/qa/extras/ooxmlexport/data/CT-with-frame.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport12.cxx   |   10 ++
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |3 +--
 3 files changed, 11 insertions(+), 2 deletions(-)

New commits:
commit bf9eb540d7544799b4c7d66b07719631e654732b
Author: Michael Stahl 
AuthorDate: Tue Feb 25 16:03:20 2025 +0100
Commit: Xisco Fauli 
CommitDate: Wed Feb 26 12:07:41 2025 +0100

tdf#165330 writerfilter: fix import of redline in paragraph after frame

The flag m_bIsActualParagraphFramed is reset only in
ExecuteFrameConversion() which is called at the end of the paragraph
that follows the one that is in the frame, so all redlines in that
paragraph were erroneously moved to the frame; reset it when a paragraph
ends, if the next paragraph is also in the frame it can set the flag
again.

(regression from commit e8bae67b3dbcc90ace8264b6b1aefaf0ce459aba)

Change-Id: I75a18d2e7b600737958e984c135ebf6201e6f979
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182181
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit d09f3f24c38eda633825f4ac214731db06bc9a9a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182190
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/ooxmlexport/data/CT-with-frame.docx 
b/sw/qa/extras/ooxmlexport/data/CT-with-frame.docx
new file mode 100644
index ..85653b0caaec
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/CT-with-frame.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
index 17b09796db41..7eb8f39f4137 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
@@ -1603,6 +1603,16 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf128156)
 assertXPath(pXmlDoc, "//w:ins", 2);
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf165330)
+{
+loadAndSave("CT-with-frame.docx");
+
+xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr);
+// check that *both* tracked changes were round tripped
+assertXPathContent(pXmlDoc, "//w:p[1]/w:ins/w:r/w:t", u"world! ");
+assertXPathContent(pXmlDoc, "//w:p[3]/w:ins/w:r/w:t", u"hello ");
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testTdf125546)
 {
 loadAndSave("tdf125546.docx");
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index ea56f5a83fbe..a797804df116 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -3061,6 +3061,7 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap, con
 else
 SetIsPreviousParagraphFramed(false);
 
+m_bIsActualParagraphFramed = false;
 m_StreamStateStack.top().bRemoveThisParagraph = false;
 if( !IsInHeaderFooter() && !IsInShape()
 && (!pParaContext || !pParaContext->props().IsFrameMode()) )
@@ -9670,8 +9671,6 @@ void DomainMapper_Impl::ExecuteFrameConversion()
 DBG_UNHANDLED_EXCEPTION( "writerfilter.dmapper", "Exception caught 
when converting to frame");
 }
 
-m_bIsActualParagraphFramed = false;
-
 if (redPos.size() == m_aStoredRedlines[StoredRedlines::FRAME].size())
 {
 for( sal_Int32 i = m_aStoredRedlines[StoredRedlines::FRAME].size() 
- 1; i >= 0; --i)


core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-02-22 Thread Oliver Specht (via logerrit)
 sw/qa/extras/rtfimport/data/165333.rtf   |   12 +++
 sw/qa/extras/rtfimport/rtfimport.cxx |   11 +++
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |   58 ++-
 3 files changed, 56 insertions(+), 25 deletions(-)

New commits:
commit d3c332aa2d721601b14ecfff3f4f83ab8e9cb5a5
Author: Oliver Specht 
AuthorDate: Wed Feb 19 14:18:39 2025 +0100
Commit: Gabor Kelemen 
CommitDate: Sat Feb 22 13:22:08 2025 +0100

tdf#165333 RTF: import SYMBOL fields correctly

Úsing XTextAppend to insert SYMBOL fields fixes wrongly extended
character properties.

Change-Id: I14f187e63e2c72d3c2cf27ab99cdced108797057
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181892
Tested-by: Jenkins
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 
(cherry picked from commit 330efa9db365fbc28d825de2fe14162a692ffb2f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182014

diff --git a/sw/qa/extras/rtfimport/data/165333.rtf 
b/sw/qa/extras/rtfimport/data/165333.rtf
new file mode 100644
index ..7834bfd178ef
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/165333.rtf
@@ -0,0 +1,12 @@
+{ tf1
+
+{\stylesheet
+{\qls72 Normal;}
+}
+
+\pard{ tlchcs1 bf40fs12 \ltrchcs0 
+40s12+{ tlchcs1 f40fs10 \ltrchcs0 40s10\insrsid12669988+{ield{\*
ldinst SYMBOL 253 \f "Wingdings" \s 5}{ldrslt10s10}}}\par
+
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 7a83bffe7b35..6b854306dbe3 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1984,6 +1984,17 @@ CPPUNIT_TEST_FIXTURE(Test, test118465Tdf)
 CPPUNIT_ASSERT_EQUAL(sal_Int32(3), getProperty(xTable, 
u"HeaderRowCount"_ustr));
 }
 
+CPPUNIT_TEST_FIXTURE(Test, test165333Tdf)
+{
+createSwDoc("165333.rtf");
+uno::Reference const xRun1(
+getRun(uno::Reference(getParagraphOrTable(1), 
uno::UNO_QUERY), 1));
+CPPUNIT_ASSERT_EQUAL(true, getProperty(xRun1, u"CharHidden"_ustr));
+uno::Reference const xRun2(
+getRun(uno::Reference(getParagraphOrTable(1), 
uno::UNO_QUERY), 2));
+CPPUNIT_ASSERT_EQUAL(false, getProperty(xRun2, u"CharHidden"_ustr));
+}
+
 // tests should only be added to rtfIMPORT *if* they fail round-tripping in 
rtfEXPORT
 } // end of anonymous namespace
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index a45e7374827e..ea56f5a83fbe 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -8416,38 +8416,46 @@ void DomainMapper_Impl::CloseFieldCommand()
 
 if (xTextAppend.is())
 {
-uno::Reference< text::XText > xText = 
xTextAppend->getText();
-uno::Reference< text::XTextCursor > xCrsr = 
xText->createTextCursor();
-if (xCrsr.is())
+uno::Sequence 
aValues(bHasFont ? 4 : 3);
+beans::PropertyValue aCharSetVal;
+aCharSetVal.Name = 
getPropertyName(PROP_CHAR_FONT_CHAR_SET);
+aCharSetVal.Value <<= awt::CharSet::SYMBOL;
+aValues.getArray()[0] = std::move(aCharSetVal);
+if(bHasFont)
 {
-xCrsr->gotoEnd(false);
-xText->insertString(xCrsr, sSymbol, true);
-uno::Reference< beans::XPropertySet > xProp( 
xCrsr, uno::UNO_QUERY );
-
xProp->setPropertyValue(getPropertyName(PROP_CHAR_FONT_CHAR_SET), 
uno::Any(awt::CharSet::SYMBOL));
-if(bHasFont)
-{
-uno::AnyaVal( sFont );
-
xProp->setPropertyValue(getPropertyName(PROP_CHAR_FONT_NAME), aVal);
-
xProp->setPropertyValue(getPropertyName(PROP_CHAR_FONT_NAME_ASIAN), aVal);
-
xProp->setPropertyValue(getPropertyName(PROP_CHAR_FONT_NAME_COMPLEX), aVal);
+beans::PropertyValue aFontVal1;
+beans::PropertyValue aFontVal2;
+beans::PropertyValue aFontVal3;
+
+aFontVal1.Name = 
getPropertyName(PROP_CHAR_FONT_NAME);
+aFontVal1.Value <<= sFont;
+aFontVal2.Name = 
getPropertyName(PROP_CHAR_FONT_NAME_ASIAN);
+aFontVal2.Value <<= sFont;
+aFontVal3.Name = 
getPropertyName(PROP_CHAR_FONT_NAME_COMPLEX);
+aFontVal3.Va

core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-02-21 Thread Michael Stahl (via logerrit)
 sw/qa/extras/layout/data/merge_hidden_redline.docx |binary
 sw/qa/extras/layout/layout2.cxx|  247 -
 sw/source/core/docnode/node.cxx|6 
 sw/source/core/inc/rootfrm.hxx |1 
 sw/source/core/inc/scriptinfo.hxx  |2 
 sw/source/core/inc/txtfrm.hxx  |   13 -
 sw/source/core/layout/newfrm.cxx   |2 
 sw/source/core/text/itrform2.cxx   |   10 
 sw/source/core/text/porlay.cxx |   15 +
 sw/source/core/text/redlnitr.cxx   |   62 -
 sw/source/core/text/txtfrm.cxx |   73 --
 sw/source/core/view/viewsh.cxx |   26 +-
 12 files changed, 390 insertions(+), 67 deletions(-)

New commits:
commit 43adea12b199622bb703fe731afb3be182f2c17d
Author: Michael Stahl 
AuthorDate: Wed Feb 19 16:25:35 2025 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Fri Feb 21 13:14:16 2025 +0100

sw: use same paragraph properties as Word for hidden text

This is a follow-up to commit 2bcfb7231b5ca74f02274cfb74ca8463f78905d6
"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:
58353884dc86bdb3c1464f8bbf8c3e131584b78a (related: tdf#130685) sw: adapt 
definition of sw_redlinehide index 0
b86ff2c6a88aa41379e74f11e8ec8497ff85ffd0 tdf#118699 sw_redlinehide: need 
some more changes to use the last node
fa5eb82b398e29ae033f7b7c8c8195dfc10cf5b0 tdf#118699 change tracking: don't 
number empty lines
beec1594587d0bf1ea2268f9a435c948b5580278 tdf#125319 sw_redlinehide: handle 
empty paragraphs more like Word
c20308f1b919ca5ce61233068946e5fddb7eadb3 sw_redlinehide_4b: surprising 
discoveries

Change-Id: If0e49a4d105dbf7d71e753967f36f2ec56f21f1d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181918
Reviewed-by: Michael Stahl 
Tested-by: Jenkins
(cherry picked from commit 8712673a445edeb28a5f3029bbcaa096f38d72e6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181957
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/qa/extras/layout/data/merge_hidden_redline.docx 
b/sw/qa/extras/layout/data/merge_hidden_redline.docx
new file mode 100644
index ..7a7013321402
Binary files /dev/null and b/sw/qa/extras/layout/data/merge_hidden_redline.docx 
differ
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index 5dc1e6fff241..9364add9ecaf 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -20,6 +20,10 @@
 #include 
 
 #include 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -707,24 +711,25 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf152872)
 // 5 is empty and hidden
 assertXPath(pXmlDoc, "/root/page/body/txt[2]/infos/bounds", "height", 
u"0");
 
-dispatchCommand(mxComponent, u".uno:ControlCodes"_ustr, {});
+SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+SwViewOption aViewOptions(*pWrtShell->GetViewOptions());
+aViewOptions.SetShowHiddenChar(true);
+aViewOptions.SetViewMetaChars(true);
+pWrtShell->ApplyViewOptions(aViewOptions);
 
 pXmlDoc = parseLayoutDump();
 
 assertXPath(pXmlDoc, "/root/page[1]/body/txt", 5);
 assertXPath(pXmlDoc, "/root/page/body/txt[1]/SwParaPortion/SwLineLayout", 
"portion", u"C ");
 assertXPath(pXmlDoc, "/root/page/body/txt[2]/SwParaPortion/SwLineLayout", 
"portion", u"D");
-// 3 is an empty paragraph with RES_CHRATR_HIDDEN which results in 0-height
-// frame; ideally it should only be hidden when control codes are hidden
-// and be a full-height frame now, but that needs more wor

core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-02-19 Thread Oliver Specht (via logerrit)
 sw/qa/extras/rtfimport/data/tblrepeat.rtf |  541 ++
 sw/qa/extras/rtfimport/rtfimport.cxx  |   10 
 sw/source/writerfilter/rtftok/rtfdispatchflag.cxx |6 
 3 files changed, 557 insertions(+)

New commits:
commit 4fb4b4ab8009449d3b7f25d23d16b7af34dadf8e
Author: Oliver Specht 
AuthorDate: Mon Feb 17 15:23:23 2025 +0100
Commit: Gabor Kelemen 
CommitDate: Wed Feb 19 17:42:10 2025 +0100

tdf#118465 RTF: import repeated headers of tables

Change-Id: Idc0cd36e1ca55a0c0cc60faf455919af645bb747
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181792
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen 
Tested-by: Gabor Kelemen 
(cherry picked from commit 44d1dd3a252cb79629037110c75058925efdeb80)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181830

diff --git a/sw/qa/extras/rtfimport/data/tblrepeat.rtf 
b/sw/qa/extras/rtfimport/data/tblrepeat.rtf
new file mode 100644
index ..1288c59f3fd3
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tblrepeat.rtf
@@ -0,0 +1,541 @@
+{ 
tf1deflang1025nsinsicpg1252\uc1deff295\deff0\stshfdbch157\stshfloch369\stshfhich369\stshfbi295\deflang1031\deflangfe1041
 hemelang1031hemelangfe1041  hemelangcs0{onttbl{34bidi romancharset0
prq2{\*\panose 02040503050406030204}Cambria Math;}
+{46bidi swisscharset0prq2{\*\panose 020b0604020202020204}Liberation 
Sans;}{103bidi swisscharset134prq2{\*\panose 
020b0503020204020204}Microsoft YaHei;}{104bidi swisscharset134prq2 
@Microsoft YaHei;}
+{157bidi moderncharset134prq1{\*\panose 02010609030101010101}NSimSun;}{
158bidi moderncharset134prq1 @NSimSun;}{295bidi swisscharset0
prq2{\*\panose 020b0602030504020204}Lucida Sans;}
+{369bidi romancharset0prq2{\*\panose 02020603050405020304}Liberation 
Serif;}{lomajor31500bidi romancharset0prq2{\*\panose 
02020603050405020304}Times New Roman;}
+{dbmajor31501bidi swisscharset128prq2{\*\panose 020b0300}Yu 
Gothic Light{\*alt \'9f\'e0\'83\'53\'83\'56\'83\'62\'83\'4e Light};}{himajor
31502bidi swisscharset0prq2 Aptos Display;}
+{bimajor31503bidi romancharset0prq2{\*\panose 02020603050405020304}Times 
New Roman;}{lominor31504bidi romancharset0prq2{\*\panose 
02020603050405020304}Times New Roman;}
+{dbminor31505bidi romancharset128prq2{\*\panose 02020400}Yu 
Mincho{\*alt \'9f\'e0\'96\'be\'92\'a9};}{himinor31506bidi swisscharset0
prq2 Aptos;}
+{biminor31507bidi romancharset0prq2{\*\panose 02020603050405020304}Times 
New Roman;}{1693bidi romancharset238prq2 Cambria Math CE;}{1694bidi 
romancharset204prq2 Cambria Math Cyr;}
+{1696bidi romancharset161prq2 Cambria Math Greek;}{1697bidi roman
charset162prq2 Cambria Math Tur;}{1700bidi romancharset186prq2 Cambria 
Math Baltic;}{1701bidi romancharset163prq2 Cambria Math (Vietnamese);}
+{1813bidi swisscharset238prq2 Liberation Sans CE;}{1814bidi swiss
charset204prq2 Liberation Sans Cyr;}{1816bidi swisscharset161prq2 
Liberation Sans Greek;}{1817bidi swisscharset162prq2 Liberation Sans Tur;}
+{1818bidi swisscharset177prq2 Liberation Sans (Hebrew);}{1820bidi 
swisscharset186prq2 Liberation Sans Baltic;}{1821bidi swisscharset163
prq2 Liberation Sans (Vietnamese);}
+{2385bidi swisscharset0prq2 Microsoft YaHei Western;}{2383bidi swiss
charset238prq2 Microsoft YaHei CE;}{2384bidi swisscharset204prq2 
Microsoft YaHei Cyr;}{2386bidi swisscharset161prq2 Microsoft YaHei Greek;}
+{2387bidi swisscharset162prq2 Microsoft YaHei Tur;}{2395bidi swiss
charset0prq2 @Microsoft YaHei Western;}{2393bidi swisscharset238prq2 
@Microsoft YaHei CE;}{2394bidi swisscharset204prq2 @Microsoft YaHei Cyr;}
+{2396bidi swisscharset161prq2 @Microsoft YaHei Greek;}{2397bidi swiss
charset162prq2 @Microsoft YaHei Tur;}{2925bidi moderncharset0prq1 NSimSun 
Western;}{2935bidi moderncharset0prq1 @NSimSun Western;}
+{5043bidi romancharset238prq2 Liberation Serif CE;}{5044bidi roman
charset204prq2 Liberation Serif Cyr;}{5046bidi romancharset161prq2 
Liberation Serif Greek;}{5047bidi romancharset162prq2 Liberation Serif 
Tur;}
+{5048bidi romancharset177prq2 Liberation Serif (Hebrew);}{5050bidi 
romancharset186prq2 Liberation Serif Baltic;}{5051bidi romancharset163
prq2 Liberation Serif (Vietnamese);}
+{lomajor31508bidi romancharset238prq2 Times New Roman CE;}{lomajor
31509bidi romancharset204prq2 Times New Roman Cyr;}{lomajor31511bidi 
romancharset161prq2 Times New Roman Greek;}
+{lomajor31512bidi romancharset162prq2 Times New Roman Tur;}{lomajor
31513bidi romancharset177prq2 Times New Roman (Hebrew);}{lomajor31514
bidi romancharset178prq2 Times New Roman (Arabic);}
+{lomajor31515bidi romancharset186prq2 Times New Roman Baltic;}{lomajor
31516bidi romancharset163prq2 Times New Roman (Vietnames

core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-02-19 Thread Jonathan Clark (via logerrit)
 sw/qa/extras/layout/data/tdf149089.fodt |  121 
 sw/qa/extras/layout/layout5.cxx |   14 +++
 sw/source/core/text/itrform2.cxx|9 +-
 sw/source/filter/ww8/ww8par.cxx |2 
 4 files changed, 144 insertions(+), 2 deletions(-)

New commits:
commit d2d33e105d53a7007c0715b0c14f0e1443466d52
Author: Jonathan Clark 
AuthorDate: Thu Feb 13 02:46:49 2025 -0700
Commit: Michael Stahl 
CommitDate: Wed Feb 19 09:58:01 2025 +0100

tdf#149089 sw: DOC/DOCX portions should not be snapped to char grid

The Writer and Word text grid implementations differ significantly.
Writer tries to align characters to grid cells for attractive
typesetting. Word, on the other hand, adds extra space to each character
based solely on the grid metrics, with no effort to align characters to
the grid. The result looks odd, but emulating it is necessary in order
to display most CJK Word documents (or non-CJK documents translated
from CJK languages).

Part of this mismatch was already addressed by tdf#161145.

This change builds upon the previous work by updating Writer to no
longer insert extra kerning portions when the MS_WORD_COMP_GRID_METRICS
compatibility flag is set. Writer normally needs these portions in order
to align the starts of successive portions to the grid. However, Word
doesn't do this. This mismatch was causing layout issues manifesting as
excessive indentation or whitespace inserted into text where none is
expected.

Change-Id: I3adf9001bdb49a69bdf760919d6f8810eac565d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181617
Reviewed-by: Jonathan Clark 
Tested-by: Jenkins
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181633
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/layout/data/tdf149089.fodt 
b/sw/qa/extras/layout/data/tdf149089.fodt
new file mode 100644
index ..e3aa2bd353c3
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf149089.fodt
@@ -0,0 +1,121 @@
+
+http://www.w3.org/TR/css3-text/"; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xforms="http://www.w3.org/2002/xforms"; 
xmlns:dom="http://www.w3.org/2001/xml-events"; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:drawooo="http://openoffice.org/2010/draw"; 
xmlns:oooc="http://openoffice.org/2004/calc"; 
xmlns:dc="http://purl.org/dc/elements/1.1/"; xmlns:c
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table"; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report"; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office"; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:
 meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.4" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
2025-02-13T04:23:16.326282421LibreOfficeDev/25.8.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/1b9abff28de5e0e0d4ff3583facbb7db78b5f4be2025-02-13T04:27:41.902739947PT4M23S7
+ 
+  
+   true
+  
+ 
+ 
+  
+  
+  
+  
+  
+ 
+ 
+  
+   
+   
+
+   
+   
+  
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+  
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+  
+  
+  
+  
+  
+ 
+  
+   
+  
+  
+   
+
+   
+   
+   
+  
+  
+   
+  
+ 
+ 
+  
+ 
+

core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-02-14 Thread Jonathan Clark (via logerrit)
 dev/null|binary
 sw/qa/extras/layout/data/tdf144450.fodt |  168 
 sw/qa/extras/layout/layout5.cxx |   61 +++
 sw/qa/extras/ww8export/ww8export4.cxx   |6 -
 sw/source/core/text/itrform2.cxx|   34 ++
 5 files changed, 262 insertions(+), 7 deletions(-)

New commits:
commit adb18c960b37cbc2042bde799c86f78175dcfcb9
Author: Jonathan Clark 
AuthorDate: Wed Feb 12 08:18:40 2025 -0700
Commit: Xisco Fauli 
CommitDate: Fri Feb 14 13:44:17 2025 +0100

tdf#164871 sw: Implemented exact and at-least line spacing for grid

Previously, paragraphs snapped to CJK grid allowed proportional line
spacing, but did not allow either exact or at-least line spacing. These
other line spacing types had not been implemented.

Change-Id: I4c07876ab4f9881899bcc2ebb8b64019141bf988
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181508
Tested-by: Jenkins
Reviewed-by: Jonathan Clark 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181632

diff --git a/sw/qa/extras/layout/data/tdf144450.fodt 
b/sw/qa/extras/layout/data/tdf144450.fodt
new file mode 100644
index ..598d179363bb
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf144450.fodt
@@ -0,0 +1,168 @@
+
+http://www.w3.org/TR/css3-text/"; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xforms="http://www.w3.org/2002/xforms"; 
xmlns:dom="http://www.w3.org/2001/xml-events"; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:drawooo="http://openoffice.org/2010/draw"; 
xmlns:oooc="http://openoffice.org/2004/calc"; 
xmlns:dc="http://purl.org/dc/elements/1.1/"; xmlns:c
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table"; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report"; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office"; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:
 meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.4" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
2025-02-12T10:58:58.1910280842025-02-12T11:06:48.424292523PT7M50S3LibreOfficeDev/25.8.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/2e93642a5f37f03ddd9530c0fd4d4b29243a0585
+ 
+  
+  
+  
+  
+ 
+ 
+  
+   
+   
+
+   
+   
+  
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+  
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+  
+  
+  
+  
+  
+ 
+  
+   
+  
+  
+   
+   
+  
+  
+   
+   
+  
+  
+   
+   
+  
+  
+   
+   
+  
+  
+   
+   
+  
+  
+   
+   
+  
+  
+   
+   
+  
+  
+   
+   
+  
+  
+   
+   
+  
+  
+   
+   
+  
+  
+   
+   
+  
+  
+   
+
+
+   
+   
+   
+  
+ 
+ 
+  
+ 
+ 
+  
+   
+
+
+
+
+
+   
+         
+         
+         
+         
+         
+         
+         
+         
+         
+         
+         
+   
+  
+ 
+
\ No newline at end of file
diff --git a/sw/qa/extras/layout/layout5.cxx b/sw/qa/extras/layout/layout5.cxx
index

core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-02-13 Thread Xisco Fauli (via logerrit)
 sw/qa/extras/uiwriter/data/tdf164620.docx |binary
 sw/qa/extras/uiwriter/uiwriter3.cxx   |   18 ++
 sw/source/core/fields/reffld.cxx  |3 +++
 3 files changed, 21 insertions(+)

New commits:
commit 01365b2db23d99b95a088276585a14de7a5a4138
Author: Xisco Fauli 
AuthorDate: Mon Jan 13 10:16:41 2025 +0100
Commit: Xisco Fauli 
CommitDate: Thu Feb 13 18:54:43 2025 +0100

tdf#164620: sw_uiwriter3: Add unittest

and fix another edge case it found.

Change-Id: Ia57ae1c9a13279f240b78f90fd05faa2f0da7ce5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180162
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit ff7bd4d2ac03f39f1da8ead9a6474e84d0f7b277)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181640
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/uiwriter/data/tdf164620.docx 
b/sw/qa/extras/uiwriter/data/tdf164620.docx
new file mode 100644
index ..6e74b6bf7fe3
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf164620.docx differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 96ef31c0cc46..de126574ca78 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -1189,6 +1189,24 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf100691)
 CPPUNIT_ASSERT_EQUAL(u"Text1"_ustr, pNext->GetText());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf164620)
+{
+createSwDoc("tdf164620.docx");
+
+CPPUNIT_ASSERT_EQUAL(2, getPages());
+
+dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {});
+
+// Without the fix in place, this test would have crashed here
+dispatchCommand(mxComponent, u".uno:Delete"_ustr, {});
+
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+dispatchCommand(mxComponent, u".uno:Undo"_ustr, {});
+
+CPPUNIT_ASSERT_EQUAL(2, getPages());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf134404)
 {
 createSwDoc("tdf134404.odt");
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 59638ffa20a5..4fb526c59aa3 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -1606,6 +1606,9 @@ SwTextNode* 
SwGetRefFieldType::FindAnchorRefStyleOther(SwDoc* pDoc,
 SwNodeOffset nReference = pReference->GetIndex();
 const SwNodes& nodes = pDoc->GetNodes();
 
+if (&nodes != &pReference->GetNodes())
+return nullptr;
+
 // It is possible to end up here, with a pReference pointer which points 
to a node which has already been
 // removed from the nodes array, which means that calling GetIndex() 
returns an incorrect index.
 if (nReference >= nodes.Count() || nodes[nReference] != pReference)


core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-02-12 Thread László Németh (via logerrit)
 sw/qa/extras/layout/data/tdf164499.docx |binary
 sw/qa/extras/layout/layout3.cxx |   28 +++-
 sw/source/core/text/portxt.cxx  |2 ++
 3 files changed, 25 insertions(+), 5 deletions(-)

New commits:
commit 55830c147b0f2cebfa4bc4f8c271ae455e6446b5
Author: László Németh 
AuthorDate: Tue Feb 11 01:22:42 2025 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Thu Feb 13 05:51:47 2025 +0100

tdf#164499 sw smart justify: disable in tabulated lines to fix ToC

Calculated extra text content without shrinking resulted overhanging
text lines, e.g page numbers over the margin in ToC. Fix it
by skipping space shrinking completely in tabulated lines,
restoring also interoperability.

Regression since commit 53de98b29548ded88e0a44c80256fc5e340d551e
"tdf#158333 sw smart justify: fix multiple text portions".

Change-Id: I390a254b8a47c6563d2c01a2f818f5ac6122e2ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181397
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit ed7fbfce0b434f7d2a5542483d2838af51958e34)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181450
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/qa/extras/layout/data/tdf164499.docx 
b/sw/qa/extras/layout/data/tdf164499.docx
new file mode 100644
index ..d970bb29affa
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf164499.docx differ
diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index af6dac583f29..5460eae5199a 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -479,12 +479,10 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf161810)
 auto pTextArrayAction = static_cast(pAction);
 auto pDXArray = pTextArrayAction->GetDXArray();
 
-// There should be 73 chars on the first line
-CPPUNIT_ASSERT_EQUAL(size_t(73), pDXArray.size());
+// There should be 70 chars on the first line
+// (tdf#164499 no space shrinking in lines with tabulation)
+CPPUNIT_ASSERT_EQUAL(size_t(70), pDXArray.size());
 
-// Assert we are using the expected position for the last char
-// This was 9369, now 9165, according to the fixed space shrinking
-CPPUNIT_ASSERT_LESS(sal_Int32(9300), sal_Int32(pDXArray[72]));
 break;
 }
 }
@@ -535,6 +533,26 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf163149)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf164499)
+{
+createSwDoc("tdf164499.docx");
+
+// Ensure that all text portions are calculated before testing.
+SwViewShell* pViewShell = 
getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
+CPPUNIT_ASSERT(pViewShell);
+pViewShell->Reformat();
+
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+// no shrinking in tabulated text lines
+
+// This was 1 (no line break in heading 2.5.5)
+assertXPath(pXmlDoc, 
"/root/page[1]/body/section/txt[18]/SwParaPortion/SwLineLayout", 2);
+// line break in heading 2.5.5: the second line contains only the page 
number
+assertXPath(pXmlDoc, 
"/root/page[1]/body/section/txt[18]/SwParaPortion/SwLineLayout[2]",
+"portion", u"*1");
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf132599_always)
 {
 uno::Reference xHyphenator = 
LinguMgr::GetHyphenator();
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 8fd5f1c07623..d72bc719a730 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -333,6 +333,8 @@ bool SwTextPortion::Format_( SwTextFormatInfo &rInf )
  pGuess->BreakPos() != TextFrameIndex(COMPLETE_STRING) &&
  rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(
 DocumentSettingId::JUSTIFY_LINES_WITH_SHRINKING) &&
+ // tdf#164499 no shrinking in tabulated line
+ ( !rInf.GetLast() || !rInf.GetLast()->InTabGrp() ) &&
  // tdf#158436 avoid shrinking at underflow, e.g. no-break space after 
a
  // very short word resulted endless loop
  !rInf.IsUnderflow() )


core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-02-12 Thread Oliver Specht (via logerrit)
 sw/qa/extras/rtfimport/rtfimport.cxx   |7 +++
 sw/source/writerfilter/rtftok/rtfdispatchvalue.cxx |6 ++
 2 files changed, 13 insertions(+)

New commits:
commit 70e5461a866f14c198cbb4894fa81c465f4269ae
Author: Oliver Specht 
AuthorDate: Tue Jan 28 14:16:07 2025 +0100
Commit: Gabor Kelemen 
CommitDate: Wed Feb 12 18:19:32 2025 +0100

tdf#164266 RTF: border distance in style is not applied to table

Attributes from styles are only valid if they are repeated at the
location where the style is applied.

Change-Id: I0083b833266346084d51aaf78a162b96012a0dab
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180835
Reviewed-by: Gabor Kelemen 
Tested-by: Jenkins
Tested-by: Gabor Kelemen 
(cherry picked from commit 0e0ae62ded3f72768bc06e38253dacbf5af0ed5a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181459

diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 515fae3c4a5c..54315245036d 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1958,6 +1958,13 @@ CPPUNIT_TEST_FIXTURE(Test, test162198Tdf)
 sal_Int32 nRightDistance = getProperty(xCellPropSet, 
u"LeftBorderDistance"_ustr);
 CPPUNIT_ASSERT_EQUAL_MESSAGE("left cell spacing to contents", 
sal_Int32(9), nLeftDistance);
 CPPUNIT_ASSERT_EQUAL_MESSAGE("right cell spacing to contents", 
sal_Int32(9), nRightDistance);
+
+xCell = xTable1->getCellByName(u"B1"_ustr);
+xCellPropSet = uno::Reference(xCell, 
uno::UNO_QUERY_THROW);
+nLeftDistance = getProperty(xCellPropSet, 
u"LeftBorderDistance"_ustr);
+nRightDistance = getProperty(xCellPropSet, 
u"LeftBorderDistance"_ustr);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("left cell spacing to contents", 
sal_Int32(9), nLeftDistance);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("right cell spacing to contents", 
sal_Int32(9), nRightDistance);
 }
 
 CPPUNIT_TEST_FIXTURE(Test, test153192Tdf)
diff --git a/sw/source/writerfilter/rtftok/rtfdispatchvalue.cxx 
b/sw/source/writerfilter/rtftok/rtfdispatchvalue.cxx
index 85ad1613a5dd..d89c3420017a 100644
--- a/sw/source/writerfilter/rtftok/rtfdispatchvalue.cxx
+++ b/sw/source/writerfilter/rtftok/rtfdispatchvalue.cxx
@@ -665,6 +665,12 @@ bool RTFDocumentImpl::dispatchTableValue(RTFKeyword 
nKeyword, int nParam)
 case RTFKeyword::TRPADDR:
 case RTFKeyword::TRPADDT:
 {
+// tdf#162198 prevent adding attributes to rows/cells from style 
without
+// being repeated at the cell/row level
+// this might be required for other attributes, too
+if (m_aStates.top().getDestination() == Destination::STYLEENTRY)
+return true;
+
 RTFSprms aAttributes;
 aAttributes.set(NS_ooxml::LN_CT_TblWidth_w, new RTFValue(nParam));
 switch (nKeyword)


core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-02-12 Thread Oliver Specht (via logerrit)
 sw/qa/extras/unowriter/data/tdf164921.odt |binary
 sw/qa/extras/unowriter/unowriter.cxx  |   44 ++
 sw/source/core/doc/docnum.cxx |   19 +++-
 3 files changed, 61 insertions(+), 2 deletions(-)

New commits:
commit dffdb6ebeefe0783cc67168406a3bcffd4b60144
Author: Oliver Specht 
AuthorDate: Wed Jan 29 12:38:55 2025 +0100
Commit: Gabor Kelemen 
CommitDate: Wed Feb 12 17:31:51 2025 +0100

tdf#164921 Renaming list styles fixed

User defined list styles are now correctly updated in paragraph
styles that are using them and only directly applied to paragraphs
that had a direct formating before.

Change-Id: I9b671655ffa430d643c48fc35f15f38b41de4b9b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180892
Reviewed-by: Gabor Kelemen 
Tested-by: Gabor Kelemen 
Tested-by: Jenkins
(cherry picked from commit fe1a74c68b892d01bf5d8be9aed90c12c5bf6abd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181465

diff --git a/sw/qa/extras/unowriter/data/tdf164921.odt 
b/sw/qa/extras/unowriter/data/tdf164921.odt
new file mode 100644
index ..b24b4b6f3299
Binary files /dev/null and b/sw/qa/extras/unowriter/data/tdf164921.odt differ
diff --git a/sw/qa/extras/unowriter/unowriter.cxx 
b/sw/qa/extras/unowriter/unowriter.cxx
index abcda606ec69..4618fd6bb362 100644
--- a/sw/qa/extras/unowriter/unowriter.cxx
+++ b/sw/qa/extras/unowriter/unowriter.cxx
@@ -47,6 +47,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1516,6 +1517,49 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTdf164885)
 CPPUNIT_ASSERT_EQUAL(u".uno:Open"_ustr, 
interceptor->pDispatch->sLastCommand);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTdf164921)
+{
+// check renaming list style
+OUString sChangedListStyle = u"ChangedListStyle"_ustr;
+
+{
+createSwDoc("tdf164921.odt");
+//change list style name
+//auto xModel = mxComponent.queryThrow();
+uno::Reference xSFS(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xListStyles(
+xSFS->getStyleFamilies()->getByName(u"NumberingStyles"_ustr), 
uno::UNO_QUERY);
+uno::Reference 
xListStyle(xListStyles->getByName(u"NewListStyle"_ustr),
+ uno::UNO_QUERY);
+xListStyle->setName(sChangedListStyle);
+
+utl::MediaDescriptor aMediaDescriptor;
+aMediaDescriptor[u"FilterName"_ustr] <<= u"writer8"_ustr;
+uno::Reference const xStorable(mxComponent, 
uno::UNO_QUERY);
+xStorable->storeToURL(maTempFile.GetURL(), 
aMediaDescriptor.getAsConstPropertyValueList());
+}
+{
+saveAndReload(u"writer8"_ustr);
+
+uno::Reference xSFS(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xListStyles(
+xSFS->getStyleFamilies()->getByName(u"NumberingStyles"_ustr), 
uno::UNO_QUERY);
+uno::Reference xNewListStyle(
+xListStyles->getByName(u"ChangedListStyle"_ustr), uno::UNO_QUERY);
+
+CPPUNIT_ASSERT_EQUAL(xNewListStyle->getName(), sChangedListStyle);
+
+uno::Reference xParaStyles(
+xSFS->getStyleFamilies()->getByName(u"ParagraphStyles"_ustr), 
uno::UNO_QUERY);
+uno::Reference 
xBodyTextStyle(xParaStyles->getByName("Text body"),
+   uno::UNO_QUERY);
+
+rtl::OUString sListStyleName;
+xBodyTextStyle->getPropertyValue(u"NumberingStyleName"_ustr) >>= 
sListStyleName;
+CPPUNIT_ASSERT_EQUAL(sListStyleName, sChangedListStyle);
+}
+}
+
 } // end of anonymous namespace
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 584417b5ed76..c851d150d500 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -1232,12 +1232,27 @@ bool SwDoc::RenameNumRule(const OUString & rOldName, 
const OUString & rNewName,
 pNumRule->GetTextNodeList( aTextNodeList );
 
 pNumRule->SetName( rNewName, getIDocumentListsAccess() );
-
 SwNumRuleItem aItem(rNewName);
 
+const size_t nArrLen = GetTextFormatColls()->size();
+for( size_t i = 0; i < nArrLen; i++ )
+{
+SwTextFormatColl* pColl = (*GetTextFormatColls())[ i ];
+const SwAttrSet& rAttrSet = pColl->GetAttrSet();
+
+const SfxPoolItem* pTempItem = nullptr;
+if (SfxItemState::SET == rAttrSet.GetItemState(RES_PARATR_NUMRULE, 
false, &pTempItem))
+{
+const SwNumRuleItem* pNumItem = static_cast(pTempItem);
+if (pNumItem->GetValue().equals(rOldName))
+pColl->SetFormatAttr( aItem );
+}
+}
+
 for ( SwTextNode* pTextNd : aTextNodeList )
 {
-pTextNd->SetAttr(aItem);
+if (SfxItemState::SET == 
pTextNd->GetSwAttrSet().GetItemState(RES_PARATR_NUMRULE, false))
+ 

core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-02-12 Thread Oliver Specht (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf164176.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx   |   15 +++
 sw/source/writerfilter/dmapper/SettingsTable.cxx |4 +++-
 3 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 472a503d283d96309525078a7933f4d5ec8a1d65
Author: Oliver Specht 
AuthorDate: Thu Dec 5 07:48:10 2024 +0100
Commit: Gabor Kelemen 
CommitDate: Wed Feb 12 17:26:28 2025 +0100

tdf#164176 Import multiline document variable with break

Converts the '_x000d_' or '_x000d__x000a_' to a paragraph break in docx 
import.

Change-Id: Ib8b5203338e987028279711928d3aecb9cedd836
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177838
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen 
Tested-by: Gabor Kelemen 
(cherry picked from commit 9647aded124c17e97db1bf7bb071136c7f91cb90)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181438

diff --git a/sw/qa/extras/ooxmlexport/data/tdf164176.docx 
b/sw/qa/extras/ooxmlexport/data/tdf164176.docx
new file mode 100644
index ..2d93cfd3765d
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf164176.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index 5ba9a7f02ff2..3f806154d257 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -17,6 +17,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -1203,6 +1205,19 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf146269)
 }
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf164176, "tdf164176.docx")
+{
+uno::Reference xTextFieldsSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xFieldsAccess(
+xTextFieldsSupplier->getTextFields());
+uno::Reference 
xFields(xFieldsAccess->createEnumeration());
+
+uno::Reference 
xEnumerationAccess1(xFields->nextElement(), uno::UNO_QUERY);
+rtl::OUString sPresentation = 
xEnumerationAccess1->getPresentation(true).trim();
+CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), sPresentation.indexOf("_x000d_"));
+CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), sPresentation.indexOf("_x000a_"));
+}
+
 } // end of anonymous namespace
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/writerfilter/dmapper/SettingsTable.cxx 
b/sw/source/writerfilter/dmapper/SettingsTable.cxx
index b4bf82541484..7ec07453d4f6 100644
--- a/sw/source/writerfilter/dmapper/SettingsTable.cxx
+++ b/sw/source/writerfilter/dmapper/SettingsTable.cxx
@@ -215,7 +215,9 @@ void SettingsTable::lcl_attribute(Id nName, const Value & 
val)
 m_pImpl->m_aDocVars.back().first = sStringValue;
 break;
 case NS_ooxml::LN_CT_DocVar_val:
-m_pImpl->m_aDocVars.back().second = sStringValue;
+m_pImpl->m_aDocVars.back().second =
+sStringValue.replaceAll("_x000d__x000a_", "
")
+.replaceAll("_x000d_", "
");
 break;
 case NS_ooxml::LN_CT_CompatSetting_name:
 m_pImpl->m_aCurrentCompatSettingName = sStringValue;


core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-02-10 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx   |   28 ++-
 sw/source/writerfilter/dmapper/DomainMapper.cxx  |2 -
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |4 +-
 3 files changed, 24 insertions(+), 10 deletions(-)

New commits:
commit e2a49e43bf7258146202a4a177c3a91d24801c12
Author: Justin Luth 
AuthorDate: Sat Feb 8 20:00:38 2025 -0500
Commit: Xisco Fauli 
CommitDate: Mon Feb 10 16:57:48 2025 +0100

tdf#164876 tdf#165117 writerfilter: no dummy paragraphs in header

The problem was that an extra CR was being added
(often every round-trip) to headers that started with a table.

This is a long-standing bug (see moz1211781-1.docx)
that got more exposure recently from changes to
7.6.6 (via 86ad08f9d25110e91e92a0badf6de75e785b3644)
and 24.8.0 (via ef77086255821d61838a7e26fee9baadaca0b9e0)

make CppunitTest_sw_ooxmlexport21 CPPUNIT_TEST_NAME=testTdf161631

Change-Id: Idb6a0efda246fa064822f01a9ce097f686810b5c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181307
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit 44eda1f72b4d67b9627155741067d3e57a1f9747)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181354
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index 207568ee8b76..5ba9a7f02ff2 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -40,15 +40,29 @@ public:
 }
 };
 
-DECLARE_OOXMLEXPORT_TEST(testTdf161631, "tdf161631.docx")
+CPPUNIT_TEST_FIXTURE(Test, testTdf161631)
 {
-CPPUNIT_ASSERT_EQUAL(1, getPages());
-CPPUNIT_ASSERT_EQUAL(1, getParagraphs());
+auto verify = [this](bool bIsExport = false) {
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+CPPUNIT_ASSERT_EQUAL(1, getParagraphs());
+
+// Without the fix in place, this test would have failed with
+// - Expected : Some text
+// - Actual:
+CPPUNIT_ASSERT_EQUAL(u"Some text"_ustr, getParagraph(1)->getString());
+
+if (bIsExport)
+{
+// tdf#164876 tdf#165117: don't add an empty paragraph every 
round-trip
+xmlDocUniquePtr pXmlDoc1 = parseExport(u"word/footer2.xml"_ustr);
+assertXPath(pXmlDoc1, "/w:ftr/w:p", 1);
+}
+};
 
-// Without the fix in place, this test would have failed with
-// - Expected: Some text
-// - Actual  :
-CPPUNIT_ASSERT_EQUAL(u"Some text"_ustr, getParagraph(1)->getString());
+createSwDoc("tdf161631.docx");
+verify();
+saveAndReload(mpFilter);
+verify(/*bIsExport*/ true);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTdf158597, "tdf158597.docx")
diff --git a/sw/source/writerfilter/dmapper/DomainMapper.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper.cxx
index c5fde2a1ab4e..c743f19aa542 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper.cxx
@@ -1501,7 +1501,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
 if (m_pImpl->m_StreamStateStack.top().nTableDepth == 0
 && m_pImpl->GetIsFirstParagraphInSection()
 && !m_pImpl->GetIsDummyParaAddedForTableInSection() && 
!m_pImpl->GetIsTextFrameInserted()
-&& !m_pImpl->GetIsPreviousParagraphFramed() && 
!IsInHeaderFooter())
+&& !m_pImpl->GetIsPreviousParagraphFramed())
 {
 m_pImpl->AddDummyParaForTableInSection();
 }
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index efe48d107dfe..a45e7374827e 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -689,8 +689,8 @@ void DomainMapper_Impl::RemoveDummyParaForTableInSection()
 }
 void DomainMapper_Impl::AddDummyParaForTableInSection()
 {
-// Shapes and textboxes can't have sections.
-if (IsInShape() || m_StreamStateStack.top().bIsInTextBox)
+// Shapes, headers, and textboxes can't have sections.
+if (IsInShape() || IsInHeaderFooter() || 
m_StreamStateStack.top().bIsInTextBox)
 return;
 
 if (!m_aTextAppendStack.empty())


core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-02-07 Thread Oliver Specht (via logerrit)
 sw/qa/extras/rtfimport/data/read-only-protect.rtf |  214 ++
 sw/qa/extras/rtfimport/rtfimport.cxx  |8 
 sw/source/writerfilter/rtftok/rtfdispatchflag.cxx |   10 +
 3 files changed, 232 insertions(+)

New commits:
commit 4d21c1cc64c8dca5056d6334f0d1bf425b1b70a6
Author: Oliver Specht 
AuthorDate: Mon Jan 6 12:37:30 2025 +0100
Commit: Christian Lohmaier 
CommitDate: Fri Feb 7 13:07:59 2025 +0100

tdf#153192 support read protection in RTF documents

The keyword  eadprot sets the document to read-only mode.

Change-Id: Idef47e9f93d3891d491cada18a9646b9f1b56cb4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179826
Tested-by: Jenkins
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 
(cherry picked from commit d723103ff8404ddadb3314dd3b67439602799d6c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181151
Reviewed-by: Xisco Fauli 
Reviewed-by: Christian Lohmaier 

diff --git a/sw/qa/extras/rtfimport/data/read-only-protect.rtf 
b/sw/qa/extras/rtfimport/data/read-only-protect.rtf
new file mode 100644
index ..e3744fcab2a6
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/read-only-protect.rtf
@@ -0,0 +1,214 @@
+{ 
tf1deflang1025nsinsicpg1250\uc1deff31507\deff0\stshfdbch31506\stshfloch31506\stshfhich31506\stshfbi31507\deflang1038\deflangfe1038
   hemelang1038hemelangfe0 hemelangcs0{onttbl{0bidi roman
charset0prq2{\*\panose 02020603050405020304}Times New Roman{\*alt Arial};}
+{0bidi romancharset0prq2{\*\panose 02020603050405020304}Times New 
Roman{\*alt Arial};}{39bidi swisscharset0prq2{\*\panose 
020f0502020204030204}Calibri;}
+{lomajor31500bidi romancharset0prq2{\*\panose 02020603050405020304}Times 
New Roman{\*alt Arial};}{dbmajor31501bidi romancharset0prq2{\*\panose 
02020603050405020304}Times New Roman{\*alt Arial};}
+{himajor31502bidi swisscharset0prq2{\*\panose 
020f0302020204030204}Calibri Light;}{bimajor31503bidi romancharset0
prq2{\*\panose 02020603050405020304}Times New Roman{\*alt Arial};}
+{lominor31504bidi romancharset0prq2{\*\panose 02020603050405020304}Times 
New Roman{\*alt Arial};}{dbminor31505bidi romancharset0prq2{\*\panose 
02020603050405020304}Times New Roman{\*alt Arial};}
+{himinor31506bidi swisscharset0prq2{\*\panose 
020f0502020204030204}Calibri;}{biminor31507bidi romancharset0
prq2{\*\panose 02020603050405020304}Times New Roman{\*alt Arial};}
+{364bidi romancharset238prq2 Times New Roman CE{\*alt Arial};}{365bidi 
romancharset204prq2 Times New Roman Cyr{\*alt Arial};}{367bidi roman
charset161prq2 Times New Roman Greek{\*alt Arial};}
+{368bidi romancharset162prq2 Times New Roman Tur{\*alt Arial};}{369
bidi romancharset177prq2 Times New Roman (Hebrew){\*alt Arial};}{370bidi 
romancharset178prq2 Times New Roman (Arabic){\*alt Arial};}
+{371bidi romancharset186prq2 Times New Roman Baltic{\*alt Arial};}{372
bidi romancharset163prq2 Times New Roman (Vietnamese){\*alt Arial};}{364
bidi romancharset238prq2 Times New Roman CE{\*alt Arial};}
+{365bidi romancharset204prq2 Times New Roman Cyr{\*alt Arial};}{367
bidi romancharset161prq2 Times New Roman Greek{\*alt Arial};}{368bidi 
romancharset162prq2 Times New Roman Tur{\*alt Arial};}
+{369bidi romancharset177prq2 Times New Roman (Hebrew){\*alt Arial};}{
370bidi romancharset178prq2 Times New Roman (Arabic){\*alt Arial};}{371
bidi romancharset186prq2 Times New Roman Baltic{\*alt Arial};}
+{372bidi romancharset163prq2 Times New Roman (Vietnamese){\*alt 
Arial};}{754bidi swisscharset238prq2 Calibri CE;}{755bidi swiss
charset204prq2 Calibri Cyr;}{757bidi swisscharset161prq2 Calibri Greek;}
+{758bidi swisscharset162prq2 Calibri Tur;}{759bidi swisscharset177
prq2 Calibri (Hebrew);}{760bidi swisscharset178prq2 Calibri (Arabic);}{
761bidi swisscharset186prq2 Calibri Baltic;}
+{762bidi swisscharset163prq2 Calibri (Vietnamese);}{lomajor31508bidi 
romancharset238prq2 Times New Roman CE{\*alt Arial};}{lomajor31509bidi 
romancharset204prq2 Times New Roman Cyr{\*alt Arial};}
+{lomajor31511bidi romancharset161prq2 Times New Roman Greek{\*alt 
Arial};}{lomajor31512bidi romancharset162prq2 Times New Roman Tur{\*alt 
Arial};}
+{lomajor31513bidi romancharset177prq2 Times New Roman (Hebrew){\*alt 
Arial};}{lomajor31514bidi romancharset178prq2 Times New Roman (Arabic){\*
alt Arial};}
+{lomajor31515bidi romancharset186prq2 Times New Roman Baltic{\*alt 
Arial};}{lomajor31516bidi romancharset163prq2 Times New Roman 
(Vietnamese){\*alt Arial};}
+{dbmajor31518bidi romancharset238prq2 Times New Roman CE{\*alt 
Arial};}{dbmajor31519bidi romancharset204prq2 Times New Roman Cyr{\*alt 
Arial};}
+{dbmajor31521bidi romancharset161prq2 Times New Roman Greek{\*alt 
Arial};}

core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-02-05 Thread László Németh (via logerrit)
 sw/qa/extras/odfexport/odfexport2.cxx |   21 +
 sw/source/core/docnode/section.cxx|   13 +
 2 files changed, 34 insertions(+)

New commits:
commit 250e46d37c43d290f2830e1d2f35dfd9921f61a6
Author: László Németh 
AuthorDate: Thu Jan 23 12:58:15 2025 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Thu Feb 6 06:32:51 2025 +0100

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 2f135fa82c5d78ddafc14f38c0ee33358075b266
"tdf#121119 master docs at-page anchor: fix missing images"
and commit fb4197ed81765e122b862471e184fcade4a2b524
"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 
Tested-by: Jenkins
(cherry picked from commit 47d596688f2dcdf67fab24e58d92f823e69c0c35)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180826
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/qa/extras/odfexport/odfexport2.cxx 
b/sw/qa/extras/odfexport/odfexport2.cxx
index 70e8e9bfa70d..39659ff96ef0 100644
--- a/sw/qa/extras/odfexport/odfexport2.cxx
+++ b/sw/qa/extras/odfexport/odfexport2.cxx
@@ -1788,6 +1788,27 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf121119)
 CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xIndexAccess2->getCount());
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf121119_runtime_update)
+{
+createSwGlobalDoc("tdf121119.odm");
+SwDoc* pDoc = getSwDoc();
+CPPUNIT_ASSERT_EQUAL(
+size_t(2), 
pDoc->getIDocumentLinksAdministration().GetLinkManager().GetLinks().size());
+
pDoc->getIDocumentLinksAdministration().GetLinkManager().UpdateAllLinks(false, 
false, nullptr,
+
u""_ustr);
+// double update of the links
+
pDoc->getIDocumentLinksAdministration().GetLinkManager().UpdateAllLinks(false, 
false, nullptr,
+
u""_ustr);
+
+uno::Reference 
xTextGraphicObjectsSupplier(mxComponent,
+   
   uno::UNO_QUERY);
+uno::Reference xIndexAccess(
+xTextGraphicObjectsSupplier->getGraphicObjects(), uno::UNO_QUERY);
+
+// This was 8 (duplicated images anchored at page)
+CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xIndexAccess->getCount());
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testTdf163703)
 {
 // Given a document with italics autostyle in a comment
diff --git a/sw/source/core/docnode/section.cxx 
b/sw/source/core/docnode/section.cxx
index fe244e79b734..84bf46e9fbad 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -1235,6 +1235,19 @@ static void lcl_UpdateLinksInSect( const SwBaseLink& 
rUpdLnk, SwSectionNode& rSe
 }
 else if( pSrcDoc != pDoc )
 {
+// before update, remove obsolete page-anchored flys from 
the target master document
+auto pFormats = pDoc->GetSpzFrameFormats();
+for( sal_uInt16 nCnt = pFormats->size(); nCnt; )
+{
+SwFrameFormat* pFormat = (*pFormats)[ --nCnt ];
+SwFormatAnchor aAnchor( pFormat->GetAnchor() );
+if ( RndStdIds::FLY_AT_PAGE == aAnchor.GetAnchorId() &&
+pFormat->GetName().indexOf(sFileName) > -1 )
+{
+pDoc->getIDocumentLayoutAccess().DelLayoutFormat( 
pFormat );
+}
+}
+
 // store page count of the source document to calculate
 // the physical page number of the objects anchored at page
 const SwDocStat& rDStat = 
pSrcDoc->getIDocumentStatistics().GetDocStat();


core.git: Branch 'libreoffice-25-2' - sw/qa sw/source xmloff/source

2025-02-05 Thread László Németh (via logerrit)
 sw/qa/extras/odfexport/data/DUMMY2.odt|binary
 sw/qa/extras/odfexport/data/DUMMY2B.odt   |binary
 sw/qa/extras/odfexport/data/tdf121119.odm |binary
 sw/qa/extras/odfexport/odfexport2.cxx |   35 ++
 sw/source/core/docnode/section.cxx|4 +++
 xmloff/source/text/txtparae.cxx   |   15 
 6 files changed, 54 insertions(+)

New commits:
commit d32f6ecb3973064dbe26e40722f5d1f01d046907
Author: László Németh 
AuthorDate: Thu Jan 23 12:08:04 2025 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Thu Feb 6 06:32:21 2025 +0100

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 2f135fa82c5d78ddafc14f38c0ee33358075b266
"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 
(cherry picked from commit fb4197ed81765e122b862471e184fcade4a2b524)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180825
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/qa/extras/odfexport/data/DUMMY2.odt 
b/sw/qa/extras/odfexport/data/DUMMY2.odt
new file mode 100644
index ..9e616cc80767
Binary files /dev/null and b/sw/qa/extras/odfexport/data/DUMMY2.odt differ
diff --git a/sw/qa/extras/odfexport/data/DUMMY2B.odt 
b/sw/qa/extras/odfexport/data/DUMMY2B.odt
new file mode 100644
index ..92d6c15c51f1
Binary files /dev/null and b/sw/qa/extras/odfexport/data/DUMMY2B.odt differ
diff --git a/sw/qa/extras/odfexport/data/tdf121119.odm 
b/sw/qa/extras/odfexport/data/tdf121119.odm
new file mode 100644
index ..ea7784a20058
Binary files /dev/null and b/sw/qa/extras/odfexport/data/tdf121119.odm differ
diff --git a/sw/qa/extras/odfexport/odfexport2.cxx 
b/sw/qa/extras/odfexport/odfexport2.cxx
index 2dcac38ae108..70e8e9bfa70d 100644
--- a/sw/qa/extras/odfexport/odfexport2.cxx
+++ b/sw/qa/extras/odfexport/odfexport2.cxx
@@ -42,6 +42,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 namespace
 {
@@ -1753,6 +1755,39 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf159027)
 CPPUNIT_ASSERT_EQUAL(u"6"_ustr, xCellE9->getString());
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf121119)
+{
+createSwGlobalDoc("tdf121119.odm");
+SwDoc* pDoc = getSwDoc();
+CPPUNIT_ASSERT_EQUAL(
+size_t(2), 
pDoc->getIDocumentLinksAdministration().GetLinkManager().GetLinks().size());
+
pDoc->getIDocumentLinksAdministration().GetLinkManager().UpdateAllLinks(false, 
false, nullptr,
+
u""_ustr);
+
+uno::Reference 
xTextGraphicObjectsSupplier(mxComponent,
+   
   uno::UNO_QUERY);
+uno::Reference xIndexAccess(
+xTextGraphicObjectsSupplier->getGraphicObjects(), uno::UNO_QUERY);
+
+CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xIndexAccess->getCount());
+
+saveAndReload(u"writerglobal8_writer"_ustr);
+pDoc = getSwDoc();
+
+CPPUNIT_ASSERT_EQUAL(
+size_t(2), 
pDoc->getIDocumentLinksAdministration().GetLinkManager().GetLinks().size());
+
pDoc->getIDocumentLinksAdministration().GetLinkManager().UpdateAllLinks(false, 
false, nullptr,
+
u""_ustr);
+
+uno::Reference 
xTextGraphicObjectsSupplier2(mxComponent,
+   
   uno::UNO_QUERY);
+uno::Reference xIndexAccess2(
+xTextGraphicObjectsSupplier2->getGraphicObjects(), uno::UNO_QUERY);
+
+// This was 8 (duplicated images anchored at page)
+CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xIndexAccess2->getCount());
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testTdf163703)
 {
 // Given a document with italics autostyle in a comment
diff --git a/sw/source/core/docnode/section.cxx 
b/sw/source/core/docnode/section.cxx
index f64029494cfb..fe244e79b734 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -1245,6 +1245,10 @@ static void lcl_UpdateLinksInSect( const SwBaseLink& 
rUpdLnk, SwSectionNode& rSe
 sal_uInt32 nPrevPages = 0;
 for( sw::SpzFrameFormat* pCpyFormat: *pSrcFormats)
 {
+// add file name of the source document to the name of 
the copied object
+// Note: used for the recognition of the copied 
objects anchored at page
+pCpyFormat->SetFormatName( pCpyFormat->GetName() + " 
(" + sFileName + ")" );
+
 SwFormatAnchor aAnchor( pCpyFormat->GetAnchor() 

core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-02-04 Thread László Németh (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf164901.docx|binary
 sw/qa/extras/ooxmlexport/ooxmlexport20.cxx  |9 +
 sw/source/writerfilter/dmapper/DomainMapper.cxx |6 +-
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 4d98e46b7b22f6b2f048273890410f0579fe052c
Author: László Németh 
AuthorDate: Wed Jan 29 23:36:14 2025 +0100
Commit: Xisco Fauli 
CommitDate: Tue Feb 4 16:45:32 2025 +0100

tdf#164901 sw inline heading: fix lost floating tables

Style separators inside floating tables resulted losing of
the floating tables. In this case, don't handle style separators,
as before commit 56588663a0fddc005c12afaa7d3f8874d036875f.

Regression since commit 56588663a0fddc005c12afaa7d3f8874d036875f
"tdf#131728 sw inline heading: fix DOCX paragraph layout interoperability".

Change-Id: I30b6683b2312636405960efc65b5af2b6b4dbfa3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180925
Reviewed-by: László Németh 
Tested-by: Jenkins
(cherry picked from commit f1bbce4068828f3d1240afd50b228d820c17e848)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180941
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf164901.docx 
b/sw/qa/extras/ooxmlexport/data/tdf164901.docx
new file mode 100644
index ..9035c53cf476
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf164901.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx
index c418c1904197..fc4640425f88 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx
@@ -274,6 +274,15 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf48459)
 assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:pPr/w:rPr/w:specVanish", 1);
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf164901)
+{
+loadAndSave("tdf164901.docx");
+xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr);
+
+// This was 0 (lost floating table because of containing a style separator)
+assertXPath(pXmlDoc, "/w:document/w:body/w:tbl", 1);
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testFdo77129)
 {
 loadAndSave("fdo77129.docx");
diff --git a/sw/source/writerfilter/dmapper/DomainMapper.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper.cxx
index 03a5b22b4afb..c5fde2a1ab4e 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper.cxx
@@ -2139,7 +2139,11 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
 }
 break;
 case NS_ooxml::LN_EG_RPrBase_specVanish:
-if ( nIntValue && !IsStyleSheetImport() )
+// tdf#131728 import inline heading
+if ( nIntValue && !IsStyleSheetImport() &&
+// tdf#164901 but not in a floating table
+!(m_pImpl->hasTableManager() &&
+
m_pImpl->getTableManager().getCurrentTablePosition().getLength() != 0) )
 {
 // put inline heading inside a text frame to get the same layout 
with ToC/PDF bookmark support
 m_pImpl->m_StreamStateStack.top().bIsInlineParagraph = true;


core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-02-04 Thread Miklos Vajna (via logerrit)
 sw/qa/writerfilter/dmapper/DomainMapper.cxx |   25 
 sw/qa/writerfilter/dmapper/data/font-family.rtf |   12 +++
 sw/source/writerfilter/dmapper/DomainMapper.cxx |2 -
 3 files changed, 38 insertions(+), 1 deletion(-)

New commits:
commit c2c39d4c46c3ae9416c1772bf4f0a3865b77c817
Author: Miklos Vajna 
AuthorDate: Thu Jan 30 10:18:46 2025 +0100
Commit: Xisco Fauli 
CommitDate: Tue Feb 4 15:33:44 2025 +0100

tdf#164904 RTF import: fix unexpected CharFontFamily

Open the RTF in Word, the font fallback is serif, open in Writer, our
fallback is sans.

roman is not parsed by the RTF import, but the default font family was
ROMAN and that worked in the past.

Fix the problem by only setting the property in case the tokenizer has a
value for it, there is a difference between not setting it vs setting it
to "don't know".

Regression from commit d06de2e049761b7b9e8a95f17557d309812f7acc
(Related: tdf#162072 DOCX import: handle font family for characters,
2024-07-19).

Change-Id: I4253ac7e27fab7d3e8e61c43659589b4fc177d6c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180934
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit 7af540ddeb42a3a733f258a77e17c7ebb16d4571)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180936
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/writerfilter/dmapper/DomainMapper.cxx 
b/sw/qa/writerfilter/dmapper/DomainMapper.cxx
index c9a44648d660..3f6dbc0072fb 100644
--- a/sw/qa/writerfilter/dmapper/DomainMapper.cxx
+++ b/sw/qa/writerfilter/dmapper/DomainMapper.cxx
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -224,6 +225,30 @@ CPPUNIT_TEST_FIXTURE(Test, testRTFStylePaste)
 // was imported, even if no pasted content referenced it.
 CPPUNIT_ASSERT(!xStyleFamily->hasByName(u"Default Drawing Style"_ustr));
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testRTFFontFamily)
+{
+// Given an RTF file with a 'Times New (W1)' font:
+loadFromFile(u"font-family.rtf");
+
+// When checking the font family:
+uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xParaEnumAccess(xTextDocument->getText(),
+  
uno::UNO_QUERY);
+uno::Reference xParaEnum = 
xParaEnumAccess->createEnumeration();
+uno::Reference 
xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
+uno::Reference xPortionEnum = 
xPara->createEnumeration();
+uno::Reference xPortion(xPortionEnum->nextElement(), 
uno::UNO_QUERY);
+sal_Int16 eFamily{};
+xPortion->getPropertyValue(u"CharFontFamily"_ustr) >>= eFamily;
+
+// Then make sure it's roman:
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 3 (ROMAN)
+// - Actual  : 0 (DONTKNOW)
+// i.e. the final result was a sans fallback instead of a serif fallback.
+CPPUNIT_ASSERT_EQUAL(awt::FontFamily::ROMAN, eFamily);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/writerfilter/dmapper/data/font-family.rtf 
b/sw/qa/writerfilter/dmapper/data/font-family.rtf
new file mode 100644
index ..b776df8ac5cd
--- /dev/null
+++ b/sw/qa/writerfilter/dmapper/data/font-family.rtf
@@ -0,0 +1,12 @@
+{ tf1
+{onttbl
+{42bidi romancharset0prq2
+Times New (W1)
+{\*alt Times New Roman}
+;}
+}
+\paperw11906\paperh16838\margl1440\margr1440\margt1440\margb1440
+\pard\plain
+42 Lorem ipsum
+\par
+}
diff --git a/sw/source/writerfilter/dmapper/DomainMapper.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper.cxx
index 86e785a0dd4c..03a5b22b4afb 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper.cxx
@@ -430,7 +430,7 @@ void DomainMapper::lcl_attribute(Id nName, const Value & 
val)
 
 // Set the matching font family if we have one.
 FontEntry::Pointer_t pFontEntry = 
m_pImpl->GetFontTable()->getFontEntryByName(sStringValue);
-if (pFontEntry)
+if (pFontEntry && pFontEntry->m_nFontFamily != 
awt::FontFamily::DONTKNOW)
 {
 m_pImpl->GetTopContext()->Insert(PROP_CHAR_FONT_FAMILY,
  
uno::Any(pFontEntry->m_nFontFamily));


core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-02-04 Thread Oliver Specht (via logerrit)
 sw/qa/extras/uiwriter/data/tdf163340_2.odt  |binary
 sw/qa/extras/uiwriter/uiwriter9.cxx |   27 
 sw/source/core/doc/DocumentContentOperationsManager.cxx |6 +--
 3 files changed, 30 insertions(+), 3 deletions(-)

New commits:
commit 917064244308e6f5e08a5a85fa7cbb58a6ec1594
Author: Oliver Specht 
AuthorDate: Tue Jan 21 09:25:21 2025 +0100
Commit: Xisco Fauli 
CommitDate: Tue Feb 4 14:15:58 2025 +0100

tdf#163340 fixes regression

Pasting a single paragraph with a list into an empty paragraph
with a different list should keep that target list and not apply
the source list.

Change-Id: Ife81aa9553bb2396082d23cc86336ad773b83a16
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180536
Reviewed-by: Gabor Kelemen 
Tested-by: Gabor Kelemen 
Tested-by: Jenkins
(cherry picked from commit 875bb514b9d50bae02c2999f3be071e654c0d10d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180854
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/uiwriter/data/tdf163340_2.odt 
b/sw/qa/extras/uiwriter/data/tdf163340_2.odt
new file mode 100644
index ..c58a181a0846
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf163340_2.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx 
b/sw/qa/extras/uiwriter/uiwriter9.cxx
index 375752f3d807..559cd7619188 100644
--- a/sw/qa/extras/uiwriter/uiwriter9.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter9.cxx
@@ -929,6 +929,33 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf163340)
 CPPUNIT_ASSERT_EQUAL(u"A."_ustr, getProperty(xParaCursor, 
u"ListLabelString"_ustr));
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf163340_2)
+{
+//selects and copies a single paragraph with a list (bullets)
+//and pastes it into an empty paragraph with a different list (numbers)
+//checks that the resulting paragraph keeps that different list
+createSwDoc("tdf163340_2.odt");
+uno::Reference xModel(mxComponent, uno::UNO_QUERY);
+uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xText = xTextDocument->getText();
+uno::Reference 
xSelSupplier(xModel->getCurrentController(),
+  
uno::UNO_QUERY_THROW);
+uno::Reference 
xParaCursor(xTextDocument->getText()->createTextCursor(),
+   uno::UNO_QUERY);
+
+for (int i = 0; i < 2; i++)
+xParaCursor->gotoNextParagraph(false);
+xParaCursor->gotoEndOfParagraph(true);
+xSelSupplier->select(uno::Any(xParaCursor));
+
+xParaCursor = 
uno::Reference(xText->createTextCursor(), 
uno::UNO_QUERY);
+for (int i = 0; i < 10; i++)
+xParaCursor->gotoNextParagraph(false);
+xParaCursor->gotoEndOfParagraph(true);
+dispatchCommand(mxComponent, u".uno:Paste"_ustr, {});
+CPPUNIT_ASSERT_EQUAL(u"5."_ustr, getProperty(xParaCursor, 
u"ListLabelString"_ustr));
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf159023)
 {
 createSwDoc();
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index d8119d2f8889..8f0302b7f101 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -491,9 +491,9 @@ namespace
 if (pTextNd == nullptr || pEndTextNd == nullptr)
 return false;
 bool bRet = pTextNd->IsInListFromStyle();
-//prefer list if it's a single paragraph with list from style
-if (pTextNd == pEndTextNd && bRet)
-return true;
+//single paragraphs are preferred only if it's a has a list from style
+if (pTextNd == pEndTextNd)
+return bRet;
 
 if (pTextNd && pTextNd->IsInList() && !pTextNd->IsInListFromStyle() &&
  pEndTextNd && pEndTextNd->IsInList() && 
!pEndTextNd->IsInListFromStyle())


core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-01-31 Thread Michael Stahl (via logerrit)
 sw/qa/extras/uiwriter/uiwriter9.cxx |   33 
 sw/source/core/doc/DocumentContentOperationsManager.cxx |6 +-
 2 files changed, 37 insertions(+), 2 deletions(-)

New commits:
commit 5468c6d32911dc68dc31b4c608d6eb9097f59b1f
Author: Michael Stahl 
AuthorDate: Thu Jan 30 15:06:34 2025 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Fri Jan 31 11:27:20 2025 +0100

(tdf#159377 related) sw: fix undo of table pasted in middle of paragraph

The problem is that the !bCanMoveBack path doesn't work if the insert
position's content index isn't 0.

(regression from commit fcd4222d36e1864452163e5c94976eea353bbaf0)

Change-Id: I746db2187ab8f2e24eb694dc94d7eea9f50e2d9f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180948
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 3227660e55416254463234f35a43268b9b4c2c9e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180959
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx 
b/sw/qa/extras/uiwriter/uiwriter9.cxx
index 604a6075dbbb..375752f3d807 100644
--- a/sw/qa/extras/uiwriter/uiwriter9.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter9.cxx
@@ -159,6 +159,39 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf159377)
 CPPUNIT_ASSERT_EQUAL(SwNodeOffset(28), pDoc->GetNodes().Count());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testPasteTableInMiddleOfParagraph)
+{
+createSwDoc();
+
+SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+
+SwInsertTableOptions aTableOptions(SwInsertTableFlags::DefaultBorder, 0);
+pWrtShell->InsertTable(aTableOptions, /*nRows=*/2, /*nCols=*/2);
+pWrtShell->MoveTable(GotoPrevTable, fnTableStart);
+
+dispatchCommand(mxComponent, u".uno:SelectTable"_ustr, {});
+dispatchCommand(mxComponent, u".uno:Copy"_ustr, {});
+
+pWrtShell->Undo();
+
+pWrtShell->Insert(u"AB"_ustr);
+
+pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, 
/*bBasicCall=*/false);
+
+dispatchCommand(mxComponent, u".uno:Paste"_ustr, {});
+
+pWrtShell->Undo();
+
+// the problem was that the A was missing
+CPPUNIT_ASSERT_EQUAL(OUString("AB"),
+ 
pWrtShell->GetCursor()->GetPointNode().GetTextNode()->GetText());
+
+pWrtShell->Redo();
+pWrtShell->Undo();
+CPPUNIT_ASSERT_EQUAL(OUString("AB"),
+ 
pWrtShell->GetCursor()->GetPointNode().GetTextNode()->GetText());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf111969)
 {
 // given a document with a field surrounded by N-dashes (–date–)
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 2fb761669f67..d8119d2f8889 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -5153,7 +5153,9 @@ bool 
DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
 // Note this doesn't just check IsStartNode() because SwDoc::AppendDoc()
 // intentionally sets it to the body start node, perhaps it should just
 // call SplitNode instead?
-if (!pStt->GetNode().IsSectionNode() && !pStt->GetNode().IsTableNode())
+if ((!pStt->GetNode().IsSectionNode() && !pStt->GetNode().IsTableNode())
+|| (pCopyPam->GetPoint()->GetContentIndex() != 0 // also if node will 
split
+&& pCopyPam->GetPoint()->GetContentIndex() != 
pCopyPam->GetPoint()->GetNode().GetContentNode()->Len()))
 {
 bCanMoveBack = pCopyPam->Move(fnMoveBackward, GoInContent);
 }
@@ -5347,7 +5349,7 @@ bool 
DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
 --aRg.aEnd;
 }
 }
-assert(!bCanMoveBack);
+assert((nDeleteTextNodes.get() != 0) == bCanMoveBack);
 }
 
 pDestTextNd = aInsPos.GetNode().GetTextNode();


core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-01-31 Thread Michael Stahl (via logerrit)
 sw/qa/extras/uiwriter/uiwriter9.cxx |   41 
 sw/source/core/doc/DocumentContentOperationsManager.cxx |5 -
 sw/source/core/undo/untblk.cxx  |4 -
 3 files changed, 41 insertions(+), 9 deletions(-)

New commits:
commit 4c0b1c359458976b6e96625e9cca13ff9d34a917
Author: Michael Stahl 
AuthorDate: Thu Jan 30 14:47:01 2025 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Fri Jan 31 11:26:49 2025 +0100

tdf#159377 sw: fix undo of paste table into footnote

Tables aren't allowed in footnotes, hence pasting a table into a
footnote will paste only the text nodes in the cells but not the table
nodes.

This code isn't prepared for this situation, so the adjustment of the
position doesn't happen.

if (pCopyPam->GetPoint()->GetNode().IsStartNode())
pCopyPam->GetPoint()->Adjust(SwNodeOffset(-1));

But then the corresponding adjustment in SwUndoInserts::SetInsertRange()
does happen and the stored start node index is wrong.

It looks like both of these adjustments can simply be removed.

(regression from commit fcd4222d36e1864452163e5c94976eea353bbaf0)

Change-Id: Ib419b29da552cf1df7150178924c45e3743cd7d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180947
Reviewed-by: Michael Stahl 
Tested-by: Jenkins
(cherry picked from commit 3bbbe366e455f1b165f2f913fffd27f3a0e03a2d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180957
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx 
b/sw/qa/extras/uiwriter/uiwriter9.cxx
index 66ef51e47102..604a6075dbbb 100644
--- a/sw/qa/extras/uiwriter/uiwriter9.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter9.cxx
@@ -118,6 +118,47 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf158785)
 CPPUNIT_ASSERT_EQUAL(IsAttrAtPos::NONE, aContentAtPos.eContentAtPos);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf159377)
+{
+createSwDoc();
+
+SwDoc* pDoc = getSwDoc();
+SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+
+SwInsertTableOptions aTableOptions(SwInsertTableFlags::DefaultBorder, 0);
+pWrtShell->InsertTable(aTableOptions, /*nRows=*/2, /*nCols=*/2);
+pWrtShell->MoveTable(GotoPrevTable, fnTableStart);
+
+dispatchCommand(mxComponent, u".uno:SelectTable"_ustr, {});
+dispatchCommand(mxComponent, u".uno:Copy"_ustr, {});
+
+pWrtShell->InsertFootnote(u""_ustr);
+CPPUNIT_ASSERT(pWrtShell->IsCursorInFootnote());
+
+CPPUNIT_ASSERT_EQUAL(SwNodeOffset(28), pDoc->GetNodes().Count());
+
+dispatchCommand(mxComponent, u".uno:Paste"_ustr, {});
+
+// this pasted the 4 text nodes in the table, but no table nodes
+// as currently tables aren't allowed in footnotes
+
+CPPUNIT_ASSERT_EQUAL(SwNodeOffset(32), pDoc->GetNodes().Count());
+
+pWrtShell->Undo();
+
+CPPUNIT_ASSERT(pWrtShell->IsCursorInFootnote());
+// problem was that this was 29 with an extra text node in the footnote
+CPPUNIT_ASSERT_EQUAL(SwNodeOffset(28), pDoc->GetNodes().Count());
+
+pWrtShell->Redo();
+
+CPPUNIT_ASSERT_EQUAL(SwNodeOffset(32), pDoc->GetNodes().Count());
+
+pWrtShell->Undo();
+
+CPPUNIT_ASSERT_EQUAL(SwNodeOffset(28), pDoc->GetNodes().Count());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf111969)
 {
 // given a document with a field surrounded by N-dashes (–date–)
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 6389c67c3a2c..2fb761669f67 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -5552,11 +5552,6 @@ bool 
DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
 {
 // Reset the offset to 0 as it was before the insertion
 pCopyPam->GetPoint()->Adjust(SwNodeOffset(+1));
-
-// If the next node is a start node, then step back: SetInsertRange()
-// will add 1 in this case, but that is too much...
-if (pCopyPam->GetPoint()->GetNode().IsStartNode())
-pCopyPam->GetPoint()->Adjust(SwNodeOffset(-1));
 }
 oInsContentIndex.reset();
 pCopyPam->Exchange();
diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx
index 55ae66b86fd9..8c5288aed0bd 100644
--- a/sw/source/core/undo/untblk.cxx
+++ b/sw/source/core/undo/untblk.cxx
@@ -129,10 +129,6 @@ void SwUndoInserts::SetInsertRange( const SwPaM& rPam, 
bool bScanFlys,
 m_nSttContent = pTmpPos->GetContentIndex();
 
 m_nDeleteTextNodes = nDeleteTextNodes;
-if (m_nDeleteTextNodes == SwNodeOffset(0)) // if a table selection is 
added...
-{
-++m_nSttNode; // ... then the CopyPam is not fully correct
-}
 }
 
 // Fill m_FlyUndos with flys anchored to first and last paragraphs


core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-01-24 Thread Jonathan Clark (via logerrit)
 sw/qa/extras/layout/data/tdf164803.fodt |  115 
 sw/qa/extras/layout/layout5.cxx |9 ++
 sw/source/core/text/inftxt.cxx  |   13 +++
 3 files changed, 135 insertions(+), 2 deletions(-)

New commits:
commit 57614c6d6c2b95cfac83c22e4ed4a55d439b5cf4
Author: Jonathan Clark 
AuthorDate: Thu Jan 23 09:04:10 2025 -0700
Commit: Michael Stahl 
CommitDate: Fri Jan 24 11:55:30 2025 +0100

tdf#164803 sw: Fix SwTextSizeInfo applying grid metrics without grid

Writer has two grid attributes: the document-level grid item, which
controls whether the grid is enabled; and a paragraph-level grid item,
which controls whether the document grid applies to the paragraph.

Previously, SwTextSizeInfo populated its snap-to-grid flag based only on
the paragraph-level attribute. Downstream code was expected to
double-check that the grid is actually enabled using the document-level
item. As shown by tdf#164803, this is error-prone.

Now, SwTextSizeInfo only sets the snap-to-grid flag when the grid is
enabled by both attributes.

Change-Id: I6528f653748de942f42da11e34ff340cb3db37e2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180676
Reviewed-by: Jonathan Clark 
Tested-by: Jenkins
(cherry picked from commit 43fc662520e5488cbeadd6eb60a24374a837dca4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180686
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/layout/data/tdf164803.fodt 
b/sw/qa/extras/layout/data/tdf164803.fodt
new file mode 100644
index ..7a4ef38d8d1b
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf164803.fodt
@@ -0,0 +1,115 @@
+
+http://www.w3.org/TR/css3-text/"; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xforms="http://www.w3.org/2002/xforms"; 
xmlns:dom="http://www.w3.org/2001/xml-events"; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:drawooo="http://openoffice.org/2010/draw"; 
xmlns:oooc="http://openoffice.org/2004/calc"; 
xmlns:dc="http://purl.org/dc/elements/1.1/"; xmlns:c
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table"; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report"; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office"; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:
 meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.4" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
2025-01-23T08:44:13.366544373LibreOfficeDev/25.8.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/b811b283c254fb48d8991576dfee0bae3dc322dd2025-01-23T08:58:37.879339983PT5M3S7
+ 
+  
+  
+  
+ 
+ 
+  
+   
+   
+
+   
+   
+  
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+  
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+  
+  
+  
+  
+  
+ 
+  
+   
+   
+  
+  
+   
+
+   
+   
+   
+  
+  
+   
+  
+ 
+ 
+  
+ 
+ 
+  
+   
+
+
+
+
+
+   
+   A A A A A A A A A A A A A A A A A A A A A A A 
A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A 
A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A 
A A A A A A A A A A A A A A A A A A A A A A A A A A A A 
A A A A A A A A A A A A
+  
+ 
+
\ No newline at end of file
diff --git a/sw/qa/extras/layout/layout5.cxx b

core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-01-22 Thread Miklos Vajna (via logerrit)
 sw/qa/writerfilter/dmapper/DomainMapperTableHandler.cxx   |   25 ++
 sw/qa/writerfilter/dmapper/data/floattable-nested-layout.docx |binary
 sw/source/writerfilter/dmapper/DomainMapperTableHandler.cxx   |3 -
 3 files changed, 27 insertions(+), 1 deletion(-)

New commits:
commit 62af1be5b58f69f10fb1aaa300a5106d2382a785
Author: Miklos Vajna 
AuthorDate: Tue Jan 21 08:19:57 2025 +0100
Commit: Xisco Fauli 
CommitDate: Wed Jan 22 13:20:54 2025 +0100

tdf#161001 sw floattable: require in-header/footer for non-follow-text-flow

Open the bugdoc, the in-body floating table has an inner floating table
which is rendered above the outer table, not inside it.

This went wrong in commit f74a6ef94ac957e4c146fc9923d30ce6bd31b5ce
(tdf#159453 sw floattable: fix unexpected overlap of in-header fly and
body text, 2024-02-13), where the use-case was an in-header floating
table interacting with body text.

The more general case is in-body floating tables interacting with
in-body text, so fix the problem by restricting the custom
IsFollowingTextFlow=false property for in-header floating tables.

Change-Id: I902f232e3c840ff0279d8ed6c2329ba48a03b4e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180534
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit 524c266f0f0a3cdccfa9feecfba2a19c9a29b701)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180545
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/writerfilter/dmapper/DomainMapperTableHandler.cxx 
b/sw/qa/writerfilter/dmapper/DomainMapperTableHandler.cxx
index fb090009c070..03c4727737b7 100644
--- a/sw/qa/writerfilter/dmapper/DomainMapperTableHandler.cxx
+++ b/sw/qa/writerfilter/dmapper/DomainMapperTableHandler.cxx
@@ -252,6 +252,31 @@ CPPUNIT_TEST_FIXTURE(Test, testTableStyleParaBorderSpacing)
 // i.e. the top and bottom border and its 1pt spacing was not set on the 
in-table paragraph.
 CPPUNIT_ASSERT_EQUAL(static_cast(35), nTopBorderDistance);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testDOCXFloatingTableNestedLayout)
+{
+// Given a floating table inside an outer table, both in body text:
+// When loading that document:
+loadFromFile(u"floattable-nested-layout.docx");
+
+// Then make sure the inner table stays inside the outer table:
+uno::Reference xModel(mxComponent, uno::UNO_QUERY);
+css::uno::Reference xDumper(xModel->getCurrentController(), 
uno::UNO_QUERY);
+OString aDump = xDumper->dump(u"layout"_ustr).toUtf8();
+auto pCharBuffer = reinterpret_cast(aDump.getStr());
+xmlDocUniquePtr pXmlDoc(xmlParseDoc(pCharBuffer));
+sal_Int32 nFlyTop = getXPath(pXmlDoc, "//fly/infos/bounds", 
"top").toInt32();
+sal_Int32 nFlyBottom = getXPath(pXmlDoc, "//fly/infos/bounds", 
"bottom").toInt32();
+sal_Int32 nTableTop = getXPath(pXmlDoc, "//page[1]/body/tab/infos/bounds", 
"top").toInt32();
+sal_Int32 nTableBottom
+= getXPath(pXmlDoc, "//page[1]/body/tab/infos/bounds", 
"bottom").toInt32();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected greater than: 1839
+// - Actual  : 360
+// i.e. the floating table was outside the outer table.
+CPPUNIT_ASSERT_GREATER(nTableTop, nFlyTop);
+CPPUNIT_ASSERT_LESS(nTableBottom, nFlyBottom);
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/qa/writerfilter/dmapper/data/floattable-nested-layout.docx 
b/sw/qa/writerfilter/dmapper/data/floattable-nested-layout.docx
new file mode 100644
index ..d17a97969f4c
Binary files /dev/null and 
b/sw/qa/writerfilter/dmapper/data/floattable-nested-layout.docx differ
diff --git a/sw/source/writerfilter/dmapper/DomainMapperTableHandler.cxx 
b/sw/source/writerfilter/dmapper/DomainMapperTableHandler.cxx
index 58658ba927c8..ad8db564e13c 100644
--- a/sw/source/writerfilter/dmapper/DomainMapperTableHandler.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapperTableHandler.cxx
@@ -1634,7 +1634,8 @@ void DomainMapperTableHandler::endTable(unsigned int 
nestedTableLevel)
 if (it != aFrameProperties.end())
 {
 it->Value >>= nVertOrientRelation;
-if (nVertOrientRelation == 
text::RelOrientation::PAGE_FRAME)
+bool bInHeaderFooter = m_rDMapper_Impl.IsInHeaderFooter();
+if (nVertOrientRelation == 
text::RelOrientation::PAGE_FRAME && bInHeaderFooter)
 {
 // If vertical relation is page, follow-text-flow is 
not useful and causes
 // unwanted wrap of body text around in-header 
floating table, so avoid it.


core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2025-01-22 Thread Michael Stahl (via logerrit)
 sw/qa/extras/uiwriter/data/placeholder-bold-style-override.fodt |  121 
++
 sw/qa/extras/uiwriter/uiwriter3.cxx |   57 
 sw/source/filter/html/swhtml.cxx|   25 +-
 3 files changed, 201 insertions(+), 2 deletions(-)

New commits:
commit 3efc4b353e671b833f6f2b40ce03fc8ecf03d4f9
Author: Michael Stahl 
AuthorDate: Fri Jan 17 14:56:13 2025 +0100
Commit: Xisco Fauli 
CommitDate: Wed Jan 22 13:19:41 2025 +0100

sw: HTML import: apply hard formatting at insert position ...

... even if the paragraph style contains the same item, but with a
different value.

Surprisingly, SfxItemSet::Differentiate() doesn't actually compare if
the items in the 2 sets have the same value, just that 2 items with the
same WhichId exist.

Also, apply paragraph attributes, except list and breaks and other ones.

(follow-up to commit f45d2fa85ba89eb7d71b51c3324f5938509b3201)

Change-Id: I1e11705f63c1f059e2f5baa658238f2d62f6c66c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180422
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit f8126c5d93f2807030da20e2de39f3c72c92e7d3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180506
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/uiwriter/data/placeholder-bold-style-override.fodt 
b/sw/qa/extras/uiwriter/data/placeholder-bold-style-override.fodt
new file mode 100644
index ..aed6e40f6648
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/placeholder-bold-style-override.fodt
@@ -0,0 +1,121 @@
+
+http://www.w3.org/TR/css3-text/"; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xforms="http://www.w3.org/2002/xforms"; 
xmlns:dom="http://www.w3.org/2001/xml-events"; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:drawooo="http://openoffice.org/2010/draw"; 
xmlns:oooc="http://openoffice.org/2004/calc"; 
xmlns:dc="http://purl.org/dc/elements/1.1/"; xmlns:c
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table"; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report"; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office"; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:
 meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
2024-08-08T18:32:28.4200828172024-08-08T18:33:51.021911316PT1M27S1ZetaOffice/7.4.8.0.0$Linux_X86_64
 
LibreOffice_project/ab7057b1137e2241f51e62b58a0c605ec9a4b29c
+ 
+  
+  
+  
+  
+  
+ 
+ 
+  
+   
+   
+
+   
+   
+  
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+  
+  
+  
+  
+  
+  
+
+  
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+  
+  
+  
+  
+ 
+ 
+  
+  
+  
+  
+  
+   
+
+   
+   
+   
+  
+ 
+ 
+  
+ 
+ 
+  
+   
+
+
+
+
+
+   
+   MEINPLATZHALTER
+  
+ 
+
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index d169f76dbe09..96ef31c0cc46 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -130,6 +131,62 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, 
testPlaceholderHTMLInser

core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2024-12-23 Thread Balazs Varga (via logerrit)
 sw/qa/core/accessibilitycheck/data/FakeCaptionTest.odt |binary
 sw/source/core/access/AccessibilityCheck.cxx   |2 +-
 2 files changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 25f8ae6ebd2a983d1c8f7c98842c30c03112f84c
Author: Balazs Varga 
AuthorDate: Fri Dec 20 14:46:24 2024 +0100
Commit: Xisco Fauli 
CommitDate: Mon Dec 23 11:00:24 2024 +0100

tdf#164383 - sw a11y fix unnecessary "Avoid simulated captions" warning

for caption frame.

We should not have "Avoid simulated captions" warning about correct 
captions.

Change-Id: I57fe53c5f9e1aa2affe0aec6520d1d6eed5d6990
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178927
Tested-by: Jenkins
Tested-by: Gabor Kelemen 
Reviewed-by: Balazs Varga 
(cherry picked from commit 78dbd341bb5023448af2c3eefceb5a840fd6d8d9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179199
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/core/accessibilitycheck/data/FakeCaptionTest.odt 
b/sw/qa/core/accessibilitycheck/data/FakeCaptionTest.odt
index 9630bfcf73d7..25c164d1626e 100644
Binary files a/sw/qa/core/accessibilitycheck/data/FakeCaptionTest.odt and 
b/sw/qa/core/accessibilitycheck/data/FakeCaptionTest.odt differ
diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 4f14066aee58..9434f5318fff 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -1977,7 +1977,7 @@ public:
 if (const SwNode* pStartFly = pCurrent->FindFlyStartNode())
 {
 const SwFrameFormat* pFormat = pStartFly->GetFlyFormat();
-if (!pFormat || pFormat->GetAnchor().GetAnchorId() != 
RndStdIds::FLY_AS_CHAR)
+if (pFormat)
 return;
 }
 


core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2024-12-20 Thread Balazs Varga (via logerrit)
 sw/qa/core/accessibilitycheck/data/AccessibilityTests1.odt |binary
 sw/source/core/access/AccessibilityCheck.cxx   |3 ++-
 2 files changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 46290af4bfe820944e27f86dbb6608a12ad70202
Author: Balazs Varga 
AuthorDate: Thu Dec 19 11:31:01 2024 +0100
Commit: Xisco Fauli 
CommitDate: Fri Dec 20 12:39:26 2024 +0100

tdf#164091 - sw fix Accessibility sidebar gives warning about decorative

marked shapes

We should not have warning about missing alternative text in case of
decorative marked shapes.

Change-Id: Ibac7f152886d7db004039eede9b657fa5e84ae87
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178795
Tested-by: Jenkins
Reviewed-by: Balazs Varga 
(cherry picked from commit 519282418137861144341da8b7a5759068104405)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178881
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/core/accessibilitycheck/data/AccessibilityTests1.odt 
b/sw/qa/core/accessibilitycheck/data/AccessibilityTests1.odt
index 405fd6647a08..e6dffec6225e 100644
Binary files a/sw/qa/core/accessibilitycheck/data/AccessibilityTests1.odt and 
b/sw/qa/core/accessibilitycheck/data/AccessibilityTests1.odt differ
diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 60c5d8c83534..4f14066aee58 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -2653,7 +2653,8 @@ void AccessibilityCheck::checkObject(SwNode* pCurrent, 
SdrObject* pObject)
 || nObjId == SdrObjKind::Media || nObjId == SdrObjKind::Group
 || nObjId == SdrObjKind::Graphic || nInv == SdrInventor::FmForm)
 {
-if (pObject->GetTitle().isEmpty() && 
pObject->GetDescription().isEmpty())
+if (!pObject->IsDecorative() && pObject->GetTitle().isEmpty()
+&& pObject->GetDescription().isEmpty())
 {
 const OUString& sName = pObject->GetName();
 OUString sIssueText = 
SwResId(STR_NO_ALT).replaceAll("%OBJECT_NAME%", sName);


core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2024-12-19 Thread Mike Kaganski (via logerrit)
 sw/qa/extras/htmlexport/data/link_with_target.fodt  |9 ++
 sw/qa/extras/htmlexport/data/tdf160867_image_with_link.fodt |4 +--
 sw/qa/extras/htmlexport/htmlexport2.cxx |   16 
 sw/source/filter/html/htmlatr.cxx   |   15 ++-
 sw/source/filter/html/htmlflywriter.cxx |7 +++--
 5 files changed, 40 insertions(+), 11 deletions(-)

New commits:
commit 300f70ec4b56b64f7b23aac0bdbe9cca978189b2
Author: Mike Kaganski 
AuthorDate: Tue Dec 10 16:03:40 2024 +0500
Commit: Xisco Fauli 
CommitDate: Thu Dec 19 11:32:33 2024 +0100

ReqIF: avoid 'target' attribute in 'a' elements

Change-Id: Iab34a18e2da766d30a2d6b5f5d8ed3855f3c8b8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178207
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit 46ce77dfffaa6445ed05e1400284f4f9491b9faf)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178556
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/htmlexport/data/link_with_target.fodt 
b/sw/qa/extras/htmlexport/data/link_with_target.fodt
new file mode 100644
index ..3be1cc31f120
--- /dev/null
+++ b/sw/qa/extras/htmlexport/data/link_with_target.fodt
@@ -0,0 +1,9 @@
+
+
+http://www.w3.org/1999/xlink"; 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
+  
+   http://www.example.org/"; 
office:target-frame-name="_blank">link
+  
+ 
+
\ No newline at end of file
diff --git a/sw/qa/extras/htmlexport/data/tdf160867_image_with_link.fodt 
b/sw/qa/extras/htmlexport/data/tdf160867_image_with_link.fodt
index 43c35cdff13e..7bf886ab94ce 100644
--- a/sw/qa/extras/htmlexport/data/tdf160867_image_with_link.fodt
+++ b/sw/qa/extras/htmlexport/data/tdf160867_image_with_link.fodt
@@ -8,13 +8,13 @@
  
  
   
-   
+   

iVBORw0KGgoNSUhEUgEBCAIAAACQd1PeAXNSR0IArs4c6QRnQU1BAACxjwv8YQUJcEhZcwAADsIAAA7CARUoSoAMSURBVBhXY/jPwwEBAGMkVdMASUVORK5C
   
  image1 with a hyperlink, and this text with another 
hyperlink

  
-  
+  
   
iVBORw0KGgoNSUhEUgEBCAIAAACQd1PeAXNSR0IArs4c6QRnQU1BAACxjwv8YQUJcEhZcwAADsIAAA7CARUoSoAMSURBVBhXY/jPwwEBAGMkVdMASUVORK5C
  
 image2 with a hyperlink, and this text with 
another 
hyperlink, in a frame
diff --git a/sw/qa/extras/htmlexport/htmlexport2.cxx 
b/sw/qa/extras/htmlexport/htmlexport2.cxx
index 99e9d5347b15..550c9644af97 100644
--- a/sw/qa/extras/htmlexport/htmlexport2.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport2.cxx
@@ -1270,6 +1270,8 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testReqIF_160867)
 assertXPath(pXmlDoc, 
"//reqif-xhtml:p[2]/reqif-xhtml:a/reqif-xhtml:object");
 CPPUNIT_ASSERT(
 getXPath(pXmlDoc, "//reqif-xhtml:p[2]/reqif-xhtml:a", 
"href").endsWith("foo/bar"));
+// There must be no 'target' attribute
+assertXPathNoAttribute(pXmlDoc, "//reqif-xhtml:p[2]/reqif-xhtml:a", 
"target");
 }
 
 CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_161979)
@@ -1606,6 +1608,20 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testHTML_163873)
 assertXPath(pDoc, "/html/body/p[14]/span/h2", "style", u"display:inline;");
 }
 
+CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifNoTargetInA)
+{
+// Given a document with a link with target:
+createSwDoc("link_with_target.fodt");
+
+// When exporting to XHTML:
+ExportToReqif();
+
+// Check that 'a' element has no 'target' attribute
+xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile();
+// Without the accompanying fix in place, this test would have failed
+assertXPathNoAttribute(pXmlDoc, "//reqif-xhtml:a", "target");
+}
+
 } // end of anonymous namespace
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/filter/html/htmlatr.cxx 
b/sw/source/filter/html/htmlatr.cxx
index 7e2009263cd6..d71b97fb281a 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -3105,13 +3105,16 @@ SwHTMLWriter& OutHTML_INetFormat( SwHTMLWriter& rWrt, 
const SwFormatINetFormat&
 sOut = "\""_ostr;
 }
 
-const OUString& rTarget = rINetFormat.GetTargetFrame();
-if( !rTarget.isEmpty() )
+if (!rWrt.mbReqIF) // no target attribute for ReqIF
 {
-sOut += " " OOO_STRING_SVTOOLS_HTML_O_target "=\"";
-rWrt.Strm().WriteOString( sOut );
-HTMLOutFuncs::Out_String( rWrt.Strm(), rTarget );
-sOut = "\""_ostr;
+const OUString& rTarget = rINetFormat.GetTargetFrame();
+if (!rTarget.isEmpty())
+{
+sOut += " " OOO_STRING_SVTOOLS_HTML_O_target "=\"";
+rWrt.Strm().WriteOString(sOut);
+HTMLOutFuncs::Out_String(rWrt.Strm(), rTarget);
+sOut = "\""_ostr;
+}
 }
 
 if( !sRel.isEmpty() )
diff --git a/sw/source/filter/html/htmlflywriter.cxx 
b/sw/source/

core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2024-12-09 Thread Michael Weghorn (via logerrit)
 sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx |   31 +++
 sw/qa/core/accessibilitycheck/data/ContrastTestFail.odt  |binary
 sw/qa/core/accessibilitycheck/data/ContrastTestOK.odt|binary
 sw/source/core/access/AccessibilityCheck.cxx |   29 +-
 4 files changed, 59 insertions(+), 1 deletion(-)

New commits:
commit 7349fc1e469f3302e1bff38c8eb078e6f4712935
Author: Michael Weghorn 
AuthorDate: Mon Dec 9 10:11:59 2024 +0100
Commit: Michael Weghorn 
CommitDate: Tue Dec 10 07:20:01 2024 +0100

tdf#164247 sw a11y check: Adhere to WCAG contrast threshold for large text

Quoting WCAG 2.2 "Success Criterion 1.4.3 Contrast (Minimum)" [1]:

> The visual presentation of text and images of text has a contrast
> ratio of at least 4.5:1, except for the following:
>
> Large Text
>
> Large-scale text and images of large-scale text have a contrast
> ratio of at least 3:1;

Regarding large text, the corresponding "Understanding SC 1.4.3" [2]
clarifies:

> Text that is larger and has wider character strokes is easier to read at
> lower contrast. The contrast requirement for larger text is therefore
> lower. This allows authors to use a wider range of color choices for
> large text, which is helpful for design of pages, particularly titles.
> 18 point text or 14 point bold text is judged to be large enough to
> require a lower contrast ratio.

Therefore, lower the text contrast requirement in
Writer's accessibility check from 4.5 to 3.0 for
text that is considered large according to that
specification.

Add a unit test with 2 test documents:

* one that adheres to the requirements and would have triggered false
  positives without this change in place
  (sw/qa/core/accessibilitycheck/data/ContrastTestOK.odt)
* one that doesn't adhere to the requirements and still fails the
  check, as it should
  (sw/qa/core/accessibilitycheck/data/ContrastTestFail.odt)

[1] https://www.w3.org/TR/WCAG22/#contrast-minimum
[2] https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html

Change-Id: I398f72aa5bdcd77c42834632575d6465a5ecd586
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178127
Reviewed-by: Michael Weghorn 
Tested-by: Jenkins
Reviewed-by: Balazs Varga 
(cherry picked from commit a4b03fce93fce7672be40b57d30797ac36ca67c9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178168

diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx 
b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
index 1f820b47ed02..981cf03cd26b 100644
--- a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
+++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
@@ -318,6 +318,37 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, 
testStylesWithHeader)
 CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, 
aIssues[4]->m_eIssueID);
 }
 
+// Text contrast tests
+// see https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html
+CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckTextContrast)
+{
+// first test doc has these issues:
+// * normal text with contrast < 4.5
+// * large text with contrast < 3.0
+// * bold text with font size 13 (i.e. not considered large) with contrast 
< 4.5
+createSwDoc("ContrastTestFail.odt");
+SwDoc* pDoc = getSwDoc();
+sw::AccessibilityCheck aCheck(pDoc);
+aCheck.check();
+auto& aIssues = aCheck.getIssueCollection().getIssues();
+CPPUNIT_ASSERT_EQUAL(size_t(3), aIssues.size());
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_CONTRAST, 
aIssues[0]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_CONTRAST, 
aIssues[1]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_CONTRAST, 
aIssues[2]->m_eIssueID);
+
+// second test doc has large text with contrast between 3.0 and 4.5,
+// which is sufficient for large text
+// both of these are considered large text according to the spec:
+// * non-bold text font with size 18
+// * bold text with font size 14
+createSwDoc("ContrastTestOK.odt");
+SwDoc* pDocOK = getSwDoc();
+sw::AccessibilityCheck aCheckOK(pDocOK);
+aCheckOK.check();
+auto& aIssuesOK = aCheckOK.getIssueCollection().getIssues();
+CPPUNIT_ASSERT_EQUAL(size_t(0), aIssuesOK.size());
+}
+
 namespace
 {
 std::vector>
diff --git a/sw/qa/core/accessibilitycheck/data/ContrastTestFail.odt 
b/sw/qa/core/accessibilitycheck/data/ContrastTestFail.odt
new file mode 100644
index ..4f898942e37f
Binary files /dev/null and 
b/sw/qa/core/accessibilitycheck/data/ContrastTestFail.odt differ
diff --git a/sw/qa/core/accessibilitycheck/data/ContrastTestOK.odt 
b/sw/qa/core/accessibilitycheck/data/ContrastTestOK.odt
new file mode 100644
index ..2f47148838a2
Binary files /dev/null

core.git: Branch 'libreoffice-25-2' - sw/qa sw/source

2024-12-08 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/calcmove.cxx  |   18 
++
 sw/qa/core/layout/data/ignore-top-margin-page-style-change.docx |binary
 sw/source/core/layout/calcmove.cxx  |   10 +
 3 files changed, 28 insertions(+)

New commits:
commit 64a5c93d4230ff0deccf2cccbaec52463ff07149
Author: Miklos Vajna 
AuthorDate: Fri Dec 6 14:09:28 2024 +0100
Commit: Miklos Vajna 
CommitDate: Mon Dec 9 08:56:24 2024 +0100

tdf#164095 sw: fix missing top margin on paragraph after changing page style

Open the bugdoc, go to the page after the section break, there is a top
margin for the first paragraph there in Word, but not in Writer.

This went wrong in commit abd90828cf101581a07b9d1c371a8c3156521e9f
(tdf#160952 sw: ignore top margin of para on non-first pages with newer
DOCX, 2024-05-14), where it seemed that all implicit and explicit page
breaks want to ignore that top margin for the first paragraph.

Turns out this is more complex: implicit breaks and page breaks should
be followed by an ignore, but not paragraphs after "section break (next
page)". So restore the margins for the RES_PAGEDESC, but continue to
have them for RES_BREAK & implicit breaks.

Change-Id: If1fcf3077b81a705d3587bdae422dcfa16f1c17c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177973
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit ae7900dd42a65aaf60df6b21b9ad511496b209d9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178020

diff --git a/sw/qa/core/layout/calcmove.cxx b/sw/qa/core/layout/calcmove.cxx
index 0fca693eca54..893d3fd89915 100644
--- a/sw/qa/core/layout/calcmove.cxx
+++ b/sw/qa/core/layout/calcmove.cxx
@@ -84,6 +84,24 @@ CPPUNIT_TEST_FIXTURE(Test, testIgnoreTopMarginFly)
 CPPUNIT_ASSERT_EQUAL(static_cast(4000), nParaTopMargin);
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testIgnoreTopMarginPageStyleChange)
+{
+// Given a DOCX (>= Word 2013), section break (next page) between pages 2 
and 3:
+createSwDoc("ignore-top-margin-page-style-change.docx");
+
+// When laying out that document:
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+// Then make sure that the top margin is not ignored on page 3:
+sal_Int32 nParaTopMargin
+= getXPath(pXmlDoc, "/root/page[3]/body/txt/infos/prtBounds", 
"top").toInt32();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 2000
+// - Actual  : 0
+// i.e. the top margin was ignored, which is incorrect.
+CPPUNIT_ASSERT_EQUAL(static_cast(2000), nParaTopMargin);
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testHideWhitespaceGrowingLastPage)
 {
 // Given a document with a full first page, then hiding whitespace:
diff --git a/sw/qa/core/layout/data/ignore-top-margin-page-style-change.docx 
b/sw/qa/core/layout/data/ignore-top-margin-page-style-change.docx
new file mode 100644
index ..ea7d16d8851f
Binary files /dev/null and 
b/sw/qa/core/layout/data/ignore-top-margin-page-style-change.docx differ
diff --git a/sw/source/core/layout/calcmove.cxx 
b/sw/source/core/layout/calcmove.cxx
index 92bf65cf0aad..e05024d7f2b6 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -1139,6 +1139,16 @@ bool SwFrame::IsCollapseUpper() const
 return false;
 }
 
+// Avoid the ignore after applying a new page style (but do it after page 
breaks).
+const SwTextNode* pTextNode = pTextFrame->GetTextNodeForParaProps();
+if (pTextNode)
+{
+if (pTextNode->HasSwAttrSet() && 
pTextNode->GetSwAttrSet().HasItem(RES_PAGEDESC))
+{
+return false;
+}
+}
+
 return true;
 }