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

2024-09-12 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx   |2 +-
 writerfilter/source/dmapper/StyleSheetTable.cxx |8 
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 623b525654b49621f2d7d3e5fc041224ae48d1f3
Author: Justin Luth 
AuthorDate: Wed Sep 11 13:37:13 2024 -0400
Commit: Miklos Vajna 
CommitDate: Fri Sep 13 08:16:41 2024 +0200

tdf#162884 writerfilter: map to built-in footnote style name

This partial revert fixes a 24.2.4 regression from
commit 72ea1005b987159a6a59f9379e63321e0b0dd44f
Author: Michael Stahl on Mon May 6 15:58:36 2024 +0200
tdf#160402 writerfilter: extend StyleMap with all Word styles

Footnote anchor character formatting is controlled by
the character style set in Tools - Footnotes Settings.

The default name of that style is UI dependent,
so only the English UI was importing properly
when the localized name was used in the mapping.

"Footnote Symbol" is the internal name - both the internal name
and the localized name are find-able at the same time,
so the only things that will have a problem are things
that don't connect to the style, but just hold the string name.

The unit test change is also a revert from mstahl's commit.
make CppunitTest_sw_ooxmlexport9 \
CPPUNIT_TEST_NAME=testTdf109310_endnoteStyleForMSO
and is an indication of another problem that this fixes,
namely that a new Footnote Characters style is added
with each round-trip.

Bug 162884 was only reproducible with a non-English UI.
To reproduce, I compiled with autogen.input
--with-lang=de

Thus no unit test...

Change-Id: I63d37f13f435ff7ec41d6b22d74db83dc495150a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173141
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
Reviewed-by: Miklos Vajna 
(cherry picked from commit 3fddae6812f91e5c5f57dacf641f964cd995f2f5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173180
Reviewed-by: Michael Stahl 
Reviewed-by: Justin Luth 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173262

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 91f0deb4bb05..a91723b4f6d5 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -690,7 +690,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf109310_endnoteStyleForMSO)
 xmlDocUniquePtr pXmlDoc = parseExport("word/endnotes.xml");
 // Check w:rStyle element has w:val attribute - note that w: is not 
specified for attribute
 assertXPath(pXmlDoc, 
"/w:endnotes/w:endnote[@w:id='2']/w:p/w:r[1]/w:rPr/w:rStyle"_ostr, "val"_ostr,
-"EndnoteCharacters1");
+u"EndnoteCharacters"_ustr);
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testTdf103389)
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx 
b/writerfilter/source/dmapper/StyleSheetTable.cxx
index d932be695b9f..f4cbd6d688f9 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -1656,8 +1656,8 @@ StyleSheetTable::ConvertStyleName(const OUString& rWWName)
 { "envelope address", "Addressee" }, // RES_POOLCOLL_ENVELOPE_ADDRESS
 { "Envelope Return", "Sender" }, // RES_POOLCOLL_SEND_ADDRESS
 { "envelope return", "Sender" }, // RES_POOLCOLL_SEND_ADDRESS
-{ "footnote reference", "Footnote Characters" }, // 
RES_POOLCHR_FOOTNOTE; tdf#82173
-{ "Footnote Reference", "Footnote Characters" }, // 
RES_POOLCHR_FOOTNOTE; tdf#82173
+{ "footnote reference", "Footnote Symbol" }, // RES_POOLCHR_FOOTNOTE; 
tdf#82173 tdf#162884
+{ "Footnote Reference", "Footnote Symbol" }, // RES_POOLCHR_FOOTNOTE; 
tdf#82173 tdf#162884
 { "Annotation Reference", "" },
 { "annotation reference", "" },
 { "Line Number", "Line Numbering" }, // RES_POOLCHR_LINENUM
@@ -1665,8 +1665,8 @@ StyleSheetTable::ConvertStyleName(const OUString& rWWName)
 { "Page Number", "Page Number" }, // RES_POOLCHR_PAGENO
 { "page number", "Page Number" }, // RES_POOLCHR_PAGENO
 { "PageNumber", "Page Number" }, // RES_POOLCHR_PAGENO
-{ "endnote reference", "Endnote Characters" }, // RES_POOLCHR_ENDNOTE; 
tdf#82173
-{ "Endnote Reference", "Endnote Characters" }, // RES_POOLCHR_ENDNOTE; 
tdf#82173
+{ "endnote reference", "Endnote Symbol" }, // RES_POOLCHR_ENDNOTE; 
tdf#82173 tdf#162884
+{ "Endnote Reference", "Endnote Symbol" }, // RES_POOLCHR_ENDNOTE; 
tdf#82173 tdf#162884
 { "endnote text", "Endnote" }, // RES_POOLCOLL_ENDNOTE
 { "Endnote Text", "Endnote" }, // RES_POOLCOLL_ENDNOTE
 { "Table of Authorities", "Bibliography Heading" }, // 
RES_POOLCOLL_TOX_AUTHORITIESH


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

2024-05-07 Thread Michael Stahl (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx   |4 
 writerfilter/source/dmapper/StyleSheetTable.cxx |  417 +---
 2 files changed, 367 insertions(+), 54 deletions(-)

New commits:
commit 331da18872d8dd526b0e91854450223ee8c0bf0c
Author: Michael Stahl 
AuthorDate: Mon May 6 15:58:36 2024 +0200
Commit: Michael Stahl 
CommitDate: Tue May 7 11:59:31 2024 +0200

tdf#160402 writerfilter: extend StyleMap with all Word styles

There doesn't appear to be an accurate and complete documentation of all
the Word built-in style names, but fortunately Word writes them all into
styles.xml in a w:latentStyles element anyway.

It turned out that a lot of the Writer built-in style names here were
obsoleted by renaming and did not match any more.

Change-Id: Ic69785a34524f667b83a06a267715b2c8b0165d0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167242
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 72ea1005b987159a6a59f9379e63321e0b0dd44f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167261
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index ad3bba49df49..91f0deb4bb05 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -563,7 +563,7 @@ 
DECLARE_OOXMLEXPORT_TEST(testTdf104061_tableSectionColumns,"tdf104061_tableSecti
 
 //tdf#95114 - follow style is Text Body - DOCX test
 uno::Reference< beans::XPropertySet > 
properties(getStyles("ParagraphStyles")->getByName("annotation subject"), 
uno::UNO_QUERY);
-CPPUNIT_ASSERT_EQUAL(OUString("annotation text"), 
getProperty(properties, "FollowStyle"));
+CPPUNIT_ASSERT_EQUAL(OUString("Marginalia"), 
getProperty(properties, "FollowStyle"));
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTdf46940_dontEquallyDistributeColumns, 
"tdf46940_dontEquallyDistributeColumns.docx")
@@ -690,7 +690,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf109310_endnoteStyleForMSO)
 xmlDocUniquePtr pXmlDoc = parseExport("word/endnotes.xml");
 // Check w:rStyle element has w:val attribute - note that w: is not 
specified for attribute
 assertXPath(pXmlDoc, 
"/w:endnotes/w:endnote[@w:id='2']/w:p/w:r[1]/w:rPr/w:rStyle"_ostr, "val"_ostr,
-"EndnoteCharacters");
+"EndnoteCharacters1");
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testTdf103389)
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx 
b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 6b1a79e66c04..d932be695b9f 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -1561,10 +1561,18 @@ StyleSheetTable::ConvertStyleName(const OUString& 
rWWName)
 // will point to a style with specific RES_POOL* in its m_nPoolFormatId. 
Then on export, the
 // pool format id will map to a ww::sti enum value, and finally to a Word 
style name. Keep this
 // part in sync with the export functions mentioned above!
-// In addition to "standard" names, some case variations are handled here; 
and also there are
-// a number of strange mappings like "BodyTextIndentItalic" -> "Text body 
indent italic", which
-// map something unused in Word to something unused in Writer :-/
+// In addition to "standard" names, some case variations are handled here.
+// It's required to know all the Word paragraph/character styles for
+// STYLEREF/TOC fields; the ones that don't have a Writer equivalent have
+// an empty string in the map, and the code should return the original 
name.
+// Also very unclear: at least in DOCX, style names appear to be case
+// sensitive; if Word imports 2 styles that have the same case-insensitive
+// name as a built-in style, it renames one of them by appending a number.
+// These are from the w:latentStyles in the styles.xml of a Word 15.0 DOCX,
+// plus some pre-existing additions and variants.
 static const std::map< OUString, OUString> StyleNameMap {
+//FIXME: testFdo77716, testTdf129575_docDefault etc. fail with correct 
mapping
+//{ "Normal", "Default Paragraph Style" }, // RES_POOLCOLL_STANDARD
 { "Normal", "Standard" }, // RES_POOLCOLL_STANDARD
 { "heading 1", "Heading 1" }, // RES_POOLCOLL_HEADLINE1
 { "heading 2", "Heading 2" }, // RES_POOLCOLL_HEADLINE2
@@ -1587,12 +1595,21 @@ StyleSheetTable::ConvertStyleName(const OUString& 
rWWName)
 { "Index 1", "Index 1" }, // RES_POOLCOLL_TOX_IDX1
 { "Index 2", "Index 2" }, // RES_POOLCOLL_TOX_IDX2
 { "Index 3", "Index 3" }, // RES_POOLCOLL_TOX_IDX3
-//{ "Index 4", "" },
-//{ "Index 5", "" },
-//{ "Index 6", "" },
-//{ "Index 7", "" },
-//{ "Index 8", "" },
-//{ "Index 9", "" },
+{ "Index 4", "" },
+{ "Index 5", "" },
+{ "Index 6", "" },
+

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

2024-02-15 Thread Michael Stahl (via logerrit)
 sw/qa/extras/rtfexport/data/piccrop.rtf|   74 +
 sw/qa/extras/rtfexport/rtfexport8.cxx  |   25 
 writerfilter/source/dmapper/GraphicImport.cxx  |   12 +++-
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   10 +++
 writerfilter/source/rtftok/rtfvalue.cxx|9 +++
 writerfilter/source/rtftok/rtfvalue.hxx|6 ++
 6 files changed, 134 insertions(+), 2 deletions(-)

New commits:
commit 7e7b0230aa56e38f03d3d2563568a4cd2a5a6bb6
Author: Michael Stahl 
AuthorDate: Tue Feb 13 14:45:25 2024 +0100
Commit: Caolán McNamara 
CommitDate: Thu Feb 15 18:27:32 2024 +0100

tdf#155663 writerfilter: RTF import: don't lose \piccrop*

For DOCX the a:srcRect is imported in oox module in BlipFillContext and
set on the XShape; obviously that doesn't work for RTF.

The crop was already taken into account in
RTFDocumentImpl::resolvePict(), but only to set the size of the picture;
to actually set a crop effect, set shape's "GraphicsCrop" property
in dmapper::GraphicImport::lcl_attribute().

Change-Id: Ib12853724744542a09b0073fefc42ad32bb2ff19
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163310
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 47f50af3f057bac1739b7d17d781c0b1d05faa95)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163330
Reviewed-by: Caolán McNamara 

diff --git a/sw/qa/extras/rtfexport/data/piccrop.rtf 
b/sw/qa/extras/rtfexport/data/piccrop.rtf
new file mode 100644
index ..4e8a70420575
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/piccrop.rtf
@@ -0,0 +1,74 @@
+{ 
tf1deflang1025nsinsicpg1252\uc1deff31507\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi31507\deflang1033\deflangfe1028
   hemelang1033hemelangfe1028  hemelangcs1025{onttbl{1bidi swiss
charset0prq2{\*\panose 020b0604020202020204}Arial{\*alt 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;}{291
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{\*alt Arial};}{302bidi swiss
charset238prq2 Arial CE{\*alt Arial};}
+{303bidi swisscharset204prq2 Arial Cyr{\*alt Arial};}{305bidi swiss
charset161prq2 Arial Greek{\*alt Arial};}{306bidi swisscharset162prq2 
Arial Tur{\*alt Arial};}
+{307bidi swisscharset177prq2 Arial (Hebrew){\*alt Arial};}{308bidi 
swisscharset178prq2 Arial (Arabic){\*alt Arial};}{309bidi swiss
charset186prq2 Arial Baltic{\*alt Arial};}
+{310bidi swisscharset163prq2 Arial (Vietnamese){\*alt Arial};}{632bidi 
romancharset238prq2 Cambria Math CE;}{633bidi romancharset204prq2 
Cambria Math Cyr;}{635bidi romancharset161prq2 Cambria Math Greek;}
+{636bidi romancharset162prq2 Cambria Math Tur;}{639bidi roman
charset186prq2 Cambria Math Baltic;}{640bidi romancharset163prq2 Cambria 
Math (Vietnamese);}{662bidi swisscharset238prq2 Calibri CE;}
+{663bidi swisscharset204prq2 Calibri Cyr;}{665bidi swisscharset161
prq2 Calibri Greek;}{666bidi swisscharset162prq2 Calibri Tur;}{667bidi 
swisscharset177prq2 Calibri (Hebrew);}
+{668bidi swisscharset178prq2 Calibri (Arabic);}{669bidi swiss
charset186prq2 Calibri Baltic;}{670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};

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

2024-02-06 Thread Michael Stahl (via logerrit)
 sw/qa/extras/rtfexport/data/tdf136445-1-min.rtf   |   17 +++
 sw/qa/extras/rtfexport/rtfexport8.cxx |   14 +
 sw/qa/extras/rtfimport/rtfimport.cxx  |2 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   52 +-
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |   49 ++--
 writerfilter/source/rtftok/rtfdispatchsymbol.cxx  |2 
 6 files changed, 82 insertions(+), 54 deletions(-)

New commits:
commit b5a31c9cd0b53957a716a487e203f13919bac64c
Author: Michael Stahl 
AuthorDate: Thu Feb 1 12:53:07 2024 +0100
Commit: Caolán McNamara 
CommitDate: Tue Feb 6 20:34:02 2024 +0100

writerfilter: fix missing paragraph break on tdf136445-1.rtf

This causes an assert:
crossrefbookmark.cxx:44: sw::mark::CrossRefBookmark::CrossRefBookmark(): 
Assertion `IDocumentMarkAccess::IsLegalPaMForCrossRefHeadingBookmark(rPaM) && 
"" "- creation of cross-reference 
bookmark with an illegal PaM that does not expand over exactly one whole 
paragraph."' failed.

The problem is that there is an annotation at the end of a paragraph,
and reading the annotation changes various members of DomainMapper_Impl,
in particular m_bParaSectpr and m_bParaChanged, causing "bRemove" in
DomainMapper::lcl_utext() to be erroneously true, removing the just
inserted paragraph break again.

Move all flags that are evaluated for bRemove to SubstreamContext.

This causes one test failure, but it turns out that the new result is
the same as in Word 2013.

  Test name: (anonymous namespace)::testTdf108947::TestBody
  equality assertion failed
  - Expected: Header Page 2 ?
  - Actual  :
  Header Page 2 ?

(regression from commit 15b886f460919ea3dce425a621dc017c2992a96b)

Change-Id: I44a7a8928ab04c600d4d3c43bc4e4deeafe57d89
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162932
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 86ad08f9d25110e91e92a0badf6de75e785b3644)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162936
Reviewed-by: Caolán McNamara 

diff --git a/sw/qa/extras/rtfexport/data/tdf136445-1-min.rtf 
b/sw/qa/extras/rtfexport/data/tdf136445-1-min.rtf
new file mode 100644
index ..c0abd0d293be
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf136445-1-min.rtf
@@ -0,0 +1,17 @@
+{ tf1
+{\*\listtable
+{\list\listtemplateid8
+{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext 
\'02E\'00;}{\levelnumbers\'02;}i-720\li720}\listid8}
+}
+{\listoverridetable{\listoverride\listid8\listoverridecount0\ls8}}
+
+\ltrpar \sectd
+\pard\plain \ltrpar{ tlch\hich \ltrch\loch
+I ax xoixx xuxixx xxe xixxx. (Xaxxexx 1989 x.x. xaxax a)}{ tlch\hich 
\ltrch\loch
+{\*tnid CL}{\*tnauthor Christian}+sic!}}}
+\par \pard\plain {\listtext\pard\plain  E119   ab}\ilvl0\ls8 \li720 i0\lin720 
in0i-720\ql\ltrpar{{\*kmkstart __RefNumPara__395941_134077278}{\*kmkend 
__RefNumPara__395941_134077278} tlch\hich \ltrch\loch
+Xixab xaxa ab x-a  ab  ab  ab xix  ab }{ tlch\hich 
\ltrch\langfe0\dbch\loch\lang255\loch
+x xi = xa.}
+\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport8.cxx 
b/sw/qa/extras/rtfexport/rtfexport8.cxx
index 167539197051..08ca8452f928 100644
--- a/sw/qa/extras/rtfexport/rtfexport8.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport8.cxx
@@ -109,6 +109,20 @@ DECLARE_RTFEXPORT_TEST(testTdf158586_lostFrame, 
"tdf158586_lostFrame.rtf")
 CPPUNIT_ASSERT_EQUAL(2, getPages());
 }
 
+DECLARE_RTFEXPORT_TEST(testAnnotationPar, "tdf136445-1-min.rtf")
+{
+// the problem was that the paragraph break following annotation was 
missing
+CPPUNIT_ASSERT_EQUAL(2, getParagraphs());
+CPPUNIT_ASSERT_EQUAL(
+OUString("Annotation"),
+getProperty(
+getRun(getParagraph(1, "I ax xoixx xuxixx xxe xixxx. (Xaxxexx 1989 
x.x. xaxax a)"), 2),
+"TextPortionType"));
+CPPUNIT_ASSERT(
+!getProperty(getParagraph(2, "Xixxaxax-a 
xix x xi = xa."), "ListId")
+ .isEmpty());
+}
+
 DECLARE_RTFEXPORT_TEST(testTdf158826_extraCR, "tdf158826_extraCR.rtf")
 {
 // Note: this is a hand-minimized sample, and very likely doesn't follow 
RTF { } rules...
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 3d516a004218..1a6d1c9772ea 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1568,7 +1568,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf108947)
 uno::Reference xHeaderTextLeft = 
getProperty>(
 getStyles("PageStyles")->getByName("Default Page Style"), 
"HeaderTextLeft");
 aActual = xHeaderTextLeft->getString();
-CPPUNIT_ASSERT_EQUAL(OUString("Header Page 2 ?"), aActual);
+CPPUNIT_ASSERT_EQUAL(OUString(SAL_NEWLINE_STRING "Header Page 2 ?"), 
aActual);
 #endif
 }
 
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b

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

2024-02-06 Thread Vasily Melenchuk (via logerrit)
 sw/qa/extras/rtfexport/data/tdf158409.rtf  |   12 
 sw/qa/extras/rtfexport/rtfexport3.cxx  |9 +
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |4 ++--
 3 files changed, 23 insertions(+), 2 deletions(-)

New commits:
commit e52d61431b43336eca338d4afe061433fb7c97a2
Author: Vasily Melenchuk 
AuthorDate: Wed Dec 6 14:40:15 2023 +0300
Commit: Xisco Fauli 
CommitDate: Tue Feb 6 16:51:25 2024 +0100

tdf#158409: RTF import: use current run props for fields

Fields import was not using current run properties causing
fallback to used style or default style what is wrong for RTF.

Change-Id: I0189c6122b703a23ff910ee38da78aa05ac4d9f8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160387
Tested-by: Jenkins
Reviewed-by: Vasily Melenchuk 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163057

diff --git a/sw/qa/extras/rtfexport/data/tdf158409.rtf 
b/sw/qa/extras/rtfexport/data/tdf158409.rtf
new file mode 100644
index ..a89a5ba95d8a
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf158409.rtf
@@ -0,0 +1,12 @@
+{ tf1
+{\info
+{  itle DocTitle}
+}
+{\stylesheet
+{\qls72 Normal;}
+}
+
+\pards16 {ield{\*ldinst TITLE}}\par
+\pards72 { tfchs16{ield{\*ldinst TITLE}}}\par
+
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx 
b/sw/qa/extras/rtfexport/rtfexport3.cxx
index 435242308a0e..fd25e7e5758d 100644
--- a/sw/qa/extras/rtfexport/rtfexport3.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport3.cxx
@@ -707,6 +707,15 @@ CPPUNIT_TEST_FIXTURE(Test, 
testFloattableOverlapNeverRTFExport)
 
CPPUNIT_ASSERT(!pFly->GetAttrSet().GetWrapInfluenceOnObjPos().GetAllowOverlap());
 }
 
+DECLARE_RTFEXPORT_TEST(testTdf158409, "tdf158409.rtf")
+{
+uno::Reference xRun = getRun(getParagraph(1), 1, 
"DocTitle");
+CPPUNIT_ASSERT_EQUAL(8.0, getProperty(xRun, "CharHeight"));
+
+xRun = getRun(getParagraph(2), 1, "DocTitle");
+CPPUNIT_ASSERT_EQUAL(8.0, getProperty(xRun, "CharHeight"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 52c8311fcb96..cc85a48ae27b 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2342,7 +2342,7 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& 
rState)
 
 if (m_aStates.top().isFieldLocked())
 singleChar(cFieldLock);
-singleChar(cFieldSep);
+singleChar(cFieldSep, true);
 }
 break;
 case Destination::FIELDRESULT:
@@ -2569,7 +2569,7 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& 
rState)
 str = OUString::Concat(field) + " \"" + str.replaceAll("\"", 
"\\"") + "\"";
 singleChar(cFieldStart);
 Mapper().utext(str.getStr(), str.getLength());
-singleChar(cFieldSep);
+singleChar(cFieldSep, true);
 // no result
 singleChar(cFieldEnd);
 }


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

2024-02-05 Thread Miklos Vajna (via logerrit)
 sw/qa/core/header_footer/HeaderFooterTest.cxx |6 ++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |9 +
 writerfilter/source/dmapper/PropertyMap.cxx   |6 ++
 writerfilter/source/dmapper/PropertyMap.hxx   |3 +++
 4 files changed, 20 insertions(+), 4 deletions(-)

New commits:
commit af302ee34f74b4d71b1721d23f62225b7e66ff2e
Author: Miklos Vajna 
AuthorDate: Mon Feb 5 10:38:06 2024 +0100
Commit: Xisco Fauli 
CommitDate: Mon Feb 5 14:44:36 2024 +0100

tdf#158814 DOCX import: fix unwanted header with type="first" & no titlePg

The bugdoc had no header in Word, but had one in Writer, since commit
17e51f427b3f0cec74ac8e0a1b3f51189006ae6f (DOCX import: first page header
should always set default headers as well, 2014-11-21).

The code has changed a log in the meantime, today we import first page
headers and left/right page headers as a single page style, but still
code was missing to detect the case when  was not followed by , which is an indicator
that the first page header/footer should be used.

Fix the problem by new flags to SectionPropertyMap to track if we ever
seen a first/left/right header. This allows making an informed decision
in SectionPropertyMap::setHeaderFooterProperties(): if the header is on,
but we effectively don't have none of a first, left or right header,
then it's time to turn it off, similar to what the DOC import does.

Note that this only changes behavior for headers, but if there is a
practical need, then the same could be also done for footers as well.
Instead of adding a new test, notice that testTdf112694 in
CppunitTest_sw_core_header_footer explicitly tests this case: a first
header which is not a title page. So change that testcase to assert the
behavior now matches Word and drop the FIXME.

Change-Id: Ib604e786d7a5a197d4b562533326206697de882a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162992
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit d918beda2ab42668014b0dd42996b6ccc97e8c3a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162907
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/core/header_footer/HeaderFooterTest.cxx 
b/sw/qa/core/header_footer/HeaderFooterTest.cxx
index 6bb5fd616710..4d2938ef28dc 100644
--- a/sw/qa/core/header_footer/HeaderFooterTest.cxx
+++ b/sw/qa/core/header_footer/HeaderFooterTest.cxx
@@ -467,10 +467,8 @@ CPPUNIT_TEST_FIXTURE(HeaderFooterTest, testTdf112694)
 auto verify = [this]() {
 uno::Any aPageStyle = getStyles("PageStyles")->getByName("Standard");
 // Header was on when header for file was for explicit first pages only
-// (marked via ).
-//CPPUNIT_ASSERT(!getProperty(aPageStyle, "HeaderIsOn"));
-// TODO - can't disable headers/footers selectively (only fo first 
page)
-CPPUNIT_ASSERT(getProperty(aPageStyle, "HeaderIsOn"));
+// but  was missing.
+CPPUNIT_ASSERT(!getProperty(aPageStyle, "HeaderIsOn"));
 };
 
 createSwDoc("tdf112694.docx");
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index cea1585e42fe..5342e7a21b83 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3826,7 +3826,10 @@ void 
DomainMapper_Impl::PushPageHeaderFooter(PagePartType ePagePartType, PageTyp
 if (eType == PageType::LEFT)
 {
 if (bHeader)
+{
 pSectionContext->m_bLeftHeader = true;
+pSectionContext->m_bHadLeftHeader = true;
+}
 else
 pSectionContext->m_bLeftFooter = true;
 
@@ -3835,7 +3838,10 @@ void 
DomainMapper_Impl::PushPageHeaderFooter(PagePartType ePagePartType, PageTyp
 else if (eType == PageType::FIRST)
 {
 if (bHeader)
+{
 pSectionContext->m_bFirstHeader = true;
+pSectionContext->m_bHadFirstHeader = true;
+}
 else
 pSectionContext->m_bFirstFooter = true;
 
@@ -3844,7 +3850,10 @@ void 
DomainMapper_Impl::PushPageHeaderFooter(PagePartType ePagePartType, PageTyp
 else
 {
 if (bHeader)
+{
 pSectionContext->m_bRightHeader = true;
+pSectionContext->m_bHadRightHeader = true;
+}
 else
 pSectionContext->m_bRightFooter = true;
 
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index 9f9269b73471..ec055c532c4d 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -566,6 +566,12 @@ void 
SectionPropertyMap::setHeaderFooterProperties(DomainMapper_Impl& rDM_Impl)
 m_aPageStyle->setPropertyValue(getPropertyName(P

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

2024-01-23 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf159207_footerFramePrBorder.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx   |   18 
++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx|4 ++
 3 files changed, 22 insertions(+)

New commits:
commit 3c0a6102ce26c546c0c448a8d7468dea92623273
Author: Justin Luth 
AuthorDate: Sat Jan 20 19:54:54 2024 -0500
Commit: Michael Stahl 
CommitDate: Tue Jan 23 10:42:42 2024 +0100

tdf#154703 writerfilter framePr: avoid unexpected frame borders

This fixes my regressive 7.6 commit
31ea6305b6a763ee48f639562313d9bd109a2923

The text's first border checked (the left one) returned void
because the property SetState was DONTCARE.
Then it SETS the text's left border to be nothing
(I presume to remove the border from the paragraph since
it is moving it onto frame).
Well, apparently that act of setting one border sets all of them
(which makes sense since it would be one box item,
and once the box item exists, it has a definition for each border).

Therefore on the the next steps of the for loop,
the remaining borders will exist (as nothing)
and be dutifully moved to the frame.

Apparently the default for a frame is a box with DEFINED borders,
so omitting the moving of a nothing border resulted in a stray edge.

make CppunitTest_sw_ooxmlexport21 \
CPPUNIT_TEST_NAME=testTdf159207_footerFramePrBorder

Change-Id: I217d02678b368f70643be91c4466927b4ca53988
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162409
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit f43efd5473862edbdad0feb7f78c7be02914e997)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162375
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf159207_footerFramePrBorder.docx 
b/sw/qa/extras/ooxmlexport/data/tdf159207_footerFramePrBorder.docx
new file mode 100644
index ..7a4c54cc5c75
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf159207_footerFramePrBorder.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index 3a5ae1f394ea..cdcdfe778577 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -44,6 +44,24 @@ DECLARE_OOXMLEXPORT_TEST(testTdf153909_followTextFlow, 
"tdf153909_followTextFlow
 CPPUNIT_ASSERT(nTableTop > nRectBottom);
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf159207_footerFramePrBorder)
+{
+loadFromFile(u"tdf159207_footerFramePrBorder.docx"); // re-imports as 
editeng Frame/Shape
+
+// given a doc with footer paragraphs frame (with a top border, but no 
left border)
+uno::Reference xTextFramesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xIndexAccess(xTextFramesSupplier->getTextFrames(),
+ uno::UNO_QUERY);
+uno::Reference xFrame0(xIndexAccess->getByIndex(0), 
uno::UNO_QUERY);
+auto aBorder = getProperty(xFrame0, "LeftBorder");
+sal_uInt32 nBorderWidth
+= aBorder.OuterLineWidth + aBorder.InnerLineWidth + 
aBorder.LineDistance;
+// Without patch it failed with Expected 0, Actual 26
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Left border:", static_cast(0), 
nBorderWidth);
+
+// TODO: there SHOULD BE a top border, and even if loaded, it would be 
lost on re-import...
+}
+
 } // end of anonymous namespace
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index db2a71270331..cea1585e42fe 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1731,7 +1731,11 @@ static void 
lcl_MoveBorderPropertiesToFrame(std::vector& r
 aValue.Name = sPropertyName;
 aValue.Value = 
xTextRangeProperties->getPropertyValue(sPropertyName);
 if( nProperty < 4 )
+{
 xTextRangeProperties->setPropertyValue( sPropertyName, 
uno::Any(table::BorderLine2()));
+if (!aValue.Value.hasValue())
+aValue.Value <<= table::BorderLine2();
+}
 else // border spacing
 {
 sal_Int32 nDistance = 0;


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

2024-01-23 Thread Mike Kaganski (via logerrit)
 sw/qa/extras/layout/data/sdt+framePr.docx|binary
 sw/qa/extras/layout/layout3.cxx  |   36 +++
 writerfilter/source/dmapper/DomainMapper.cxx |   18 ++---
 writerfilter/source/dmapper/SdtHelper.hxx|1 
 4 files changed, 51 insertions(+), 4 deletions(-)

New commits:
commit ccad5b30548072249b8d8abf1c43de8350271f54
Author: Mike Kaganski 
AuthorDate: Mon Jan 22 19:10:29 2024 +0600
Commit: Xisco Fauli 
CommitDate: Tue Jan 23 09:47:15 2024 +0100

tdf#159259: make sure to set FieldStartRange in sdt helper

... also for field case.
Unfortunately, it is not really clear, if the anagement of this could
be moved to DomainMapper_Impl. There are several insertion contexts;
they may use different insertion points; there maybe could be cases
when an inserted content should not go into the current sdt (?). Thus,
I didn't put the code into DomainMapper_Impl::appendTextContent(),
where the field character is inserted. Instead, I added code to check
and set the start range in the same place as for the normal text: we
know for sure, that if it were a normal text, we would append it to
GetCurrentTextRange()->getEnd() - so do the same for fields.

My concern that still stays is that the use of hasUnusedText looks
hackish and fragile. Inserted fields don't set it - so the code that
depends on empty sdt will not notice it. OTOH, it can't set it: this
would break inserting field result for an already inserted command.
Possibly all handling of sdt should be refactored at some point.

Change-Id: I7a783aab2400d9a9c1f9f2e5607c872cb58d346b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162398
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162427
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/layout/data/sdt+framePr.docx 
b/sw/qa/extras/layout/data/sdt+framePr.docx
new file mode 100644
index ..d46bcbfaa774
Binary files /dev/null and b/sw/qa/extras/layout/data/sdt+framePr.docx differ
diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index 35c5cf669175..9c46d8395a1e 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -2267,6 +2267,42 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf159271)
 assertXPath(pXmlDoc, 
"/root/page/body/tab/row/cell[2]/txt//SwFieldPortion"_ostr, 1);
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf159259)
+{
+// Given a document with a block sdt with a single field, having framePr 
aligned to right
+createSwDoc("sdt+framePr.docx");
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+// Make sure there is only one page and one paragraph with one line and 
one anchored object
+assertXPath(pXmlDoc, "/root/page"_ostr, 1);
+// Without the fix, this would fail: there were two paragraphs
+assertXPath(pXmlDoc, "/root/page/body/txt"_ostr, 1);
+assertXPath(pXmlDoc, "/root/page/body/txt/SwParaPortion"_ostr, 1);
+assertXPath(pXmlDoc, 
"/root/page/body/txt/SwParaPortion/SwLineLayout"_ostr, 1);
+// Without the fix, this would fail: there was a field portion in the line
+assertXPath(pXmlDoc, 
"/root/page/body/txt/SwParaPortion/SwLineLayout/SwFieldPortion"_ostr, 0);
+// Without the fix, this would fail: there was no anchored objects
+assertXPath(pXmlDoc, "/root/page/body/txt/anchored"_ostr, 1);
+assertXPath(pXmlDoc, "/root/page/body/txt/anchored/fly"_ostr, 1);
+
+const sal_Int32 paraRight
+= getXPath(pXmlDoc, "/root/page/body/txt/infos/bounds"_ostr, 
"right"_ostr).toInt32();
+const sal_Int32 paraHeight
+= getXPath(pXmlDoc, "/root/page/body/txt/infos/bounds"_ostr, 
"height"_ostr).toInt32();
+
+CPPUNIT_ASSERT_GREATER(sal_Int32(0), paraRight);
+CPPUNIT_ASSERT_GREATER(sal_Int32(0), paraHeight);
+
+const sal_Int32 flyRight
+= getXPath(pXmlDoc, 
"/root/page/body/txt/anchored/fly/infos/bounds"_ostr, "right"_ostr)
+  .toInt32();
+const sal_Int32 flyHeight
+= getXPath(pXmlDoc, 
"/root/page/body/txt/anchored/fly/infos/bounds"_ostr, "height"_ostr)
+  .toInt32();
+
+CPPUNIT_ASSERT_EQUAL(paraRight, flyRight); // The fly is right-aligned
+CPPUNIT_ASSERT_EQUAL(paraHeight, flyHeight);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 6bb5071a4dd6..903954de033e 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -4479,14 +4479,24 @@ void DomainMapper::lcl_utext(const sal_Unicode *const 
data_, size_t len)
 }
 else if (m_pImpl->IsOpenFieldCommand() && 
!m_pImpl->IsForceGenericFields())
 {
-if (bInSdtBlockText && m_pImpl->m_pSdtHelper->hasUnusedText()

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

2024-01-15 Thread Oliver Specht (via logerrit)
 sw/qa/extras/rtfexport/data/tdf158830.rtf |  237 
 sw/qa/extras/rtfexport/data/tdf158978.rtf |  350 ++
 sw/qa/extras/rtfexport/data/tdf158982.rtf |  281 
 sw/qa/extras/rtfexport/rtfexport8.cxx |   45 +++
 writerfilter/source/rtftok/rtfsprm.cxx|2 
 5 files changed, 914 insertions(+), 1 deletion(-)

New commits:
commit b65a2bc14c1553846bd0f4910951a0a964b3cde5
Author: Oliver Specht 
AuthorDate: Tue Jan 9 11:39:58 2024 +0100
Commit: Xisco Fauli 
CommitDate: Mon Jan 15 21:40:14 2024 +0100

tdf#158830 fixes regression introduces with tdf#158044

Removing paragraph attributes equal to style attributes now works also
for paragraphs within tables.
This fixes also the regressions documented in tdf#158978 and tdf#158982

Change-Id: I9f430e23fd33cff4d6ec1d1954969666f0080574
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161824
Tested-by: Jenkins
Tested-by: Xisco Fauli 
Reviewed-by: Xisco Fauli 
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 
(cherry picked from commit 204d50a07501bf8445a8a0526f68987373834318)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162109

diff --git a/sw/qa/extras/rtfexport/data/tdf158830.rtf 
b/sw/qa/extras/rtfexport/data/tdf158830.rtf
new file mode 100755
index ..f6408a63b4c6
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf158830.rtf
@@ -0,0 +1,237 @@
+{
tf1deflang1025nsinsicpg1250\uc1deff1\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1038\deflangfe1038
  hemelang1035hemelangfe0 hemelangcs0{onttbl{0bidi roman
charset0prq2{\*\panose 02020603050405020304}Times New Roman{\*alt Times New 
Roman};}
+{1bidi swisscharset0prq2{\*\panose 020b0604020202020204}Arial{\*alt 
Helvetica};}{1bidi swisscharset0prq2{\*\panose 
020b0604020202020204}Arial{\*alt Helvetica};}
+{39bidi swisscharset0prq2{\*\panose 020f0502020204030204}Calibri;}{40
bidi swisscharset0prq2{\*\panose }Tahoma;}{42bidi 
romancharset0prq2{\*\panose 02040503050406030204}Cambria;}
+{lomajor31500bidi romancharset0prq2{\*\panose 02020603050405020304}Times 
New Roman{\*alt Times New Roman};}{dbmajor31501bidi romancharset0
prq2{\*\panose 02020603050405020304}Times New Roman{\*alt Times New Roman};}
+{himajor31502bidi romancharset0prq2{\*\panose 
02040503050406030204}Cambria;}{bimajor31503bidi romancharset0
prq2{\*\panose 02020603050405020304}Times New Roman{\*alt Times New Roman};}
+{lominor31504bidi romancharset0prq2{\*\panose 02020603050405020304}Times 
New Roman{\*alt Times New Roman};}{dbminor31505bidi romancharset0
prq2{\*\panose 02020603050405020304}Times New Roman{\*alt Times New Roman};}
+{himinor31506bidi swisscharset0prq2{\*\panose 
020f0502020204030204}Calibri;}{biminor31507bidi romancharset0
prq2{\*\panose 02020603050405020304}Times New Roman{\*alt Times New Roman};}
+{359bidi romancharset238prq2 Times New Roman CE{\*alt Times New 
Roman};}{360bidi romancharset204prq2 Times New Roman Cyr{\*alt Times New 
Roman};}
+{362bidi romancharset161prq2 Times New Roman Greek{\*alt Times New 
Roman};}{363bidi romancharset162prq2 Times New Roman Tur{\*alt Times New 
Roman};}
+{364bidi romancharset177prq2 Times New Roman (Hebrew){\*alt Times New 
Roman};}{365bidi romancharset178prq2 Times New Roman (Arabic){\*alt Times 
New Roman};}
+{366bidi romancharset186prq2 Times New Roman Baltic{\*alt Times New 
Roman};}{367bidi romancharset163prq2 Times New Roman (Vietnamese){\*alt 
Times New Roman};}{369bidi swisscharset238prq2 Arial CE{\*alt Helvetica};}
+{370bidi swisscharset204prq2 Arial Cyr{\*alt Helvetica};}{372bidi 
swisscharset161prq2 Arial Greek{\*alt Helvetica};}{373bidi swiss
charset162prq2 Arial Tur{\*alt Helvetica};}
+{374bidi swisscharset177prq2 Arial (Hebrew){\*alt Helvetica};}{375bidi 
swisscharset178prq2 Arial (Arabic){\*alt Helvetica};}{376bidi swiss
charset186prq2 Arial Baltic{\*alt Helvetica};}
+{377bidi swisscharset163prq2 Arial (Vietnamese){\*alt Helvetica};}{369
bidi swisscharset238prq2 Arial CE{\*alt Helvetica};}{370bidi swiss
charset204prq2 Arial Cyr{\*alt Helvetica};}
+{372bidi swisscharset161prq2 Arial Greek{\*alt Helvetica};}{373bidi 
swisscharset162prq2 Arial Tur{\*alt Helvetica};}{374bidi swisscharset177
prq2 Arial (Hebrew){\*alt Helvetica};}
+{375bidi swisscharset178prq2 Arial (Arabic){\*alt Helvetica};}{376bidi 
swisscharset186prq2 Arial Baltic{\*alt Helvetica};}{377bidi swiss
charset163prq2 Arial (Vietnamese){\*alt Helvetica};}
+{749bidi swisscharset238prq2 Calibri CE;}{750bidi swisscharset204
prq2 Calibri Cyr;}{752bidi swisscharset161prq2 Calibri Greek;}{753bidi 
swisscharset162prq2 Calibri Tur;}
+{754bidi swisscharset177prq2 Calibri (Hebrew);

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

2024-01-14 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx |6 ++
 writerfilter/source/dmapper/GraphicImport.cxx |7 +++
 2 files changed, 9 insertions(+), 4 deletions(-)

New commits:
commit 8132f0eb48d1b1601b690c43bcd4991c86dd1217
Author: Justin Luth 
AuthorDate: Fri Jan 12 16:17:03 2024 -0500
Commit: Miklos Vajna 
CommitDate: Mon Jan 15 08:51:39 2024 +0100

tdf#139915 tdf#159157 writerfilter: fix image position with TEXT_LINE

This is an IMAGE followup to vmiklos' shape/textbox fix in
LO 7.2 commit 2f21e4f357ec60450df84ddd858c3cf0a4711b02

Images follow a different code path, but needed the same treatment.

Change-Id: I974944c7fbb4e0fa6aa52ac239c6a16ec7f927e6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161986
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161988

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
index 2463534dd8ba..0ea69e698807 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -174,10 +174,8 @@ after they are loaded.
 CPPUNIT_ASSERT_EQUAL( OUString( "Red" ), descr2 );
 CPPUNIT_ASSERT_EQUAL( OUString( "Green" ), descr3 );
 
-//FIXME: MS Word shows the image below the line of text, not above it.
-// tdf#139915 This was 826, but it should be -826
-if (isExported())
-CPPUNIT_ASSERT_EQUAL(sal_Int32(-826), getProperty(image1, 
"VertOrientPosition"));
+// tdf#139915/tdf#159157 This was 826, but it should be -826
+CPPUNIT_ASSERT_EQUAL(sal_Int32(-826), getProperty(image1, 
"VertOrientPosition"));
 sal_Int16 nExpected = text::RelOrientation::TEXT_LINE;
 CPPUNIT_ASSERT_EQUAL(nExpected, getProperty(image1, 
"VertOrientRelation"));
 
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index 63330c477cbd..eebd1b822897 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1850,6 +1850,13 @@ uno::Reference 
GraphicImport::createGraphicObject(uno::Refer
 m_pImpl->m_nLeftPosition = 0;
 }
 
+if (m_pImpl->m_nVertRelation == 
text::RelOrientation::TEXT_LINE)
+{
+// Word's "line" is "below the bottom of the line", our 
TEXT_LINE is
+// "towards top, from the bottom of the line", so invert 
the vertical position.
+m_pImpl->m_nTopPosition *= -1;
+}
+
 m_pImpl->applyPosition(xGraphicObjectProperties);
 m_pImpl->applyRelativePosition(xGraphicObjectProperties);
 if( !m_pImpl->m_bOpaque )


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

2024-01-08 Thread Mike Kaganski (via logerrit)
 sw/qa/extras/ooxmlexport/data/sdt_after_section_break.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport20.cxx |   50 +
 writerfilter/source/dmapper/DomainMapper_Impl.cxx  |   36 +
 3 files changed, 72 insertions(+), 14 deletions(-)

New commits:
commit 1e8e2134c66b2875aeacddfc9c68fdd584f74892
Author: Mike Kaganski 
AuthorDate: Tue Jan 2 17:12:06 2024 +0600
Commit: Xisco Fauli 
CommitDate: Mon Jan 8 09:50:15 2024 +0100

tdf#158971: Only copy directly-set properties

Commit f09420fa189be5165b0311083ba127073500a121 (tdf#158855: Make sure
to not add extra paragraph after a table in a section, 2023-12-25) had
implemented copying all attributes of a paragraph using copyAllProps.
But the function didn't check the states of properties, so copied also
default values of properties, making them direct properties of the
paragraph. Due to tdf#158972, that caused an assertion when saving,
and the main problem was a set of direct properties in the paragraph.

Fix that by checking the properties states. Also make sure to work with
paragraphs, rather than with ranges, which treats any properties set on
paragraph level as default-state on the run level.

Change-Id: I7cd9c7fbb9313d666c46be201913f0223a6b4f5e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161539
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161580

diff --git a/sw/qa/extras/ooxmlexport/data/sdt_after_section_break.docx 
b/sw/qa/extras/ooxmlexport/data/sdt_after_section_break.docx
new file mode 100644
index ..d753f5da30bf
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/sdt_after_section_break.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx
index 639aea237618..317937fb3742 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx
@@ -9,6 +9,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -1041,6 +1042,55 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf158855)
 getParagraph(2, u"Next page"_ustr);
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf158971)
+{
+// Given a section break and an SDT in the following paragraph
+load(createFileURL(u"sdt_after_section_break.docx"));
+
+// Check that the import doesn't introduce unwanted character properties 
in the paragraph after
+// the section break
+CPPUNIT_ASSERT_EQUAL(2, getParagraphs());
+{
+auto para = getParagraph(2, u"text"_ustr);
+css::uno::Reference xRunState(getRun(para, 
1, u""_ustr),
+  
css::uno::UNO_QUERY_THROW);
+// without the fix, this would fail with
+// - Expected: 1
+// - Actual  : 0
+CPPUNIT_ASSERT_EQUAL(css::beans::PropertyState_DEFAULT_VALUE,
+ xRunState->getPropertyState(u"RubyAdjust"_ustr));
+CPPUNIT_ASSERT_EQUAL(css::beans::PropertyState_DEFAULT_VALUE,
+ xRunState->getPropertyState(u"RubyIsAbove"_ustr));
+CPPUNIT_ASSERT_EQUAL(css::beans::PropertyState_DEFAULT_VALUE,
+ 
xRunState->getPropertyState(u"RubyPosition"_ustr));
+CPPUNIT_ASSERT_EQUAL(css::beans::PropertyState_DEFAULT_VALUE,
+ 
xRunState->getPropertyState(u"UnvisitedCharStyleName"_ustr));
+CPPUNIT_ASSERT_EQUAL(css::beans::PropertyState_DEFAULT_VALUE,
+ 
xRunState->getPropertyState(u"VisitedCharStyleName"_ustr));
+}
+
+// Saving must not fail assertions
+saveAndReload(mpFilter);
+
+// Check again
+CPPUNIT_ASSERT_EQUAL(2, getParagraphs());
+{
+auto para = getParagraph(2, u"text"_ustr);
+css::uno::Reference xRunState(getRun(para, 
1, u""_ustr),
+  
css::uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_EQUAL(css::beans::PropertyState_DEFAULT_VALUE,
+ xRunState->getPropertyState(u"RubyAdjust"_ustr));
+CPPUNIT_ASSERT_EQUAL(css::beans::PropertyState_DEFAULT_VALUE,
+ xRunState->getPropertyState(u"RubyIsAbove"_ustr));
+CPPUNIT_ASSERT_EQUAL(css::beans::PropertyState_DEFAULT_VALUE,
+ 
xRunState->getPropertyState(u"RubyPosition"_ustr));
+CPPUNIT_ASSERT_EQUAL(css::beans::PropertyState_DEFAULT_VALUE,
+ 
xRunState->getPropertyState(u"UnvisitedCharStyleName"_ustr));
+CPPUNIT_ASSERT_EQUAL(css::beans::PropertyState_DEFAULT_VALUE,
+ 
xRunState->getPropertyState(u"VisitedCharStyleName"_ustr));
+}
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/Doma

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

2024-01-03 Thread Mike Kaganski (via logerrit)
 sw/qa/extras/ooxmlexport/data/section_break_after_table.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport20.cxx   |   19 +
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx|2 
 writerfilter/source/dmapper/DomainMapper.cxx |   13 -
 writerfilter/source/dmapper/DomainMapper_Impl.cxx|  137 ---
 writerfilter/source/dmapper/DomainMapper_Impl.hxx|3 
 6 files changed, 122 insertions(+), 52 deletions(-)

New commits:
commit 62e8b576b287111bd0dc79e71334f77dcf909938
Author: Mike Kaganski 
AuthorDate: Mon Dec 25 15:32:41 2023 +0600
Commit: Xisco Fauli 
CommitDate: Wed Jan 3 10:26:58 2024 +0100

tdf#158855: Make sure to not add extra paragraph after a table in a section

Simplify the condition for last paragraph removal in lcl_utext, and clean up
the complications piled after commit 
2e8aad6d45c53d554ccaf26de998ede708cfc289
(fdo#39056 fdo#75431 Section Properties if section starts with table,
2014-04-24). This makes sure that the trailing extra paragraph gets properly
removed, even when there was a dummy paragraph added for a table in section.

Because of the removed check, import used to avoid the removal of the extra
paragraph immediately following a table (when the table needed to be the 
last
element in the section); hence, in 
DomainMapper_Impl::appendTextSectionAfter,
a last section's table was followed by two paragraphs (one that is expected
to stay after the created section, and one before that, that was not removed
after the table). xCursor had ininitally both paragraphs in the selection
after the forward goto* calls; and then, gotoLeft excluded only the last
paragraph from the selection. After the change, in such a case, there is 
only
one paragraph in the end: the one that should stay after the created 
section.
But calling gotoLeft then would have to put the end of selection to a text
node inside the table; since the selection that starts before the table 
can't
end inside the table, the call resulted in the whole table excluded from the
selection. This requires to add a paragraph here, to allow the previous
behavior of cursor; and then the last paragraph in section is destroyed. The
code makes sure that the trailing paragraph kept after the creation of the
section has all the properties applied to the old last paragraph.

testFdo53985 used to check for total 9 paragraphs in the document; while
3 of those were introduced exactly by the bug fixed here; they are absent
in Word. The test is fixed; its logic is unchanged, and it still correctly
tests that a round-trip doesn't increase number of paragraphs.

Change-Id: Ibf6349ba7906dac185c759eb3b58c1849ee5064a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161275
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161300

diff --git a/sw/qa/extras/ooxmlexport/data/section_break_after_table.docx 
b/sw/qa/extras/ooxmlexport/data/section_break_after_table.docx
new file mode 100644
index ..9f8e4c687bbb
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/section_break_after_table.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx
index 4a4e6e087b68..639aea237618 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx
@@ -1022,6 +1022,25 @@ CPPUNIT_TEST_FIXTURE(Test, testtdf158044)
 assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[8]/w:r[4]/w:rPr[1]/w:shadow[1]"_ostr);
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf158855)
+{
+// Given a table immediately followed by a section break
+load(createFileURL(u"section_break_after_table.docx"));
+
+// Check that the import doesn't produce an extra empty paragraph before a 
page break
+CPPUNIT_ASSERT_EQUAL(2, getPages()); // was 3
+CPPUNIT_ASSERT_EQUAL(2, getParagraphs()); // was 3
+uno::Reference(getParagraphOrTable(1), 
uno::UNO_QUERY_THROW);
+getParagraph(2, u"Next page"_ustr); // was empty, with the 3rd being "Next 
page"
+
+saveAndReload(mpFilter);
+
+CPPUNIT_ASSERT_EQUAL(2, getPages());
+CPPUNIT_ASSERT_EQUAL(2, getParagraphs());
+uno::Reference(getParagraphOrTable(1), 
uno::UNO_QUERY_THROW);
+getParagraph(2, u"Next page"_ustr);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
index 158b8f61d873..10fd87ebec2c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -756,7 +756,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo53985, "fdo53985.docx")
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Section3 is protected", false, 
getProperty(xSect, "IsProtected"));
 
 // T

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

2023-12-28 Thread Justin Luth (via logerrit)
 sw/qa/extras/rtfexport/data/tdf158826_extraCR.rtf |   23 ++
 sw/qa/extras/rtfexport/rtfexport8.cxx |   14 +
 writerfilter/source/rtftok/rtfdispatchflag.cxx|4 ++-
 3 files changed, 40 insertions(+), 1 deletion(-)

New commits:
commit 8d37b8e6430715860934ccaec8c0d1b448ac4d8c
Author: Justin Luth 
AuthorDate: Wed Dec 27 18:58:33 2023 -0500
Commit: Justin Luth 
CommitDate: Fri Dec 29 03:44:03 2023 +0100

tdf#158826 rtfimport: ignore page break before document starts

This avoids a 24.2 exposed bug from my
commit 016f779ee6c7f601be3ae19dc57497e63a5bf817

RTF import simply cannot be relied upon to create paragraphs
where they need to be. A side effect of fixing frames
is that spurious paragraphs can be created,
and if a frame starts the document, then an otherwise
ignored page break can be attached to the second paragraph
and thus become exposed.

This seems pretty much like the RTF implementation of
what was done for DOC and DOCX for tdf#118711.
At least it is related.

make CppunitTest_sw_rtfexport8 CPPUNIT_TEST_NAME=testTdf158826_extraCR

The following unit tests trigger this code (with no visible change)
abi10076.odt  tdf121623.rtf  tdf129513.rtf  tdf131963.docx

Change-Id: I21afa826b6f6fbb735591603a0620b8b47de517e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161374
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161395

diff --git a/sw/qa/extras/rtfexport/data/tdf158826_extraCR.rtf 
b/sw/qa/extras/rtfexport/data/tdf158826_extraCR.rtf
new file mode 100644
index ..5461327da3ca
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf158826_extraCR.rtf
@@ -0,0 +1,23 @@
+{
tf1
+\landscape\paperh5953\paperw8391\margl720\margr720\margt432\margb1728\gutter0\ltrsect
+
+
+\pagebb
+\intbl
+\pvpg\phpg
+
+\posx720\posy432
+\dxfrtext187\dfrmtxtx187\dfrmtxty0
+\wraparoundspalphaspnum
+aautodjustright
+
in0\lin0bsnoovrlp1\pararsid5332093\yts39
+
+
+\shp
+
+
+a +++
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport8.cxx 
b/sw/qa/extras/rtfexport/rtfexport8.cxx
index f8d800380cba..9848d0573db8 100644
--- a/sw/qa/extras/rtfexport/rtfexport8.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport8.cxx
@@ -36,6 +36,8 @@
 
 using namespace css;
 
+namespace
+{
 class Test : public SwModelTestBase
 {
 public:
@@ -84,6 +86,18 @@ DECLARE_RTFEXPORT_TEST(testTdf158586_lostFrame, 
"tdf158586_lostFrame.rtf")
 // CPPUNIT_ASSERT_EQUAL(2, getPages());
 }
 
+DECLARE_RTFEXPORT_TEST(testTdf158826_extraCR, "tdf158826_extraCR.rtf")
+{
+// Note: this is a hand-minimized sample, and very likely doesn't follow 
RTF { } rules...
+
+// The page break defined before the document content should not cause a 
page break
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+// There is a two-column floating table [that SHOULD be 
getParagraphOrTable(1)]
+uno::Reference xTable(getParagraphOrTable(2), 
uno::UNO_QUERY_THROW);
+}
+
+} // end of anonymous namespace
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx 
b/writerfilter/source/rtftok/rtfdispatchflag.cxx
index 72c777aab1fb..753f1c3fbba9 100644
--- a/writerfilter/source/rtftok/rtfdispatchflag.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx
@@ -520,7 +520,9 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
 }
 break;
 case RTFKeyword::PAGEBB:
-nParam = NS_ooxml::LN_CT_PPrBase_pageBreakBefore;
+// ignore a page break that is defined before the document content 
has even started
+if (!m_bFirstRun)
+nParam = NS_ooxml::LN_CT_PPrBase_pageBreakBefore;
 break;
 default:
 break;


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

2023-12-19 Thread Justin Luth (via logerrit)
 sw/qa/extras/rtfimport/data/fdo52052.rtf |2 +-
 writerfilter/source/rtftok/rtfdispatchsymbol.cxx |2 +-
 writerfilter/source/rtftok/rtfdocumentimpl.cxx   |6 ++
 writerfilter/source/rtftok/rtfdocumentimpl.hxx   |5 ++---
 4 files changed, 6 insertions(+), 9 deletions(-)

New commits:
commit 7abb319821e641599f92e5f4ad2d7c0e377851fa
Author: Justin Luth 
AuthorDate: Mon Dec 18 12:29:25 2023 -0500
Commit: Xisco Fauli 
CommitDate: Tue Dec 19 16:54:28 2023 +0100

tdf#158586 RTF writerfilter: substitute hasProperties for inFrame

A proper inFrame() would be identical to hasProperties,
so just substitute the existing, complete function for inFrame.

This is based on a code read, not a problem document,
but finding a document that depended on inFrame
returning true made it trivial to modify it to fail.

Somewhat surprisingly, it made it all the way through
the rtfexports without failing.

make CppunitTest_sw_rtfimport CPPUNIT_TEST_NAME=testFdo52052

Change-Id: I96f00c9b542dabd3709a896d778569b7681c8f19
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160928
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160984

diff --git a/sw/qa/extras/rtfimport/data/fdo52052.rtf 
b/sw/qa/extras/rtfimport/data/fdo52052.rtf
index e58a64bd43f6..8ae92383c443 100644
--- a/sw/qa/extras/rtfimport/data/fdo52052.rtf
+++ b/sw/qa/extras/rtfimport/data/fdo52052.rtf
@@ -13,7 +13,7 @@
 {\pard \pvpg\phpg\posx2007\posy597\absw12870\absh-900\fi0 \ltrpar\qc first
 \par }
 \page\sect 
-{\pard \pvpg\phpg\posx13152\posy612\absw2984\absh-210\fi0 
\ltrpar\qr\tx360\tx720\tx1080\tx1440\tx1800\tx2160\tx2520\tx2880
+{\pard \pvpg\phpg \posxc\posyc \fi0 
\ltrpar\qr\tx360\tx720\tx1080\tx1440\tx1800\tx2160\tx2520\tx2880
 {\ltrch\f0 \b\i0\ul0\strike0\fs15 \cf1 second}
 \par }
 \page\sect 
diff --git a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx 
b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
index 61499aac04b5..aa1360f6dc55 100644
--- a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
@@ -124,7 +124,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword 
nKeyword)
 }
 // but don't emit properties yet, since they may change till the 
first text token arrives
 m_bNeedPap = true;
-if (!m_aStates.top().getFrame().inFrame())
+if (!m_aStates.top().getFrame().hasProperties())
 m_bNeedPar = false;
 m_bNeedFinalPar = false;
 }
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index dc4bca02d73b..1d0c2d7dde4c 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1337,8 +1337,6 @@ RTFError RTFDocumentImpl::resolveChars(char ch)
 return RTFError::OK;
 }
 
-bool RTFFrame::inFrame() const { return m_nW > 0 || m_nH > 0 || m_nX > 0 || 
m_nY > 0; }
-
 void RTFDocumentImpl::singleChar(sal_uInt8 nValue, bool bRunProps)
 {
 sal_uInt8 sValue[] = { nValue };
@@ -2952,7 +2950,7 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& 
rState)
 case Destination::SHAPE:
 m_bNeedFinalPar = true;
 m_bNeedCr = m_bNeedCrOrig;
-if (rState.getFrame().inFrame())
+if (rState.getFrame().hasProperties())
 {
 // parBreak() modifies m_aStates.top() so we can't apply 
resetFrame() directly on aState
 resetFrame();
@@ -3615,7 +3613,7 @@ RTFError RTFDocumentImpl::popState()
 
 checkUnicode(/*bUnicode =*/true, /*bHex =*/true);
 RTFParserState aState(m_aStates.top());
-m_bWasInFrame = aState.getFrame().inFrame();
+m_bWasInFrame = aState.getFrame().hasProperties();
 
 // dmapper expects some content in header/footer, so if there would be 
nothing, add an empty paragraph.
 if (m_pTokenizer->getGroup() == 1 && m_bFirstRun)
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 091739888089..eb50e3c7e088 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -384,9 +384,8 @@ public:
 RTFSprms getSprms();
 /// Store a property
 void setSprm(Id nId, Id nValue);
-bool hasProperties() const;
 /// If we got tokens indicating we're in a frame.
-bool inFrame() const;
+bool hasProperties() const;
 };
 
 /// State of the parser, which gets saved / restored when changing groups.
@@ -967,7 +966,7 @@ private:
 RTFKeyword m_nResetBreakOnSectBreak;
 /// If a section break is needed before the end of the doc (false right 
after a section break).
 bool m_bNeedSect;
-/// If aFrame.inFrame() was true in the previous state.
+  

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

2023-12-13 Thread Justin Luth (via logerrit)
 dev/null  |binary
 sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak3.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx|   20 
+++---
 writerfilter/source/dmapper/DomainMapper.cxx  |   16 

 4 files changed, 14 insertions(+), 22 deletions(-)

New commits:
commit de773a115c25c36993f5bb5a463ea5db452b5be5
Author: Justin Luth 
AuthorDate: Wed Dec 13 16:09:52 2023 -0500
Commit: Justin Luth 
CommitDate: Thu Dec 14 02:55:31 2023 +0100

tdf#158681 Revert "tdf#153613 writerfilter: don't always split para

... for shape w/ pagebreak"

This reverts 7.6 commit a9bc19c2d4a35606668aa2dcc53355651b71ee78.

The commit in general is probably fine. However, it fails in case
of an empty paragraph (with only anchors).
Unfortunately, there is no way of knowing ahead of time,
so either everything needs to be processed after a delay,
or else the paragraph needs to be split and then re-joined
in case it is not an empty paragraph.
Both options are extremely non-trivial - I don't know how
to do either of them.

In this case it is also the last paragraph in the document,
again something not known during import and which has
special-casing in MSO.

make CppunitTest_sw_ooxmlexport18 \
CPPUNIT_TEST_NAME=testTdf153613_textboxAfterPgBreak3

Change-Id: I4471e216b6523032b85178d85795434694cc1e22
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160720
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit d58cd70f550e8967c2518ebb2179e15f5a3a84ea)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160695

diff --git a/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak.docx 
b/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak.docx
deleted file mode 100644
index 4ad4dfba8110..
Binary files a/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak.docx 
and /dev/null differ
diff --git a/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak2.docx 
b/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak2.docx
deleted file mode 100644
index 26006abd2fe3..
Binary files 
a/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak2.docx and 
/dev/null differ
diff --git a/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak3.docx 
b/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak3.docx
new file mode 100644
index ..29c63ad71ed3
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak3.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
index de52a56ff0d2..967a4f24183e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -357,26 +357,18 @@ 
DECLARE_OOXMLEXPORT_TEST(testTdf153613_inlineAfterPgBreak2, "tdf153613_inlineAft
 assertXPath(pLayout, "//page[2]//anchored"_ostr, 1);
 }
 
-DECLARE_OOXMLEXPORT_TEST(testTdf153613_textboxAfterPgBreak, 
"tdf153613_textboxAfterPgBreak.docx")
+DECLARE_OOXMLEXPORT_TEST(testTdf153613_sdtAfterPgBreak, 
"tdf153613_sdtAfterPgBreak.docx")
 {
-CPPUNIT_ASSERT_EQUAL(3, getParagraphs());
-
-const auto& pLayout = parseLayoutDump();
-assertXPathContent(pLayout, "//page[2]/body/txt"_ostr, "There should be no 
prior carriage return.");
+CPPUNIT_ASSERT_EQUAL(2, getPages());
 }
 
-DECLARE_OOXMLEXPORT_TEST(testTdf153613_textboxAfterPgBreak2, 
"tdf153613_textboxAfterPgBreak2.docx")
+DECLARE_OOXMLEXPORT_TEST(testTdf153613_textboxAfterPgBreak3, 
"tdf153613_textboxAfterPgBreak3.docx")
 {
-// same as previous example, except that it is the first paragraph in the 
section.
-CPPUNIT_ASSERT_EQUAL(2, getParagraphs());
+// both textboxes on on the second (last) page
+CPPUNIT_ASSERT_EQUAL(2, getPages());
 
 const auto& pLayout = parseLayoutDump();
-assertXPathContent(pLayout, "//page[2]/body/txt"_ostr, "There should be no 
prior carriage return.");
-}
-
-DECLARE_OOXMLEXPORT_TEST(testTdf153613_sdtAfterPgBreak, 
"tdf153613_sdtAfterPgBreak.docx")
-{
-CPPUNIT_ASSERT_EQUAL(2, getPages());
+assertXPath(pLayout, "//page[2]/body/txt/anchored/fly"_ostr, 2);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTdf153964_topMarginAfterBreak14, 
"tdf153964_topMarginAfterBreak14.docx")
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 70fc7820844c..98d763b709b6 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3744,14 +3744,14 @@ void 
DomainMapper::lcl_startShape(uno::Reference const& xShape)
 // started shape will be on the correct page.
 if (m_pImpl->isBreakDeferred(PAGE_BREAK))
 {
-// RTF doesn't properly report IsFirstRun, so in order to prevent 
regression