core.git: sw/qa sw/source

2024-07-25 Thread Xisco Fauli (via logerrit)
 sw/qa/filter/ascii/ascii.cxx   |   37 +
 sw/qa/filter/ascii/data/tdf162180.docx |binary
 sw/source/filter/ascii/wrtasc.cxx  |4 ++-
 3 files changed, 40 insertions(+), 1 deletion(-)

New commits:
commit 145c606d01e0ee673dee69271477155fef6aa81b
Author: Xisco Fauli 
AuthorDate: Thu Jul 25 13:12:09 2024 +0200
Commit: Xisco Fauli 
CommitDate: Thu Jul 25 21:42:00 2024 +0200

tdf#162180: GetTableBox might return nullptr

Change-Id: I31091b5bd06ba30a2e9bbddad66c5c597b22a6fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171007
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/filter/ascii/ascii.cxx b/sw/qa/filter/ascii/ascii.cxx
index db581043fb0e..bdcf1a142273 100644
--- a/sw/qa/filter/ascii/ascii.cxx
+++ b/sw/qa/filter/ascii/ascii.cxx
@@ -147,6 +147,43 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf144576_ascii)
 // left spot available
 CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testTdf162180)
+{
+createSwDoc("tdf162180.docx");
+SwDoc* pDoc = getSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+// Select the whole table
+dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {});
+dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {});
+dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {});
+
+// Without the fix in place, this test would have crashed here
+rtl::Reference xTransferable(new 
SwTransferable(*pWrtShell));
+xTransferable->Copy(); // Ctl-C
+xTransferable.get();
+
+// Get the plain text version of the selection
+datatransfer::DataFlavor aFlavor;
+aFlavor.MimeType = "text/plain;charset=utf-16";
+aFlavor.DataType = cppu::UnoType::get();
+uno::Any aData = xTransferable->getTransferData(aFlavor);
+CPPUNIT_ASSERT(aData.hasValue());
+
+OUString aActual;
+aData >>= aActual;
+
+#if !defined(_WIN32) //FIXME
+OUString aExpected
+= u"2010   2011"_ustr SAL_NEWLINE_STRING u"All Projects"_ustr 
SAL_NEWLINE_STRING u"Pending "_ustr SAL_NEWLINE_STRING u"USA West
Approved"_ustr SAL_NEWLINE_STRING u"Central Pending"_ustr 
SAL_NEWLINE_STRING u" EastApproved"_ustr;
+#else
+OUString aExpected
+= u"2010   2011"_ustr SAL_NEWLINE_STRING u"All Projects
Pending "_ustr SAL_NEWLINE_STRING u"USA WestApproved"_ustr 
SAL_NEWLINE_STRING u"Central Pending"_ustr SAL_NEWLINE_STRING u" East   
 Approved"_ustr;
+#endif
+
+CPPUNIT_ASSERT_EQUAL(aExpected, aActual.trim());
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/qa/filter/ascii/data/tdf162180.docx 
b/sw/qa/filter/ascii/data/tdf162180.docx
new file mode 100644
index ..4ac1730e275e
Binary files /dev/null and b/sw/qa/filter/ascii/data/tdf162180.docx differ
diff --git a/sw/source/filter/ascii/wrtasc.cxx 
b/sw/source/filter/ascii/wrtasc.cxx
index 39f5ec9cfb91..af08a2771c99 100644
--- a/sw/source/filter/ascii/wrtasc.cxx
+++ b/sw/source/filter/ascii/wrtasc.cxx
@@ -242,7 +242,9 @@ void SwASCWriter::WriteTable(SwTableNode* pTableNd, 
SwTextNode* pNd)
 {
 Out( aASCNodeFnTab, *pNd, *this );
 
-Point aPrevBoxPoint = pNd->GetTableBox()->GetCoordinates();
+Point aPrevBoxPoint;
+if (const SwTableBox* pPrevBox = pNd->GetTableBox())
+aPrevBoxPoint = pPrevBox->GetCoordinates();
 m_pCurrentPam->Move(fnMoveForward, GoInNode);
 pNd = m_pCurrentPam->GetPoint()->GetNode().GetTextNode();
 


core.git: sw/qa

2024-07-25 Thread Xisco Fauli (via logerrit)
 sw/qa/extras/htmlexport/htmlexport.cxx |   49 +
 1 file changed, 14 insertions(+), 35 deletions(-)

New commits:
commit 94b8f312528d2e7737381a957399c97eed81b5c1
Author: Xisco Fauli 
AuthorDate: Thu Jul 25 19:54:47 2024 +0200
Commit: Xisco Fauli 
CommitDate: Thu Jul 25 20:54:17 2024 +0200

CppunitTest_sw_htmlexport: simplify a bit

Change-Id: I7091c59583b7fadd5504567c4dcadde844b02b9d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171049
Reviewed-by: Xisco Fauli 
Tested-by: Jenkins

diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index b39d02a8ff86..a7878823f63b 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -24,7 +24,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
@@ -261,11 +260,10 @@ void SwHtmlDomExportTest::ExportToReqif()
 
 void SwHtmlDomExportTest::ExportToHTML()
 {
-uno::Reference xStorable(mxComponent, uno::UNO_QUERY);
 uno::Sequence aStoreProperties = {
 comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML 
(StarWriter)"_ustr),
 };
-xStorable->storeToURL(maTempFile.GetURL(), aStoreProperties);
+saveWithParams(aStoreProperties);
 }
 
 void SwHtmlDomExportTest::ImportFromReqif(const OUString& rUrl)
@@ -274,7 +272,7 @@ void SwHtmlDomExportTest::ImportFromReqif(const OUString& 
rUrl)
 comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML 
(StarWriter)"_ustr),
 comphelper::makePropertyValue(u"FilterOptions"_ustr, 
u"xhtmlns=reqif-xhtml"_ustr),
 };
-mxComponent = loadFromDesktop(rUrl, 
u"com.sun.star.text.TextDocument"_ustr, aLoadProperties);
+loadWithParams(rUrl, aLoadProperties);
 }
 
 CPPUNIT_TEST_FIXTURE(HtmlExportTest, testFdo81276)
@@ -803,14 +801,12 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIfPngImg)
 
 ImportFromReqif(createFileURL(u"reqif-png-img.xhtml"));
 verify(/*bExported=*/false);
-uno::Reference xStorable(mxComponent, uno::UNO_QUERY);
 uno::Sequence aStoreProperties = {
 comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML 
(StarWriter)"_ustr),
 comphelper::makePropertyValue(u"FilterOptions"_ustr, 
u"xhtmlns=reqif-xhtml"_ustr),
 comphelper::makePropertyValue(u"ExportImagesAsOLE"_ustr, true),
 };
-xStorable->storeToURL(maTempFile.GetURL(), aStoreProperties);
-mxComponent->dispose();
+saveWithParams(aStoreProperties);
 ImportFromReqif(maTempFile.GetURL());
 verify(/*bExported=*/true);
 }
@@ -1046,13 +1042,12 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, 
testTransparentImage)
 CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTransparentImageReqIf)
 {
 createSwDoc("transparent-image.odt");
-uno::Reference xStorable(mxComponent, uno::UNO_QUERY);
 uno::Sequence aStoreProperties = {
 comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML 
(StarWriter)"_ustr),
 comphelper::makePropertyValue(u"FilterOptions"_ustr, 
u"xhtmlns=reqif-xhtml"_ustr),
 comphelper::makePropertyValue(u"ExportImagesAsOLE"_ustr, true),
 };
-xStorable->storeToURL(maTempFile.GetURL(), aStoreProperties);
+saveWithParams(aStoreProperties);
 xmlDocUniquePtr pDoc = WrapReqifFromTempFile();
 
 OUString aSource = getXPath(
@@ -1184,13 +1179,12 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testRTFOLEMimeType)
 ImportFromReqif(createFileURL(u"reqif-ole-data.xhtml"));
 
 // Export it.
-uno::Reference xStorable(mxComponent, uno::UNO_QUERY);
 uno::Sequence aStoreProperties = {
 comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML 
(StarWriter)"_ustr),
 comphelper::makePropertyValue(u"FilterOptions"_ustr, 
u"xhtmlns=reqif-xhtml"_ustr),
 comphelper::makePropertyValue(u"RTFOLEMimeType"_ustr, aType),
 };
-xStorable->storeToURL(maTempFile.GetURL(), aStoreProperties);
+saveWithParams(aStoreProperties);
 xmlDocUniquePtr pDoc = WrapReqifFromTempFile();
 
 // Without the accompanying fix in place, this test would have failed with:
@@ -1294,8 +1288,6 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testReqifOle1PDF)
 CPPUNIT_ASSERT_EQUAL(static_cast(0x99ed), 
aOle1Reader.m_nNativeDataSize);
 
 // Now import this back and check the ODT result.
-mxComponent->dispose();
-mxComponent.clear();
 ImportFromReqif(maTempFile.GetURL());
 save(u"writer8"_ustr);
 uno::Reference xNameAccess
@@ -1366,13 +1358,12 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testReqifOle1PaintBitmapFormat)
 createSwDoc("paint-ole-bitmap-format.odt");
 
 // When exporting to reqif-xhtml with ExportImagesAsOLE enabled:
-uno::Reference xStorable(mxComponent, uno::UNO_QUERY);
 uno::Sequence aStoreProperties = {
 comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML 
(StarWriter)"_ustr),
 comphelper::makePropertyValue(u"FilterOptions"_ustr, 
u"xhtmlns=reqif-xhtml"_ustr),
 

core.git: sw/qa

2024-07-25 Thread Stephan Bergmann (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit e6d98900a9b035e616083416302759a28acdeb26
Author: Stephan Bergmann 
AuthorDate: Thu Jul 25 12:49:37 2024 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Jul 25 14:59:42 2024 +0200

-Werror,-Wunused-variable

...in code newly introduced in 62974cf6a8148377091cb709e7e00dacac152093
"tdf#158661 docx import plaintext sdt: remove unnecessary goRight"

Change-Id: I8d05c4936cdf17d2c819f8ab93ddab3ba6bfdc61
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171005
Reviewed-by: Stephan Bergmann 
Tested-by: Jenkins

diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index ec0037196a3c..5b5010ecb750 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -481,7 +481,6 @@ CPPUNIT_TEST_FIXTURE(Test, testParagraphSdt)
 CPPUNIT_ASSERT_EQUAL(u"ContentControl"_ustr, aPortionType);
 uno::Reference xContentControl;
 xTextPortion->getPropertyValue(u"ContentControl"_ustr) >>= xContentControl;
-uno::Reference xContentControlProps(xContentControl, 
uno::UNO_QUERY);
 uno::Reference 
xContentControlEnumAccess(xContentControl, uno::UNO_QUERY);
 uno::Reference xContentControlEnum = 
xContentControlEnumAccess->createEnumeration();
 uno::Reference 
xTextPortionRange(xContentControlEnum->nextElement(), uno::UNO_QUERY);


core.git: sw/qa sw/source

2024-07-25 Thread Jonathan Clark (via logerrit)
 sw/qa/extras/layout/data/tdf157829-ltr.fodt |  123 
 sw/qa/extras/layout/data/tdf157829-rtl.fodt |  122 +++
 sw/qa/extras/layout/layout3.cxx |   28 ++
 sw/source/core/text/pormulti.cxx|   54 ++--
 4 files changed, 303 insertions(+), 24 deletions(-)

New commits:
commit 04184aa7e3aada8f4d938d20dfdb54b3a7dd3896
Author: Jonathan Clark 
AuthorDate: Thu Jul 18 08:40:16 2024 -0600
Commit: Jonathan Clark 
CommitDate: Thu Jul 25 14:23:35 2024 +0200

tdf#157829 sw: Implemented line break underflow for bidi portions

Previously, bidi portions did not handle underflow in word wrapping.
This caused bidi portions to break at format changes during wrapping,
instead of backtracking to a valid break opportunity.

Change-Id: Ib86effe2642a9d133242c28538026d9b4a7e90e9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171006
Tested-by: Jenkins
Reviewed-by: Jonathan Clark 

diff --git a/sw/qa/extras/layout/data/tdf157829-ltr.fodt 
b/sw/qa/extras/layout/data/tdf157829-ltr.fodt
new file mode 100644
index ..c65ddea3f588
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf157829-ltr.fodt
@@ -0,0 +1,123 @@
+
+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">
+ Lior 
Kaplan2012-10-25T19:53:272024-07-17T09:23:21.008633324PT9M55S14LibreOfficeDev/25.2.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/aa938fe03cfb968f7f4ed9760dcbe579a74bdc02
+ 
+  
+  
+  
+  
+  
+  
+ 
+  
+   
+   
+
+   
+   
+  
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+  
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+  
+  
+  
+  
+  
+ 
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+
+   
+   
+   
+  
+  
+   
+  
+ 
+ 
+  
+ 
+ 
+  
+   
+
+
+
+
+
+   
+   English English English עברית 
English
+  
+ 
+
\ No newline at end of file
diff --git a/sw/qa/extras/layout/data/tdf157829-rtl.fodt 
b/sw/qa/extras/layout/data/tdf157829-rtl.fodt
new file mode 100644
index ..96ddbbb3ed04
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf157829-rtl.fodt
@@ -0,0 +1,122 @@
+
+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" 

core.git: sw/qa sw/source

2024-07-24 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf138093B.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport19.cxx|   37 ++
 sw/source/writerfilter/dmapper/SdtHelper.cxx  |3 +-
 3 files changed, 39 insertions(+), 1 deletion(-)

New commits:
commit 3974c4748b9a2bcd054e0b9f9e3d42bdca45bef2
Author: Justin Luth 
AuthorDate: Tue Jul 23 20:57:37 2024 -0400
Commit: Justin Luth 
CommitDate: Wed Jul 24 13:52:00 2024 +0200

tdf#138093 tdf#131722 docx import: sdt lost first date character #2

While GetIsDummyParaAddedForTableInSection() is true
for the entire section, it should only be used
against GetIsFirstParagraphInSection()
where the dummy para exists.

make CppunitTest_sw_ooxmlexport19 CPPUNIT_TEST_NAME=testTdf138093B

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

diff --git a/sw/qa/extras/ooxmlexport/data/tdf138093B.docx 
b/sw/qa/extras/ooxmlexport/data/tdf138093B.docx
new file mode 100644
index ..f6f770a7160e
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf138093B.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx
index 8080bd448a55..dc2a291234c3 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx
@@ -977,6 +977,43 @@ DECLARE_OOXMLEXPORT_TEST(testTdf138093, "tdf138093.docx")
 }
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf138093B)
+{
+loadAndReload("tdf138093B.docx");
+
+xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr);
+assertXPath(pXmlDoc, "//w:sdt"_ostr, 3);
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTablesSupplier->getTextTables(),
+uno::UNO_QUERY);
+uno::Reference xTable(xTables->getByIndex(1), 
uno::UNO_QUERY);
+uno::Reference xCell = xTable->getCellByName(u"A1"_ustr);
+uno::Reference xParagraphsAccess(xCell, 
uno::UNO_QUERY);
+uno::Reference xParagraphs = 
xParagraphsAccess->createEnumeration();
+uno::Reference 
xParagraph(xParagraphs->nextElement(),
+ uno::UNO_QUERY);
+uno::Reference xPortions = 
xParagraph->createEnumeration();
+uno::Reference xTextPortion(xPortions->nextElement(), 
uno::UNO_QUERY);
+
+OUString aPortionType;
+xTextPortion->getPropertyValue(u"TextPortionType"_ustr) >>= aPortionType;
+CPPUNIT_ASSERT_EQUAL(u"ContentControl"_ustr, aPortionType);
+
+uno::Reference xContentControl;
+xTextPortion->getPropertyValue(u"ContentControl"_ustr) >>= xContentControl;
+uno::Reference xContentControlProps(xContentControl, 
uno::UNO_QUERY);
+bool bDate{};
+xContentControlProps->getPropertyValue(u"Date"_ustr) >>= bDate;
+CPPUNIT_ASSERT(bDate);
+uno::Reference 
xContentControlEnumAccess(xContentControl,
+
uno::UNO_QUERY);
+uno::Reference xContentControlEnum
+= xContentControlEnumAccess->createEnumeration();
+uno::Reference 
xTextPortionRange(xContentControlEnum->nextElement(),
+   uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(u"2019"_ustr, xTextPortionRange->getString());
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf131722, "tdf131722.docx")
 {
 if (isExported())
diff --git a/sw/source/writerfilter/dmapper/SdtHelper.cxx 
b/sw/source/writerfilter/dmapper/SdtHelper.cxx
index 7687843e7ae3..6f72f3cbab9c 100644
--- a/sw/source/writerfilter/dmapper/SdtHelper.cxx
+++ b/sw/source/writerfilter/dmapper/SdtHelper.cxx
@@ -459,7 +459,8 @@ void SdtHelper::createDateContentControl()
 // Modified to XOR relationship and adding dummy paragraph conditions
 bool bIsInTable = (m_rDM_Impl.hasTableManager() && 
m_rDM_Impl.getTableManager().isInTable())
   != (0 < 
m_rDM_Impl.m_StreamStateStack.top().nTableDepth)
-  && m_rDM_Impl.GetIsDummyParaAddedForTableInSection();
+  && m_rDM_Impl.GetIsDummyParaAddedForTableInSection()
+  && m_rDM_Impl.GetIsFirstParagraphInSection();
 if (bIsInTable)
 xCrsr->goRight(1, false);
 xCrsr->gotoEnd(true);


core.git: sw/qa sw/source

2024-07-24 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf158661_blockSDT.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |   62 ++
 sw/source/writerfilter/dmapper/SdtHelper.cxx  |5 -
 3 files changed, 62 insertions(+), 5 deletions(-)

New commits:
commit 62974cf6a8148377091cb709e7e00dacac152093
Author: Justin Luth 
AuthorDate: Tue Jul 23 20:23:40 2024 -0400
Commit: Justin Luth 
CommitDate: Wed Jul 24 13:50:55 2024 +0200

tdf#158661 docx import plaintext sdt: remove unnecessary goRight

This fixes a 24.2 regression
from commit 5082d50d24c3fec4487c724a15eb0d54a82ecd0d
   writerfilter: use content controls for text in block SDTs

which was made even worse
with 24.2 commit 7c4dba1deffd81f647a4a3be7a79f68f3bf9f1ba.

Initially, the starting mark was made as soon as SdtContent was seen.
After that, you could get a w:tbl, or a w:tc which could trigger
the start of a table, and potentially add a dummy paragraph
which needed to be jumped over (at least for the first SDT,
but not for subsequent SDTs).

In the second patch, the starting mark was made just before
the text was appended, so all of the cell/table creation
has already been completed, so there is no more need to
jump over any dummy paragraphs, even for the first table.

Affected unit tests were
- table-start-2-sdt.docx
- sdt-company-multipara.docx
- paragraph-sdt.docx

make CppunitTest_sw_ooxmlfieldexport CPPUNIT_TEST_NAME=testParagraphSdt
make CppunitTest_sw_ooxmlfieldexport \
CPPUNIT_TEST_NAME=testTdf158661_blockSDT

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

diff --git a/sw/qa/extras/ooxmlexport/data/tdf158661_blockSDT.docx 
b/sw/qa/extras/ooxmlexport/data/tdf158661_blockSDT.docx
new file mode 100644
index ..644c67c1e2a0
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf158661_blockSDT.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index a6346350f6b8..ec0037196a3c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -465,6 +465,68 @@ CPPUNIT_TEST_FIXTURE(Test, testParagraphSdt)
 xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr);
 // The path to w:sdt contained a w:p.
 assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:p/w:sdt"_ostr);
+
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
+uno::Reference xTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+uno::Reference xCell = xTable->getCellByName(u"A1"_ustr);
+uno::Reference xParagraphsAccess(xCell, 
uno::UNO_QUERY);
+uno::Reference xParagraphs = 
xParagraphsAccess->createEnumeration();
+uno::Reference 
xParagraph(xParagraphs->nextElement(),
+uno::UNO_QUERY);
+uno::Reference xPortions = 
xParagraph->createEnumeration();
+uno::Reference xTextPortion(xPortions->nextElement(), 
uno::UNO_QUERY);
+OUString aPortionType;
+xTextPortion->getPropertyValue(u"TextPortionType"_ustr) >>= aPortionType;
+CPPUNIT_ASSERT_EQUAL(u"ContentControl"_ustr, aPortionType);
+uno::Reference xContentControl;
+xTextPortion->getPropertyValue(u"ContentControl"_ustr) >>= xContentControl;
+uno::Reference xContentControlProps(xContentControl, 
uno::UNO_QUERY);
+uno::Reference 
xContentControlEnumAccess(xContentControl, uno::UNO_QUERY);
+uno::Reference xContentControlEnum = 
xContentControlEnumAccess->createEnumeration();
+uno::Reference 
xTextPortionRange(xContentControlEnum->nextElement(), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(u"Android Security Final Design Report"_ustr, 
xTextPortionRange->getString());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testTdf158661_blockSDT)
+{
+loadAndReload("tdf158661_blockSDT.docx");
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
+uno::Reference xTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+uno::Reference xCell = xTable->getCellByName(u"A1"_ustr);
+uno::Reference xParagraphsAccess(xCell, 
uno::UNO_QUERY);
+uno::Reference xParagraphs = 
xParagraphsAccess->createEnumeration();
+uno::Reference 
xParagraph(xParagraphs->nextElement(),
+uno::UNO_QUERY);
+uno::Reference xPortions = 
xParagraph->createEnumeration();
+uno::Reference xTextPortion(xPortions->nextElement(), 
uno::UNO_QUERY);
+OUString aPortionType;
+xTextPortion->getPropertyValue(u"TextPortionType"_ustr) >>= aPortionType;
+

core.git: sw/qa sw/source

2024-07-23 Thread Jim Raykowski (via logerrit)
 sw/qa/uitest/writer_tests/trackedChanges.py |2 
 sw/source/uibase/misc/redlndlg.cxx  |   71 ++--
 2 files changed, 48 insertions(+), 25 deletions(-)

New commits:
commit 863b90e33c4b9964a697684887aeb42cc538b019
Author: Jim Raykowski 
AuthorDate: Sun Jul 21 09:44:57 2024 -0800
Commit: Jim Raykowski 
CommitDate: Tue Jul 23 18:11:28 2024 +0200

Resolves tdf#162018 Unexpected loss in focus in the "Manage Changes"

window when adding a change in the document (Track changes mode),
round 3

Done to address loss of selection when an entry is added to the
beginning of the changes list. The patch reworks round 1 and 2 to
handle any entry insert position. It also keeps the selected entry
selected after a sort by document order.

Change-Id: Icb6f6b6b80ad9ddc5d008a00d195ceb7c1d6dc3f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170828
Tested-by: Jenkins
Reviewed-by: Jim Raykowski 

diff --git a/sw/qa/uitest/writer_tests/trackedChanges.py 
b/sw/qa/uitest/writer_tests/trackedChanges.py
index 93b2374ed820..d013be0343e3 100644
--- a/sw/qa/uitest/writer_tests/trackedChanges.py
+++ b/sw/qa/uitest/writer_tests/trackedChanges.py
@@ -289,6 +289,8 @@ class trackedchanges(UITestCase):
 # Now: 4 changes (2 deleted/inserted rows and 2 
deleted/inserted tables)
 self.assertEqual(4, len(changesList.getChildren()))
 
+changesList.getChild(0).executeAction("SELECT", tuple())
+
 # jump to the parent to allow rejecting the table change
 changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"LEFT"}))
 
diff --git a/sw/source/uibase/misc/redlndlg.cxx 
b/sw/source/uibase/misc/redlndlg.cxx
index 5bbac52db74d..3c66afd1a2e1 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -144,6 +144,48 @@ SwModelessRedlineAcceptDlg::~SwModelessRedlineAcceptDlg()
 mbInDestruction = true;
 }
 
+namespace
+{
+const SwRedlineData* lcl_get_selected_redlinedata(weld::TreeView& rTreeView)
+{
+std::unique_ptr xEntry(rTreeView.make_iterator());
+if (rTreeView.get_selected(xEntry.get()))
+{
+RedlinData* pRedlinData = 
weld::fromId(rTreeView.get_id(*xEntry));
+if (rTreeView.get_iter_depth(*xEntry))
+return 
static_cast(pRedlinData->pData)->pChild;
+else
+return 
static_cast(pRedlinData->pData)->pData;
+}
+return nullptr;
+}
+
+void lcl_reselect(weld::TreeView& rTreeView, const SwRedlineData* 
pSelectedEntryRedlineData)
+{
+if (!pSelectedEntryRedlineData)
+{
+rTreeView.set_cursor(-1);
+return;
+}
+rTreeView.all_foreach(
+[, ](weld::TreeIter& rIter)
+{
+RedlinData* pRedlinData = 
weld::fromId(rTreeView.get_id(rIter));
+const SwRedlineData* pRedlineData;
+if (rTreeView.get_iter_depth(rIter))
+pRedlineData = 
static_cast(pRedlinData->pData)->pChild;
+else
+pRedlineData = 
static_cast(pRedlinData->pData)->pData;
+if (pRedlineData == pSelectedEntryRedlineData)
+{
+rTreeView.set_cursor(rIter);
+return true;
+}
+return false;
+});
+}
+}
+
 SwRedlineAcceptDlg::SwRedlineAcceptDlg(std::shared_ptr xParent, 
weld::Builder *pBuilder,
weld::Container *pContentArea, bool 
bAutoFormat)
 : m_xParentDlg(std::move(xParent))
@@ -230,13 +272,7 @@ void SwRedlineAcceptDlg::Init(SwRedlineTable::size_type 
nStart)
 m_aUsedSeqNo.clear();
 
 // tdf#162018 keep the selected entry selected
-const OUString& rId = rTreeView.get_selected_id();
-auto reselect = [, ]() {
-rTreeView.select_id(rId);
-std::unique_ptr xEntry(rTreeView.make_iterator());
-if (rTreeView.get_selected(xEntry.get()))
-rTreeView.set_cursor(*xEntry);
-};
+const SwRedlineData* pSelectedEntryRedlineData = 
lcl_get_selected_redlinedata(rTreeView);
 
 rTreeView.freeze();
 if (nStart)
@@ -254,7 +290,7 @@ void SwRedlineAcceptDlg::Init(SwRedlineTable::size_type 
nStart)
 InsertParents(nStart);
 InitAuthors();
 
-reselect();
+lcl_reselect(rTreeView, pSelectedEntryRedlineData);
 }
 
 void SwRedlineAcceptDlg::InitAuthors()
@@ -421,13 +457,7 @@ void SwRedlineAcceptDlg::Activate()
 
 // tdf#162018 keep the selected entry selected
 weld::TreeView& rTreeView = m_pTable->GetWidget();
-const OUString& rId = rTreeView.get_selected_id();
-auto reselect = [, ]() {
-rTreeView.select_id(rId);
-std::unique_ptr xEntry(rTreeView.make_iterator());
-if (rTreeView.get_selected(xEntry.get()))
-rTreeView.set_cursor(*xEntry);
-};
+const SwRedlineData* pSelectedEntryRedlineData = 
lcl_get_selected_redlinedata(m_pTable->GetWidget());
 
 

core.git: sw/qa sw/source

2024-07-20 Thread Jim Raykowski (via logerrit)
 sw/qa/uitest/writer_tests/trackedChanges.py |   10 +++
 sw/qa/uitest/writer_tests7/tdf90401.py  |2 +
 sw/source/uibase/misc/redlndlg.cxx  |   36 
 3 files changed, 38 insertions(+), 10 deletions(-)

New commits:
commit de9a7a593630d3319e0e311b641c7c52c96b9e4a
Author: Jim Raykowski 
AuthorDate: Tue Jul 16 21:58:37 2024 -0800
Commit: Jim Raykowski 
CommitDate: Sat Jul 20 20:48:23 2024 +0200

Resolves tdf#162018 Unexpected loss in focus in the "Manage Changes"

window when adding a change in the document (Track changes mode),
round 2

Addresses two situations where the list still jumps to the top:

Situation 1:
When an entry is added to the end of the changes list.

Situation 2:
After editing a comment for a change list entry with the 'Comment'
dialog.

Change-Id: I4a75e6bcba13fb9cc735cf78756fe736b9d4665d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170598
Reviewed-by: Jim Raykowski 
Tested-by: Jenkins

diff --git a/sw/qa/uitest/writer_tests/trackedChanges.py 
b/sw/qa/uitest/writer_tests/trackedChanges.py
index 8681140bb695..93b2374ed820 100644
--- a/sw/qa/uitest/writer_tests/trackedChanges.py
+++ b/sw/qa/uitest/writer_tests/trackedChanges.py
@@ -78,6 +78,8 @@ class trackedchanges(UITestCase):
 self.xUITest.executeCommand(".uno:ShowTrackedChanges")
 
 with 
self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges",
 close_button="close") as xTrackDlg:
+changesList = xTrackDlg.getChild("writerchanges")
+changesList.getChild(0).executeAction("SELECT", tuple())
 
 xRejBtn = xTrackDlg.getChild("reject")
 xRejBtn.executeAction("CLICK", tuple())
@@ -152,6 +154,8 @@ class trackedchanges(UITestCase):
 "The tennis ball is a small ball. The basketball is much 
bigger.",
 "The tennis ball is a small ball. The basketball is much 
bigger."]
 
+changesList.getChild(0).executeAction("SELECT", tuple())
+
 for i in range(len(listText)):
 self.assertEqual(document.Text.String.strip(), 
resultsAccept[i])
 
self.assertEqual(get_state_as_dict(changesList.getChild('0'))["Text"], 
listText[i] )
@@ -176,6 +180,8 @@ class trackedchanges(UITestCase):
 "The tenis ball is a small bal. The baskedball is much 
bigger.",
 "The tenis ball is a small bal. The baskedball is much 
biger."]
 
+changesList.getChild(0).executeAction("SELECT", tuple())
+
 for i in range(len(listText)):
 self.assertEqual(document.Text.String.strip(), 
resultsReject[i])
 
self.assertEqual(get_state_as_dict(changesList.getChild('0'))["Text"], 
listText[i] )
@@ -231,6 +237,8 @@ class trackedchanges(UITestCase):
 # Now: 4 changes (2 deleted/inserted rows and 2 
deleted/inserted tables)
 self.assertEqual(4, len(changesList.getChildren()))
 
+changesList.getChild(0).executeAction("SELECT", tuple())
+
 # Without the fix in place, it would have crashed here
 for i in (3, 2, 1, 0):
 xAccBtn = xTrackDlg.getChild("accept")
@@ -521,6 +529,7 @@ class trackedchanges(UITestCase):
 # check and reject changes
 with 
self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges",
 close_button="close") as xTrackDlg:
 changesList = xTrackDlg.getChild("writerchanges")
+changesList.getChild(0).executeAction("SELECT", tuple())
 
 # six changes, but only one visible in the Manage Changes 
dialog window
 state = get_state_as_dict(changesList)
@@ -562,6 +571,7 @@ class trackedchanges(UITestCase):
 # check and reject changes
 with 
self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges",
 close_button="close") as xTrackDlg:
 changesList = xTrackDlg.getChild("writerchanges")
+changesList.getChild(0).executeAction("SELECT", tuple())
 
 # six changes, but only one visible in the Manage Changes 
dialog window
 state = get_state_as_dict(changesList)
diff --git a/sw/qa/uitest/writer_tests7/tdf90401.py 
b/sw/qa/uitest/writer_tests7/tdf90401.py
index 95cc966e1dc7..6c29269a5880 100644
--- a/sw/qa/uitest/writer_tests7/tdf90401.py
+++ b/sw/qa/uitest/writer_tests7/tdf90401.py
@@ -79,6 +79,7 @@ class tdf90401(UITestCase):
 # check removed personal info on tracked changes
 with 
self.ui_test.execute_modeless_dialog_through_command('.uno:AcceptTrackedChanges',
 close_button="close") as xTrackDlg:
 xTreeList = xTrackDlg.getChild('writerchanges')
+ 

core.git: sw/qa sw/source

2024-07-19 Thread Miklos Vajna (via logerrit)
 sw/qa/writerfilter/dmapper/FontTable.cxx |   36 +++
 sw/qa/writerfilter/dmapper/data/font-family.docx |binary
 sw/source/writerfilter/dmapper/DomainMapper.cxx  |8 +
 sw/source/writerfilter/dmapper/FontTable.cxx |   27 +
 sw/source/writerfilter/dmapper/FontTable.hxx |3 +
 sw/source/writerfilter/dmapper/PropertyIds.cxx   |1 
 sw/source/writerfilter/dmapper/PropertyIds.hxx   |1 
 7 files changed, 76 insertions(+)

New commits:
commit d06de2e049761b7b9e8a95f17557d309812f7acc
Author: Miklos Vajna 
AuthorDate: Fri Jul 19 16:11:33 2024 +0200
Commit: Miklos Vajna 
CommitDate: Fri Jul 19 22:38:42 2024 +0200

Related: tdf#162072 DOCX import: handle font family for characters

Open the bugdoc, the first paragraph is meant to be sans and the second
paragraph is meant to be serif, but both of them are serif.

The bugdoc uses the fonts 'IBM Plex Sans' and 'IBM Plex Serif', which is
not something we bundle, so the font fallback is expected, but the
fallback should have a matching font family (roman vs swiss).

Fix the problem by implementing support for  in
the DOCX import, which was just ignored previously.

Now the DOCX import result in on par with the ODT import result.

Change-Id: I321b9fc6f63126ca5ad61af57af8a5bc7456d5b4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170772
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/writerfilter/dmapper/FontTable.cxx 
b/sw/qa/writerfilter/dmapper/FontTable.cxx
index 2fe3dced2e1f..2d5a80ca0476 100644
--- a/sw/qa/writerfilter/dmapper/FontTable.cxx
+++ b/sw/qa/writerfilter/dmapper/FontTable.cxx
@@ -9,6 +9,10 @@
 
 #include 
 
+#include 
+#include 
+#include 
+
 #include 
 
 using namespace com::sun::star;
@@ -57,6 +61,38 @@ CPPUNIT_TEST_FIXTURE(Test, testSubsettedFullEmbeddedFont)
 CPPUNIT_ASSERT(!aUrl.isEmpty());
 #endif
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testFontFamily)
+{
+// Given a document with 2 paragraphs, first is sans, second is serif:
+// When loading that document:
+loadFromFile(u"font-family.docx");
+
+// Then make sure we import :
+uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xParaEnumAccess(xTextDocument->getText(),
+  
uno::UNO_QUERY);
+uno::Reference xParaEnum = 
xParaEnumAccess->createEnumeration();
+// First paragraph: sans.
+uno::Reference 
xPortionEnumAccess(xParaEnum->nextElement(),
+ 
uno::UNO_QUERY);
+uno::Reference xPortionEnum = 
xPortionEnumAccess->createEnumeration();
+uno::Reference xPortion(xPortionEnum->nextElement(), 
uno::UNO_QUERY);
+sal_Int16 nFontFamily = awt::FontFamily::DONTKNOW;
+xPortion->getPropertyValue(u"CharFontFamily"_ustr) >>= nFontFamily;
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 5 (SWISS)
+// - Actual  : 3 (ROMAN)
+// i.e. the font family was not imported, all font family was roman.
+CPPUNIT_ASSERT_EQUAL(awt::FontFamily::SWISS, nFontFamily);
+// Second paragraph: serif.
+xPortionEnumAccess.set(xParaEnum->nextElement(), uno::UNO_QUERY);
+xPortionEnum = xPortionEnumAccess->createEnumeration();
+xPortion.set(xPortionEnum->nextElement(), uno::UNO_QUERY);
+nFontFamily = awt::FontFamily::DONTKNOW;
+xPortion->getPropertyValue(u"CharFontFamily"_ustr) >>= nFontFamily;
+CPPUNIT_ASSERT_EQUAL(awt::FontFamily::ROMAN, nFontFamily);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/writerfilter/dmapper/data/font-family.docx 
b/sw/qa/writerfilter/dmapper/data/font-family.docx
new file mode 100644
index ..15bda10374ea
Binary files /dev/null and b/sw/qa/writerfilter/dmapper/data/font-family.docx 
differ
diff --git a/sw/source/writerfilter/dmapper/DomainMapper.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper.cxx
index 8854e7ed9ece..52e3eda73187 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper.cxx
@@ -418,6 +418,14 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
 if (m_pImpl->GetTopContext())
 {
 m_pImpl->GetTopContext()->Insert(PROP_CHAR_FONT_NAME, 
uno::Any( sStringValue ));
+
+// Set the matching font family if we have one.
+FontEntry::Pointer_t pFontEntry = 
m_pImpl->GetFontTable()->getFontEntryByName(sStringValue);
+if (pFontEntry)
+{
+m_pImpl->GetTopContext()->Insert(PROP_CHAR_FONT_FAMILY,
+ 
uno::Any(pFontEntry->m_nFontFamily));
+}
 }
 break;
 case NS_ooxml::LN_CT_Fonts_asciiTheme:
diff --git 

core.git: sw/qa sw/source

2024-07-19 Thread Attila Szűcs (via logerrit)
 sw/qa/uitest/ui/misc/misc.py  |9 +
 sw/source/uibase/wrtsh/wrtsh1.cxx |   27 +++
 2 files changed, 20 insertions(+), 16 deletions(-)

New commits:
commit 352e564dd1de09a04a2fb1f9b40780b305da7c80
Author: Attila Szűcs 
AuthorDate: Fri Jul 12 14:51:41 2024 +0200
Commit: Miklos Vajna 
CommitDate: Fri Jul 19 21:26:28 2024 +0200

SW: random ID for new content controls

Make the generated unique ID random for new content controls.
This way if we copy paste them from different documents,
they may still be unique.

Change-Id: I2adb6577e08b5798ae88a63b6178352aa76280d6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170773
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/uitest/ui/misc/misc.py b/sw/qa/uitest/ui/misc/misc.py
index 8af00054a5e6..94fd60bff16f 100644
--- a/sw/qa/uitest/ui/misc/misc.py
+++ b/sw/qa/uitest/ui/misc/misc.py
@@ -44,9 +44,10 @@ class TestTmpdlg(UITestCase):
 type_text(xTag, "new tag ")
 xAdd = xDialog.getChild("add")
 
-xId = xDialog.getChild("idspinbutton")
-self.assertEqual(get_state_as_dict(xId)['Text'], "0")
-type_text(xId, "429496729") # added in front, making it 
4294967290
+# Id is a random number now, not 0.
+# xId = xDialog.getChild("idspinbutton")
+# self.assertEqual(get_state_as_dict(xId)['Text'], "0")
+# type_text(xId, "429496729") # added in front, making it 
4294967290
 
 xTabIndex = xDialog.getChild("tabindexspinbutton")
 self.assertEqual(get_state_as_dict(xTabIndex)['Text'], "1")
@@ -67,7 +68,7 @@ class TestTmpdlg(UITestCase):
 self.assertEqual(listItems[1][1].Value, "foo-bar")
 self.assertEqual(contentControl.Alias, "new alias my alias")
 self.assertEqual(contentControl.Tag, "new tag my tag")
-self.assertEqual(contentControl.Id, -6) # stored as signed, 
displays as unsigned
+# self.assertEqual(contentControl.Id, -6) # stored as signed, 
displays as unsigned
 self.assertEqual(contentControl.TabIndex, 4294967295) # stored as 
unsigned, displays as signed
 
 
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx 
b/sw/source/uibase/wrtsh/wrtsh1.cxx
index 65d725c6872a..585203eed017 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -42,6 +42,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1076,25 +1077,27 @@ void 
SwWrtShell::InsertContentControl(SwContentControlType eType)
 
 auto pContentControl = std::make_shared(nullptr);
 
-// Search for a non used ID for the new ContentControl, to make it unique
+// Make Random ID.. cehcek if it is unique
+// warning: possible infinite loop if there would be billions of content 
controls.
 SwContentControlManager& pManager = GetDoc()->GetContentControlManager();
 size_t nCCCount = pManager.GetCount();
-std::vector aIdMap(nCCCount);
-aIdMap.resize(nCCCount, false);
-size_t nIdToCheck;
-for (nIdToCheck = 0; nIdToCheck < nCCCount; nIdToCheck++)
+sal_Int32 nIdToCheck;
+nIdToCheck
+= comphelper::rng::uniform_uint_distribution(1, 
std::numeric_limits::max());
+size_t nIdx = 0;
+while (nIdx < nCCCount)
 {
 sal_Int32 nID
-= 
pManager.UnsortedGet(nIdToCheck)->GetContentControl().GetContentControl()->GetId();
-if (nID >= 0 && nID < static_cast(nCCCount))
+= 
pManager.UnsortedGet(nIdx)->GetContentControl().GetContentControl()->GetId();
+if (nID == nIdToCheck)
 {
-aIdMap[nID] = true;
+nIdToCheck = comphelper::rng::uniform_uint_distribution(
+1, std::numeric_limits::max());
+nIdx = 0;
 }
+else
+nIdx++;
 }
-// Find the first ID that was not used
-nIdToCheck = 0;
-while (nIdToCheck < nCCCount && aIdMap[nIdToCheck])
-nIdToCheck++;
 pContentControl->SetId(nIdToCheck);
 
 OUString aPlaceholder;


core.git: sw/qa

2024-07-19 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/uiwriter/data/tdf133967.odt |binary
 1 file changed

New commits:
commit cb3ab04adaed834341f6324c7e77f46f56f1f049
Author: Miklos Vajna 
AuthorDate: Fri Jul 19 13:23:47 2024 +0200
Commit: Miklos Vajna 
CommitDate: Fri Jul 19 14:37:57 2024 +0200

CppunitTest_sw_uiwriter3: avoid font fallback in testTdf133967

I'm not sure when this started, but the testcase fails with:

- Expected: 6
- Actual  : 7

I.e. the initial page count is meant to be more than 1, but we
explicitly assert that page count.

Once gb_CppunitTest_set_non_application_font_use is set to abort for
this suite, then vcl says the font fallback is:

vcl/unx/generic/fontmanager/fontconfig.cxx:1195: 
PrintFontManager::Substitute: missing font: 'Albany' try: Liberation Sans 
instead

Do that replacement, that restores the 6 pages on load even in cases
where it was 7 previously.

Change-Id: I0cf40c0cdbbb5c1e894468371ea260f0d15a3e40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170759
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/uiwriter/data/tdf133967.odt 
b/sw/qa/extras/uiwriter/data/tdf133967.odt
index 18ed5bfb7844..15e6dcfe5095 100644
Binary files a/sw/qa/extras/uiwriter/data/tdf133967.odt and 
b/sw/qa/extras/uiwriter/data/tdf133967.odt differ


core.git: sw/qa

2024-07-19 Thread Andrea Gelmini (via logerrit)
 0 files changed

New commits:
commit 1a808e205756ae2ad160fd959190abce2a9c257d
Author: Andrea Gelmini 
AuthorDate: Tue Jul 16 14:20:37 2024 +0200
Commit: Andrea Gelmini 
CommitDate: Fri Jul 19 10:10:03 2024 +0200

Remove exec bits on rtf file

Change-Id: I4a297e40f907d2d530e3231f5258eb57791da2db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170579
Reviewed-by: Andrea Gelmini 
Tested-by: Jenkins

diff --git a/sw/qa/extras/rtfimport/data/tdf148544.rtf 
b/sw/qa/extras/rtfimport/data/tdf148544.rtf
old mode 100755
new mode 100644


core.git: sw/qa sw/source

2024-07-18 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx   |4 ++--
 sw/source/filter/ww8/ww8atr.cxx  |2 +-
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |8 
 3 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit b657b6c6c918fb7c239ad835db44de249b1c1763
Author: Justin Luth 
AuthorDate: Thu Jul 18 08:16:42 2024 -0400
Commit: Justin Luth 
CommitDate: Fri Jul 19 02:51:22 2024 +0200

related tdf#125469 docx im/export: better precision percent<->value

A line spacing difference of 1.07 and 1.06 is significant for layout.
Use rounding to get better round-trippability.

This patch was created based on a code read, finding a DOUBLES unit test
and having related coding attempts noticing integer precision loss.

make CppunitTest_sw_ooxmlexport13 \
CPPUNIT_TEST_NAME=testTdf118947_tableStyle

The export change is a blind fix
(but older LO now opens ooxmlexport13's RT as 1.07% (256.8)
because we now write w:line="257" (1.07083) instead of 256 (1.066).

The import change is confirmed by ooxmlexport13 (matching Word 2010).

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

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index 3712cb56bade..c98b85f241a9 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -501,7 +501,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf118947_tableStyle, 
"tdf118947_tableStyle.docx")
 CPPUNIT_ASSERT_EQUAL_MESSAGE("TextBody has 1pt space below paragraph", 
sal_Int32(35), getProperty(xPara, u"ParaBottomMargin"_ustr));
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Table has 10pt space above paragraph", 
sal_Int32(353), getProperty(xPara, u"ParaTopMargin"_ustr));
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Table style sets 0 right margin", 
sal_Int32(0), getProperty(xPara, u"ParaRightMargin"_ustr));
-CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("TextBody has 1.07 line-spacing", 
sal_Int16(107), getProperty(xPara, 
u"ParaLineSpacing"_ustr).Height, 1);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("TextBody has 1.07 line-spacing", 
sal_Int16(107), getProperty(xPara, 
u"ParaLineSpacing"_ustr).Height);
 // table-style based paragraph background color
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Missing paragraph background color in cell 
A1", Color(0xCCFFCC), getProperty(xPara, u"ParaBackColor"_ustr));
 
@@ -516,7 +516,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf118947_tableStyle, 
"tdf118947_tableStyle.docx")
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Normal has 0pt space below paragraph", 
sal_Int32(0), getProperty(xPara, u"ParaBottomMargin"_ustr));
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Table sets 10pt space above paragraph", 
sal_Int32(353), getProperty(xPara, u"ParaTopMargin"_ustr));
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Table style sets 0 right margin", 
sal_Int32(0), getProperty(xPara, u"ParaRightMargin"_ustr));
-CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Table sets 2.5 line-spacing", 
sal_Int16(250), getProperty(xPara, 
u"ParaLineSpacing"_ustr).Height, 1);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Table sets 2.5 line-spacing", 
sal_Int16(250), getProperty(xPara, 
u"ParaLineSpacing"_ustr).Height);
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Paragraph background color in cell A2", 
sal_Int32(-1), getProperty(xPara, u"ParaBackColor"_ustr));
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Compat mode overrides left adjust", 
style::ParagraphAdjust_RIGHT,
  
static_cast(getProperty(xPara, 
u"ParaAdjust"_ustr)));
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 3b03cfdf7f13..d72db627eced 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -5162,7 +5162,7 @@ void AttributeOutputBase::ParaLineSpacing( const 
SvxLineSpacingItem& rSpacing )
 else // Proportional
 {
 if ( rSpacing.GetInterLineSpaceRule() != 
SvxInterLineSpaceRule::Off )
-nSpace = static_cast( ( 240L * 
rSpacing.GetPropLineSpace() ) / 100L );
+nSpace = static_cast(round(240.0 * 
rSpacing.GetPropLineSpace() / 100));
 nMulti = 1;
 }
 }
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index 83a9301c0738..d814ab4ee603 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -5112,7 +5112,7 @@ void DomainMapper_Impl::SetLineSpacing(const Id nName, 
sal_Int32 nIntValue, bool
 appendGrabBag(m_aSubInteropGrabBag, u"line"_ustr, 
OUString::number(nIntValue));
 // now set the value depending on the Mode
 if (aSpacing.Mode == style::LineSpacingMode::PROP)
-aSpacing.Height = sal_Int16(nIntValue 

core.git: sw/qa sw/source

2024-07-18 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx   |   14 +++---
 sw/source/writerfilter/dmapper/DomainMapper.cxx  |3 ++-
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |   19 ---
 sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx |2 +-
 4 files changed, 26 insertions(+), 12 deletions(-)

New commits:
commit 965d83d3a729b0c01c882e200d8bf18dd347c027
Author: Justin Luth 
AuthorDate: Wed Jul 17 15:51:46 2024 -0400
Commit: Justin Luth 
CommitDate: Fri Jul 19 02:49:18 2024 +0200

related tdf#125469 writerfilter: support negative exact and atLeast

When vmiklos added support for negative auto -> FIX,
he indicated that there was no documentation for it.
commit f575f70b8303ba187f6989920281ff02e7a431c9
Author: Miklos Vajna on Thu Jun 22 13:41:30 2017 +0200
tdf#108682 DOCX import: fix  for negative
I didn't find UI in Word to create

In working on bug 125469, I hand-crafted a nasty example document
which had negative exact and atLeast examples,
and this patch matches what I saw happening in Word 2010.
Too bad MS isn't completely consistent...

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

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index 91fbf2e7e110..cf9d75b7e871 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -342,25 +342,25 @@ DECLARE_OOXMLEXPORT_TEST(testTdf125469_singleSpacing, 
"tdf125469_singleSpacing.d
 // The negative value (always) turns the (inherited) "atLeast" into an 
"exact".
 // Visually, this is hardly readable (36pt font forced into 12pt space)
 aSpacing = getProperty(getParagraph(2), 
u"ParaLineSpacing"_ustr);
-// CPPUNIT_ASSERT_EQUAL(sal_Int16(style::LineSpacingMode::FIX), 
aSpacing.Mode);
-// CPPUNIT_ASSERT_EQUAL(sal_Int16(423), aSpacing.Height);
+CPPUNIT_ASSERT_EQUAL(sal_Int16(style::LineSpacingMode::FIX), 
aSpacing.Mode);
+CPPUNIT_ASSERT_EQUAL(sal_Int16(423), aSpacing.Height);
 
 // Paragraph 3 - paragraph style specifies exact 240, para overrides with 
exact -240.
 // The negative value turns the non-inherited "exact" into an "atLeast".
 // Visually, this should clearly say "Negative exact"
 aSpacing = getProperty(getParagraph(3), 
u"ParaLineSpacing"_ustr);
-// CPPUNIT_ASSERT_EQUAL(sal_Int16(style::LineSpacingMode::MINIMUM), 
aSpacing.Mode);
-// CPPUNIT_ASSERT_EQUAL(sal_Int16(423), aSpacing.Height);
+CPPUNIT_ASSERT_EQUAL(sal_Int16(style::LineSpacingMode::MINIMUM), 
aSpacing.Mode);
+CPPUNIT_ASSERT_EQUAL(sal_Int16(423), aSpacing.Height);
 
 // Paragraph 4 - paragraph style specifies exact 240, para overrides with 
only -240.
 // The negative value does nothing to the inherited "exact".
 // Visually, this is hardly readable (36pt font forced into 12pt space)
 aSpacing = getProperty(getParagraph(4), 
u"ParaLineSpacing"_ustr);
-// CPPUNIT_ASSERT_EQUAL(sal_Int16(style::LineSpacingMode::FIX), 
aSpacing.Mode);
-// CPPUNIT_ASSERT_EQUAL(sal_Int16(423), aSpacing.Height);
+CPPUNIT_ASSERT_EQUAL(sal_Int16(style::LineSpacingMode::FIX), 
aSpacing.Mode);
+CPPUNIT_ASSERT_EQUAL(sal_Int16(423), aSpacing.Height);
 
 // all of this ends up being squeezed onto a single page
-// CPPUNIT_ASSERT_EQUAL(1, getPages());
+CPPUNIT_ASSERT_EQUAL(1, getPages());
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTdf43767_caseMapNumbering, 
"tdf43767_caseMapNumbering.odt")
diff --git a/sw/source/writerfilter/dmapper/DomainMapper.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper.cxx
index 13ffe529d09d..8854e7ed9ece 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper.cxx
@@ -2423,7 +2423,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
 else if (aInheritedSpacing.Mode == style::LineSpacingMode::MINIMUM)
 nLineRule = NS_ooxml::LN_Value_doc_ST_LineSpacingRule_atLeast;
 
-m_pImpl->SetLineSpacing(NS_ooxml::LN_CT_Spacing_lineRule, 
nLineRule);
+const bool bNegativeFlip = nLineRule != 
NS_ooxml::LN_Value_doc_ST_LineSpacingRule_exact;
+m_pImpl->SetLineSpacing(NS_ooxml::LN_CT_Spacing_lineRule, 
nLineRule, bNegativeFlip);
 }
 
 m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, u"spacing"_ustr, 
m_pImpl->m_aSubInteropGrabBag);
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index df28343d3186..83a9301c0738 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -5092,7 +5092,7 @@ bool DomainMapper_Impl::IsDiscardHeaderFooter() const
 return 

core.git: sw/qa sw/source

2024-07-18 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf125469_singleSpacing.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx |   36 +
 sw/source/writerfilter/dmapper/DomainMapper.cxx|   36 +++--
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx   |   13 
 sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx   |   10 +++
 5 files changed, 91 insertions(+), 4 deletions(-)

New commits:
commit e3dfb54117f5325d8f38f58ef892c2808d601e54
Author: Justin Luth 
AuthorDate: Wed Jul 17 14:48:57 2024 -0400
Commit: Justin Luth 
CommitDate: Fri Jul 19 02:47:26 2024 +0200

tdf#125469 writerfilter: use "auto" for not-provided lineRule

This fixes the problem where a programmatically generated document
didn't specify a w:lineRule, and thus the w:line size
was treated as a FIXed spacing of 12pt instead of as single spacing.


lineRule (Spacing Between Lines)
Specifies how the spacing between lines is calculated
as stored in the line attribute.

If this attribute is omitted, then it shall be assumed to be
of a value "auto" if a w:line attribute value is present.

However, our implementation (wisely) defaulted to ::FIX
instead of ::PROP (which keeps precision in w:line sizes
since PROP is a integer percentage instead of a float
and thus loses precision when switching between FIX and PROP).

Note of course that if neither w:line nor w:lineRule is provided,
then we go with the LO default of mode=0, height=0 (aka AUTO).

This gets tricky because the lineRule can be inherited,
so just because it is missing in a pPr doesn't necessarily mean
we can just substitute "auto".

It is also tricky because w:spacing
deals with more than just line spacing.

Not surprisingly, no existing unit tests matched this case.
However, the unit tests were VERY helpful in pointing out
limitations as I attempted to code the fix.

make CppunitTest_sw_ooxmlexport21 \
CPPUNIT_TEST_NAME=testTdf125469_singleSpacing

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

diff --git a/sw/qa/extras/ooxmlexport/data/tdf125469_singleSpacing.docx 
b/sw/qa/extras/ooxmlexport/data/tdf125469_singleSpacing.docx
new file mode 100644
index ..ff92e1b2d0c7
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf125469_singleSpacing.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index 9ef569e47683..91fbf2e7e110 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -327,6 +327,42 @@ DECLARE_OOXMLEXPORT_TEST(testTdf158597, "tdf158597.docx")
 }
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf125469_singleSpacing, 
"tdf125469_singleSpacing.docx")
+{
+// Given a document with 4 paragraphs of varying strange line spacing 
definitions,
+// and a DocDefault of single line spacing (AUTO 240pt) (240pt is 0.423 cm)
+
+// Paragraph 1 - DocDefaults specifies size 240 without a lineRule - 
default is AUTO(aka PROP)
+// Visually, this should clearly say "Single spacing"
+auto aSpacing = getProperty(getParagraph(1), 
u"ParaLineSpacing"_ustr);
+CPPUNIT_ASSERT_EQUAL(sal_Int16(style::LineSpacingMode::PROP), 
aSpacing.Mode);
+CPPUNIT_ASSERT_EQUAL(sal_Int16(100), aSpacing.Height);
+
+// Paragraph 2 - paragraph style specifies atLeast 240, para overrides 
with only -240.
+// The negative value (always) turns the (inherited) "atLeast" into an 
"exact".
+// Visually, this is hardly readable (36pt font forced into 12pt space)
+aSpacing = getProperty(getParagraph(2), 
u"ParaLineSpacing"_ustr);
+// CPPUNIT_ASSERT_EQUAL(sal_Int16(style::LineSpacingMode::FIX), 
aSpacing.Mode);
+// CPPUNIT_ASSERT_EQUAL(sal_Int16(423), aSpacing.Height);
+
+// Paragraph 3 - paragraph style specifies exact 240, para overrides with 
exact -240.
+// The negative value turns the non-inherited "exact" into an "atLeast".
+// Visually, this should clearly say "Negative exact"
+aSpacing = getProperty(getParagraph(3), 
u"ParaLineSpacing"_ustr);
+// CPPUNIT_ASSERT_EQUAL(sal_Int16(style::LineSpacingMode::MINIMUM), 
aSpacing.Mode);
+// CPPUNIT_ASSERT_EQUAL(sal_Int16(423), aSpacing.Height);
+
+// Paragraph 4 - paragraph style specifies exact 240, para overrides with 
only -240.
+// The negative value does nothing to the inherited "exact".
+// Visually, this is hardly readable (36pt font forced into 12pt space)
+aSpacing = getProperty(getParagraph(4), 
u"ParaLineSpacing"_ustr);
+// CPPUNIT_ASSERT_EQUAL(sal_Int16(style::LineSpacingMode::FIX), 
aSpacing.Mode);
+// 

core.git: sw/qa sw/source

2024-07-18 Thread Jonathan Clark (via logerrit)
 sw/qa/extras/layout/data/tdf56408-after-field.fodt |  175 +
 sw/qa/extras/layout/layout3.cxx|6 
 sw/source/core/text/pormulti.cxx   |6 
 3 files changed, 184 insertions(+), 3 deletions(-)

New commits:
commit e9a37656b75b4ce82b3e48af727f03f386e64a08
Author: Jonathan Clark 
AuthorDate: Thu Jul 18 13:56:26 2024 -0600
Commit: Jonathan Clark 
CommitDate: Fri Jul 19 00:28:18 2024 +0200

(related tdf#56408) crashtesting: assert on exporting ooo30385-2.doc to odt

since:

commit 6a54d08e6e52623f9769d17d7ea7390052cb275b
Date:   Fri Jul 5 15:19:23 2024 -0600

tdf#56408 Writer always breaks lines at text direction change

Change-Id: If4627f4d65d2c44b65653c689ee00a2e0cb4456a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170154

Assertion occurs when underflowing a bidi portion after a field portion.
When attempting to reproduce the issue in GUI, this was accompanied by
an infinite loop. This change fixes both issues.

Change-Id: I85f6fa769756138fe000681a4663925ddfc7ed83
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170705
Reviewed-by: Jonathan Clark 
Tested-by: Jenkins

diff --git a/sw/qa/extras/layout/data/tdf56408-after-field.fodt 
b/sw/qa/extras/layout/data/tdf56408-after-field.fodt
new file mode 100644
index ..6d636174dd42
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf56408-after-field.fodt
@@ -0,0 +1,175 @@
+
+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">
+ Lior 
Kaplan2012-10-25T19:53:272024-07-18T15:05:42.825774264PT25M13S40LibreOfficeDev/25.2.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/50f8ea8c90151bdd67aa8f223ec7ee082955494c
+ 
+  
+  
+  
+  
+  
+ 
+  
+   
+   
+
+   
+   
+  
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+  
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+  
+  
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+  
+  
+  
+  
+  
+ 
+  
+   
+   
+  
+  
+   
+  
+  
+   
+
+   
+   
+   
+  
+  
+   
+  
+ 
+ 
+  
+ 
+ 
+  
+   
+
+
+
+
+
+   
+   
+
+ מכיוון שכל התנועה בין שתי רשתות מועברת בקשר אחד – בין 
הfireWall של הרשת האחת לfireWall
+
+   
+  
+ 
+
\ No newline at end of file
diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index 

core.git: sw/qa

2024-07-17 Thread Adam Seskunas (via logerrit)
 sw/qa/filter/ww8/data/tdf71749_with_footnote.doc|binary
 sw/qa/filter/ww8/data/tdf71749_without_footnote.doc |binary
 sw/qa/filter/ww8/ww8.cxx|   16 
 3 files changed, 16 insertions(+)

New commits:
commit d5d4e1334957abc29c5c4f543a8cd15a5aaf8748
Author: Adam Seskunas 
AuthorDate: Mon Jul 8 11:23:10 2024 -0700
Commit: Xisco Fauli 
CommitDate: Thu Jul 18 01:11:12 2024 +0200

tdf#71749 Unit test for sw: WW8: don't loop on tables in footnotes

Change-Id: I5ca830b2ec0c883a23bab1ece006f8c88310f3ce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170169
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/filter/ww8/data/tdf71749_with_footnote.doc 
b/sw/qa/filter/ww8/data/tdf71749_with_footnote.doc
new file mode 100644
index ..9de42a4aac11
Binary files /dev/null and b/sw/qa/filter/ww8/data/tdf71749_with_footnote.doc 
differ
diff --git a/sw/qa/filter/ww8/data/tdf71749_without_footnote.doc 
b/sw/qa/filter/ww8/data/tdf71749_without_footnote.doc
new file mode 100644
index ..cf0b647f1066
Binary files /dev/null and 
b/sw/qa/filter/ww8/data/tdf71749_without_footnote.doc differ
diff --git a/sw/qa/filter/ww8/ww8.cxx b/sw/qa/filter/ww8/ww8.cxx
index 9a1b919c0cc8..1838210ed9d8 100644
--- a/sw/qa/filter/ww8/ww8.cxx
+++ b/sw/qa/filter/ww8/ww8.cxx
@@ -642,6 +642,22 @@ CPPUNIT_TEST_FIXTURE(Test, 
testContentControlPDFDropDownEmptyItem)
 // i.e. we emitted an empty list item, so the result can't be opened in 
Word.
 assertXPath(pXmlDoc, "//w:dropDownList/w:listItem"_ostr, 1);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, tdf71749_with_footnote)
+{
+// Without the fix in place,
+// loading the document would hang.
+loadFromFile(u"tdf71749_with_footnote.doc");
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, tdf71749_without_footnote)
+{
+// Without the fix in place,
+// loading the document would hang.
+loadFromFile(u"tdf71749_without_footnote.doc");
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();


core.git: sw/qa

2024-07-17 Thread Andrea Gelmini (via logerrit)
 0 files changed

New commits:
commit 2f4d06747b533d962078cd25370f433037098359
Author: Andrea Gelmini 
AuthorDate: Tue Jul 16 14:20:02 2024 +0200
Commit: Taichi Haradaguchi <20001...@ymail.ne.jp>
CommitDate: Wed Jul 17 13:54:17 2024 +0200

Remove exec bits on rtf file

Change-Id: Ic975ecb00db43fadb3134a592e9d6fe5cd0f847b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170578
Tested-by: Jenkins
Reviewed-by: Taichi Haradaguchi <20001...@ymail.ne.jp>

diff --git a/sw/qa/extras/rtfexport/data/tdf161864.rtf 
b/sw/qa/extras/rtfexport/data/tdf161864.rtf
old mode 100755
new mode 100644


core.git: sw/qa sw/source

2024-07-17 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/tiledrendering2/tiledrendering2.cxx |   34 +
 sw/source/uibase/dochdl/swdtflvr.cxx |   36 +--
 2 files changed, 68 insertions(+), 2 deletions(-)

New commits:
commit 8af3bab06ed27a01df370bb5f79e5f15892e778d
Author: Miklos Vajna 
AuthorDate: Wed Jul 17 10:00:43 2024 +0200
Commit: Miklos Vajna 
CommitDate: Wed Jul 17 11:51:28 2024 +0200

Related: cool#9504 sw: don't invalidate num rules when pasting into bullets

Open the bugdoc, navigate to the last para of the first page, enable
bullets for that paragraph, paste a one-liner plain text string, observe
a 274 ms hang.

Commit dc3e022866893d8c0950f2269c0c8d61c24ed9bf (cool#9504 sw: don't
invalidate num rules when pasting into a non-num paragraph, 2024-07-15)
already fixed a not needed invalidation when pasting plain text at a
non-list paragraph, but here the insert point is part of a list, so we
still invalidate.

Improve this further to also not invalidate when we paste a paragraph
which is part of a list, but the numbering type is a bullet, which again
doesn't need an invalidation.

If the invalidation still happens, then the LOK case still calcs the
entire layout in one go, that's not yet fixed here.

Change-Id: I97c92aebb67ba8ca66b5820943dc1550d62bb467
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170606
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/qa/extras/tiledrendering2/tiledrendering2.cxx 
b/sw/qa/extras/tiledrendering2/tiledrendering2.cxx
index 779192bdc250..efe53e64bcec 100644
--- a/sw/qa/extras/tiledrendering2/tiledrendering2.cxx
+++ b/sw/qa/extras/tiledrendering2/tiledrendering2.cxx
@@ -231,6 +231,40 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testPasteInvalidateNumRules)
 SwFrame* pPage3 = pPage2->GetNext();
 
CPPUNIT_ASSERT(!aView.m_aInvalidations.Overlaps(pPage3->getFrameArea().SVRect()));
 }
+
+CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testPasteInvalidateNumRulesBullet)
+{
+// Given a document with 3 pages: first page is ~empty, then page break, 
then pages 2 & 3 have
+// bullets:
+SwXTextDocument* pXTextDocument = createDoc("numrules.odt");
+CPPUNIT_ASSERT(pXTextDocument);
+ViewCallback aView;
+SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
+pWrtShell->SttEndDoc(/*bStt=*/true);
+pWrtShell->Down(/*bSelect=*/false);
+pWrtShell->Insert(u"test"_ustr);
+pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 4, 
/*bBasicCall=*/false);
+dispatchCommand(mxComponent, u".uno:Cut"_ustr, {});
+dispatchCommand(mxComponent, u".uno:DefaultBullet"_ustr, {});
+aView.m_aInvalidations = tools::Rectangle();
+aView.m_bFullInvalidateSeen = false;
+
+// When pasting at the end of page 1, in a paragraph that is a bullet (a 
list, but not a
+// numbering):
+dispatchCommand(mxComponent, u".uno:PasteUnformatted"_ustr, {});
+
+// Then make sure we only invalidate page 1, not page 2 or page 3:
+CPPUNIT_ASSERT(!aView.m_bFullInvalidateSeen);
+SwRootFrame* pLayout = pWrtShell->GetLayout();
+SwFrame* pPage1 = pLayout->GetLower();
+
CPPUNIT_ASSERT(aView.m_aInvalidations.Overlaps(pPage1->getFrameArea().SVRect()));
+SwFrame* pPage2 = pPage1->GetNext();
+// Without the accompanying fix in place, this test would have failed, we 
invalidated page 2 and
+// page 3 as well.
+
CPPUNIT_ASSERT(!aView.m_aInvalidations.Overlaps(pPage2->getFrameArea().SVRect()));
+SwFrame* pPage3 = pPage2->GetNext();
+
CPPUNIT_ASSERT(!aView.m_aInvalidations.Overlaps(pPage3->getFrameArea().SVRect()));
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx 
b/sw/source/uibase/dochdl/swdtflvr.cxx
index e9cbe2fe675d..b5cd76930891 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -2140,6 +2140,39 @@ SotExchangeDest SwTransferable::GetSotDestination( const 
SwWrtShell& rSh )
 return nRet;
 }
 
+namespace
+{
+bool CanSkipInvalidateNumRules(const SwPosition& rInsertPosition)
+{
+SwTextNode* pTextNode = rInsertPosition.GetNode().GetTextNode();
+if (!pTextNode)
+{
+return false;
+}
+
+const SwNodeNum* pNum = pTextNode->GetNum();
+if (pNum)
+{
+SwNumRule* pNumRule = pNum->GetNumRule();
+if (pNumRule)
+{
+const SvxNumberType rType = 
pNumRule->Get(pTextNode->GetActualListLevel());
+if (rType.GetNumberingType() == SVX_NUM_CHAR_SPECIAL)
+{
+// Bullet list, skip invalidation.
+return true;
+}
+}
+
+// Numbered list, invalidate.
+return false;
+}
+
+// Not a list, skip invalidation.
+return true;
+}
+}
+
 bool SwTransferable::PasteFileContent( const TransferableDataHelper& rData,
 SwWrtShell& 

core.git: sw/qa

2024-07-16 Thread Xisco Fauli (via logerrit)
 sw/qa/extras/autocorrect/autocorrect.cxx |   17 +
 1 file changed, 17 insertions(+)

New commits:
commit 27e8099a740562bd46d716ccc65c8fb42424a557
Author: Xisco Fauli 
AuthorDate: Tue Jul 16 12:44:50 2024 +0200
Commit: Xisco Fauli 
CommitDate: Tue Jul 16 23:39:04 2024 +0200

tdf#42893: sw_autocorrect: Add unittest

Change-Id: I9a01eafea95e121f98153f43691bdb87fbb19e69
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170573
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/autocorrect/autocorrect.cxx 
b/sw/qa/extras/autocorrect/autocorrect.cxx
index be567006a523..ef238451aee0 100644
--- a/sw/qa/extras/autocorrect/autocorrect.cxx
+++ b/sw/qa/extras/autocorrect/autocorrect.cxx
@@ -280,6 +280,23 @@ CPPUNIT_TEST_FIXTURE(SwAutoCorrect, testTdf57640)
 CPPUNIT_ASSERT_EQUAL(u"Dž  "_ustr, getParagraph(1)->getString());
 }
 
+CPPUNIT_TEST_FIXTURE(SwAutoCorrect, testTdf62923)
+{
+createSwDoc(); // Default lang is en-US
+SwXTextDocument& rTextDoc = dynamic_cast(*mxComponent);
+
+OUString sReplaced(u"1–2 "_ustr);
+// Without the fix in place, this test would have failed with
+// - Expected: 1—2
+// - Actual  : 1–2
+emulateTyping(rTextDoc, u"1--2 ");
+CPPUNIT_ASSERT_EQUAL(sReplaced, getParagraph(1)->getString());
+
+sReplaced += u"a—b "_ustr;
+emulateTyping(rTextDoc, u"a--b ");
+CPPUNIT_ASSERT_EQUAL(sReplaced, getParagraph(1)->getString());
+}
+
 CPPUNIT_TEST_FIXTURE(SwAutoCorrect, testTdf42893)
 {
 createSwDoc(); // Default lang is en-US


core.git: sw/qa

2024-07-16 Thread Xisco Fauli (via logerrit)
 sw/qa/extras/autocorrect/autocorrect.cxx |   15 +++
 sw/qa/extras/autocorrect/data/el-GR.fodt |   14 ++
 2 files changed, 29 insertions(+)

New commits:
commit f8c89be7f1548902f8f6449222f87e00d845a303
Author: Xisco Fauli 
AuthorDate: Fri Jun 28 17:09:58 2024 +0200
Commit: Xisco Fauli 
CommitDate: Tue Jul 16 23:28:11 2024 +0200

tdf#158051: sw_autocorrect: Add unittest

Change-Id: Ibde8357f37176b826683771924912ac31e31098d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169719
Reviewed-by: Xisco Fauli 
Tested-by: Jenkins

diff --git a/sw/qa/extras/autocorrect/autocorrect.cxx 
b/sw/qa/extras/autocorrect/autocorrect.cxx
index 228300d1a7ab..be567006a523 100644
--- a/sw/qa/extras/autocorrect/autocorrect.cxx
+++ b/sw/qa/extras/autocorrect/autocorrect.cxx
@@ -395,6 +395,21 @@ CPPUNIT_TEST_FIXTURE(SwAutoCorrect, testTdf133524_Romanian)
 CPPUNIT_ASSERT_EQUAL(sReplaced, getParagraph(1)->getString());
 }
 
+CPPUNIT_TEST_FIXTURE(SwAutoCorrect, testTdf158051)
+{
+createSwDoc("el-GR.fodt");
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+
+// Without the fix in place, this test would have failed with
+// - Expected: Π Τάκης σ’ ευχαριστώ
+// - Actual  : Π Τάκης ς’ ευχαριστώ
+emulateTyping(*pTextDoc, u"π Τάκης σ’ ευχαριστώ");
+
+#if !defined(_WIN32) // For some reason it fails on Window. the manual test 
works fine
+CPPUNIT_ASSERT_EQUAL(u"Π Τάκης σ’ ευχαριστώ"_ustr, 
getParagraph(1)->getString());
+#endif
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/autocorrect/data/el-GR.fodt 
b/sw/qa/extras/autocorrect/data/el-GR.fodt
new file mode 100644
index ..555f3f2e66c3
--- /dev/null
+++ b/sw/qa/extras/autocorrect/data/el-GR.fodt
@@ -0,0 +1,14 @@
+
+http://openoffice.org/2009/office; 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
+  
+  
+   
+  
+ 
+ 
+  
+   
+  
+ 
+


core.git: sw/qa

2024-07-16 Thread Xisco Fauli (via logerrit)
 sw/qa/extras/autocorrect/autocorrect.cxx |  220 +--
 1 file changed, 127 insertions(+), 93 deletions(-)

New commits:
commit 5f68f3b4d83e8975cee216cd7a90a2a5ed459a69
Author: Xisco Fauli 
AuthorDate: Tue Jul 16 18:45:24 2024 +0200
Commit: Xisco Fauli 
CommitDate: Tue Jul 16 22:05:18 2024 +0200

CppunitTest_sw_autocorrect: split into different tests

It seems CI fails on Windows sometimes.
See https://gerrit.libreoffice.org/c/core/+/170573

Change-Id: I3e48d2656f31451e07a8bd52e98c793fa409f4c7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170591
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/autocorrect/autocorrect.cxx 
b/sw/qa/extras/autocorrect/autocorrect.cxx
index 877254f368fb..228300d1a7ab 100644
--- a/sw/qa/extras/autocorrect/autocorrect.cxx
+++ b/sw/qa/extras/autocorrect/autocorrect.cxx
@@ -28,13 +28,13 @@ public:
 }
 };
 
-CPPUNIT_TEST_FIXTURE(SwAutoCorrect, nl_BE)
+CPPUNIT_TEST_FIXTURE(SwAutoCorrect, testTdf92029)
 {
 createSwDoc("nl-BE.fodt");
 
 SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
 
-// tdf#92029: Without the fix in place, this test would have failed with
+// Without the fix in place, this test would have failed with
 // - Expected: Ik ben ’s morgens opgestaan
 // - Actual  : Ik ben ‘s morgens opgestaan
 emulateTyping(*pTextDoc, u"Ik ben 's morgens opgestaan");
@@ -42,36 +42,46 @@ CPPUNIT_TEST_FIXTURE(SwAutoCorrect, nl_BE)
 CPPUNIT_ASSERT_EQUAL(sReplaced, getParagraph(1)->getString());
 }
 
-CPPUNIT_TEST_FIXTURE(SwAutoCorrect, fr_FR)
+CPPUNIT_TEST_FIXTURE(SwAutoCorrect, testTdf158703)
 {
 createSwDoc("fr-FR.fodt");
 SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
 CPPUNIT_ASSERT(pTextDoc);
 
-// tdf#158703: Typing ":" after the spaces should start auto-correction, 
which is expected to
+// Typing ":" after the spaces should start auto-correction, which is 
expected to
 // remove the spaces, and insert an NBSP instead. It must not crash.
 emulateTyping(*pTextDoc, u"Foo :");
 CPPUNIT_ASSERT_EQUAL(u"Foo\u00A0:"_ustr, getParagraph(1)->getString());
+}
 
-dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {});
+CPPUNIT_TEST_FIXTURE(SwAutoCorrect, testTdf38394)
+{
+createSwDoc("fr-FR.fodt");
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
 
-// tdf#38394: testing autocorrect of French l'" -> l'« (instead of l'»)
+// testing autocorrect of French l'" -> l'« (instead of l'»)
 emulateTyping(*pTextDoc, u"l'\"");
-OUString sReplaced(u"l\u2019« "_ustr);
-CPPUNIT_ASSERT_EQUAL(sReplaced, getParagraph(1)->getString());
-// tdf#132301 autocorrect of qu'«
+CPPUNIT_ASSERT_EQUAL(u"l\u2019« "_ustr, getParagraph(1)->getString());
+}
+
+CPPUNIT_TEST_FIXTURE(SwAutoCorrect, testTdf132301)
+{
+createSwDoc("fr-FR.fodt");
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+
+// autocorrect of qu'«
 emulateTyping(*pTextDoc, u" qu'\"");
-sReplaced += u" qu\u2019« ";
-CPPUNIT_ASSERT_EQUAL(sReplaced, getParagraph(1)->getString());
+CPPUNIT_ASSERT_EQUAL(u" qu\u2019« "_ustr, getParagraph(1)->getString());
 }
 
-CPPUNIT_TEST_FIXTURE(SwAutoCorrect, pt_BR)
+CPPUNIT_TEST_FIXTURE(SwAutoCorrect, tdfTdf44293)
 {
 createSwDoc("pt-BR.fodt");
 SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
 CPPUNIT_ASSERT(pTextDoc);
 
-// tdf#44293
 emulateTyping(*pTextDoc, u"1a 1o ");
 CPPUNIT_ASSERT_EQUAL(u"1.a 1.o "_ustr, getParagraph(1)->getString());
 emulateTyping(*pTextDoc, u"1ra 1ro ");
@@ -81,8 +91,15 @@ CPPUNIT_TEST_FIXTURE(SwAutoCorrect, pt_BR)
  getParagraph(1)->getString());
 }
 
-CPPUNIT_TEST_FIXTURE(SwAutoCorrect, de_DE)
+CPPUNIT_TEST_FIXTURE(SwAutoCorrect, testTdf151801)
 {
+Resetter resetter([]() {
+std::shared_ptr pBatch(
+comphelper::ConfigurationChanges::create());
+officecfg::Office::Common::AutoCorrect::SingleQuoteAtStart::set(0, 
pBatch);
+officecfg::Office::Common::AutoCorrect::SingleQuoteAtEnd::set(0, 
pBatch);
+return pBatch->commit();
+});
 // Set Single Quotes › and ‹
 std::shared_ptr pBatch(
 comphelper::ConfigurationChanges::create());
@@ -91,48 +108,44 @@ CPPUNIT_TEST_FIXTURE(SwAutoCorrect, de_DE)
 pBatch->commit();
 
 createSwDoc("de-DE.fodt");
-SwDoc* pDoc = getSwDoc();
-SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
-CPPUNIT_ASSERT(pWrtShell);
 SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
-// tdf#151801: Single starting quote: 'word -> ›word
+
+// Single starting quote: 'word -> ›word
 emulateTyping(*pTextDoc, u"'word");
 OUString sReplaced(u"\u203Aword"_ustr);
 CPPUNIT_ASSERT_EQUAL(sReplaced, getParagraph(1)->getString());
-// 

core.git: sw/qa sw/source

2024-07-16 Thread Justin Luth (via logerrit)
 dev/null |binary
 sw/qa/core/header_footer/HeaderFooterTest.cxx|   13 -
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |   10 --
 sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx |   12 
 sw/source/writerfilter/dmapper/PropertyMap.cxx   |6 ++
 5 files changed, 2 insertions(+), 39 deletions(-)

New commits:
commit 671290e8054366997e512572b2e4e38efbf95f80
Author: Justin Luth 
AuthorDate: Mon Jul 15 14:33:32 2024 -0400
Commit: Justin Luth 
CommitDate: Tue Jul 16 13:48:19 2024 +0200

Revert "tdf#159013 writerfilter: link to the correct first-page header"

This reverts commit 25.2 358ac0da827f908ce312c6d392a3d9102f36428e.
which was backported to 24.8

Although this patch made the situation "better than it was"
for most cases, it will inevitably make some documents worse.

Ultimately, this approach is wrong.
See tdf#158977's 158977_linkNonEmptyFirst.docx.

We can't only copy from the styles that "express" a H/F
(and UNO doesn't let us copy from styles that hide it).

A COPY appropach would need to ALWAYS import every header/footer
into a dedicated "header/footer repository" page style,
and every page style would need to copy its "expressed"
headers/footers from the repository to its page style.

That would mean our copy procedure would need to be very robust,
and all of this is way too big for a bug-fixer like me to consider.
I don't want to be the one on the hook expected to fix it properly.

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

diff --git a/sw/qa/core/header_footer/HeaderFooterTest.cxx 
b/sw/qa/core/header_footer/HeaderFooterTest.cxx
index 763012652c7c..acfd77f1270e 100644
--- a/sw/qa/core/header_footer/HeaderFooterTest.cxx
+++ b/sw/qa/core/header_footer/HeaderFooterTest.cxx
@@ -525,19 +525,6 @@ CPPUNIT_TEST_FIXTURE(HeaderFooterTest, 
testTdf145998_firstHeader)
 CPPUNIT_ASSERT_EQUAL(u"Normal Header"_ustr, 
parseDump("/root/page[2]/header/txt"_ostr));
 }
 
-CPPUNIT_TEST_FIXTURE(HeaderFooterTest, testTdf1159013_firstHeaderCopy)
-{
-// given a document with a first-header-section, a non-first-section, then 
a first-link-section
-createSwDoc("tdf1159013_firstHeaderCopy.docx");
-saveAndReload(u"Office Open XML Text"_ustr);
-
-// Sanity check - always good to test when dealing with page styles and 
breaks.
-CPPUNIT_ASSERT_EQUAL(5, getPages());
-
-// This was copying the non-first-section header instead of "linking" to 
the first
-CPPUNIT_ASSERT_EQUAL(u"First Page header"_ustr, 
parseDump("/root/page[5]/header/txt"_ostr));
-}
-
 CPPUNIT_TEST_FIXTURE(HeaderFooterTest, testEvenPageOddPageFooter_Import)
 {
 // Related tdf#135216
diff --git a/sw/qa/core/header_footer/data/tdf1159013_firstHeaderCopy.docx 
b/sw/qa/core/header_footer/data/tdf1159013_firstHeaderCopy.docx
deleted file mode 100644
index fa2c84cbe4cd..
Binary files a/sw/qa/core/header_footer/data/tdf1159013_firstHeaderCopy.docx 
and /dev/null differ
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index 5e01071bfa62..a6bbf5302f89 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -3993,16 +3993,6 @@ void DomainMapper_Impl::PopPageHeaderFooter(PagePartType 
ePagePartType, PageType
 if (pSectionContext)
 {
 pSectionContext->clearHeaderFooterLinkToPrevious(ePagePartType, eType);
-
-// remember most recent "first page" header/footer so follow sections 
can "link" to them
-if (eType == PageType::FIRST)
-{
-if (ePagePartType == PagePartType::Header)
-m_pLastFirstHeader = pSectionContext->GetPageStyle(*this);
-else if (ePagePartType == PagePartType::Footer)
-m_pLastFirstFooter = pSectionContext->GetPageStyle(*this);
-}
-
 m_HeaderFooterSeen.emplace(ePagePartType, eType);
 }
 
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx
index 86df252b8ff9..9ab2e6f789f8 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx
@@ -617,8 +617,6 @@ private:
 
 PropertyMapPtr  m_pTopContext;
 tools::SvRef m_pLastSectionContext;
-rtl::Reference m_pLastFirstHeader; // last page style with 
different first header
-rtl::Reference m_pLastFirstFooter; // last page style with 
different first footer
 PropertyMapPtr   m_pLastCharacterContext;
 
 ::std::vector m_aCurrentTabStops;
@@ -718,16 +716,6 @@ public:
 return m_pLastSectionContext.get( );
 }
 

core.git: sw/qa

2024-07-15 Thread Justin Luth (via logerrit)
 sw/qa/extras/rtfexport/rtfexport2.cxx |   25 +
 1 file changed, 9 insertions(+), 16 deletions(-)

New commits:
commit 1d2c42037c6704122581c2c6f0dd9d7979f49211
Author: Justin Luth 
AuthorDate: Mon Jul 15 15:40:20 2024 -0400
Commit: Justin Luth 
CommitDate: Tue Jul 16 05:26:27 2024 +0200

tdf#158977: restore disabled rtfexport2 testFdo44176

Some unit tests were disabled with
tdf#136472 adjust ooxml import to handle first header/footer

This unit test seems pointless currently,
but apparently back in 3.5 days it means something.
The point is that the header space on the two pages
is supposed to be identical, which measureably
means that the body area of the pages should be identical.

Adapted to try to keep the test alive and potentially relevant.

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

diff --git a/sw/qa/extras/rtfexport/rtfexport2.cxx 
b/sw/qa/extras/rtfexport/rtfexport2.cxx
index 03cca0a40ee9..49bedd63213a 100644
--- a/sw/qa/extras/rtfexport/rtfexport2.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport2.cxx
@@ -354,27 +354,20 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo47107)
 verify();
 }
 
-// TODO - First Page Headers Support
-// This assumption is false now - we only have "Standard" page style, which 
should have properties properly set
-/*CPPUNIT_TEST_FIXTURE(Test, testFdo44176)
-{
-auto verify = [this]() {
-uno::Reference 
xPageStyles(getStyles("PageStyles"));
-uno::Reference 
xFirstPage(xPageStyles->getByName("First Page"),
-   uno::UNO_QUERY);
-uno::Reference 
xDefault(xPageStyles->getByName("Standard"),
- uno::UNO_QUERY);
-sal_Int32 nFirstTop = 0, nDefaultTop = 0, nDefaultHeader = 0;
-xFirstPage->getPropertyValue("TopMargin") >>= nFirstTop;
-xDefault->getPropertyValue("TopMargin") >>= nDefaultTop;
-xDefault->getPropertyValue("HeaderHeight") >>= nDefaultHeader;
-CPPUNIT_ASSERT_EQUAL(nFirstTop, nDefaultTop + nDefaultHeader);
+CPPUNIT_TEST_FIXTURE(Test, testFdo44176)
+{
+auto verify = [this]() {
+// given a document with an empty first header, and a non-empty follow 
header,
+// ensure that the body text space is equal on the first and follow 
page
+// (since in this case the default margins are large enough to fully 
include the header)
+const OUString sBodyHeight = parseDump("//page[1]/body/infos"_ostr, 
"height"_ostr);
+CPPUNIT_ASSERT_EQUAL(sBodyHeight, 
parseDump("//page[2]/body/infos"_ostr, "height"_ostr));
 };
 createSwDoc("fdo44176.rtf");
 verify();
 saveAndReload(mpFilter);
 verify();
-}*/
+}
 
 CPPUNIT_TEST_FIXTURE(Test, testFdo39053)
 {


core.git: sw/qa

2024-07-15 Thread Justin Luth (via logerrit)
 sw/qa/extras/rtfexport/data/fdo44174.rtf |6 --
 sw/qa/extras/rtfexport/rtfexport.cxx |   19 ---
 2 files changed, 25 deletions(-)

New commits:
commit 626a9e73a0ed8072a5a078dceaf1b4e2ec9ef0d5
Author: Justin Luth 
AuthorDate: Mon Jul 15 11:21:31 2024 -0400
Commit: Justin Luth 
CommitDate: Mon Jul 15 21:47:20 2024 +0200

tdf#158977: remove obsolete rtfexport testFdo44174

Some unit tests were changed or disabled with
tdf#136472 adjust ooxml import to handle first header/footer

This unit test is basically the same file as rtfexport2's fdo44176.rtf
except that one actually has two pages, while this one SAYS
it has two pages but only actually has one.

Nor are there any headers or footers involved,
so it is a completely pointless test.

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

diff --git a/sw/qa/extras/rtfexport/data/fdo44174.rtf 
b/sw/qa/extras/rtfexport/data/fdo44174.rtf
deleted file mode 100644
index 518619327208..
--- a/sw/qa/extras/rtfexport/data/fdo44174.rtf
+++ /dev/null
@@ -1,6 +0,0 @@
-{ tf1
-   itlepg
-First page has no header.
-\pagebb
-Second page has a header.
-\par }
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx 
b/sw/qa/extras/rtfexport/rtfexport.cxx
index 849071f18e20..fb7c05a0e8a1 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -90,25 +90,6 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo49683)
 verify();
 }
 
-// TODO Use case not clear!
-CPPUNIT_TEST_FIXTURE(Test, testFdo44174)
-{
-auto verify = [this]() {
-uno::Reference xModel(mxComponent, uno::UNO_QUERY);
-uno::Reference xTextViewCursorSupplier(
-xModel->getCurrentController(), uno::UNO_QUERY);
-uno::Reference 
xPropertySet(xTextViewCursorSupplier->getViewCursor(),
- uno::UNO_QUERY);
-OUString aValue;
-xPropertySet->getPropertyValue(u"PageStyleName"_ustr) >>= aValue;
-CPPUNIT_ASSERT_EQUAL(u"Standard"_ustr, aValue);
-};
-createSwDoc("fdo44174.rtf");
-verify();
-saveAndReload(mpFilter);
-verify();
-}
-
 CPPUNIT_TEST_FIXTURE(Test, testFdo50087)
 {
 auto verify = [this]() {


core.git: sw/qa

2024-07-15 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |   10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

New commits:
commit aec34ae349aee866db628e7a48cd1b5f6cc6dca1
Author: Justin Luth 
AuthorDate: Mon Jul 15 11:12:45 2024 -0400
Commit: Justin Luth 
CommitDate: Mon Jul 15 21:46:46 2024 +0200

tdf#158977: restore disable ooxmlimport unit test

Some unit tests were disabled with
tdf#136472 adjust ooxml import to handle first header/footer

This one simply needed to be re-written to reliably test
if it was laid out on page 1.

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

diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index eab15994c459..4fb26cb80367 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -172,7 +172,6 @@ CPPUNIT_TEST_FIXTURE(Test, testN751077)
 createSwDoc("n751077.docx");
 /*
 xray ThisComponent.DrawPage(1).getByIndex(0).String
-xray ThisComponent.DrawPage(1).getByIndex(0).Anchor.PageStyleName
 */
 uno::Reference xShapes(getShape(2), uno::UNO_QUERY);
 // The groupshape should be in the foreground, not the background.
@@ -180,11 +179,10 @@ xray 
ThisComponent.DrawPage(1).getByIndex(0).Anchor.PageStyleName
 
 uno::Reference xShape(xShapes->getByIndex(0), 
uno::UNO_QUERY);
 CPPUNIT_ASSERT_EQUAL(u"TEXT1
"_ustr, xShape->getString());
-// we want to test the textbox is on the first page (it was put onto 
another page without the fix),
-// use a small trick and instead of checking the page layout, check the 
page style
-uno::Reference xTextContent(xShape, uno::UNO_QUERY);
-CPPUNIT_ASSERT_EQUAL(u"Standard"_ustr, 
getProperty(xTextContent->getAnchor(), u"PageStyleName"_ustr));
-// TODO - This is not a reliable way to determine if something is on first 
page
+
+// test the textbox is on the first page (it was put onto another page 
without the fix)
+const xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+assertXPathContent(pXmlDoc, "//page[1]//OutlinerParaObject[1]//text"_ostr, 
"TEXT1");
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testTdf129237)


core.git: sw/qa sw/source

2024-07-15 Thread Oliver Specht (via logerrit)
 sw/qa/extras/rtfexport/data/tdf161864.rtf|   20 
 sw/qa/extras/rtfexport/rtfexport8.cxx|   23 +++
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |   17 --
 3 files changed, 58 insertions(+), 2 deletions(-)

New commits:
commit 0b7201bc4299f76c8a3e085f213ffeb7ea9e8556
Author: Oliver Specht 
AuthorDate: Tue Jul 2 11:14:20 2024 +0200
Commit: Thorsten Behrens 
CommitDate: Mon Jul 15 21:12:06 2024 +0200

tdf#161864 Apply character properties to SYMBOL field

In RTF import character attributes are applied to symbols
imported from ield{ SYMBOL }.

Change-Id: I088c47e799380813dce19fd9823cdba6b8048af1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169864
Tested-by: Gabor Kelemen 
Reviewed-by: Thorsten Behrens 
Tested-by: Jenkins

diff --git a/sw/qa/extras/rtfexport/data/tdf161864.rtf 
b/sw/qa/extras/rtfexport/data/tdf161864.rtf
new file mode 100755
index ..785399acf3b9
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf161864.rtf
@@ -0,0 +1,20 @@
+{ tf1nsi\deff0deflang1025
+{onttbl
+{2swissprq2charset0 Liberation Serif;}
+{10nilprq2charset0 Mangal;}
+}
+{+{\stylesheet{\s0\snext0
owidctlpar{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}+{\s15\sbasedon0\snext16\sb240\sa120\keepn\dbchf5\dbchf6fs28\loch
2s28 Heading;}
+{\s16\sbasedon0\snext16\sb0\sa120 Text body;}
+{\s17\sbasedon16\snext17\sb0\sa120\dbchf7 List;}
+{\s18\sbasedon0\snext18\sb120\sa120
oline\i\dbchf7fs24is24 Caption;}
+{\s19\sbasedon0\snext19
oline\dbchf7 Index;}
+}{\info{uthor trent}{+iewscale100
+{\*\pgdsctbl
+{\pgdsc0\pgdscuse195\pgwsxn11906\pghsxn16838\marglsxn1440\margrsxn1440\margtsxn1440\margbsxn1440\pgdscnxt0
 Default;}}
+
ormshade{\*\pgdscno0}\paperh16838\paperw11906\margl1440\margr1440\margt1440\margb1440\sectd\sbknone\sectunlocked1\pgndec\pgwsxn11906\pghsxn16838\marglsxn1440\margrsxn1440\margtsxn1440\margbsxn1440
tnbjtnstart1tnrstconttnnarenddocftnrstcontftnstart1ftnnrlc
+\pgndec\pard\plain \s0
owidctlpar{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}+s8 {ield{\*ldinst 
SYMBOL 108 \f "Liberation Serif" \s 8}{ldrslt10s8}} First bullet in 4pt s22 
{ield{\*ldinst SYMBOL 108 \f "Liberation Serif" \s 8}{ldrslt10s22}} second 
bullet in 11pts32 {ield{\*ldinst SYMBOL 108 \f "Liberation Serif" \s 16}{
ldrslt10s32}} last one in 16pt}
+\par }
diff --git a/sw/qa/extras/rtfexport/rtfexport8.cxx 
b/sw/qa/extras/rtfexport/rtfexport8.cxx
index 28b755cd8f4a..a4457ef13aa8 100644
--- a/sw/qa/extras/rtfexport/rtfexport8.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport8.cxx
@@ -582,6 +582,29 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf158982)
 verify();
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf161864)
+{
+auto verify = [this]() {
+//check bullet size at position 0, 22, 45 with 4/11/16 pt
+uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xText = xTextDocument->getText();
+uno::Reference xCursor = xText->createTextCursor();
+uno::Reference xPropSet(xCursor, uno::UNO_QUERY);
+xCursor->goRight(1, true);
+CPPUNIT_ASSERT_EQUAL(uno::Any(float(4)), 
xPropSet->getPropertyValue(u"CharHeight"_ustr));
+xCursor->goRight(21, false);
+xCursor->goRight(1, true);
+CPPUNIT_ASSERT_EQUAL(uno::Any(float(11)), 
xPropSet->getPropertyValue(u"CharHeight"_ustr));
+xCursor->goRight(22, false);
+xCursor->goRight(1, true);
+CPPUNIT_ASSERT_EQUAL(uno::Any(float(16)), 
xPropSet->getPropertyValue(u"CharHeight"_ustr));
+};
+createSwDoc("tdf161864.rtf");
+verify();
+saveAndReload(mpFilter);
+verify();
+}
+
 } // 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 00c098a11b8e..5e01071bfa62 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -8316,8 +8316,6 @@ void DomainMapper_Impl::CloseFieldCommand()
 sFont = sFont.copy(0,sFont.getLength()-1);
 }
 
-
-
 if (xTextAppend.is())
 {
 uno::Reference< text::XText > xText = 
xTextAppend->getText();
@@ -8336,6 +8334,21 @@ void DomainMapper_Impl::CloseFieldCommand()
 
xProp->setPropertyValue(getPropertyName(PROP_CHAR_FONT_NAME_COMPLEX), aVal);
 
 }
+PropertyMapPtr pCharTopContext = 
GetTopContextOfType(CONTEXT_CHARACTER);
+if (pCharTopContext.is())
+{
+uno::Sequence aValues
+= pCharTopContext->GetPropertyValues(
+/*bCharGrabBag=*/!IsInComments());
+   

core.git: sw/qa sw/source

2024-07-15 Thread Oliver Specht (via logerrit)
 sw/qa/extras/rtfimport/data/tdf148544.rtf   |  512 
 sw/qa/extras/rtfimport/rtfimport.cxx|   27 +
 sw/source/writerfilter/rtftok/rtfdispatchsymbol.cxx |   39 +
 sw/source/writerfilter/rtftok/rtfdispatchvalue.cxx  |6 
 4 files changed, 581 insertions(+), 3 deletions(-)

New commits:
commit 13cd36248069d32688cfb8adfe0955ca5229e075
Author: Oliver Specht 
AuthorDate: Tue Jul 9 08:50:46 2024 +0200
Commit: Thorsten Behrens 
CommitDate: Mon Jul 15 20:14:29 2024 +0200

tdf#148554 RTF import - reset borders on fill cells

In documents containing tables with rows having different right margins
an additional cell is added to fill the gap.
These cells should be 'invisible' and therefore need to have no border.

Change-Id: I802310251f36fb6b2c00f3cb38786f438e4565a6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170179
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/sw/qa/extras/rtfimport/data/tdf148544.rtf 
b/sw/qa/extras/rtfimport/data/tdf148544.rtf
new file mode 100755
index ..0677acb3ce91
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf148544.rtf
@@ -0,0 +1,512 @@
+{ 
tf1deflang1025nsinsicpg1250\uc1deff0\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1038\deflangfe1038
   hemelang1031hemelangfe0 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};}{2bidi moderncharset0prq1{\*\panose 
02070309020205020404}Courier New;}{2bidi moderncharset0prq1{\*\panose 
02070309020205020404}Courier New;}
+{39bidi swisscharset0prq2{\*\panose 020b0604030504040204}Tahoma;}{
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};}{321bidi romancharset238prq2 Times New 
Roman CE{\*alt Times New Roman};}
+{322bidi romancharset204prq2 Times New Roman Cyr{\*alt Times New 
Roman};}{324bidi romancharset161prq2 Times New Roman Greek{\*alt Times 
New Roman};}
+{325bidi romancharset162prq2 Times New Roman Tur{\*alt Times New 
Roman};}{326bidi romancharset177prq2 Times New Roman (Hebrew){\*alt Times 
New Roman};}
+{327bidi romancharset178prq2 Times New Roman (Arabic){\*alt Times New 
Roman};}{328bidi romancharset186prq2 Times New Roman Baltic{\*alt Times 
New Roman};}
+{329bidi romancharset163prq2 Times New Roman (Vietnamese){\*alt Times 
New Roman};}{331bidi swisscharset238prq2 Arial CE{\*alt Helvetica};}{332
bidi swisscharset204prq2 Arial Cyr{\*alt Helvetica};}
+{334bidi swisscharset161prq2 Arial Greek{\*alt Helvetica};}{335bidi 
swisscharset162prq2 Arial Tur{\*alt Helvetica};}{336bidi swisscharset177
prq2 Arial (Hebrew){\*alt Helvetica};}
+{337bidi swisscharset178prq2 Arial (Arabic){\*alt Helvetica};}{338bidi 
swisscharset186prq2 Arial Baltic{\*alt Helvetica};}{339bidi swiss
charset163prq2 Arial (Vietnamese){\*alt Helvetica};}
+{341bidi moderncharset238prq1 Courier New CE;}{342bidi modern
charset204prq1 Courier New Cyr;}{344bidi moderncharset161prq1 Courier New 
Greek;}{345bidi moderncharset162prq1 Courier New Tur;}
+{346bidi moderncharset177prq1 Courier New (Hebrew);}{347bidi modern
charset178prq1 Courier New (Arabic);}{348bidi moderncharset186prq1 
Courier New Baltic;}{349bidi moderncharset163prq1 Courier New 
(Vietnamese);}
+{341bidi moderncharset238prq1 Courier New CE;}{342bidi modern
charset204prq1 Courier New Cyr;}{344bidi moderncharset161prq1 Courier New 
Greek;}{345bidi moderncharset162prq1 Courier New Tur;}
+{346bidi moderncharset177prq1 Courier New (Hebrew);}{347bidi modern
charset178prq1 Courier New (Arabic);}{348bidi moderncharset186prq1 
Courier New Baltic;}{349bidi moderncharset163prq1 Courier New 
(Vietnamese);}
+{711bidi swisscharset238prq2 Tahoma CE;}{712bidi swisscharset204prq2 
Tahoma Cyr;}{714bidi swisscharset161prq2 Tahoma Greek;}{715bidi swiss
charset162prq2 Tahoma Tur;}
+{716bidi swisscharset177prq2 Tahoma 

core.git: sw/qa sw/source

2024-07-12 Thread Balazs Varga (via logerrit)
 sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx |4 +++-
 sw/qa/core/accessibilitycheck/data/TabsTest.odt  |binary
 sw/source/core/access/AccessibilityCheck.cxx |   11 +--
 3 files changed, 12 insertions(+), 3 deletions(-)

New commits:
commit 629a20b97f186531d73d78ef8a02e5def35f22e1
Author: Balazs Varga 
AuthorDate: Thu Jul 11 18:33:25 2024 +0200
Commit: Balazs Varga 
CommitDate: Fri Jul 12 16:54:01 2024 +0200

tdf#159776 - A11Y sidebar: Fix no warning about multiple tabs

used for creating spacing.

Change-Id: I9a2725954406140efa27ccc3ae30f19d0bd1fa8a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170387
Reviewed-by: Balazs Varga 
Tested-by: Jenkins

diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx 
b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
index 77330b9a8157..43a872832ee0 100644
--- a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
+++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
@@ -219,7 +219,7 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, 
testCheckTabsFormatting)
 sw::AccessibilityCheck aCheck(pDoc);
 aCheck.check();
 auto& aIssues = aCheck.getIssueCollection().getIssues();
-CPPUNIT_ASSERT_EQUAL(size_t(8), aIssues.size());
+CPPUNIT_ASSERT_EQUAL(size_t(10), aIssues.size());
 CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[0]->m_eIssueID);
 CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, 
aIssues[1]->m_eIssueID);
 CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[2]->m_eIssueID);
@@ -228,6 +228,8 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, 
testCheckTabsFormatting)
 CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, 
aIssues[5]->m_eIssueID);
 CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[6]->m_eIssueID);
 CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, 
aIssues[7]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[8]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, 
aIssues[9]->m_eIssueID);
 }
 
 //tdf#156550 - Accessibility sidebar complains about TOC hyperlinks
diff --git a/sw/qa/core/accessibilitycheck/data/TabsTest.odt 
b/sw/qa/core/accessibilitycheck/data/TabsTest.odt
index 29b415df87a7..d48a5a0155cf 100644
Binary files a/sw/qa/core/accessibilitycheck/data/TabsTest.odt and 
b/sw/qa/core/accessibilitycheck/data/TabsTest.odt differ
diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 723d20566f24..429b94a02efb 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -937,6 +937,7 @@ public:
 sal_Int32 nTabCount = 0;
 bool bNonSpaceFound = false;
 bool bPreviousWasChar = false;
+bool bPreviousWasTab = false;
 for (sal_Int32 i = 0; i < nParagraphLength; i++)
 {
 switch (sParagraphText[i])
@@ -958,10 +959,15 @@ public:
 if (pSection && pSection->GetTOXBase())
 continue;
 
-if (bPreviousWasChar)
+// text between tabs or text align at least with two tabs
+if (bPreviousWasChar || bPreviousWasTab)
 {
 ++nTabCount;
-bPreviousWasChar = false;
+if (bPreviousWasChar)
+{
+bPreviousWasChar = false;
+bPreviousWasTab = true;
+}
 if (nTabCount == 2)
 {
 auto pIssue = lclAddIssue(m_rIssueCollection,
@@ -993,6 +999,7 @@ public:
 }
 bNonSpaceFound = true;
 bPreviousWasChar = true;
+bPreviousWasTab = false;
 nSpaceCount = 0;
 break;
 }


core.git: sw/qa sw/source

2024-07-12 Thread Michael Stahl (via logerrit)
 sw/qa/extras/layout/data/field_hide_section.fodt |  193 +++
 sw/qa/extras/layout/layout.cxx   |   45 +
 sw/source/core/layout/trvlfrm.cxx|5 
 3 files changed, 243 insertions(+)

New commits:
commit e2d82681a8055d0d4e7007b8dacf38f5675bc70f
Author: Michael Stahl 
AuthorDate: Thu Jul 11 14:55:26 2024 +0200
Commit: Michael Stahl 
CommitDate: Fri Jul 12 10:18:45 2024 +0200

sw: layout: ShrinkFrame() may do nothing for layout frames...

... which may cause empty pages, so explicitly set the height to 0.

(regression from commit 2dce213ce9f399c6ce1a3e928f34fa27988fa833)

Change-Id: Ife5c2873b375431d2dd90c9b7e8b3b8c40a9cf7f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170383
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/layout/data/field_hide_section.fodt 
b/sw/qa/extras/layout/data/field_hide_section.fodt
new file mode 100644
index ..9d00bf6f8c4c
--- /dev/null
+++ b/sw/qa/extras/layout/data/field_hide_section.fodt
@@ -0,0 +1,193 @@
+
+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">
+ 
2024-07-11T15:14:52.010777485PT2M3S2CIB_OfficeDev/6.4.0.26$Linux_X86_64
 
LibreOffice_project/c02dfb55f9962adebc1d2eb5248abd10c63e7bbe2024-07-11T15:16:53.863806593
+ 
+  
+  
+  
+ 
+ 
+  
+   
+   
+
+   
+   
+  
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+  
+   
+  
+  
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+  
+  
+  
+  
+ 
+ 
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+
+   
+  
+  
+   
+
+   
+   
+   
+  
+  
+   
+  
+ 
+ 
+  
+ 
+ 
+  
+   
+
+   
+   
+
+
+
+
+
+   
+   0
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+Abc
+
+ 
+ 
+ 
+ 
+  
+   d
+  
+  
+   e
+  
+ 
+ 
+  
+   f
+  
+  
+   g
+  
+ 
+
+xyz
+   
+   
+  
+ 
+
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 6c01a32bcaaf..ea03eef254de 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /// Test to assert layout / rendering result of Writer.
 class SwLayoutWriter : public SwModelTestBase
@@ -807,6 +808,50 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testFlyHiddenParagraph)
 Scheduler::ProcessEventsToIdle();
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testFieldHideSection)
+{
+

core.git: sw/qa sw/source

2024-07-11 Thread Michael Stahl (via logerrit)
 sw/qa/extras/layout/data/fly_hidden_paragraph.fodt |  127 +
 sw/qa/extras/layout/layout.cxx |   60 +
 sw/source/core/layout/trvlfrm.cxx  |5 
 3 files changed, 188 insertions(+), 4 deletions(-)

New commits:
commit 2dce213ce9f399c6ce1a3e928f34fa27988fa833
Author: Michael Stahl 
AuthorDate: Wed Jul 10 14:19:56 2024 +0200
Commit: Michael Stahl 
CommitDate: Thu Jul 11 13:24:50 2024 +0200

sw: layout: invalidate upper when hiding frame

If a text frame is in a fly frame, and View->Field Names is turned off,
the text frame is hidden but the fly frame is still the same size as
before.  Call ShrinkFrame() to do some invalidations.

(regression from commit fc1e6a64bd0517a7e67f08860c29b44d030220eb)

Change-Id: I154551ebaa2370d088b12e178954f92d33056711
(cherry picked from commit b77ebc93844f1b54c74ae5db9253a1d3ff618968)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170323
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/layout/data/fly_hidden_paragraph.fodt 
b/sw/qa/extras/layout/data/fly_hidden_paragraph.fodt
new file mode 100644
index ..51731a6b368a
--- /dev/null
+++ b/sw/qa/extras/layout/data/fly_hidden_paragraph.fodt
@@ -0,0 +1,127 @@
+
+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">
+  
+  
+  
+  
+ 
+ 
+  
+   
+   
+
+   
+   
+  
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+  
+  
+   
+  
+  
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+  
+  
+  
+  
+ 
+ 
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+
+   
+   
+   
+  
+ 
+ 
+  
+ 
+ 
+  
+   
+
+
+
+
+
+   
+   
+
+   
+   
+ 
+  invisible
+ 
+
+  
+ 
+
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 10d8717e5f4a..6c01a32bcaaf 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -747,6 +747,66 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testFlyHiddenParagraph)
+{
+createSwDoc("fly_hidden_paragraph.fodt");
+
+// first, disable both so para gets hidden
+uno::Sequence argsSH(
+comphelper::InitPropertySequence({ { "ShowHiddenParagraphs", 
uno::Any(false) } }));
+dispatchCommand(mxComponent, ".uno:ShowHiddenParagraphs", argsSH);
+
+uno::Sequence args(
+comphelper::InitPropertySequence({ { "Fieldnames", uno::Any(false) } 
}));
+
+dispatchCommand(mxComponent, ".uno:Fieldnames", args);
+Scheduler::ProcessEventsToIdle();
+
+

core.git: sw/qa sw/source

2024-07-11 Thread Justin Luth (via logerrit)
 sw/qa/writerfilter/dmapper/PropertyMap.cxx |   37 +
 sw/source/writerfilter/dmapper/PropertyMap.cxx |5 ++-
 2 files changed, 40 insertions(+), 2 deletions(-)

New commits:
commit aaf93cd9629acd476284a4933a656ddd188a80aa
Author: Justin Luth 
AuthorDate: Wed Jul 10 19:26:20 2024 -0400
Commit: Tomaž Vajngerl 
CommitDate: Thu Jul 11 12:33:07 2024 +0200

tdf#160139 sw RTF paste: don't empty headers/footers

Regression from quikee's 24.2
commit 4b0fa253a4540f5461397815d290586f9ddabe61
tdf#136472 adjust ooxml import to handle first header/footer

RTF paste is particularly nasty because it calls CloseSectionGroup,
which is rather strange for just pasting some characters...

Fix the problem by leaving the paste alone:
we already omit a number of actions in this case,
and was similarly done initially by quikee in copyHeaderFooter.

setHeaderFooterProperties() was newly added by quikee,
so relatively safe to start avoiding on paste.

make CppunitTest_sw_writerfilter_dmapper \
CPPUNIT_TEST_NAME=testPasteHeaderEmptied

Change-Id: Iad997481a75bb971f9e71373175134cbec9aa7d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170328
Reviewed-by: Tomaž Vajngerl 
Tested-by: Jenkins

diff --git a/sw/qa/writerfilter/dmapper/PropertyMap.cxx 
b/sw/qa/writerfilter/dmapper/PropertyMap.cxx
index 3a564d886f1f..83a3b660c3c9 100644
--- a/sw/qa/writerfilter/dmapper/PropertyMap.cxx
+++ b/sw/qa/writerfilter/dmapper/PropertyMap.cxx
@@ -181,6 +181,43 @@ CPPUNIT_TEST_FIXTURE(Test, testPasteHeaderDisable)
 // Then make sure the header stays on:
 CPPUNIT_ASSERT(xStyle->getPropertyValue(u"HeaderIsOn"_ustr).get());
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testPasteHeaderEmptied)
+{
+// Given an empty document with a turned on footer with content:
+loadFromFile(u"page-break-footer-table.docx");
+uno::Reference 
xStyleFamiliesSupplier(mxComponent,
+ 
uno::UNO_QUERY);
+uno::Reference xStyleFamilies
+= xStyleFamiliesSupplier->getStyleFamilies();
+uno::Reference xStyleFamily(
+xStyleFamilies->getByName(u"PageStyles"_ustr), uno::UNO_QUERY);
+uno::Reference 
xStyle(xStyleFamily->getByName(u"Standard"_ustr),
+   uno::UNO_QUERY);
+
+// When pasting RTF content:
+uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xText = xTextDocument->getText();
+uno::Reference xBodyEnd = xText->getEnd();
+uno::Reference xFilter(
+
m_xSFactory->createInstance(u"com.sun.star.comp.Writer.RtfFilter"_ustr), 
uno::UNO_QUERY);
+uno::Reference xImporter(xFilter, uno::UNO_QUERY);
+xImporter->setTargetDocument(mxComponent);
+std::unique_ptr pStream(new SvMemoryStream);
+pStream->WriteOString("{\rtf1 paste}");
+pStream->Seek(0);
+uno::Reference xStream(new 
utl::OStreamWrapper(std::move(pStream)));
+uno::Sequence aDescriptor{ 
comphelper::makePropertyValue(u"InputStream"_ustr, xStream),
+   
comphelper::makePropertyValue(u"InsertMode"_ustr, true),
+   
comphelper::makePropertyValue(u"TextInsertModeRange"_ustr,
+ xBodyEnd) };
+CPPUNIT_ASSERT(xFilter->filter(aDescriptor));
+
+// Then make sure the header retains its contents:
+uno::Reference 
xFooterText(xStyle->getPropertyValue(u"FooterText"_ustr),
+ uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(u"Odd page footer"_ustr, xFooterText->getString());
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/writerfilter/dmapper/PropertyMap.cxx 
b/sw/source/writerfilter/dmapper/PropertyMap.cxx
index c4754c6095ee..76e195eeb486 100644
--- a/sw/source/writerfilter/dmapper/PropertyMap.cxx
+++ b/sw/source/writerfilter/dmapper/PropertyMap.cxx
@@ -530,7 +530,8 @@ void 
SectionPropertyMap::removeXTextContent(uno::Reference const& r
  */
 void SectionPropertyMap::setHeaderFooterProperties(DomainMapper_Impl& rDM_Impl)
 {
-if (!m_aPageStyle.is())
+// do not alter header/footer during copy/paste
+if (!m_aPageStyle.is() || !rDM_Impl.IsNewDoc())
 return;
 
 bool bHasHeader = false;
@@ -593,7 +594,7 @@ void 
SectionPropertyMap::setHeaderFooterProperties(DomainMapper_Impl& rDM_Impl)
 m_aPageStyle->setPropertyValue(sFirstIsShared, 
uno::Any(!m_bTitlePage));
 
 bool bHadFirstHeader = m_bHadFirstHeader && m_bTitlePage;
-if (bHasHeader && !bHadFirstHeader && !m_bHadLeftHeader && 
!m_bHadRightHeader && rDM_Impl.IsNewDoc())
+if (bHasHeader && !bHadFirstHeader && !m_bHadLeftHeader && 
!m_bHadRightHeader)
 {
 m_aPageStyle->setPropertyValue(sHeaderIsOn, uno::Any(false));
 }


core.git: sw/qa sw/uiconfig

2024-07-11 Thread Samuel Mehrbrodt (via logerrit)
 sw/qa/uitest/writer_tests5/tdf115871.py   |4 -
 sw/uiconfig/swriter/ui/templatedialog2.ui |   64 +++---
 2 files changed, 34 insertions(+), 34 deletions(-)

New commits:
commit 35e5abe8e569c67fbb0afe84afbd826373470a8c
Author: Samuel Mehrbrodt 
AuthorDate: Sat Apr 27 09:33:48 2024 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Thu Jul 11 09:48:12 2024 +0200

Improve tab order in paragraph dialog

Group similiar tabs, put the most used ones (font settings) first, etc.

Change-Id: I4e2931b30605086da588b3fdcd523faa34bb452a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166770
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/sw/qa/uitest/writer_tests5/tdf115871.py 
b/sw/qa/uitest/writer_tests5/tdf115871.py
index 1f8639b64586..94d6258e4f7a 100755
--- a/sw/qa/uitest/writer_tests5/tdf115871.py
+++ b/sw/qa/uitest/writer_tests5/tdf115871.py
@@ -35,7 +35,7 @@ class tdf115871(UITestCase):
 # Modify outline & list settings of the created style
 with self.ui_test.execute_dialog_through_command(".uno:EditStyle") 
as xDialog:
 xTabs = xDialog.getChild("tabcontrol")
-select_pos(xTabs, "15")
+select_pos(xTabs, "13")
 
 # Outline level
 xOutlineLevel = xTabs.getChild("comboLB_OUTLINE_LEVEL")
@@ -58,7 +58,7 @@ class tdf115871(UITestCase):
 # Open the paragraph style dialog and reset dialog to parent 
settings
 with self.ui_test.execute_dialog_through_command(".uno:EditStyle") 
as xDialog:
 xTabs = xDialog.getChild("tabcontrol")
-select_pos(xTabs, "15")
+select_pos(xTabs, "13")
 
 xStandardButton = xDialog.getChild("standard")
 xStandardButton.executeAction("CLICK", tuple())
diff --git a/sw/uiconfig/swriter/ui/templatedialog2.ui 
b/sw/uiconfig/swriter/ui/templatedialog2.ui
index ae467d56a486..c9afeec2f57a 100644
--- a/sw/uiconfig/swriter/ui/templatedialog2.ui
+++ b/sw/uiconfig/swriter/ui/templatedialog2.ui
@@ -159,10 +159,10 @@
   
 
 
-  
+  
 True
 False
-Indents  Spacing
+Font
   
   
 1
@@ -183,10 +183,10 @@
   
 
 
-  
+  
 True
 False
-Alignment
+Font Effects
   
   
 2
@@ -231,10 +231,10 @@
   
 
 
-  
+  
 True
 False
-Asian Typography
+Alignment
   
   
 4
@@ -255,10 +255,10 @@
   
 
 
-  
+  
 True
 False
-Font
+Indents  Spacing
   
   
 5
@@ -279,10 +279,10 @@
   
 
 
-  
+  
 True
 False
-Font Effects
+Position
   
   
 6
@@ -303,10 +303,10 @@
   
 
 
-  
+  
 True
 False
-Position
+Drop Caps
   
   
 7
@@ -327,10 +327,10 @@
   
 
 
-  
+  
 True
 False
-Asian Layout
+Highlighting
   
   
 8
@@ -351,10 +351,10 @@
   
 
 
-  
+  
 True
 False
-Highlighting
+Area
   
   
 9
@@ -375,10 +375,10 @@
   
 
 
-  
+  
 True
 False
-Tabs
+Transparency
   
   
 10
@@ -399,10 +399,10 @@
   
 
 
-  
+  
 True
 False
-Drop Caps
+Borders
   
   
 11
@@ -423,10 +423,10 @@
   
 
 
-  
+  
 True
 False
-Area
+Tabs
   
   
 12
@@ -447,10 +447,11 @@
   
 
 
-  
+  
 True
 False
-   

core.git: sw/qa sw/source

2024-07-11 Thread Justin Luth (via logerrit)
 sw/qa/extras/rtfexport/data/tdf160976_headerFooter.odt  |binary
 sw/qa/extras/rtfexport/data/tdf160976_headerFooter2.odt |binary
 sw/qa/extras/rtfexport/data/tdf160976_headerFooter3.odt |binary
 sw/qa/extras/rtfexport/rtfexport8.cxx   |   55 
 sw/source/filter/ww8/rtfexport.cxx  |   53 ++-
 sw/source/filter/ww8/rtfexport.hxx  |3 
 6 files changed, 92 insertions(+), 19 deletions(-)

New commits:
commit 0abe0f62b9913ceb77c7ac067f1074ce0395ab93
Author: Justin Luth 
AuthorDate: Wed Jul 10 14:57:44 2024 -0400
Commit: Tomaž Vajngerl 
CommitDate: Thu Jul 11 09:02:20 2024 +0200

tdf#160976 rtfexport: export first header as well as default header

LO has never handled exporting "different first header"
ever since it was introduced in LO 4.0-ish.

In 24.2, quikee change the RTF import to default to putting
headers into "different first header" instead of "First Page Style"
with commit 4b0fa253a4540f5461397815d290586f9ddabe61,
so this existing problem has become more pronounced.

Unhandled still is any attempt to handle different even/odd pages.

This patch also reduces the number of   itlepg duplicates.

make CppunitTest_sw_rtfexport8 \
CPPUNIT_TEST_NAME=testTdf160976_headerFooter

make CppunitTest_sw_rtfexport8 \
CPPUNIT_TEST_NAME=testTdf160976_headerFooter2

make CppunitTest_sw_rtfexport8 \
CPPUNIT_TEST_NAME=testTdf160976_headerFooter3

Change-Id: Idc12c57b69ff83cbdcbac3f6a469fadd8f26fe2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170326
Reviewed-by: Tomaž Vajngerl 
Reviewed-by: Justin Luth 
Tested-by: Jenkins

diff --git a/sw/qa/extras/rtfexport/data/tdf160976_headerFooter.odt 
b/sw/qa/extras/rtfexport/data/tdf160976_headerFooter.odt
new file mode 100644
index ..d2b692613684
Binary files /dev/null and 
b/sw/qa/extras/rtfexport/data/tdf160976_headerFooter.odt differ
diff --git a/sw/qa/extras/rtfexport/data/tdf160976_headerFooter2.odt 
b/sw/qa/extras/rtfexport/data/tdf160976_headerFooter2.odt
new file mode 100644
index ..eb6fd0f1be8a
Binary files /dev/null and 
b/sw/qa/extras/rtfexport/data/tdf160976_headerFooter2.odt differ
diff --git a/sw/qa/extras/rtfexport/data/tdf160976_headerFooter3.odt 
b/sw/qa/extras/rtfexport/data/tdf160976_headerFooter3.odt
new file mode 100644
index ..43077a273fe0
Binary files /dev/null and 
b/sw/qa/extras/rtfexport/data/tdf160976_headerFooter3.odt differ
diff --git a/sw/qa/extras/rtfexport/rtfexport8.cxx 
b/sw/qa/extras/rtfexport/rtfexport8.cxx
index 3f013605d625..28b755cd8f4a 100644
--- a/sw/qa/extras/rtfexport/rtfexport8.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport8.cxx
@@ -416,6 +416,61 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf159824_gradientAngle4)
 verify();
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf160976_headerFooter)
+{
+// given a nasty ODT with first-even-odd page styles, emulate using RTF's 
abilities
+auto verify = [this](bool bIsExported = false) {
+// Sanity check - always good to test when dealing with page styles 
and breaks.
+CPPUNIT_ASSERT_EQUAL(3, getPages());
+
+CPPUNIT_ASSERT_EQUAL(u"First page first footer"_ustr,
+ parseDump("/root/page[1]/footer/txt"_ostr));
+CPPUNIT_ASSERT_EQUAL(u"First Left"_ustr, 
parseDump("/root/page[2]/footer/txt"_ostr));
+if (!bIsExported)
+CPPUNIT_ASSERT_EQUAL(u"First Right"_ustr, 
parseDump("/root/page[3]/footer/txt"_ostr));
+};
+createSwDoc("tdf160976_headerFooter.odt");
+verify();
+saveAndReload(mpFilter);
+verify(/*IsExported*/ true);
+// note: an unexpected header surfaces on page 3.
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testTdf160976_headerFooter2)
+{
+// given a typical ODT with first-follow page styles, emulate using RTF's 
abilities
+auto verify = [this]() {
+// Sanity check - always good to test when dealing with page styles 
and breaks.
+CPPUNIT_ASSERT_EQUAL(3, getPages());
+
+CPPUNIT_ASSERT_EQUAL(u"First page first footer"_ustr,
+ parseDump("/root/page[1]/footer/txt"_ostr));
+CPPUNIT_ASSERT_EQUAL(u"First page footer"_ustr, 
parseDump("/root/page[2]/footer/txt"_ostr));
+CPPUNIT_ASSERT_EQUAL(u"Default footer"_ustr, 
parseDump("/root/page[3]/footer/txt"_ostr));
+};
+createSwDoc("tdf160976_headerFooter2.odt");
+verify();
+saveAndReload(mpFilter);
+verify();
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testTdf160976_headerFooter3)
+{
+// given a simple ODT with typical "different first" on the default page 
style
+auto verify = [this]() {
+// Sanity check - always good to test when dealing with page styles 
and breaks.
+CPPUNIT_ASSERT_EQUAL(3, getPages());
+
+CPPUNIT_ASSERT_EQUAL(u"First page footer"_ustr, 
parseDump("/root/page[1]/footer/txt"_ostr));

core.git: sw/qa sw/source

2024-07-11 Thread Justin Luth (via logerrit)
 sw/qa/core/header_footer/HeaderFooterTest.cxx |   13 ++
 sw/qa/core/header_footer/data/tdf1159013_firstHeaderCopy.docx |binary
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx  |   10 +++
 sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx  |   12 +
 sw/source/writerfilter/dmapper/PropertyMap.cxx|6 +++-
 5 files changed, 39 insertions(+), 2 deletions(-)

New commits:
commit eaca93b19ebf91e495c0985f304bfa6687c55c8d
Author: Justin Luth 
AuthorDate: Tue Jul 9 20:41:34 2024 -0400
Commit: Tomaž Vajngerl 
CommitDate: Thu Jul 11 08:55:32 2024 +0200

tdf#159013 writerfilter: link to the correct first-page header

We have always done this wrong, but previous to
quikee's 24.2 4b0fa253a4540f5461397815d290586f9ddabe61
it left the first page blank (I expect),
while recently it was copying the "normal" header.

In order to avoid a UNO copy assert (if copying an empty footer)
track the header and footer style separately.
Alternatively I could have probably removed the UNO assert.
Alternatively, I could track if we ever had a first header
and a first footer - at that point they will be copied to same style.

make CppunitTest_sw_core_header_footer \
CPPUNIT_TEST_NAME=testTdf1159013_firstHeaderCopy

Change-Id: I7c5046731766a70625b1a6a8696239297369e2c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170259
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Tomaž Vajngerl 

diff --git a/sw/qa/core/header_footer/HeaderFooterTest.cxx 
b/sw/qa/core/header_footer/HeaderFooterTest.cxx
index acfd77f1270e..763012652c7c 100644
--- a/sw/qa/core/header_footer/HeaderFooterTest.cxx
+++ b/sw/qa/core/header_footer/HeaderFooterTest.cxx
@@ -525,6 +525,19 @@ CPPUNIT_TEST_FIXTURE(HeaderFooterTest, 
testTdf145998_firstHeader)
 CPPUNIT_ASSERT_EQUAL(u"Normal Header"_ustr, 
parseDump("/root/page[2]/header/txt"_ostr));
 }
 
+CPPUNIT_TEST_FIXTURE(HeaderFooterTest, testTdf1159013_firstHeaderCopy)
+{
+// given a document with a first-header-section, a non-first-section, then 
a first-link-section
+createSwDoc("tdf1159013_firstHeaderCopy.docx");
+saveAndReload(u"Office Open XML Text"_ustr);
+
+// Sanity check - always good to test when dealing with page styles and 
breaks.
+CPPUNIT_ASSERT_EQUAL(5, getPages());
+
+// This was copying the non-first-section header instead of "linking" to 
the first
+CPPUNIT_ASSERT_EQUAL(u"First Page header"_ustr, 
parseDump("/root/page[5]/header/txt"_ostr));
+}
+
 CPPUNIT_TEST_FIXTURE(HeaderFooterTest, testEvenPageOddPageFooter_Import)
 {
 // Related tdf#135216
diff --git a/sw/qa/core/header_footer/data/tdf1159013_firstHeaderCopy.docx 
b/sw/qa/core/header_footer/data/tdf1159013_firstHeaderCopy.docx
new file mode 100644
index ..fa2c84cbe4cd
Binary files /dev/null and 
b/sw/qa/core/header_footer/data/tdf1159013_firstHeaderCopy.docx differ
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index 6cecc59dd4a4..f36232dba47e 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -3992,6 +3992,16 @@ void DomainMapper_Impl::PopPageHeaderFooter(PagePartType 
ePagePartType, PageType
 if (pSectionContext)
 {
 pSectionContext->clearHeaderFooterLinkToPrevious(ePagePartType, eType);
+
+// remember most recent "first page" header/footer so follow sections 
can "link" to them
+if (eType == PageType::FIRST)
+{
+if (ePagePartType == PagePartType::Header)
+m_pLastFirstHeader = pSectionContext->GetPageStyle(*this);
+else if (ePagePartType == PagePartType::Footer)
+m_pLastFirstFooter = pSectionContext->GetPageStyle(*this);
+}
+
 m_HeaderFooterSeen.emplace(ePagePartType, eType);
 }
 
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx
index 1697ee9e849d..a4040b1f09d4 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx
@@ -617,6 +617,8 @@ private:
 
 PropertyMapPtr  m_pTopContext;
 tools::SvRef m_pLastSectionContext;
+rtl::Reference m_pLastFirstHeader; // last page style with 
different first header
+rtl::Reference m_pLastFirstFooter; // last page style with 
different first footer
 PropertyMapPtr   m_pLastCharacterContext;
 
 ::std::vector m_aCurrentTabStops;
@@ -714,6 +716,16 @@ public:
 return m_pLastSectionContext.get( );
 }
 
+const rtl::Reference& GetLastFirstHeader() const
+{
+return m_pLastFirstHeader;
+}
+
+const rtl::Reference& GetLastFirstFooter() const
+{
+return m_pLastFirstFooter;
+}
+
 

core.git: sw/qa sw/source

2024-07-10 Thread Jonathan Clark (via logerrit)
 sw/qa/extras/layout/data/tdf146081-prop-spacing.fodt |  112 +++
 sw/qa/extras/layout/layout3.cxx  |   32 +
 sw/source/core/text/itrform2.cxx |   15 ++
 3 files changed, 159 insertions(+)

New commits:
commit c012c74e69360dd78890c1d935b802c0baf79da2
Author: Jonathan Clark 
AuthorDate: Wed Jul 10 04:03:26 2024 -0600
Commit: Jonathan Clark 
CommitDate: Wed Jul 10 21:12:49 2024 +0200

tdf#146081 sw: Fix inconsistent prop line spacing

Previously, when using proportional line spacing <100%, Writer applied
inconsistent height and ascent adjustments to the first and non-first
lines of paragraphs. This caused Writer to render text at inconsistent
vertical offsets.

Height and ascent adjustments are now consistent.

Change-Id: I303d6aa379007f3fa3e8c1ebb981ef205864708a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170307
Reviewed-by: Jonathan Clark 
Tested-by: Jenkins

diff --git a/sw/qa/extras/layout/data/tdf146081-prop-spacing.fodt 
b/sw/qa/extras/layout/data/tdf146081-prop-spacing.fodt
new file mode 100644
index ..78da839f1974
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf146081-prop-spacing.fodt
@@ -0,0 +1,112 @@
+
+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-07-10T03:37:36.9468532512024-07-10T03:41:48.895381288PT4M13S1LibreOfficeDev/25.2.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/c11c5f9b87dfb7a7620341c2bffbd73b4d8eca58
+ 
+  
+  
+  
+ 
+ 
+  
+   
+   
+
+   
+   
+  
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+  
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+  
+  
+  
+  
+  
+ 
+  
+   
+   
+  
+  
+   
+
+   
+   
+   
+  
+ 
+ 
+  
+ 
+ 
+  
+   
+
+
+
+
+
+   
+   AAA
+  
+ 
+
\ No newline at end of file
diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index d10e0c78a2f7..d532c1dffec8 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -3081,6 +3081,38 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, 
TestTdf56408NoUnderflow)
 u"עברית English"_ustr);
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, TestTdf146081)
+{
+// Verifies that proportional line spacing is consistent with the
+// PropLineSpacingShrinksFirstLine compatibility flag set
+createSwDoc("tdf146081-prop-spacing.fodt");
+auto pXmlDoc = parseLayoutDump();
+
+SwTwips nTotalHeight
+= getXPath(pXmlDoc, "/root/page/body/txt/infos/bounds"_ostr, 
"height"_ostr).toInt32();
+
+SwTwips nHeight1
+   

core.git: sw/qa

2024-07-10 Thread Xisco Fauli (via logerrit)
 sw/qa/uitest/writer_dialogs/openDialogs.py |3 ++-
 sw/qa/uitest/writer_tests3/tdf124088.py|4 
 2 files changed, 6 insertions(+), 1 deletion(-)

New commits:
commit ff55c7d386a8dca90bc6e4b15cf4fd3506b7190c
Author: Xisco Fauli 
AuthorDate: Wed Jul 10 13:00:14 2024 +0200
Commit: Xisco Fauli 
CommitDate: Wed Jul 10 15:39:06 2024 +0200

sw: uitest for c519de2296

Change-Id: If5e03591ba4aef6a111268b32bff305e1ec6ba8c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170284
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/uitest/writer_dialogs/openDialogs.py 
b/sw/qa/uitest/writer_dialogs/openDialogs.py
index b3b2ffcd7bad..fc6351e6fa70 100644
--- a/sw/qa/uitest/writer_dialogs/openDialogs.py
+++ b/sw/qa/uitest/writer_dialogs/openDialogs.py
@@ -99,7 +99,8 @@ dialogs = [
 # tested in sw/qa/uitest/writer_tests/wordCount.py
 # {"command": ".uno:AutoCorrectDlg", "closeButton": "cancel"},
 # tested in sw/qa/uitest/writer_tests5/autocorrectOptions.py
-{"command": ".uno:EditGlossary", "closeButton": "close"},
+# {"command": ".uno:EditGlossary", "closeButton": "close"},
+# tested in sw/qa/uitest/writer_tests3/tdf124088.py
 # {"command": ".uno:ChapterNumberingDialog", "closeButton": "cancel"},
 # tested in sw/qa/uitest/chapterNumbering/chapterNumbering.py
 # {"command": ".uno:LineNumberingDialog", "closeButton": "cancel"},
diff --git a/sw/qa/uitest/writer_tests3/tdf124088.py 
b/sw/qa/uitest/writer_tests3/tdf124088.py
index 6ff65dad7631..125bc30cdc6a 100755
--- a/sw/qa/uitest/writer_tests3/tdf124088.py
+++ b/sw/qa/uitest/writer_tests3/tdf124088.py
@@ -24,6 +24,10 @@ class tdf124088(UITestCase):
 with 
self.ui_test.execute_dialog_through_command(".uno:EditGlossary") as 
xEditGlossaryDlg:
 xName = xEditGlossaryDlg.getChild("name")
 self.assertEqual(get_state_as_dict(xName)["Text"], "This is a 
sample")
+
+xShortName = xEditGlossaryDlg.getChild("shortname")
+self.assertEqual("Tias", get_state_as_dict(xShortName)["Text"])
+
 # Click on a group entry, proposed auto text should remain
 xCategory = xEditGlossaryDlg.getChild("category")
 xMyAutoText = xCategory.getChild("2")


core.git: sw/qa sw/source

2024-06-27 Thread Balazs Varga (via logerrit)
 sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx |   34 ++-
 sw/source/core/access/AccessibilityCheck.cxx |   20 
 2 files changed, 44 insertions(+), 10 deletions(-)

New commits:
commit 16d8f37cae3e6b68e4c41fbbacd94f48c3e304ab
Author: Balazs Varga 
AuthorDate: Wed Jun 26 10:46:23 2024 +0200
Commit: Balazs Varga 
CommitDate: Thu Jun 27 17:12:01 2024 +0200

tdf#159777 - A11Y sidebar: Add warning about ParaTopMargin

and ParaBottomMargin direct formats.

Change-Id: Ifac19eba9d3c2e3631ebede1a5f9f172bbaf8927
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169541
Reviewed-by: Balazs Varga 
Tested-by: Jenkins
Tested-by: Gabor Kelemen 

diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx 
b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
index 302efe29a5a8..77330b9a8157 100644
--- a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
+++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
@@ -104,9 +104,11 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, 
testCheckNewlineSpace)
 sw::AccessibilityCheck aCheck(pDoc);
 aCheck.check();
 auto& aIssues = aCheck.getIssueCollection().getIssues();
-CPPUNIT_ASSERT_EQUAL(size_t(2), aIssues.size());
-CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[0]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(size_t(4), aIssues.size());
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, 
aIssues[0]->m_eIssueID);
 CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[1]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, 
aIssues[2]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[3]->m_eIssueID);
 }
 
 CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckSpacebarSpace)
@@ -117,8 +119,10 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, 
testCheckSpacebarSpace)
 sw::AccessibilityCheck aCheck(pDoc);
 aCheck.check();
 auto& aIssues = aCheck.getIssueCollection().getIssues();
-CPPUNIT_ASSERT_EQUAL(size_t(1), aIssues.size());
-CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[0]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(size_t(3), aIssues.size());
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, 
aIssues[0]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[1]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, 
aIssues[2]->m_eIssueID);
 }
 
 CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testHyperlinks)
@@ -144,8 +148,10 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, 
testCheckHighlightedText)
 sw::AccessibilityCheck aCheck(pDoc);
 aCheck.check();
 auto& aIssues = aCheck.getIssueCollection().getIssues();
-CPPUNIT_ASSERT_EQUAL(size_t(1), aIssues.size());
+CPPUNIT_ASSERT_EQUAL(size_t(3), aIssues.size());
 CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, 
aIssues[0]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, 
aIssues[1]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, 
aIssues[2]->m_eIssueID);
 }
 
 CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testNumberingCheck)
@@ -172,9 +178,13 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, 
testCheckFakeFootnote)
 sw::AccessibilityCheck aCheck(pDoc);
 aCheck.check();
 auto& aIssues = aCheck.getIssueCollection().getIssues();
-CPPUNIT_ASSERT_EQUAL(size_t(2), aIssues.size());
-CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::FAKE_FOOTNOTE, 
aIssues[0]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(size_t(6), aIssues.size());
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, 
aIssues[0]->m_eIssueID);
 CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::FAKE_FOOTNOTE, 
aIssues[1]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, 
aIssues[2]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::FAKE_FOOTNOTE, 
aIssues[3]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, 
aIssues[4]->m_eIssueID);
+CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, 
aIssues[5]->m_eIssueID);
 }
 
 CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckFakeCaption)
@@ -209,11 +219,15 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, 
testCheckTabsFormatting)
 sw::AccessibilityCheck aCheck(pDoc);
 aCheck.check();
 auto& aIssues = aCheck.getIssueCollection().getIssues();
-CPPUNIT_ASSERT_EQUAL(size_t(4), aIssues.size());
+CPPUNIT_ASSERT_EQUAL(size_t(8), aIssues.size());
 CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[0]->m_eIssueID);
-CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[1]->m_eIssueID);
+

core.git: sw/qa sw/source

2024-06-26 Thread Michael Stahl (via logerrit)
 sw/qa/extras/layout/data/fdo48718-1.docx |binary
 sw/qa/extras/layout/layout3.cxx  |   12 
 sw/source/core/layout/tabfrm.cxx |3 ++-
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 68e7413b5f9ce4abd2a4e23bf27cfc335e52f03f
Author: Michael Stahl 
AuthorDate: Wed Jun 26 15:44:44 2024 +0200
Commit: Michael Stahl 
CommitDate: Wed Jun 26 18:28:32 2024 +0200

tdf#156724 sw: layout: ignore footnotes when splitting float table row

(regression from commit 534d3818aedfa95ad73935235462f5ec2817f5da)

Change-Id: I169d88375a93c288604a89ef89f7e895830446c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169570
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/layout/data/fdo48718-1.docx 
b/sw/qa/extras/layout/data/fdo48718-1.docx
new file mode 100644
index ..373aa357fd5c
Binary files /dev/null and b/sw/qa/extras/layout/data/fdo48718-1.docx differ
diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index 7c36605bb82d..3ee4953e52cc 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -2290,6 +2290,18 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf138124)
 1);
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, TestTdf161348)
+{
+createSwDoc("fdo48718-1.docx");
+
+xmlDocUniquePtr pXml = parseLayoutDump();
+
+// the floating table is on page 1
+// apparently both parts of the split table are on this text frame
+assertXPath(pXml, "/root/page[1]/body/txt[2]/anchored/fly"_ostr, 2);
+assertXPath(pXml, "/root/page[1]/body/txt[2]/anchored/fly/tab"_ostr, 2);
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf154113)
 {
 createSwDoc("three_sections.fodt");
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index efc716052fe0..42116672708f 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -807,7 +807,8 @@ static bool lcl_RecalcSplitLine( SwRowFrame& rLastLine, 
SwRowFrame& rFollowLine,
 bRet = false;
 
 // apparently checking nFootnoteHeight here does *not* guarantee that it 
fits into the body
-if (bRet && nDistanceToFootnoteBodyPrtBottom + nFollowFootnotes < 0)
+if (bRet && rTab.IsInDocBody()
+&& nDistanceToFootnoteBodyPrtBottom + nFollowFootnotes < 0)
 {
 assert(rTab.GetUpper() != 
rTab.FindFootnoteBossFrame()->FindBodyCont());
 SAL_INFO("sw.layout", "SwTabFrame Split failed because of footnote 
growth");


core.git: sw/qa sw/source

2024-06-26 Thread Michael Stahl (via logerrit)
 sw/qa/extras/layout/data/tdf161718.docx |binary
 sw/qa/extras/layout/layout3.cxx |   17 +
 sw/source/core/text/txtftn.cxx  |7 +++
 3 files changed, 24 insertions(+)

New commits:
commit 3e845b10be7ae7f2ac91e37fe6404dd390aaa49d
Author: Michael Stahl 
AuthorDate: Tue Jun 25 18:47:15 2024 +0200
Commit: Michael Stahl 
CommitDate: Wed Jun 26 14:29:16 2024 +0200

tdf#161718 sw: fix background flys blocking footnotes

The problem is that the document has an unwanted page break on the
paragraph with the footnote.

The reason is that lcl_GetFootnoteLower() tries to evade flys, but
doesn't take into account that background flys (Wrap Through) should be
ignored.

(somehow regression from commit c303981cfd95ce1c3881366023d5495ae2edce97)

Change-Id: I02578f14644e232fac127142fe12801101f87f86
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169530
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/layout/data/tdf161718.docx 
b/sw/qa/extras/layout/data/tdf161718.docx
new file mode 100644
index ..240192e07a71
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf161718.docx differ
diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index a07e7e6cd037..7c36605bb82d 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -195,6 +195,23 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf128966)
 xmlXPathFreeObject(pXmlObj);
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf161718)
+{
+createSwDoc("tdf161718.docx");
+
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+// everything on one page
+assertXPath(pXmlDoc, "/root/page/header"_ostr, 1);
+assertXPath(pXmlDoc, "/root/page/header/txt/anchored"_ostr, 1);
+assertXPath(pXmlDoc, "/root/page/footer"_ostr, 1);
+assertXPath(pXmlDoc, "/root/page/ftncont/ftn"_ostr, 1);
+assertXPath(pXmlDoc, "/root/page/ftncont/ftn/txt"_ostr, 1);
+assertXPath(pXmlDoc, "/root/page/body/txt"_ostr, 27);
+assertXPath(pXmlDoc, "/root/page/body/txt/anchored"_ostr, 1);
+assertXPath(pXmlDoc, "/root/page"_ostr, 1);
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf119908)
 {
 createSwDoc("tdf130088.docx");
diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx
index 745d40ce23bc..787ea1390e78 100644
--- a/sw/source/core/text/txtftn.cxx
+++ b/sw/source/core/text/txtftn.cxx
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -246,6 +247,12 @@ static SwTwips lcl_GetFootnoteLower( const SwTextFrame* 
pFrame, SwTwips nLower )
 const SwSortedObjs  = *pStartFrame->GetDrawObjs();
 for (SwAnchoredObject* pAnchoredObj : rObjs)
 {
+if (pAnchoredObj->GetFrameFormat()->GetSurround().GetSurround()
+== text::WrapTextMode_THROUGH)
+{
+continue; // tdf#161718 no effect on text flow, skip
+}
+
 SwRect aRect( pAnchoredObj->GetObjRect() );
 
 auto pFlyFrame = pAnchoredObj->DynCastFlyFrame();


core.git: sw/qa sw/source

2024-06-25 Thread Michael Stahl (via logerrit)
 sw/qa/extras/layout/layout3.cxx |7 +--
 sw/source/core/text/txttab.cxx  |7 ++-
 2 files changed, 11 insertions(+), 3 deletions(-)

New commits:
commit 78705c3b977aaeb0608538e63df3b78ec67bcae6
Author: Michael Stahl 
AuthorDate: Tue Jun 25 13:28:12 2024 +0200
Commit: Michael Stahl 
CommitDate: Tue Jun 25 15:57:52 2024 +0200

tdf#161721 sw: text formatting: TabOverMargin not crazy enough

Word will use a center or right tab position in the margin without
limiting it, and even put text after it.

Change-Id: Ibae5758467620f355544963acb7941689fae2602
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169517
Reviewed-by: Michael Stahl 
Tested-by: Jenkins

diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index c5885be4c6ca..a07e7e6cd037 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -567,8 +567,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf158658b)
 xmlDocUniquePtr pXmlDoc = parseLayoutDump();
 
 // Word 2013 puts all tabs and the field following into one line
-// but also puts the field off the page, while in Writer it's
-// aligned to the right margin; should be good enough for now...
+// and also puts the field off the page
 assertXPath(pXmlDoc, 
"/root/page[1]/footer/txt[1]/SwParaPortion/SwLineLayout"_ostr, 1);
 assertXPath(
 pXmlDoc,
@@ -578,6 +577,10 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf158658b)
 pXmlDoc,
 
"/root/page[1]/footer/txt[1]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::TabRight']"_ostr,
 1);
+assertXPath(
+pXmlDoc,
+
"/root/page[1]/footer/txt[1]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::TabRight']"_ostr,
+"width"_ostr, u"4446"_ustr); // was very small: 24
 assertXPath(
 pXmlDoc,
 
"/root/page[1]/footer/txt[1]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::TabLeft']"_ostr,
diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx
index 19ec92c6425b..14d8b9072693 100644
--- a/sw/source/core/text/txttab.cxx
+++ b/sw/source/core/text/txttab.cxx
@@ -175,7 +175,12 @@ SwTabPortion *SwTextFormatter::NewTabPortion( 
SwTextFormatInfo , bool bAuto
 // since up till now these were just treated as automatic 
tabstops.
 eAdj = SvxTabAdjust::Right;
 bAbsoluteNextPos = true;
-nNextPos = rInf.Width();
+// TODO: unclear if old Word has an upper limit for 
center/right
+// tabs, UI allows setting 55.87cm max which is still one line
+if (!bTabOverMargin || o3tl::toTwips(558, o3tl::Length::mm) < 
nNextPos)
+{
+nNextPos = rInf.Width();
+}
 }
 bAutoTabStop = false;
 }


core.git: sw/qa sw/source

2024-06-24 Thread Miklos Vajna (via logerrit)
 sw/qa/writerfilter/dmapper/DomainMapper.cxx  |   40 +++
 sw/qa/writerfilter/dmapper/data/clipboard.rtf|7 +++
 sw/source/writerfilter/dmapper/DomainMapper.cxx  |   32 +++
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |4 +
 sw/source/writerfilter/dmapper/StyleSheetTable.cxx   |   30 ++
 sw/source/writerfilter/dmapper/StyleSheetTable.hxx   |4 +
 6 files changed, 117 insertions(+)

New commits:
commit f58e3e3402c87755a2dd3cb83f29d00c40b94f1a
Author: Miklos Vajna 
AuthorDate: Mon Jun 24 15:46:03 2024 +0200
Commit: Miklos Vajna 
CommitDate: Mon Jun 24 19:09:09 2024 +0200

Related: tdf#161652 sw, RTF paste: only keep used paragraph styles

When pasting from old enough Impress that doesn't have commit
afb4ea67463d9f0200dc6216cfd932aec0984c82 (tdf#161652 editeng, RTF copy:
only write used paragraph styles, 2024-06-20), it still happened that we
got many styles from an Impress slide's paragraph in Writer than just
the style of that paragraph itself.

The problem is that if we want to avoid problems with bad user input,
that has to be handled on the RTF paste / import side, not on the
producing side.

Fix the problem by filtering out unused paragraph styles also on the RTF
import (paste) side, in the IsNewDoc() case, which is the clipboard case
(not RTF file open).

With this, we attempt to filter out not needed paragraph styles both on
the import and export side.

Change-Id: Ic2c63e5f45245bb4296ec0d1a95558c459667e29
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169445
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/qa/writerfilter/dmapper/DomainMapper.cxx 
b/sw/qa/writerfilter/dmapper/DomainMapper.cxx
index 3e7acdd3b495..05e6029c8c21 100644
--- a/sw/qa/writerfilter/dmapper/DomainMapper.cxx
+++ b/sw/qa/writerfilter/dmapper/DomainMapper.cxx
@@ -14,8 +14,13 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #include 
+#include 
+#include 
 
 using namespace ::com::sun::star;
 
@@ -185,6 +190,41 @@ CPPUNIT_TEST_FIXTURE(Test, testTableStyleParaBorder)
 // i.e. the 0 para border distance was applied on the cell instead.
 CPPUNIT_ASSERT_EQUAL(static_cast(203), nLeftBorderDistance);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testRTFStylePaste)
+{
+// Given an empty Writer document:
+mxComponent
+= loadFromDesktop(u"private:factory/swriter"_ustr, 
u"com.sun.star.text.TextDocument"_ustr);
+
+// When pasting RTF that has unreferenced paragraph styles:
+uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xText = xTextDocument->getText();
+uno::Reference xBodyEnd = xText->getEnd();
+uno::Reference xFilter(
+
m_xSFactory->createInstance(u"com.sun.star.comp.Writer.RtfFilter"_ustr), 
uno::UNO_QUERY);
+uno::Reference xImporter(xFilter, uno::UNO_QUERY);
+xImporter->setTargetDocument(mxComponent);
+std::unique_ptr pStream(
+new SvFileStream(createFileURL(u"clipboard.rtf"), StreamMode::READ));
+uno::Reference xStream(new 
utl::OStreamWrapper(std::move(pStream)));
+uno::Sequence aDescriptor{ 
comphelper::makePropertyValue(u"InputStream"_ustr, xStream),
+   
comphelper::makePropertyValue(u"InsertMode"_ustr, true),
+   
comphelper::makePropertyValue(u"TextInsertModeRange"_ustr,
+ xBodyEnd) };
+CPPUNIT_ASSERT(xFilter->filter(aDescriptor));
+
+// Then make sure those paragraph styles don't show up in the past result:
+uno::Reference 
xStyleFamiliesSupplier(mxComponent,
+ 
uno::UNO_QUERY);
+uno::Reference xStyleFamilies
+= xStyleFamiliesSupplier->getStyleFamilies();
+uno::Reference xStyleFamily(
+xStyleFamilies->getByName(u"ParagraphStyles"_ustr), uno::UNO_QUERY);
+// Without the accompanying fix in place, this test would have failed, 
'Default Drawing Style'
+// was imported, even if no pasted content referenced it.
+CPPUNIT_ASSERT(!xStyleFamily->hasByName(u"Default Drawing Style"_ustr));
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/writerfilter/dmapper/data/clipboard.rtf 
b/sw/qa/writerfilter/dmapper/data/clipboard.rtf
new file mode 100644
index ..0ebaa3aee0e9
--- /dev/null
+++ b/sw/qa/writerfilter/dmapper/data/clipboard.rtf
@@ -0,0 +1,7 @@
+{ tfnsi
+{\stylesheet
+{\s1 Default Drawing Style;}
+{\s37 Beehive~LT~Titel;}
+}
+\s37 beehive\par
+}
diff --git a/sw/source/writerfilter/dmapper/DomainMapper.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper.cxx
index 8e32f2e34569..adb29ba57c23 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper.cxx
@@ -2700,7 +2700,39 @@ void 

core.git: sw/qa

2024-06-21 Thread Xisco Fauli (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf161631.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx   |   11 +++
 2 files changed, 11 insertions(+)

New commits:
commit a820696263e62ffc7ebe0a9f6d51bec2e1354926
Author: Xisco Fauli 
AuthorDate: Fri Jun 21 17:07:39 2024 +0200
Commit: Xisco Fauli 
CommitDate: Fri Jun 21 19:37:49 2024 +0200

tdf#161631: sw_ooxmlexport21: Add unittest

Change-Id: I1496b82e67c5f408bd682b4998e3afaf74c37318
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169339
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf161631.docx 
b/sw/qa/extras/ooxmlexport/data/tdf161631.docx
new file mode 100644
index ..a1e91c05633c
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf161631.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index 81a5703b9ced..43dff8ae68cf 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -38,6 +38,17 @@ public:
 }
 };
 
+DECLARE_OOXMLEXPORT_TEST(testTdf161631, "tdf161631.docx")
+{
+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());
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf158597, "tdf158597.docx")
 {
 // test with 2 properties: font size, italic (toggle)


core.git: sw/qa sw/source

2024-06-21 Thread Jonathan Clark (via logerrit)
 sw/qa/extras/layout/data/tdf107209-vert-ltr.fodt |  313 +++
 sw/qa/extras/layout/data/tdf107209-vert-rtl.fodt |  310 ++
 sw/qa/extras/layout/layout3.cxx  |   32 ++
 sw/source/core/text/frmform.cxx  |9 
 4 files changed, 661 insertions(+), 3 deletions(-)

New commits:
commit c7f1e41ca672f6bb1055b92012fff0d92a5ff805
Author: Jonathan Clark 
AuthorDate: Thu Jun 20 12:05:08 2024 -0600
Commit: Jonathan Clark 
CommitDate: Fri Jun 21 17:54:28 2024 +0200

tdf#107209 Writer correct vertical text break after fly portions

This change fixes an issue causing Writer to corrupt layout for vertical
text following a fly-out. This bug manifested as overlapping or
incorrectly-reordered lines of text, sometimes appearing many pages
after the initial fly-out.

Change-Id: I05abdbf3ff122398b995220ec4e410434931fdf9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169307
Reviewed-by: Jonathan Clark 
Tested-by: Jenkins

diff --git a/sw/qa/extras/layout/data/tdf107209-vert-ltr.fodt 
b/sw/qa/extras/layout/data/tdf107209-vert-ltr.fodt
new file mode 100644
index ..53e41049a210
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf107209-vert-ltr.fodt
@@ -0,0 +1,313 @@
+
+
+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-06-20T11:10:34.9135422532024-06-20T11:15:58.597628511PT2M27S2LibreOfficeDev/25.2.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/e78bb77c3c5930b20113bff3de2dd02065cead85
+ 
+  
+   0
+   0
+   49138
+   33018
+   true
+   false
+   
+
+ view2
+ 27406
+ 25735
+ 0
+ 0
+ 49137
+ 33016
+ 0
+ 1
+ false
+ 140
+ false
+ false
+ false
+ false
+ false
+ false
+
+   
+  
+  
+   false
+   true
+   true
+   
+   false
+   0
+   false
+   true
+   false
+   true
+   false
+   false
+   0
+   true
+   false
+   false
+   false
+   false
+   false
+   true
+   false
+   false
+   true
+   false
+   true
+   true
+   false
+   true
+   false
+   false
+   false
+   false
+   true
+   true
+   false
+   false
+   false
+   false
+   false
+   false
+   high-resolution
+   false
+   1300554
+   false
+   true
+   false
+   
+   
+   true
+   
+   false
+   false
+   false
+   true
+   true
+   true
+   false
+   0
+   true
+   false
+   false
+   true
+   true
+   true
+   false
+   true
+   false
+   false
+   false
+   false
+   false
+   true
+   true
+   false
+   
+   true
+   false
+   false
+   0
+   false
+   true
+   
+   false
+   false
+   true
+   true
+   false
+   false
+   true
+   1
+   false
+   false
+   false
+   false
+   false
+   false
+   false
+   true
+   false
+   false
+   false
+   true
+   false
+   
+   true
+   1350948
+   true
+   false
+   false
+   false
+  
+ 
+ 
+  
+   

core.git: sw/qa sw/source

2024-06-20 Thread Samuel Mehrbrodt (via logerrit)
 sw/qa/extras/rtfexport/data/text-change-tracking.rtf |   17 ++
 sw/qa/extras/rtfexport/rtfexport8.cxx|   23 +++
 sw/source/filter/ww8/rtfattributeoutput.cxx  |   19 ++-
 sw/source/filter/ww8/rtfattributeoutput.hxx  |3 --
 sw/source/filter/ww8/rtfexport.cxx   |   14 ++-
 sw/source/filter/ww8/rtfexport.hxx   |   10 
 6 files changed, 76 insertions(+), 10 deletions(-)

New commits:
commit 63b46c2136d95960bab30a15e27bc94e6eefe6e6
Author: Samuel Mehrbrodt 
AuthorDate: Mon Jun 17 11:51:41 2024 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Thu Jun 20 09:22:30 2024 +0200

rtf: Don't export changes author/date when in privacy mode

Change-Id: Id8f8dea4563df3cfb0ea9009783886bdabf91b11
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168996
Reviewed-by: Samuel Mehrbrodt 
Tested-by: Jenkins

diff --git a/sw/qa/extras/rtfexport/data/text-change-tracking.rtf 
b/sw/qa/extras/rtfexport/data/text-change-tracking.rtf
new file mode 100644
index ..c6f72ceeade5
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/text-change-tracking.rtf
@@ -0,0 +1,17 @@
+{ tf1nsi\deff3deflang1025
+{onttbl{0romanprq2charset0 Liberat;}{1romanprq2charset2 Symbol;}{2
swissprq2charset0 Arial;}{3romanprq2charset0 Liberation Serif{\*alt 
Times New Roman};}{4swissprq2charset0 Liberation Sans{\*alt Arial};}{5
nilprq2charset0 Noto Sans CJK SC;}{6nilprq2charset0 Noto Sans 
Devanagari;}{7swissprq0charset0 Noto Sans Devanagari;}}
+{+{\stylesheet{\s0\snext0 tlchf6fs24lang1081 
\ltrch\lang1031\langfe2052\hichf3\loch\widctlpar\hyphpar0spalpha\ltrpar+{\*+{\s16\sbasedon0\snext17
 tlchf6fs28 \ltrch\hichf4\loch\sb240\sa120\keepn4s28\dbchf5 Heading;}
+{\s17\sbasedon0\snext17\loch\sl276\slmult1\sb0\sa140 Body Text;}
+{\s18\sbasedon17\snext18 tlchf7 \ltrch List;}
+{\s19\sbasedon0\snext19 tlchf7fs24i \ltrch\loch\sb120\sa120
olines24\i caption;}
+{\s20\sbasedon0\snext20 tlchf7 \ltrch\loch
oline Index;}
+}{\* evtbl {Unknown;}{Max Mustermann;}}
+{\*\generator LibreOfficeDev/25.2.0.0.alpha0$Linux_X86_64 
LibreOffice_project/c558004906bfaef6d1983e09473e4c236de730d3}{\info{+\hyphauto1
iewscale130 evisionsormshade
obrkwrptbl\paperh16838\paperw11906\margl1134\margr1134\margt1134\margb1134\sectd\sbknone\sftnnar\saftnnrlc\sectunlocked1\pgwsxn11906\pghsxn16838\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134
tnbjtnstart1tnrstconttnnaretftnrstcontftnstart1ftnnrlc
+{\*tnsep+Test}{ evised evauth1 evdttm667323072 \loch
+Deleted}
+\par }
\ No newline at end of file
diff --git a/sw/qa/extras/rtfexport/rtfexport8.cxx 
b/sw/qa/extras/rtfexport/rtfexport8.cxx
index 1ed6eee0ded4..3f013605d625 100644
--- a/sw/qa/extras/rtfexport/rtfexport8.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport8.cxx
@@ -482,6 +482,29 @@ CPPUNIT_TEST_FIXTURE(Test, testNotesAuthorDate)
 CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aRtfContent.indexOf("\atndate", 0));
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testChangesAuthor)
+{
+createSwDoc("text-change-tracking.rtf");
+
+auto pBatch(comphelper::ConfigurationChanges::create());
+// Remove all personal info
+
officecfg::Office::Common::Security::Scripting::RemovePersonalInfoOnSaving::set(true,
 pBatch);
+pBatch->commit();
+saveAndReload(mpFilter);
+
+SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
+CPPUNIT_ASSERT(pStream);
+OString aRtfContent(read_uInt8s_ToOString(*pStream, pStream->TellEnd()));
+
+// Make sure user name was anonymized
+CPPUNIT_ASSERT_EQUAL(sal_Int32(-1),
+ aRtfContent.indexOf("\revtbl {Unknown;}{Max 
Mustermann;}", 0));
+CPPUNIT_ASSERT(aRtfContent.indexOf("\revtbl {Author1;}{Author2;}", 0) >= 
0);
+
+// Make sure no date is set
+CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aRtfContent.indexOf("\revdttmdel", 0));
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testTdf158982)
 {
 auto verify = [this]() {
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx 
b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 22a76de4a109..07063fb4d5c5 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -626,13 +626,19 @@ void RtfAttributeOutput::Redline(const SwRedlineData* 
pRedline)
 if (!pRedline)
 return;
 
+bool bRemoveCommentAuthorDates
+= 
SvtSecurityOptions::IsOptionSet(SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo)
+  && !SvtSecurityOptions::IsOptionSet(
+ SvtSecurityOptions::EOption::DocWarnKeepNoteAuthorDateInfo);
+
 if (pRedline->GetType() == RedlineType::Insert)
 {
 m_aRun->append(OOO_STRING_SVTOOLS_RTF_REVISED);
 m_aRun->append(OOO_STRING_SVTOOLS_RTF_REVAUTH);
 m_aRun->append(static_cast(
 
m_rExport.GetRedline(SW_MOD()->GetRedlineAuthor(pRedline->GetAuthor();
-

core.git: sw/qa

2024-06-19 Thread Kira Tubo (via logerrit)
 sw/qa/extras/unowriter/unowriter.cxx |   91 +++
 1 file changed, 91 insertions(+)

New commits:
commit 59540d082f4f2ef72b3b8728f5fa2ec8a1bb4fa0
Author: Kira Tubo 
AuthorDate: Wed May 8 18:40:52 2024 -0700
Commit: Xisco Fauli 
CommitDate: Wed Jun 19 13:00:09 2024 +0200

tdf#62603: sw unit test: replace string mix font style

Test to see if font style is retained when performing find/replace on
strings containing mixed font style/sizes.

1) For example, with a doc containing the string: "test
- Normal font: "
- Italic font: test

2) Search for: "t (this contains both normal and italic font)
3) Replace with: "gu

4) Resulting string should be: "guest
- Normal font: "
- Italic font: guest

An additional test has been added to test for changes in font sizes (per
comment 24).

Change-Id: I957077efbcced0b981c31d0e547299e12a61609b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168486
Reviewed-by: Xisco Fauli 
Tested-by: Jenkins

diff --git a/sw/qa/extras/unowriter/unowriter.cxx 
b/sw/qa/extras/unowriter/unowriter.cxx
index d1f8fce4dd0c..cf10599b85ad 100644
--- a/sw/qa/extras/unowriter/unowriter.cxx
+++ b/sw/qa/extras/unowriter/unowriter.cxx
@@ -805,6 +805,97 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, 
testSelectionInTableEnumEnd)
 CPPUNIT_ASSERT(!xEnum->hasMoreElements());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTdf62603)
+{
+// Unit test for tdf#62603
+// Test to see if font style is retained when performing find/replace on 
strings
+// containing mixed font styles/sizes
+createSwDoc();
+uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xText = xTextDocument->getText();
+uno::Reference xCursor = xText->createTextCursor();
+uno::Reference xCursorProps(xCursor, uno::UNO_QUERY);
+
+// Set up test by inserting strings with different font style/sizes
+// Inserts 1st string containing quotation marks (") with no font style
+xText->insertString(xCursor, "\"", false);
+xCursor->gotoStart(true); // selects full string
+CPPUNIT_ASSERT_EQUAL(OUString("\""), xCursor->getString());
+CPPUNIT_ASSERT_EQUAL(awt::FontSlant_NONE,
+ getProperty(xCursorProps, 
"CharPosture"));
+xCursor->collapseToEnd();
+
+// Inserts 2nd string 'test' with italic font style
+xCursorProps->setPropertyValue("CharPosture", 
uno::Any(awt::FontSlant_ITALIC));
+xText->insertString(xCursor, "test", false);
+xCursor->goLeft(4, true); // selects 2nd string
+CPPUNIT_ASSERT_EQUAL(OUString("test"), xCursor->getString());
+CPPUNIT_ASSERT_EQUAL(awt::FontSlant_ITALIC,
+ getProperty(xCursorProps, 
"CharPosture"));
+xCursor->collapseToEnd();
+
+// Insert 3rd string '? ' with 28 pt font height
+xCursorProps->setPropertyValue("CharPosture", 
uno::Any(awt::FontSlant_NONE)); // no font style
+xCursorProps->setPropertyValue("CharHeight", uno::Any(float(28.0)));
+xText->insertString(xCursor, "? ", false);
+xCursor->goLeft(2, true); // selects 3rd string
+CPPUNIT_ASSERT_EQUAL(float(28.0), getProperty(xCursorProps, 
"CharHeight"));
+xCursor->collapseToEnd();
+
+// Insert 4th string 'who' with default 12 pt font height
+xCursorProps->setPropertyValue("CharHeight", uno::Any(float(12.0)));
+xText->insertString(xCursor, "who", false);
+xCursor->goLeft(3, true); // selects 4rd string
+CPPUNIT_ASSERT_EQUAL(float(12.0), getProperty(xCursorProps, 
"CharHeight"));
+xCursor->collapseToEnd();
+
+// Asserts that full string is properly inserted as: '"test? who'
+CPPUNIT_ASSERT_EQUAL(1, getParagraphs());
+CPPUNIT_ASSERT_EQUAL(OUString("\"test? who"), 
getParagraph(1)->getString());
+
+uno::Reference xReplace(mxComponent, uno::UNO_QUERY);
+uno::Reference 
xReplaceDesc(xReplace->createReplaceDescriptor());
+
+// Searches for "t and replaces with "gu
+// Note: Search string contains both no font style and italic font style
+xReplaceDesc->setSearchString("\"t");
+xReplaceDesc->setReplaceString("\"gu");
+xReplace->replaceAll(xReplaceDesc);
+
+// Search/replace adds extra space between ? and w
+// Note: Search string contains both 28 pt and 12 pt font sizes
+xReplaceDesc->setSearchString("? w");
+xReplaceDesc->setReplaceString("?  w");
+xReplace->replaceAll(xReplaceDesc);
+
+// Asserts that '"test? who' is replaced with '"guest?  who'
+CPPUNIT_ASSERT_EQUAL(OUString("\"guest?  who"), 
getParagraph(1)->getString());
+
+// Asserts no font style is on double quote mark (")
+CPPUNIT_ASSERT_EQUAL(
+awt::FontSlant_NONE,
+getProperty(getRun(getParagraph(1), 1, u"\""_ustr), 
"CharPosture"));
+
+// Asserts font style for 'guest' is italic
+// Without the test, 'g' and 'u' in 'guest' will change to no font style
+// - Expected: 2 // ITALIC
+// - 

core.git: sw/qa sw/source

2024-06-19 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/data/shape-left-padding-off-page.docx |binary
 sw/qa/core/layout/fly.cxx   |   30 
 sw/source/core/layout/fly.cxx   |   22 +++
 3 files changed, 51 insertions(+), 1 deletion(-)

New commits:
commit 61692b82ae4ff62662509b5979a7aabc7d380678
Author: Miklos Vajna 
AuthorDate: Wed Jun 19 10:05:57 2024 +0200
Commit: Miklos Vajna 
CommitDate: Wed Jun 19 11:22:25 2024 +0200

tdf#161635 sw DoNotCaptureDrawObjsOnPage: fix handling of left padding

Open the bugdoc, the shape has an 5cm left padding for its text, but
only 4cm of that is visible in Writer.

Checking the shape, part of that is outside the page frame, so the first
1cm of the left padding is not visible, visually resulting in a 4cm left
padding in Writer, but not in Word.

Fix the problem by extending SwFlyFrame::MakePrtArea(), so in case the
shape is partially outside the page frame, then we make sure to increase
the left padding enough that the nominal (5cm) left padding is inside
the page frame.

With this, the text on the title page of the document is visually
centered also in Writer, even if not using an explicit paragraph
alignment.

Change-Id: I5dcbcf407ed7f12f0bc13820fa39621a76e23fe7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169186
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/core/layout/data/shape-left-padding-off-page.docx 
b/sw/qa/core/layout/data/shape-left-padding-off-page.docx
new file mode 100644
index ..92e143616016
Binary files /dev/null and 
b/sw/qa/core/layout/data/shape-left-padding-off-page.docx differ
diff --git a/sw/qa/core/layout/fly.cxx b/sw/qa/core/layout/fly.cxx
index 075ffe54bc5d..de227280bc55 100644
--- a/sw/qa/core/layout/fly.cxx
+++ b/sw/qa/core/layout/fly.cxx
@@ -17,6 +17,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 namespace
 {
@@ -111,6 +113,34 @@ CPPUNIT_TEST_FIXTURE(Test, testFlyRelWithRounding)
 // i.e. 5714.88 was truncated, not rounded.
 CPPUNIT_ASSERT_EQUAL(static_cast(5715), nFlyWidth);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testShapeLeftPaddingOffPage)
+{
+// Given a document with a shape that is 1cm off the page:
+createSwDoc("shape-left-padding-off-page.docx");
+
+// When laying out that document:
+SwDoc* pDoc = getSwDoc();
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+
+// Then make sure that the 2.5cm page margin + 2.5cm para margin and the 
5cm shape left padding
+// line up (with 1px tolerance):
+auto pPage = pLayout->GetLower()->DynCastPageFrame();
+auto pBody = static_cast(pPage->GetLower());
+auto pTextFrame = pBody->GetLower()->DynCastTextFrame();
+SwTwips nBodyLeft = pTextFrame->getFrameArea().Left() + 
pTextFrame->getFramePrintArea().Left();
+CPPUNIT_ASSERT(pPage->GetSortedObjs());
+SwSortedObjs& rPageObjs = *pPage->GetSortedObjs();
+CPPUNIT_ASSERT_EQUAL(static_cast(2), rPageObjs.size());
+auto pFly = rPageObjs[1]->DynCastFlyFrame()->DynCastFlyAtContentFrame();
+CPPUNIT_ASSERT(pFly);
+SwTwips nFlyLeft = pFly->getFrameArea().Left() + 
pFly->getFramePrintArea().Left();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected greater or equal than: 3119
+// - Actual  : 2574
+// i.e. the shape text had ~4cm left padding (visually) instead of 5cm.
+CPPUNIT_ASSERT_GREATEREQUAL(nBodyLeft - MINFLY, nFlyLeft);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 9722a741b2f8..313f047ece98 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -1986,7 +1986,27 @@ void SwFlyFrame::MakePrtArea( const SwBorderAttrs 
 )
 
 // consider vertical layout
 SwRectFnSet aRectFnSet(this);
-aRectFnSet.SetXMargins( *this, rAttrs.CalcLeftLine(),
+SwTwips nLeftLine = rAttrs.CalcLeftLine();
+
+// The fly frame may be partially outside the page, check for this 
case.
+SwPageFrame* pPageFrame = FindPageFrame();
+SwFrameFormat* pFormat = GetFormat();
+if (pPageFrame && pFormat)
+{
+const IDocumentSettingAccess& rIDSA = 
pFormat->getIDocumentSettingAccess();
+bool bDoNotCaptureDrawObjsOnPage = 
rIDSA.get(DocumentSettingId::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE);
+bool bLRTB = pFormat->GetFrameDir().GetValue() == 
SvxFrameDirection::Horizontal_LR_TB;
+SwTwips nFlyLeft = getFrameArea().Left();
+SwTwips nPageLeft = pPageFrame->getFrameArea().Left();
+if (bDoNotCaptureDrawObjsOnPage && bLRTB && nFlyLeft < nPageLeft)
+{
+// It is outside: only start the left padding of the text 
inside the page frame,
+// when we're in Word compatibility 

core.git: sw/qa sw/source

2024-06-19 Thread László Németh (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx   |   11 +++
 sw/source/filter/ww8/docxexport.cxx  |4 
 sw/source/writerfilter/dmapper/SettingsTable.cxx |   15 +++
 sw/source/writerfilter/dmapper/SettingsTable.hxx |1 +
 4 files changed, 31 insertions(+)

New commits:
commit 64365dfa67d5a1d8fbc710238a4ea9c492645de4
Author: László Németh 
AuthorDate: Wed Jun 19 00:14:21 2024 +0200
Commit: László Németh 
CommitDate: Wed Jun 19 09:08:56 2024 +0200

tdf#161643 sw DOCX import/export of maximum consecutive hyphenated lines

Fix line break interoperability by importing w:consecutiveHyphenLimit to
ParaHyphenationMaxHyphens, and exporting ParaHyphenationMacHyphens to
w:consecutiveHyphenLimit in OOXML import/export filters.

Change-Id: I5f40bcff34ebebeabc0de9898955abda4dc34cde
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169127
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index d1e3647b9826..9a19ca827700 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -801,6 +801,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf161628, 
"tdf132599_frames_on_right_pages_no_hyph
 CPPUNIT_ASSERT_EQUAL( static_cast(0), 
getProperty(xStyle, u"ParaHyphenationZone"_ustr));
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf161643)
+{
+loadAndSave("fdo76163.docx");
+xmlDocUniquePtr pXmlSettings = parseExport(u"word/settings.xml"_ustr);
+assertXPath(pXmlSettings, "/w:settings/w:consecutiveHyphenLimit"_ostr, 
"val"_ostr, u"1"_ustr);
+
+uno::Reference 
xStyle(getStyles(u"ParagraphStyles"_ustr)->getByName(u"Standard"_ustr), 
uno::UNO_QUERY);
+// This was false (value 0)
+CPPUNIT_ASSERT_EQUAL( static_cast(1), 
getProperty(xStyle, u"ParaHyphenationMaxHyphens"_ustr));
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testTdf121658)
 {
 loadAndSave("tdf121658.docx");
diff --git a/sw/source/filter/ww8/docxexport.cxx 
b/sw/source/filter/ww8/docxexport.cxx
index 149c52f4d6fa..911b2cddc50f 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -1220,6 +1220,10 @@ void DocxExport::WriteSettings()
 bHyphenationZone = true;
 }
 
+if ( sal_Int16 nMaxHyphens = pZoneItem->GetMaxHyphens() )
+pFS->singleElementNS(XML_w, XML_consecutiveHyphenLimit, 
FSNS(XML_w, XML_val),
+ OString::number(nMaxHyphens));
+
 if ( pZoneItem->IsKeep() && pZoneItem->GetKeepType() )
 bHyphenationKeep = true;
 }
diff --git a/sw/source/writerfilter/dmapper/SettingsTable.cxx 
b/sw/source/writerfilter/dmapper/SettingsTable.cxx
index 5d4642f0cb33..fa67518ced65 100644
--- a/sw/source/writerfilter/dmapper/SettingsTable.cxx
+++ b/sw/source/writerfilter/dmapper/SettingsTable.cxx
@@ -93,6 +93,7 @@ struct SettingsTable_Impl
 boolm_bAutoHyphenation;
 boolm_bNoHyphenateCaps;
 sal_Int16   m_nHyphenationZone;
+sal_Int16   m_nConsecutiveHyphenLimit;
 sal_Int16   m_nUseWord2013TrackBottomHyphenation;
 sal_Int16   m_nAllowHyphenationAtTrackBottom;
 boolm_bWidowControl;
@@ -142,6 +143,7 @@ struct SettingsTable_Impl
 , m_bAutoHyphenation(false)
 , m_bNoHyphenateCaps(false)
 , m_nHyphenationZone( 360 ) // default is 1/4 in
+, m_nConsecutiveHyphenLimit(0)
 , m_nUseWord2013TrackBottomHyphenation(-1)
 , m_nAllowHyphenationAtTrackBottom(-1)
 , m_bWidowControl(false)
@@ -298,6 +300,9 @@ void SettingsTable::lcl_sprm(Sprm& rSprm)
 case NS_ooxml::LN_CT_Settings_hyphenationZone: // 92508;
 m_pImpl->m_nHyphenationZone = nIntValue;
 break;
+case NS_ooxml::LN_CT_Settings_consecutiveHyphenLimit:
+m_pImpl->m_nConsecutiveHyphenLimit = nIntValue;
+break;
 case NS_ooxml::LN_CT_Compat_useFELayout: // 92422;
 // useFELayout (Do Not Bypass East Asian/Complex Script Layout Code - 
support of old versions of Word - ignored)
 break;
@@ -556,6 +561,11 @@ sal_Int16 SettingsTable::GetHyphenationZone() const
 return m_pImpl->m_nHyphenationZone;
 }
 
+sal_Int16 SettingsTable::GetConsecutiveHyphenLimit() const
+{
+return m_pImpl->m_nConsecutiveHyphenLimit;
+}
+
 bool SettingsTable::GetHyphenationKeep() const
 {
 // if allowHyphenationAtTrackBottom is not true and 
useWord2013TrackBottomHyphenation is
@@ -716,6 +726,11 @@ void 
SettingsTable::ApplyProperties(rtl::Reference const& xDoc)
 uno::Reference xPropertySet(xDefault, 
uno::UNO_QUERY);
 xPropertySet->setPropertyValue(u"ParaHyphenationZone"_ustr, 
uno::Any(GetHyphenationZone()));
 }
+if (m_pImpl->m_nConsecutiveHyphenLimit)
+{
+uno::Reference xPropertySet(xDefault, 
uno::UNO_QUERY);
+xPropertySet->setPropertyValue(u"ParaHyphenationMaxHyphens"_ustr, 

core.git: sw/qa

2024-06-19 Thread Andrea Gelmini (via logerrit)
 sw/qa/extras/unowriter/unowriter.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 677366d3c9992b56b2b8c5278b29e694e0d8bfd4
Author: Andrea Gelmini 
AuthorDate: Tue Jun 18 22:41:18 2024 +0200
Commit: Julien Nabet 
CommitDate: Wed Jun 19 08:41:28 2024 +0200

Fix typo

Change-Id: Ifae040774dff2e75d4ddcfd38e8e67192f70d69a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169160
Reviewed-by: Julien Nabet 
Tested-by: Julien Nabet 

diff --git a/sw/qa/extras/unowriter/unowriter.cxx 
b/sw/qa/extras/unowriter/unowriter.cxx
index ab2320a19881..d1f8fce4dd0c 100644
--- a/sw/qa/extras/unowriter/unowriter.cxx
+++ b/sw/qa/extras/unowriter/unowriter.cxx
@@ -1107,7 +1107,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testMultiSelect)
 auto xSimpleText = xTextDocument->getText();
 xSimpleText->insertString(xSimpleText->getStart(), u"Abc aBc abC"_ustr, 
false);
 
-// Create a search descriptor and find all occurencies of search string
+// Create a search descriptor and find all occurrences of search string
 css::uno::Reference xSearchable(mxComponent, 
css::uno::UNO_QUERY_THROW);
 auto xSearchDescriptor = xSearchable->createSearchDescriptor();
 xSearchDescriptor->setPropertyValue(u"SearchStyles"_ustr, 
css::uno::Any(false));


core.git: sw/qa

2024-06-19 Thread Andrea Gelmini (via logerrit)
 0 files changed

New commits:
commit ef38bc24551a4d344c5bf1d528534fcf6977e560
Author: Andrea Gelmini 
AuthorDate: Tue Jun 18 23:53:46 2024 +0200
Commit: Julien Nabet 
CommitDate: Wed Jun 19 08:28:49 2024 +0200

Remove exec bits on docx file

Change-Id: I8aef24c3536493ab73df7637990c48a2c94c2bf0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169182
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/sw/qa/extras/ooxmlexport/data/A019_min.docx 
b/sw/qa/extras/ooxmlexport/data/A019_min.docx
old mode 100755
new mode 100644


core.git: sw/qa sw/source

2024-06-18 Thread László Németh (via logerrit)
 
sw/qa/extras/ooxmlexport/data/tdf132599_frames_on_right_pages_no_hyphenation.fodt
 |  224 ++
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
   |7 
 sw/source/filter/ww8/docxexport.cxx
   |8 
 3 files changed, 239 insertions(+)

New commits:
commit 89a80d637e2831d49cdf48921f961b04fd03cffc
Author: László Németh 
AuthorDate: Tue Jun 18 09:32:24 2024 +0200
Commit: László Németh 
CommitDate: Tue Jun 18 13:14:21 2024 +0200

tdf#161628 sw DOCX: export zero hyphenation zone, if it's not defined

To keep the layout of the document, export zero hyphenation zone
instead of nothing, otherwise it would be 360 twips after importing
the document with the default hyphenation zone.

Follow-up to commit 8d8bc48b5efacde6f99d78a557cd052ce9e0ed07
"tdf#161628 DOCX import: set default hyphenation zone (1/4 inch)".

Change-Id: I7be4a001f894bcdf10fff5f1b2e211a5a45566d6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169078
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf132599_frames_on_right_pages_no_hyphenation.fodt
 
b/sw/qa/extras/ooxmlexport/data/tdf132599_frames_on_right_pages_no_hyphenation.fodt
new file mode 100644
index ..c3df7b605f3a
--- /dev/null
+++ 
b/sw/qa/extras/ooxmlexport/data/tdf132599_frames_on_right_pages_no_hyphenation.fodt
@@ -0,0 +1,224 @@
+
+
+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">
+ 
+  
+   false
+   true
+   true
+   
+   false
+   0
+   false
+   true
+   true
+   false
+   false
+   0
+   true
+   false
+   false
+   false
+   false
+   false
+   true
+   false
+   false
+   true
+   false
+   true
+   true
+   false
+   true
+   false
+   false
+   false
+   false
+   true
+   true
+   false
+   false
+   false
+   false
+   false
+   false
+   high-resolution
+   false
+   595440
+   false
+   true
+   false
+   
+   
+   true
+   
+   false
+   false
+   false
+   true
+   true
+   true
+   false
+   0
+   true
+   false
+   false
+   true
+   true
+   true
+   false
+   true
+   false
+   false
+   false
+   false
+   false
+   true
+   true
+   false
+   
+   true
+   false
+   false
+   0
+   false
+   true
+   
+   false
+   false
+   true
+   true
+   false
+   false
+   true
+   1
+   false
+   false
+   false
+   false
+   false
+   false
+   false
+   true
+   false
+   false
+   false
+   true
+   false
+   
+   true
+   1131034
+   true
+   false
+   false
+   false
+  
+ 
+ 
+  
+   http://openoffice.org/2004/office; 
xmlns:xlink="http://www.w3.org/1999/xlink"/>
+  
+ 
+ 
+  
+  
+ 
+ 
+  
+   
+   
+
+   
+   
+  
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+   
+  
+  
+   
+   
+  
+  
+  
+   
+  
+ 
+ 
+  
+   

core.git: sw/qa sw/source

2024-06-18 Thread László Németh (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx   |7 +++
 sw/source/writerfilter/dmapper/SettingsTable.cxx |2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 8d8bc48b5efacde6f99d78a557cd052ce9e0ed07
Author: László Németh 
AuthorDate: Tue Jun 18 02:45:30 2024 +0200
Commit: László Németh 
CommitDate: Tue Jun 18 13:13:17 2024 +0200

tdf#161628 DOCX import: set default hyphenation zone (1/4 inch)

Default value of hyphenationZone is 360 twips (0.25"). Apply this
value, if hyphenationZone is not defined, according to the OOXML
standard.

Follow-up to commit 5a079652c1b1f968a851f47995b0a65b84d2d192
"tdf#149421 DOCX: import/export hyphenation zone".

Change-Id: Idadae973d93a14fbbe828fa74562db6262c40904
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169070
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index ccd4c69d9757..d0e84df71295 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -787,6 +787,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf149421, "tdf121661.docx")
 }
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf149421_default, "tdf146171.docx")
+{
+uno::Reference 
xStyle(getStyles(u"ParagraphStyles"_ustr)->getByName(u"Standard"_ustr), 
uno::UNO_QUERY);
+// This was 0 (not the default OOXML hyphenationZone)
+CPPUNIT_ASSERT_EQUAL( static_cast(360), 
getProperty(xStyle, u"ParaHyphenationZone"_ustr));
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testTdf121658)
 {
 loadAndSave("tdf121658.docx");
diff --git a/sw/source/writerfilter/dmapper/SettingsTable.cxx 
b/sw/source/writerfilter/dmapper/SettingsTable.cxx
index 4003eeed90d2..5d4642f0cb33 100644
--- a/sw/source/writerfilter/dmapper/SettingsTable.cxx
+++ b/sw/source/writerfilter/dmapper/SettingsTable.cxx
@@ -141,7 +141,7 @@ struct SettingsTable_Impl
 , m_bNoColumnBalance(false)
 , m_bAutoHyphenation(false)
 , m_bNoHyphenateCaps(false)
-, m_nHyphenationZone(0)
+, m_nHyphenationZone( 360 ) // default is 1/4 in
 , m_nUseWord2013TrackBottomHyphenation(-1)
 , m_nAllowHyphenationAtTrackBottom(-1)
 , m_bWidowControl(false)


core.git: sw/qa sw/source

2024-06-17 Thread Oliver Specht (via logerrit)
 sw/qa/extras/ooxmlexport/data/A019_min.docx|binary
 sw/qa/extras/ooxmlexport/ooxmlexport19.cxx |   17 +
 sw/source/filter/ww8/docxattributeoutput.cxx   |   11 +++
 sw/source/filter/ww8/docxexport.hxx|6 +++---
 sw/source/writerfilter/dmapper/PropertyMap.cxx |   11 ++-
 5 files changed, 41 insertions(+), 4 deletions(-)

New commits:
commit 8ef9573f087b86f93860c8d07d04b60a40512836
Author: Oliver Specht 
AuthorDate: Tue Jun 11 08:51:09 2024 +0200
Commit: Thorsten Behrens 
CommitDate: Tue Jun 18 00:59:10 2024 +0200

tdf#161521 fix page margins on first page with mirrord layout

Documents starting with an even page on a mirrored layout need
to switch left/right margin on the first page.
Applies also to docx export.
JUnit test included

Change-Id: Ia363941c6a7a25f9208acc7e40b77baa88080780
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168658
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 
Tested-by: Gabor Kelemen 

diff --git a/sw/qa/extras/ooxmlexport/data/A019_min.docx 
b/sw/qa/extras/ooxmlexport/data/A019_min.docx
new file mode 100755
index ..c7c0c890accf
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/A019_min.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx
index d74b4883a7d0..8080bd448a55 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx
@@ -1234,6 +1234,23 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf148952_2010)
 CPPUNIT_ASSERT_EQUAL(u"Black"_ustr, title);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf153196, "A019_min.docx")
+{
+uno::Reference xPageStyle;
+getStyles("PageStyles")->getByName("Converted1") >>= xPageStyle;
+sal_Int32 nLeftMargin{};
+xPageStyle->getPropertyValue("LeftMargin") >>= nLeftMargin;
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 4265
+// - Actual  : 0
+CPPUNIT_ASSERT_EQUAL(static_cast(4265), nLeftMargin);
+sal_Int32 nRightMargin{};
+xPageStyle->getPropertyValue("RightMargin") >>= nRightMargin;
+// - Expected: 0
+// - Actual  : 4265
+CPPUNIT_ASSERT_EQUAL(static_cast(0), nRightMargin);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index fb11a5247f5f..15928d5d414f 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -9272,6 +9272,17 @@ void DocxAttributeOutput::FormatLRSpace( const 
SvxLRSpaceItem& rLRSpace )
 
 m_pageMargins.nLeft += 
sal::static_int_cast(rLRSpace.GetLeft());
 m_pageMargins.nRight += 
sal::static_int_cast(rLRSpace.GetRight());
+// if page layout is 'left' then left/right margin need to be exchanged
+// as it is exported as mirrored layout starting with even page
+const WW8_SepInfo *pSectionInfo = 
m_rExport.Sections().CurrentSectionInfo();
+if (pSectionInfo->pPageDesc &&
+m_rExport.isMirroredMargin() &&
+((pSectionInfo->pPageDesc->ReadUseOn() & UseOnPage::All) == 
UseOnPage::Left))
+{
+sal_uInt16 nLeft = m_pageMargins.nLeft;
+m_pageMargins.nLeft = m_pageMargins.nRight;
+m_pageMargins.nRight = nLeft;
+}
 sal_uInt16 nGutter = rLRSpace.GetGutterMargin();
 
 AddToAttrList( m_pSectionSpacingAttrList,
diff --git a/sw/source/filter/ww8/docxexport.hxx 
b/sw/source/filter/ww8/docxexport.hxx
index 722e3b571291..a29ad9aaf3e9 100644
--- a/sw/source/filter/ww8/docxexport.hxx
+++ b/sw/source/filter/ww8/docxexport.hxx
@@ -285,9 +285,6 @@ private:
 /// Writes word/vbaProject.bin.
 void WriteVBA();
 
-/// return true if Page Layout is set as Mirrored
-bool isMirroredMargin();
-
 public:
 /// All xml namespaces to be used at the top of any text .xml file (main 
doc, headers, footers,...)
 rtl::Reference MainXmlNamespaces();
@@ -325,6 +322,9 @@ public:
 // needed in docxsdrexport.cxx and docxattributeoutput.cxx
 sal_Int32 getWordCompatibilityModeFromGrabBag() const;
 
+/// return true if Page Layout is set as Mirrored
+bool isMirroredMargin();
+
 private:
 DocxExport( const DocxExport& ) = delete;
 
diff --git a/sw/source/writerfilter/dmapper/PropertyMap.cxx 
b/sw/source/writerfilter/dmapper/PropertyMap.cxx
index b5c70b6309f8..6c169b610d4b 100644
--- a/sw/source/writerfilter/dmapper/PropertyMap.cxx
+++ b/sw/source/writerfilter/dmapper/PropertyMap.cxx
@@ -1472,14 +1472,23 @@ void 
SectionPropertyMap::CreateEvenOddPageStyleCopy(DomainMapper_Impl& rDM_Impl,
 u"HeaderText", u"HeaderTextLeft", u"HeaderTextFirst",
 u"FooterText", u"FooterTextLeft", u"FooterTextFirst" };
 
+bool isMirrorMargins = PageBreakType::Even == eBreakType && 

core.git: sw/qa sw/source

2024-06-17 Thread Miklos Vajna (via logerrit)
 sw/qa/writerfilter/dmapper/DomainMapper_Impl.cxx   |   35 
++
 sw/qa/writerfilter/dmapper/data/para-style-lost-numbering.docx |binary
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx   |   12 +++
 3 files changed, 46 insertions(+), 1 deletion(-)

New commits:
commit 4e5dd2c0774242e44ac6edf2bd5ada220541b06b
Author: Miklos Vajna 
AuthorDate: Mon Jun 17 13:27:13 2024 +0200
Commit: Miklos Vajna 
CommitDate: Mon Jun 17 18:59:04 2024 +0200

tdf#161570 DOCX import: fix lost numbering in paragraph style

Regression from commit ca71482237d31703454062b8b2f544a8bacd2831
(tdf#153083 writerfilter: import locale-dependent TOCstyle names, 2,
2023-01-31), open the doc, apply 'Level 2 Heading' on the first para,
then switch back to 'Signature' again using e.g. the sidebar, the
numbering of the first paragraph is gone.

This was initially a wider problem, but since commit
ab1697cb4c17fd7a2fbf8d374ac95fc03b4d00be (tdf#160402
filter,writerfilter: import locale-dependent STYLEREF names,
2024-05-06), the problem only affects built-in styles. There were two
remaining problems: 1) the separator for the TOC field can contain
whitespace, which resulted in a style named ' Signature' and 2) the
style was always cloned, even if the name was not localized.

Fix the problem by first trimming the style name in
DomainMapper_Impl::handleToc() and then only cloning in
DomainMapper_Impl::ConvertTOCStyleName() if we see that the style name
is localized. A localized style name can be observed when opening e.g.
sw/qa/extras/ooxmlexport/data/custom-styles-TOC-semicolon.docx that has
Intensives Zitat vs Intense Quote.

One remaining question is why the numbering is lost when the cloning
happens, that's not addressed here, as the cloning should not happen for
this document in the first place.

Change-Id: Ibc2ea20cc3c9ec6bec9bdcdabce1469a0457317a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168994
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/qa/writerfilter/dmapper/DomainMapper_Impl.cxx
index a8cef1084e44..6085872b0818 100644
--- a/sw/qa/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/qa/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -437,6 +437,41 @@ CPPUNIT_TEST_FIXTURE(Test, testClearingBreakSectEnd)
 CPPUNIT_ASSERT_EQUAL(u"LineBreak"_ustr,
  
xPortion->getPropertyValue("TextPortionType").get());
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testParaStyleLostNumbering)
+{
+// Given a document with a first paragraph, its paragraph style has a 
numbering:
+// When loading the document:
+loadFromFile(u"para-style-lost-numbering.docx");
+
+// Then make sure that the paragraph style name has no unexpected leading 
whitespace:
+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);
+OUString aParaStyleName;
+xPara->getPropertyValue("ParaStyleName") >>= aParaStyleName;
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: Signature
+// - Actual  :  Signature
+// i.e. there was an unwanted space at the start.
+CPPUNIT_ASSERT_EQUAL(u"Signature"_ustr, aParaStyleName);
+uno::Reference 
xStyleFamiliesSupplier(mxComponent,
+ 
uno::UNO_QUERY);
+// Also make sure the paragraph style has a numbering associated with it:
+uno::Reference xStyleFamilies
+= xStyleFamiliesSupplier->getStyleFamilies();
+uno::Reference xStyleFamily(
+xStyleFamilies->getByName(u"ParagraphStyles"_ustr), uno::UNO_QUERY);
+uno::Reference 
xStyle(xStyleFamily->getByName(u"Signature"_ustr),
+   uno::UNO_QUERY);
+OUString aNumberingStyleName;
+// Without the accompanying fix in place, this test would have failed, the 
WWNum14 list was set
+// only as direct formatting, not at a style level.
+xStyle->getPropertyValue("NumberingStyleName") >>= aNumberingStyleName;
+CPPUNIT_ASSERT(!aNumberingStyleName.isEmpty());
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/writerfilter/dmapper/data/para-style-lost-numbering.docx 
b/sw/qa/writerfilter/dmapper/data/para-style-lost-numbering.docx
new file mode 100644
index ..0ab96d2a41d4
Binary files /dev/null and 
b/sw/qa/writerfilter/dmapper/data/para-style-lost-numbering.docx differ
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx

core.git: sw/qa sw/source

2024-06-17 Thread Tibor Nagy (via logerrit)
 sw/qa/core/text/data/tdf159924.odt  |binary
 sw/qa/core/text/text.cxx|   35 
 sw/source/core/text/EnhancedPDFExportHelper.cxx |4 ++
 3 files changed, 38 insertions(+), 1 deletion(-)

New commits:
commit a3ac49ebe78b7fc164dbc766492faee084bad254
Author: Tibor Nagy 
AuthorDate: Mon Jun 17 12:29:56 2024 +0200
Commit: Nagy Tibor 
CommitDate: Mon Jun 17 15:35:08 2024 +0200

tdf#159924 sw: fix hyperlink name export to PDF

If there is a Name attribute set for a hyperlink, the text is exported
to PDF as tooltip.

note: not every PDF reader displays this text

Change-Id: Ib9f1c13403c1555bfae733d662754c0e052378f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168993
Tested-by: Jenkins
Reviewed-by: Nagy Tibor 

diff --git a/sw/qa/core/text/data/tdf159924.odt 
b/sw/qa/core/text/data/tdf159924.odt
new file mode 100644
index ..91fc53c194d5
Binary files /dev/null and b/sw/qa/core/text/data/tdf159924.odt differ
diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index bde60587a7bb..933fb30f696f 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -182,6 +182,41 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf159903)
 CPPUNIT_ASSERT_EQUAL(SwTwips(2268), tm.Left() - 
pFrame->getFrameArea().Left());
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf159924)
+{
+createSwDoc("tdf159924.odt");
+save(u"writer_pdf_Export"_ustr);
+
+vcl::filter::PDFDocument aDocument;
+SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+CPPUNIT_ASSERT(aDocument.Read(aStream));
+
+// The document has one page.
+std::vector aPages = aDocument.GetPages();
+CPPUNIT_ASSERT_EQUAL(static_cast(1), aPages.size());
+
+auto pAnnots = 
dynamic_cast(aPages[0]->Lookup("Annots"_ostr));
+CPPUNIT_ASSERT(pAnnots);
+CPPUNIT_ASSERT_EQUAL(static_cast(1), 
pAnnots->GetElements().size());
+
+auto pAnnotRef = 
dynamic_cast(pAnnots->GetElements()[0]);
+CPPUNIT_ASSERT(pAnnotRef);
+
+vcl::filter::PDFObjectElement* pAnnot = pAnnotRef->LookupObject();
+CPPUNIT_ASSERT(pAnnot);
+
+auto aType = 
static_cast(pAnnot->Lookup("Type"_ostr));
+CPPUNIT_ASSERT_EQUAL("Annot"_ostr, aType->GetValue());
+
+auto aSubType = 
static_cast(pAnnot->Lookup("Subtype"_ostr));
+CPPUNIT_ASSERT_EQUAL("Link"_ostr, aSubType->GetValue());
+
+auto pCont = 
dynamic_cast(pAnnot->Lookup("Contents"_ostr));
+CPPUNIT_ASSERT(pCont);
+OUString sContent = 
::vcl::filter::PDFDocument::DecodeHexStringUTF16BE(*pCont);
+CPPUNIT_ASSERT_EQUAL(u"This link opens the LibreOffice website"_ustr, 
sContent);
+}
+
 CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf159336)
 {
 createSwDoc("tdf159336.odt");
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index e723b033e415..382b08622bbc 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -2227,7 +2227,9 @@ void 
SwEnhancedPDFExportHelper::EnhancedPDFExport(LanguageType const eLanguageDe
 // be deleted again in JumpToSwMark.
 SwRects const aTmp(GetCursorRectsContainingText(mrSh));
 OSL_ENSURE( !aTmp.empty(), "Enhanced pdf export - 
rectangles are missing" );
-OUString const altText(mrSh.GetSelText());
+OUString altText(p->rINetAttr.GetINetFormat().GetName());
+if (altText.isEmpty())
+altText = mrSh.GetSelText();
 
 const SwPageFrame* pSelectionPage =
 static_cast( 
mrSh.GetLayout()->Lower() );


core.git: sw/qa sw/source

2024-06-14 Thread Jonathan Clark (via logerrit)
 sw/qa/extras/layout/data/tdf92091.fodt |  336 +
 sw/qa/extras/layout/layout3.cxx|   48 
 sw/source/core/text/frmform.cxx|   48 
 3 files changed, 432 insertions(+)

New commits:
commit e78bb77c3c5930b20113bff3de2dd02065cead85
Author: Jonathan Clark 
AuthorDate: Thu Jun 13 13:55:29 2024 -0600
Commit: Jonathan Clark 
CommitDate: Fri Jun 14 17:49:50 2024 +0200

tdf#92091 Writer save and restore VCL state during recursion

This change updates Writer to save and restore VCL device state while
laying out text. This fixes issues caused by Writer mutating device
state while recursively laying out text, particularly overlapping RTL
and LTR text when used together along with footnotes.

Change-Id: I077352551ce2072f5c5eab9bff4b98bbcc6e78f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168835
Tested-by: Jenkins
Reviewed-by: Jonathan Clark 

diff --git a/sw/qa/extras/layout/data/tdf92091.fodt 
b/sw/qa/extras/layout/data/tdf92091.fodt
new file mode 100644
index ..2a11e6ff5cdf
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf92091.fodt
@@ -0,0 +1,336 @@
+
+
+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">
+ 
2015-06-15T17:08:29Amouei
 
en-US14PT11M56SLibreOfficeDev/25.2.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/f917cea28a780a9fc9dc3c81fbaa5d3bcf6709082024-06-13T14:09:41.052310634
+ 
+  
+   0
+   8961
+   12628
+   7692
+   true
+   false
+   
+
+ view2
+ 19500
+ 2501
+ 8961
+ 0
+ 21586
+ 7691
+ 0
+ 1
+ false
+ 600
+ false
+ false
+ false
+ false
+ false
+ false
+
+   
+  
+  
+   false
+   true
+   true
+   
+   false
+   0
+   false
+   true
+   false
+   true
+   true
+   false
+   0
+   true
+   false
+   false
+   true
+   false
+   true
+   true
+   true
+   true
+   true
+   true
+   true
+   true
+   false
+   true
+   false
+   false
+   true
+   true
+   true
+   true
+   true
+   false
+   true
+   false
+   true
+   true
+   high-resolution
+   false
+   221202
+   false
+   true
+   false
+   
+   
+   true
+   
+   true
+   false
+   true
+   true
+   true
+   false
+   false
+   0
+   true
+   false
+   false
+   true
+   true
+   true
+   true
+   true
+   false
+   false
+   true
+   false
+   true
+   true
+   true
+   false
+   true
+   Generic 
Printer
+   true
+   false
+   false
+   0
+   false
+   true
+   

core.git: sw/qa sw/source

2024-06-13 Thread Miklos Vajna (via logerrit)
 
sw/qa/core/objectpositioning/data/do-not-capture-draw-objs-on-page-draw-wrap-none.docx
 |binary
 sw/qa/core/objectpositioning/objectpositioning.cxx 
|   31 ++
 sw/source/core/objectpositioning/anchoredobjectposition.cxx
|4 -
 3 files changed, 33 insertions(+), 2 deletions(-)

New commits:
commit a0b6587c4acb1d74e1b00904147821640c98b323
Author: Miklos Vajna 
AuthorDate: Thu Jun 13 08:04:30 2024 +0200
Commit: Miklos Vajna 
CommitDate: Thu Jun 13 09:44:46 2024 +0200

tdf#161199 sw DoNotCaptureDrawObjsOnPage: capture wrap=none draw objects

Regression from commit af313fc149f80adb0f1680ca20e19745ccb7fede
(tdf#105143 DOCX import: enable DoNotCaptureDrawObjsOnPage layout compat
option, 2017-01-06), the second page of the document has an off-page
positioned draw shape, which is still kept inside the page frame in
Word, but not in Writer anymore.

Reading the SwAnchoredObjectPosition::GetInfoAboutObj() code, there are
a number of conditions at play here, but the relevant one is that fly
frames have the restriction that the "do not capture" behavior is
restricted to wrap=through, but the wrap type was ignored in the draw
shape case.

Fix the problem by being consistent here: require wrap=through for both
fly frames and draw shapes that moves the shape back inside the page
frame.

Note that Word goes a bit further here and even keeps the shape inside
the body text area, but that doesn't seem to be a regression, so leave
that unchanged for now.

Change-Id: I3b6331c13d2376cac9b0de90f6f57289a7a0f0e7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168762
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git 
a/sw/qa/core/objectpositioning/data/do-not-capture-draw-objs-on-page-draw-wrap-none.docx
 
b/sw/qa/core/objectpositioning/data/do-not-capture-draw-objs-on-page-draw-wrap-none.docx
new file mode 100644
index ..8eea3a7e0df2
Binary files /dev/null and 
b/sw/qa/core/objectpositioning/data/do-not-capture-draw-objs-on-page-draw-wrap-none.docx
 differ
diff --git a/sw/qa/core/objectpositioning/objectpositioning.cxx 
b/sw/qa/core/objectpositioning/objectpositioning.cxx
index ba2e225e7d07..e8d9f0d445cc 100644
--- a/sw/qa/core/objectpositioning/objectpositioning.cxx
+++ b/sw/qa/core/objectpositioning/objectpositioning.cxx
@@ -475,6 +475,37 @@ CPPUNIT_TEST_FIXTURE(Test, 
testDoNotMirrorRtlDrawObjsLayout)
 // i.e. the graphic was on the left margin, not on the right margin.
 CPPUNIT_ASSERT_GREATER(nBodyRight, aAnchoredCenter.getX());
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testDoNotCaptureDrawObjsOnPageDrawWrapNone)
+{
+// Given a document with a draw object on page 2, wrap type is set to none 
(not through):
+createSwDoc("do-not-capture-draw-objs-on-page-draw-wrap-none.docx");
+
+// When laying out that document:
+calcLayout();
+
+// Then make sure the draw object is captured on page 2:
+SwDoc* pDoc = getSwDoc();
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+auto pPage1 = pLayout->Lower()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage1);
+auto pPage2 = pPage1->GetNext()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage2);
+CPPUNIT_ASSERT(pPage2->GetSortedObjs());
+const SwSortedObjs& rPage2Objs = *pPage2->GetSortedObjs();
+CPPUNIT_ASSERT_EQUAL(static_cast(2), rPage2Objs.size());
+SwAnchoredObject* pDrawObj = rPage2Objs[0];
+CPPUNIT_ASSERT_EQUAL(static_cast(RES_DRAWFRMFMT),
+ pDrawObj->GetFrameFormat()->Which());
+SwTwips nDrawObjTop = pDrawObj->GetObjRect().Top();
+SwTwips nPage2Top = pPage2->getFrameArea().Top();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected greater than: 17383
+// - Actual  : 13518
+// i.e. the draw object was way above the page 2 rectangle, instead of 
inside it (apart from
+// some <1px difference).
+CPPUNIT_ASSERT_GREATER(nPage2Top - MINFLY, nDrawObjTop);
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/objectpositioning/anchoredobjectposition.cxx 
b/sw/source/core/objectpositioning/anchoredobjectposition.cxx
index 4af3af542b27..9d61d9cd3054 100644
--- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx
+++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx
@@ -119,12 +119,12 @@ void SwAnchoredObjectPosition::GetInfoAboutObj()
 // determine, if anchored object has not to be captured on the page.
 // the following conditions must be hold to *not* capture it:
 // - corresponding document compatibility flag is set
-// - it's a drawing object or it's a non-textbox wrap-though fly frame
+// - it's a drawing object or it's a non-textbox fly frame with wrap-though
 // - it doesn't follow the text flow
 {
 bool bTextBox = 

core.git: sw/qa sw/source

2024-06-11 Thread Mike Kaganski (via logerrit)
 sw/qa/extras/layout/data/tdf161508.fodt |   54 
 sw/qa/extras/layout/layout3.cxx |   10 +
 sw/source/core/layout/tabfrm.cxx|   28 
 3 files changed, 91 insertions(+), 1 deletion(-)

New commits:
commit 0c49aa58cfbb81073e34b1d47861a5a1fdd44114
Author: Mike Kaganski 
AuthorDate: Tue Jun 11 17:39:26 2024 +0500
Commit: Mike Kaganski 
CommitDate: Tue Jun 11 19:59:07 2024 +0200

tdf#161508: add another loop control hack

It beats me how to resolve the oscillation cleanly, when in a row
split mode, lcl_CalcMinRowHeight calculates a small value, but in
a non-split mode,  it returns a larger value  (which is expected),
and that resulted in recalc,  getting stuck forever in the nested
SwTabFrame::MakeAll.

So this puts an oscillation control here. The placement is mostly
heuristical.  It is hackish also in the sense that it only checks
the frame size and position,  but ignores the state;  so it might
turn out that it returns too early,  when a different combination
of flags was about to be attempted.

The unit test tests two things:
1. The main aspect of freeze;
2. The expected correct layout.

If (when) the hack turns out problematic,  and its fix happens to
break the second part of the test,  that is unfortunate,  but the
most important thing is to keep it from hanging.

Change-Id: If31d8527b4677b5211dcd3308578118c7066d68c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168677
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sw/qa/extras/layout/data/tdf161508.fodt 
b/sw/qa/extras/layout/data/tdf161508.fodt
new file mode 100644
index ..31c150ff14cf
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf161508.fodt
@@ -0,0 +1,54 @@
+
+
+
+ 
+  
+ 
+ 
+  
+   
+   
+  
+ 
+ 
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+ 
+ 
+  
+ 
+ 
+  
+   Hangs since LO5.3
+   
+
+
+ 
+  
+   
+   
+
+
+   
+   
+
+
+   
+  
+ 
+
+   
+   
+  
+ 
+
\ No newline at end of file
diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index ab4bb1d52829..25d7c53edeb1 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -2849,6 +2849,16 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, 
TestCrashHyphenation)
 createSwDoc("crashHyphen.fodt");
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, TestTdf161508)
+{
+// This document must not hang on load.
+createSwDoc("tdf161508.fodt");
+auto pExportDump = parseLayoutDump();
+// The table must move completely to the second page
+assertXPath(pExportDump, "//page[1]/body/tab"_ostr, 0);
+assertXPath(pExportDump, "//page[2]/body/tab"_ostr, 1);
+}
+
 } // end of anonymous namespace
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 77bcd536d468..efc716052fe0 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -2059,6 +2059,29 @@ namespace {
 
 return bRet;
 }
+
+// Similar to SwObjPosOscillationControl in 
sw/source/core/layout/anchoreddrawobject.cxx
+class PosSizeOscillationControl
+{
+public:
+bool OscillationDetected(const SwFrameAreaDefinition& rFrameArea);
+
+private:
+std::vector> maFrameDatas;
+};
+
+bool PosSizeOscillationControl::OscillationDetected(const 
SwFrameAreaDefinition& rFrameArea)
+{
+if (maFrameDatas.size() == 20) // stack is full -> oscillation
+return true;
+
+for (const auto& [area, printArea] : maFrameDatas)
+if (rFrameArea.getFrameArea() == area && 
rFrameArea.getFramePrintArea() == printArea)
+return true;
+
+maFrameDatas.emplace_back(rFrameArea.getFrameArea(), 
rFrameArea.getFramePrintArea());
+return false;
+}
 }
 
 // extern because static can't be friend
@@ -2256,6 +2279,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* 
pRenderContext)
 
 int nUnSplitted = 5; // Just another loop control :-(
 int nThrowAwayValidLayoutLimit = 5; // And another one :-(
+PosSizeOscillationControl posSizeOscillationControl; // And yet another 
one.
 SwRectFnSet aRectFnSet(this);
 while ( !isFrameAreaPositionValid() || !isFrameAreaSizeValid() || 
!isFramePrintAreaValid() )
 {
@@ -2946,7 +2970,9 @@ void SwTabFrame::MakeAll(vcl::RenderContext* 
pRenderContext)
 // split operation as good as possible. Therefore we
 // do some more calculations. Note: Restricting this
 // to nDeadLine may not be enough.
-if ( bSplitError && bTryToSplit ) // no restart if we did 
not try to split: i72847, i79426
+// tdf#161508 hack: treat oscillation likewise
+if ((bSplitError && bTryToSplit) // no restart if we did 
not try to split: i72847, i79426
+ 

core.git: sw/qa

2024-06-11 Thread Xisco Fauli (via logerrit)
 sw/qa/extras/odfimport/odfimport.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 373bb35740e0e908acafce743bda3e186f1e36c5
Author: Xisco Fauli 
AuthorDate: Tue Jun 11 13:41:24 2024 +0200
Commit: Xisco Fauli 
CommitDate: Tue Jun 11 17:03:59 2024 +0200

CppunitTest_sw_odfimport: add assert

Change-Id: I8a9ccb490fdd717538e368f73fefca425f94b405
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168673
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/odfimport/odfimport.cxx 
b/sw/qa/extras/odfimport/odfimport.cxx
index 90e9af34020c..d6bd2827ce74 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -1404,6 +1404,7 @@ CPPUNIT_TEST_FIXTURE(Test, testForcepoint108)
 {
 //load would assert because it fails to load entirely, like 
testMathMalformedXml
 mxComponent = 
mxDesktop->loadComponentFromURL(createFileURL(u"forcepoint108.fodt"), 
u"_default"_ustr, 0, {});
+CPPUNIT_ASSERT(!mxComponent.is());
 }
 
 #ifdef _WIN32


core.git: sw/qa sw/source

2024-06-11 Thread Xisco Fauli (via logerrit)
 sw/qa/extras/odfexport/data/tdf160877.odt |binary
 sw/qa/extras/odfexport/odfexport2.cxx |   14 ++
 sw/source/core/edit/edfcol.cxx|   21 -
 3 files changed, 22 insertions(+), 13 deletions(-)

New commits:
commit ac2db9b4726e92153a7be2ed0fd2987a7922caf0
Author: Xisco Fauli 
AuthorDate: Wed Jun 5 13:55:08 2024 +0200
Commit: Xisco Fauli 
CommitDate: Tue Jun 11 13:06:53 2024 +0200

tdf#160877: call lcl_getRDF since graph-names can change

partially revert 3750d0533e0e00941e5aef92fe5a26b6e7e27734
"sw: paragraph-sign: get graph-names only once"

Change-Id: I7f99679f4a361acdd841037b782421a53350dbbb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168477
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/odfexport/data/tdf160877.odt 
b/sw/qa/extras/odfexport/data/tdf160877.odt
new file mode 100644
index ..7137eee8067a
Binary files /dev/null and b/sw/qa/extras/odfexport/data/tdf160877.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport2.cxx 
b/sw/qa/extras/odfexport/odfexport2.cxx
index 8ec307dd4e6f..2bce72b8ec61 100644
--- a/sw/qa/extras/odfexport/odfexport2.cxx
+++ b/sw/qa/extras/odfexport/odfexport2.cxx
@@ -1684,6 +1684,20 @@ CPPUNIT_TEST_FIXTURE(Test, 
testDeletedTableAutostylesExport)
 loadAndReload("deleted_table.fodt");
 }
 
+DECLARE_ODFEXPORT_TEST(testTdf160877, "tdf160877.odt")
+{
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+uno::Reference xHeaderTextPage1 = 
getProperty>(
+getStyles("PageStyles")->getByName("Standard"), "HeaderTextFirst");
+CPPUNIT_ASSERT_EQUAL(OUString("Classification: General Business"), 
xHeaderTextPage1->getString());
+
+// Without the fix in place, this test would have failed with
+// - Expected: (Sign GB)Test
+// - Actual  : Test
+CPPUNIT_ASSERT_EQUAL(OUString("(Sign GB)Test"), 
getParagraph(1)->getString());
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testMidnightRedlineDatetime)
 {
 // Given a document with a tracked change with a midnight datetime:
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index fcfa98634667..1229c0130923 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -1939,7 +1939,6 @@ void 
SwEditShell::RestoreMetadataFieldsAndValidateParagraphSignatures()
 
 static constexpr OUString sBlank(u""_ustr);
 const sfx::ClassificationKeyCreator 
aKeyCreator(SfxClassificationHelper::getPolicyType());
-const css::uno::Sequence> aGraphNames = 
SwRDFHelper::getGraphNames(xModel, MetaNS);
 
 while (xParagraphs->hasMoreElements())
 {
@@ -1949,14 +1948,11 @@ void 
SwEditShell::RestoreMetadataFieldsAndValidateParagraphSignatures()
 try
 {
 const css::uno::Reference 
xSubject(xParagraph);
-const std::map aStatements = 
SwRDFHelper::getStatements(xModel, aGraphNames, xSubject);
+const OUString sFieldNames = lcl_getRDF(xModel, xSubject, 
ParagraphClassificationFieldNamesRDFName).second;
 
-const auto it = 
aStatements.find(ParagraphClassificationFieldNamesRDFName);
-const OUString sFieldNames = (it != aStatements.end() ? it->second 
: sBlank);
 std::vector aResults;
 if (!sFieldNames.isEmpty())
 {
-assert(it != aStatements.end() && "can only be non-empty if it 
was valid");
 // Order the fields
 sal_Int32 nIndex = 0;
 do
@@ -1965,10 +1961,9 @@ void 
SwEditShell::RestoreMetadataFieldsAndValidateParagraphSignatures()
 if (sCurFieldName.isEmpty())
 break;
 
-const auto it2 = aStatements.find(sCurFieldName);
-bool bStatementFound = it2 != aStatements.end();
-const OUString sName = bStatementFound ? it->first : 
sBlank;
-const OUString sValue = bStatementFound ? it->second : 
sBlank;
+const std::pair fieldNameValue = 
lcl_getRDF(xModel, xSubject, sCurFieldName);
+const OUString sName = fieldNameValue.first;
+const OUString sValue = fieldNameValue.second;
 
 if (aKeyCreator.isMarkingTextKey(sName))
 {
@@ -1976,14 +1971,14 @@ void 
SwEditShell::RestoreMetadataFieldsAndValidateParagraphSignatures()
 }
 else if (aKeyCreator.isCategoryNameKey(sName))
 {
-const auto it3 = 
aStatements.find(ParagraphClassificationAbbrRDFName);
-const OUString sAbbreviatedName = (it3 != 
aStatements.end() && !it3->second.isEmpty() ? it3->second : sValue);
+const std::pair pairAbbr = 
lcl_getRDF(xModel, xSubject, ParagraphClassificationAbbrRDFName);
+const OUString sAbbreviatedName = 
(!pairAbbr.second.isEmpty() ? 

core.git: sw/qa sw/source

2024-06-11 Thread Miklos Vajna (via logerrit)
 sw/qa/writerfilter/dmapper/DomainMapperTableHandler.cxx  |   24 +++
 sw/qa/writerfilter/dmapper/data/table-style-para-border-spacing.docx |binary
 sw/source/core/unocore/unotext.cxx   |   24 +++
 sw/source/writerfilter/dmapper/DomainMapper.cxx  |   67 
+++---
 sw/source/writerfilter/dmapper/DomainMapperTableHandler.cxx  |   48 
++-
 sw/source/writerfilter/dmapper/PropertyIds.cxx   |   27 
++--
 sw/source/writerfilter/dmapper/PropertyIds.hxx   |   12 +
 7 files changed, 171 insertions(+), 31 deletions(-)

New commits:
commit 013300c751d7a9ede12c1bf1c784254d1c6c5433
Author: Miklos Vajna 
AuthorDate: Tue Jun 11 10:49:29 2024 +0200
Commit: Miklos Vajna 
CommitDate: Tue Jun 11 12:09:51 2024 +0200

tdf#161443 DOCX import, table style: handle para border in table cell paras

Open the bugdoc, the in-table paragraphs have some top and bottom
paragraph borders in Word, not in Writer -- because the cell and
paragraph UNO object both have a property named TopBorder as mentioned
in commit 39c54c0ef837e0e23a676a4d1fa5da667e18939c (tdf#161443 DOCX
import, table style: fix para border leaking into cell border,
2024-06-07).

The previous fix avoided the problem that the unwanted border affects,
the cell, but re-routing the property to affect the in-table paragraph
were not done.

Fix the problem by adding 3 new meta-properties with a "Para" prefix for
all 4 border locations (top/left/bottom/right), this way the paragraph
borders defined in a table style can affect the in-table paragraphs, but
not the table cells.

Apart from the border itself, this also affected the border spacing,
which means that the position of all text inside and below the table is
now also correct. Unfortunately this also means we need to move away
from the constexpr frozen container that is only suitable for a limited
number of items:
sw/source/writerfilter/dmapper/PropertyIds.cxx:394:6: error: ‘constexpr’ 
evaluation operation count exceeds limit of 33554432 (use 
‘-fconstexpr-ops-limit=’ to increase the limit)
Returning to std::unordered_map is good enough for our needs.

Change-Id: I478f274800a1d0b200f10226438ab4cfd4957b74
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168659
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/writerfilter/dmapper/DomainMapperTableHandler.cxx 
b/sw/qa/writerfilter/dmapper/DomainMapperTableHandler.cxx
index bfcbf09fe130..4ae51bfc0758 100644
--- a/sw/qa/writerfilter/dmapper/DomainMapperTableHandler.cxx
+++ b/sw/qa/writerfilter/dmapper/DomainMapperTableHandler.cxx
@@ -229,6 +229,30 @@ CPPUNIT_TEST_FIXTURE(Test, 
testDOCXFloatingTableHeaderBodyOverlap)
 // Fly bottom was 3063, body text top was 7148.
 CPPUNIT_ASSERT_LESS(nBodyTextTop, nFlyBottom);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testTableStyleParaBorderSpacing)
+{
+// Given a document with a table style, table style defines top and bottom 
border for
+// paragraphs:
+// When loading that document:
+loadFromFile(u"table-style-para-border-spacing.docx");
+
+// Then make sure the in-table paragraph gets its top border:
+uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xText(xTextDocument->getText(), uno::UNO_QUERY);
+uno::Reference xParaEnum = 
xText->createEnumeration();
+uno::Reference xPara(xParaEnum->nextElement(), 
uno::UNO_QUERY);
+uno::Reference 
xCell(xPara->getCellByName("A1"), uno::UNO_QUERY);
+xParaEnum = xCell->createEnumeration();
+uno::Reference xParaProps(xParaEnum->nextElement(), 
uno::UNO_QUERY);
+sal_Int32 nTopBorderDistance{};
+xParaProps->getPropertyValue("TopBorderDistance") >>= nTopBorderDistance;
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 35
+// - Actual  : 0
+// 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_PLUGIN_IMPLEMENT();
diff --git 
a/sw/qa/writerfilter/dmapper/data/table-style-para-border-spacing.docx 
b/sw/qa/writerfilter/dmapper/data/table-style-para-border-spacing.docx
new file mode 100644
index ..b8382000b2b5
Binary files /dev/null and 
b/sw/qa/writerfilter/dmapper/data/table-style-para-border-spacing.docx differ
diff --git a/sw/source/core/unocore/unotext.cxx 
b/sw/source/core/unocore/unotext.cxx
index fd2811f05743..7d0593221201 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -2113,6 +2113,18 @@ lcl_ApplyCellProperties(
 {
 static const std::initializer_list 
vDenylist = {
 u"LeftMargin",
+u"ParaTopBorder",
+u"ParaTopBorderDistance",
+

core.git: sw/qa sw/source

2024-06-11 Thread Tibor Nagy (via logerrit)
 sw/qa/extras/ooxmlimport/data/tdf159897_broken_link.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx|   48 ++
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |   51 ---
 3 files changed, 91 insertions(+), 8 deletions(-)

New commits:
commit efb805eb244ad9f0317083502412b5d38d7f048d
Author: Tibor Nagy 
AuthorDate: Mon Jun 10 22:33:45 2024 +0200
Commit: Nagy Tibor 
CommitDate: Tue Jun 11 11:27:31 2024 +0200

tdf#159897 docx import: fix broken hyperlink

If the ScreenTip contains quotation marks, the link will be incorrect

Change-Id: I10f5039144c71bf5105cbd4dd9e82076a4d92fc6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168648
Tested-by: Jenkins
Reviewed-by: Nagy Tibor 

diff --git a/sw/qa/extras/ooxmlimport/data/tdf159897_broken_link.docx 
b/sw/qa/extras/ooxmlimport/data/tdf159897_broken_link.docx
new file mode 100644
index ..70226dcb00ab
Binary files /dev/null and 
b/sw/qa/extras/ooxmlimport/data/tdf159897_broken_link.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index abd10a6c95ba..0c6e780c5a1e 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -56,6 +56,54 @@ public:
 }
 };
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf159897Broken_link)
+{
+createSwDoc("tdf159897_broken_link.docx");
+
+for (size_t i = 1; i < 10; ++i)
+{
+auto xPara(getParagraph(i));
+auto xRun = getRun(xPara, 0);
+OUString sURL = getProperty(xRun, "HyperLinkURL");
+CPPUNIT_ASSERT_EQUAL(OUString("https://libreoffice.org/;), sURL);
+
+OUString sText;
+switch (i)
+{
+case 1:
+sText = "Zeroth link";
+break;
+case 2:
+sText = "First \"link\"";
+break;
+case 3:
+sText = "Second \" link \"";
+break;
+case 4:
+sText = "Third \"\"\"link\"\"\"";
+break;
+case 5:
+sText = "\"Fourth\" link";
+break;
+case 6:
+sText = "Fifth \"5\" link";
+break;
+case 7:
+sText = "Sixth \"6\" link";
+break;
+case 8:
+sText = "Seventh \"link\"";
+break;
+case 9:
+sText = "\"Eighth\" link";
+break;
+}
+
+OUString sScreenTip = getProperty(xRun, "HyperLinkName");
+CPPUNIT_ASSERT_EQUAL(sText, sScreenTip);
+}
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testTdf143476LockedCanvas_twoShapes)
 {
 // Given a lockedCanvas in a docx document with compatibility to Word 
version 12 (2007).
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index 7f026444894d..65840bf3b3f4 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -6122,6 +6122,7 @@ void FieldContext::AppendCommand(std::u16string_view 
rPart)
 ::std::vector aResult;
 sal_Int32 nIndex = 0;
 bool bInString = false;
+bool bScreenTip = false;
 OUString sPart;
 while (nIndex != -1)
 {
@@ -6131,17 +6132,51 @@ void FieldContext::AppendCommand(std::u16string_view 
rPart)
 if (sToken.isEmpty())
 continue;
 
-if (sToken[0] == '"')
+if (bScreenTip)
 {
-bInStringNext = true;
-sToken = sToken.copy(1);
+bool bRemoveQuotation = true;
+bInStringNext = (nIndex != -1) ? true : false;
+
+if (sToken[0] == '"' && !bInString)
+sToken = sToken.copy(1);
+
+if (!sToken.isEmpty())
+{
+if (sToken[0] == '\')
+{
+bRemoveQuotation = false;
+OUStringBuffer sBuffer;
+for (sal_Int32 i = 0; i < sToken.getLength(); ++i)
+{
+if (sToken[i] != '\')
+{
+sBuffer.append(sToken[i]);
+}
+}
+sToken = sBuffer.makeStringAndClear();
+}
+}
+
+if (!bInStringNext && bRemoveQuotation)
+sToken = sToken.copy(0, sToken.getLength() - 1);
 }
-if (sToken.endsWith("\""))
+else
 {
-bInStringNext = false;
-sToken = sToken.copy(0, sToken.getLength() - 1);
+if (sToken[0] == '"')
+{
+bInStringNext = true;
+sToken = sToken.copy(1);
+}
+if (sToken.endsWith("\""))
+{
+bInStringNext = false;
+

core.git: sw/qa

2024-06-10 Thread Caolán McNamara (via logerrit)
 sw/qa/extras/layout/data/crashHyphen.fodt |   31 ++
 sw/qa/extras/layout/layout3.cxx   |6 +
 2 files changed, 37 insertions(+)

New commits:
commit aa6993e35c38c8be81da326ef41afc980ccc3ef3
Author: Caolán McNamara 
AuthorDate: Mon Jun 10 08:55:10 2024 +0100
Commit: Caolán McNamara 
CommitDate: Mon Jun 10 15:04:33 2024 +0200

add test for hyphenation related crash

of:

commit f050103c3324d878b310f37429ea3580a8230905
Date:   Fri Jun 7 20:14:15 2024 +0100

stale hyphenation data after skipping blanks

Change-Id: I9743d67b49db054968e9f13c5fc6a13136953733
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168606
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sw/qa/extras/layout/data/crashHyphen.fodt 
b/sw/qa/extras/layout/data/crashHyphen.fodt
new file mode 100644
index ..6cdd2ccc45e6
--- /dev/null
+++ b/sw/qa/extras/layout/data/crashHyphen.fodt
@@ -0,0 +1,31 @@
+
+
+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:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible: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">
+ 
+  
+   true
+  
+ 
+ 
+  
+ 
+ 
+  
+   
+   
+  
+ 
+ 
+  
+   
+  
+ 
+ 
+  
+ 
+ 
+  
+   He heard quiet steps behind; 
+  
+ 
+
diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index af480f970164..ab4bb1d52829 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -2843,6 +2843,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf161368)
 assertXPath(pExportDump, 
"//page[1]/body/txt[3]/SwParaPortion/SwLineLayout"_ostr, 1);
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, TestCrashHyphenation)
+{
+//just care it doesn't crash/assert
+createSwDoc("crashHyphen.fodt");
+}
+
 } // end of anonymous namespace
 
 CPPUNIT_PLUGIN_IMPLEMENT();


core.git: sw/qa

2024-06-10 Thread Noel Grandin (via logerrit)
 sw/qa/extras/accessibility/accessible_relation_set.cxx |5 
 sw/qa/extras/accessibility/basics.cxx  |   27 
 sw/qa/extras/accessibility/dialogs.cxx |   20 
 sw/qa/extras/docbookexport/docbookexport.cxx   |4 
 sw/qa/extras/fodfexport/fodfexport.cxx |9 
 sw/qa/extras/globalfilter/globalfilter.cxx |  448 ++---
 sw/qa/extras/htmlexport/htmlexport.cxx |  606 +++
 sw/qa/extras/htmlexport/xhtmlexport.cxx|   18 
 sw/qa/extras/htmlimport/htmlimport.cxx |  158 -
 sw/qa/extras/indexing/IndexingExportTest.cxx   |  242 +-
 sw/qa/extras/indexing/SearchResultLocatorTest.cxx  |2 
 sw/qa/extras/layout/layout.cxx | 1462 -
 sw/qa/extras/layout/layout2.cxx|  629 +++
 sw/qa/extras/layout/layout3.cxx|  354 ++--
 sw/qa/extras/mailmerge/mailmerge.cxx   |   78 
 sw/qa/extras/mailmerge/mailmerge2.cxx  |   72 
 sw/qa/extras/odfexport/odfexport.cxx   | 1458 
 sw/qa/extras/odfexport/odfexport2.cxx  |  720 
 sw/qa/extras/odfimport/odfimport.cxx   |  494 ++---
 sw/qa/extras/ooxmlexport/ooxml_ThemeExport.cxx |   24 
 sw/qa/extras/ooxmlexport/ooxmlencryption.cxx   |   10 
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx   |  422 ++--
 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx |  248 +-
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx |  340 +--
 sw/qa/extras/ooxmlexport/ooxmlexport12.cxx | 1174 ++---
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx |  652 +++
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx |  614 +++
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx |  502 ++---
 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx |  342 +--
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx |  454 ++---
 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx |  390 ++--
 sw/qa/extras/ooxmlexport/ooxmlexport19.cxx |  376 ++--
 sw/qa/extras/ooxmlexport/ooxmlexport2.cxx  |  446 ++---
 sw/qa/extras/ooxmlexport/ooxmlexport20.cxx |  452 ++---
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx |  383 ++--
 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx  |  528 +++---
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx  |  394 ++--
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx  |  296 +--
 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx  |  368 ++--
 sw/qa/extras/ooxmlexport/ooxmlexport7.cxx  |  410 ++--
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx  |  324 +--
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx  |  706 
 sw/qa/extras/ooxmlexport/ooxmlexport_template.cxx  |   13 
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx  |  358 ++--
 sw/qa/extras/ooxmlexport/ooxmllinks.cxx|   46 
 sw/qa/extras/ooxmlexport/ooxmlw14export.cxx|  624 +++
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx   |  688 
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx  |  301 +--
 sw/qa/extras/pdf/HybridPdfTest.cxx |8 
 sw/qa/extras/rtfexport/rtfexport.cxx   |  326 +--
 sw/qa/extras/rtfexport/rtfexport2.cxx  |  261 +--
 sw/qa/extras/rtfexport/rtfexport3.cxx  |  284 +--
 sw/qa/extras/rtfexport/rtfexport4.cxx  |  415 ++--
 sw/qa/extras/rtfexport/rtfexport5.cxx  |  335 ++-
 sw/qa/extras/rtfexport/rtfexport6.cxx  |  265 +--
 sw/qa/extras/rtfexport/rtfexport8.cxx  |6 
 sw/qa/extras/rtfimport/rtfimport.cxx   |  920 +-
 sw/qa/extras/tiledrendering/tiledrendering.cxx |  376 ++--
 sw/qa/extras/tiledrendering2/tiledrendering2.cxx   |6 
 sw/qa/extras/txtencexport/txtencexport.cxx |6 
 sw/qa/extras/txtexport/txtexport.cxx   |   10 
 sw/qa/extras/txtimport/txtimport.cxx   |   16 
 sw/qa/extras/uiwriter/uiwriter.cxx |  444 ++---
 sw/qa/extras/uiwriter/uiwriter2.cxx| 1109 ++--
 sw/qa/extras/uiwriter/uiwriter3.cxx|  776 -
 sw/qa/extras/uiwriter/uiwriter4.cxx|  525 +++---
 sw/qa/extras/uiwriter/uiwriter5.cxx| 1094 ++--
 sw/qa/extras/uiwriter/uiwriter6.cxx|  523 +++---
 sw/qa/extras/uiwriter/uiwriter7.cxx|  540 +++---
 sw/qa/extras/uiwriter/uiwriter8.cxx|  998 +--
 sw/qa/extras/uiwriter/uiwriter9.cxx|  102 -
 sw/qa/extras/unowriter/unowriter.cxx   |  351 ++--
 sw/qa/extras/ww8export/ww8export.cxx   |  458 ++---
 

core.git: sw/qa sw/source

2024-06-07 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf100037_inlineZOrder2.docx |binary
 sw/qa/extras/ooxmlexport/data/tdf100037_inlineZOrder3.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx |   44 +++
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx   |   48 +
 sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx   |4 -
 5 files changed, 81 insertions(+), 15 deletions(-)

New commits:
commit f714fb262ad8561afcababf4b7a97dedb1b72c15
Author: Justin Luth 
AuthorDate: Fri Jun 7 15:37:32 2024 -0400
Commit: Justin Luth 
CommitDate: Sat Jun 8 00:43:45 2024 +0200

tdf#100037 vml import: set fly-anchored AS_CHARs above fly's zOrder

Normally an AS_CHAR is the lowest in the heaven-layer zOrder,
but if it is inside a fly, it should be just above the fly's zOrder.

In order to get at the parent's properties,
I had to remove the stack abstraction
so I changed the stack to a vector.
That seemed a lot saner than popping and re-pushing.

make CppunitTest_sw_ooxmlexport18 \
CPPUNIT_TEST_NAME=testTdf100037_inlineZOrder2
make CppunitTest_sw_ooxmlexport18 \
CPPUNIT_TEST_NAME=testTdf100037_inlineZOrder3

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

diff --git a/sw/qa/extras/ooxmlexport/data/tdf100037_inlineZOrder2.docx 
b/sw/qa/extras/ooxmlexport/data/tdf100037_inlineZOrder2.docx
new file mode 100644
index ..e30824ba10c8
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf100037_inlineZOrder2.docx differ
diff --git a/sw/qa/extras/ooxmlexport/data/tdf100037_inlineZOrder3.docx 
b/sw/qa/extras/ooxmlexport/data/tdf100037_inlineZOrder3.docx
new file mode 100644
index ..d97bd7ecb291
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf100037_inlineZOrder3.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
index 50a9dc33e9e5..ff3e7a3bf6f6 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -1076,6 +1076,50 @@ DECLARE_OOXMLEXPORT_TEST(testTdf100037_inlineZOrder, 
"tdf100037_inlineZOrder.doc
 CPPUNIT_ASSERT_EQUAL(OUString("Frame1"), getProperty(zOrder1, 
"LinkDisplayName"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf100037_inlineZOrder2, 
"tdf100037_inlineZOrder2.docx")
+{
+// given a yellow floating textbox-with-image overlapped by a blue 
textbox-with-image,
+// the inline image should take its zOrder from the textbox it is in.
+if (isExported())
+return; // we don't export images inside of draw textboxes I guess
+
+uno::Reference zOrder0(getShape(1), uno::UNO_QUERY);
+uno::Reference zOrder1(getShape(2), uno::UNO_QUERY);
+uno::Reference zOrder2(getShape(3), uno::UNO_QUERY);
+uno::Reference zOrder3(getShape(4), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty(zOrder0, 
"ZOrder")); // lower
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty(zOrder1, 
"ZOrder"));
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty(zOrder2, 
"ZOrder"));
+CPPUNIT_ASSERT_EQUAL(sal_Int32(3), getProperty(zOrder3, 
"ZOrder")); // higher
+// yellow textbox (Frame1) is the lowest
+CPPUNIT_ASSERT_EQUAL(OUString("Frame1"), getProperty(zOrder0, 
"LinkDisplayName"));
+//CPPUNIT_ASSERT_EQUAL(OUString("Image1"), getProperty(zOrder1, 
"Name"));
+CPPUNIT_ASSERT_EQUAL(OUString("Frame2"), getProperty(zOrder2, 
"LinkDisplayName"));
+// CPPUNIT_ASSERT_EQUAL(OUString("Image2"), getProperty(zOrder3, 
"LinkDisplayName"));
+}
+
+DECLARE_OOXMLEXPORT_TEST(testTdf100037_inlineZOrder3, 
"tdf100037_inlineZOrder3.docx")
+{
+// given a yellow floating textbox-with-image that overlaps a blue 
textbox-with-image,
+// the inline image should take its zOrder from the textbox it is in.
+if (isExported())
+return; // we don't export images inside of draw textboxes I guess
+
+uno::Reference zOrder0(getShape(1), uno::UNO_QUERY);
+uno::Reference zOrder1(getShape(2), uno::UNO_QUERY);
+uno::Reference zOrder2(getShape(3), uno::UNO_QUERY);
+uno::Reference zOrder3(getShape(4), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty(zOrder0, 
"ZOrder")); // lower
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty(zOrder1, 
"ZOrder"));
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty(zOrder2, 
"ZOrder"));
+CPPUNIT_ASSERT_EQUAL(sal_Int32(3), getProperty(zOrder3, 
"ZOrder")); // higher
+// blue textbox (Frame2) is the lowest
+CPPUNIT_ASSERT_EQUAL(OUString("Frame2"), getProperty(zOrder0, 
"LinkDisplayName"));
+// CPPUNIT_ASSERT_EQUAL(OUString("Image2"), getProperty(zOrder1, 
"LinkDisplayName"));
+CPPUNIT_ASSERT_EQUAL(OUString("Frame1"), getProperty(zOrder2, 
"LinkDisplayName"));
+// CPPUNIT_ASSERT_EQUAL(OUString("Image1"), 

core.git: sw/qa sw/source

2024-06-07 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf100037_inlineZOrder.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx|   14 +-
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx |5 ++---
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx  |6 ++
 4 files changed, 21 insertions(+), 4 deletions(-)

New commits:
commit 6c2ab0f3ca440f6e10b438e6ee0e235cbe155216
Author: Justin Luth 
AuthorDate: Thu Jun 6 19:05:29 2024 -0400
Commit: Justin Luth 
CommitDate: Fri Jun 7 12:41:15 2024 +0200

tdf#100037 vml import: add AS_CHAR images to zOrder calculation

Inline shapes are at the level of body text,
so any heaven-layer floating objects should be above it,
and any hell-layer flys should be below it.

DML images already do this in applyZOrder().

make CppunitTest_sw_ooxmlexport18 \
CPPUNIT_TEST_NAME=testTdf100037_inlineZOrder

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

diff --git a/sw/qa/extras/ooxmlexport/data/tdf100037_inlineZOrder.docx 
b/sw/qa/extras/ooxmlexport/data/tdf100037_inlineZOrder.docx
new file mode 100644
index ..5f3e9b358392
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf100037_inlineZOrder.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
index de10f434b07c..50a9dc33e9e5 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -1058,12 +1058,24 @@ 
DECLARE_OOXMLEXPORT_TEST(testTdf159158_zOrder_headerBehind2, "tdf159158_zOrder_h
 CPPUNIT_ASSERT_EQUAL(OUString("HeaderImage"),
  getProperty(zOrder0, "LinkDisplayName"));
 CPPUNIT_ASSERT_EQUAL(OUString("BodyBlueRectangle"),
- getProperty(zOrder1,"LinkDisplayName"));
+ getProperty(zOrder1, "LinkDisplayName"));
 // The logo should not be opaque since it is in the header.
 CPPUNIT_ASSERT(!getProperty(zOrder0, "Opaque")); // logo should be 
invisible
 CPPUNIT_ASSERT(!getProperty(zOrder1, "Opaque"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf100037_inlineZOrder, 
"tdf100037_inlineZOrder.docx")
+{
+// given a floating textbox followed by an inline image,
+// an inline image should always be behind a heaven-layer floating object.
+uno::Reference zOrder0(getShape(1), uno::UNO_QUERY);
+uno::Reference zOrder1(getShape(2), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty(zOrder0, 
"ZOrder")); // lower
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty(zOrder1, 
"ZOrder")); // higher
+CPPUNIT_ASSERT_EQUAL(OUString("Image 2"), getProperty(zOrder0, 
"LinkDisplayName"));
+CPPUNIT_ASSERT_EQUAL(OUString("Frame1"), getProperty(zOrder1, 
"LinkDisplayName"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf155903, "tdf155903.odt")
 {
 // Without the accompanying fix in place, this test would have crashed,
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index fefabe5c3df3..6e9fae2d5fda 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -1223,8 +1223,7 @@ CPPUNIT_TEST_FIXTURE(Test, testActiveXControlAlign)
 CPPUNIT_ASSERT_EQUAL(2, getShapes());
 CPPUNIT_ASSERT_EQUAL(1, getPages());
 // First check box aligned as a floating object
-uno::Reference xControlShape(getShape(1), 
uno::UNO_QUERY);
-CPPUNIT_ASSERT(xControlShape.is());
+uno::Reference xControlShape(getShape(2), 
uno::UNO_QUERY_THROW);
 
 // Check whether we have the right control
 uno::Reference 
xPropertySet(xControlShape->getControl(), uno::UNO_QUERY);
@@ -1245,7 +1244,7 @@ CPPUNIT_TEST_FIXTURE(Test, testActiveXControlAlign)
 CPPUNIT_ASSERT_EQUAL(sal_Int32(2341), xShape->getPosition().Y);
 
 // Second check box aligned inline / as character
-xControlShape.set(getShape(2), uno::UNO_QUERY);
+xControlShape.set(getShape(1), uno::UNO_QUERY_THROW);
 
 // Check whether we have the right control
 xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY);
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index 8f20487d301a..25612d082e5f 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -4831,6 +4831,12 @@ void DomainMapper_Impl::PushShapeContext( const 
uno::Reference< drawing::XShape
 if(aPropMargin)
 
xShapePropertySet->setPropertyValue(getPropertyName(PROP_BOTTOM_MARGIN),
 aPropMargin->second);
+
+sal_Int64 zOrder = SAL_MIN_INT64;
+xShapePropertySet->setPropertyValue(u"ZOrder"_ustr,
+   

core.git: sw/qa sw/source

2024-06-07 Thread Miklos Vajna (via logerrit)
 sw/qa/writerfilter/dmapper/DomainMapper.cxx  |   24 +++
 sw/qa/writerfilter/dmapper/data/table-style-para-border.docx |binary
 sw/source/writerfilter/dmapper/DomainMapper.cxx  |9 
 3 files changed, 33 insertions(+)

New commits:
commit 39c54c0ef837e0e23a676a4d1fa5da667e18939c
Author: Miklos Vajna 
AuthorDate: Fri Jun 7 09:14:21 2024 +0200
Commit: Miklos Vajna 
CommitDate: Fri Jun 7 10:20:05 2024 +0200

tdf#161443 DOCX import, table style: fix para border leaking into cell 
border

Open the document with a single table, notice that start of the text in
A1 cell is missing.

Seems what happens is that the cell has some positive border distance,
then the para has the same negative left margin, so in total there is 0
left margin for the text, which makes this readable in Word. On our
side, we map the paragraph border from the table style to the
LeftBorderDistance property, then throw this on the cell object, which
gives us 0 border distance, so the negative para left margin results in
an unwanted shift of text towards the left: the start of the text is
hidden by clipping to make sure the painted text is inside the cell
frame. (Both paragraphs and cells have a LeftBorderDistance property, by
accident.)

Given that a visible paragraph border from table style is not actually
imported, first just do the minimal fix and make sure we don't import
paragraph borders from table style at all: this solves the problem of
unwanted 0 cell border distances and the full text is now readable.

In case the paragraph border in the table style would be actually
visible, that would be useful to route to the paragraphs in the cell,
that's not yet done here.

Change-Id: I79907a2487c48659effcc55253b9d9881550284d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168516
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/qa/writerfilter/dmapper/DomainMapper.cxx 
b/sw/qa/writerfilter/dmapper/DomainMapper.cxx
index 5c6b429bc9f6..851ab20412e8 100644
--- a/sw/qa/writerfilter/dmapper/DomainMapper.cxx
+++ b/sw/qa/writerfilter/dmapper/DomainMapper.cxx
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -161,6 +162,29 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf158360)
 // just test that doc with annotation in TOC doesn't crash/assert
 loadFromFile(u"tdf158360.docx");
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testTableStyleParaBorder)
+{
+// Given a document with a table, table style defines 115 twips left cell 
margin and an empty
+// paragraph border:
+// When importing that file:
+loadFromFile(u"table-style-para-border.docx");
+
+// Then make sure the cell margin is not lost:
+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 xCell(xPara->getCellByName("A1"), 
uno::UNO_QUERY);
+sal_Int32 nLeftBorderDistance{};
+xCell->getPropertyValue("LeftBorderDistance") >>= nLeftBorderDistance;
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 203
+// - Actual  : 0
+// i.e. the 0 para border distance was applied on the cell instead.
+CPPUNIT_ASSERT_EQUAL(static_cast(203), nLeftBorderDistance);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/writerfilter/dmapper/data/table-style-para-border.docx 
b/sw/qa/writerfilter/dmapper/data/table-style-para-border.docx
new file mode 100644
index ..0d7154eade1f
Binary files /dev/null and 
b/sw/qa/writerfilter/dmapper/data/table-style-para-border.docx differ
diff --git a/sw/source/writerfilter/dmapper/DomainMapper.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper.cxx
index 72f88fc2a1a3..30c5f02fb693 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper.cxx
@@ -1654,6 +1654,15 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
 PropertyIds eBorderId = PropertyIds::INVALID;
 PropertyIds eBorderComplexColorId = PropertyIds::INVALID;
 PropertyIds eBorderDistId = PropertyIds::INVALID;
+
+const StyleSheetEntryPtr& pEntry = 
GetStyleSheetTable()->GetCurrentEntry();
+if (pEntry && pEntry->m_nStyleTypeCode == STYLE_TYPE_TABLE)
+{
+// This would map para borders in table style to cell borders, 
avoid that till we
+// have separate property names for these.
+break;
+}
+
 switch( nSprmId )
 {
 case NS_ooxml::LN_CT_PBdr_top:


core.git: sw/qa sw/source

2024-06-05 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/data/tdf161426.fodt |  197 ++
 sw/qa/extras/uiwriter/uiwriter6.cxx   |  155 +++
 sw/source/core/frmedt/feshview.cxx|   26 +--
 3 files changed, 363 insertions(+), 15 deletions(-)

New commits:
commit 886cbcd7627985692d4d2ad3197b1af08378d430
Author: László Németh 
AuthorDate: Wed Jun 5 14:29:29 2024 +0200
Commit: László Németh 
CommitDate: Wed Jun 5 22:22:00 2024 +0200

tdf#161426 sw: fix selection in multicolumn floating table

It was not possible to select text content of a cell, if
one of the previous cells in the same row contains a cropped
image hovering this cell, too.

Follow-up to commit f3b899655018397e71300dbb32cdf4f82940a68b
"tdf#160842 sw: select cell content instead of cropped part of image".

Also clean-up to commit 2f7bb481c57458a38769ebd961f07cc45767f1f7
"tdf#161332 sw: fix missing selection of floating table".

Change-Id: Ib033f7238d9513c8ed18c472ce4afbd4d6ad1172
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168475
Reviewed-by: László Németh 
Tested-by: Jenkins

diff --git a/sw/qa/extras/uiwriter/data/tdf161426.fodt 
b/sw/qa/extras/uiwriter/data/tdf161426.fodt
new file mode 100644
index ..473921880e39
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf161426.fodt
@@ -0,0 +1,197 @@
+
+
+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-06-05T12:36:26.032955294PT4M18S2LibreOfficeDev/24.8.0.0.alpha1$Linux_X86_64
 
LibreOffice_project/57c56b7b826c02868e48120432363fcb8f9e394a
+ 
+  
+   226
+   0
+   35696
+   20736
+   true
+   false
+   
+
+ view2
+ 18053
+ 2501
+ 0
+ 226
+ 35694
+ 20960
+ 0
+ 1
+ false
+ 110
+ false
+ false
+ false
+ false
+ false
+ false
+
+   
+  
+ 
+ 
+  
+   http://openoffice.org/2004/office; 
xmlns:xlink="http://www.w3.org/1999/xlink"/>
+  
+ 
+ 
+  
+  
+  
+ 
+ 
+  
+   
+   
+
+   
+   
+  
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+   
+  
+  
+   
+   
+  
+  
+  
+   
+  
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+ 
+ 
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+
+   
+   
+   
+  
+  
+   
+  
+ 
+ 
+  
+ 
+ 
+  
+   
+ 
+  
+   
+   
+   
+
+ 
+
iVBORw0KGgoNSUhEUgICCAIAAAD91JpzFklEQVQI12P2Ytilf46NeWX3
+ a804HgAg7QTAqXPBTwBJRU5ErkJggg==
+
+   
+  
+
+
+ 
+
+   
+   
+
+ Lorem ipsum dolor sit amet, 
consectetur 

core.git: sw/qa sw/source

2024-06-05 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/rtfexport/rtfexport8.cxx   |   31 +++
 sw/source/filter/ww8/rtfattributeoutput.cxx |   18 +
 sw/source/filter/ww8/rtfexport.cxx  |   55 ++--
 3 files changed, 102 insertions(+), 2 deletions(-)

New commits:
commit 937bdd08ee8ff9ce90db06fd463719ba8e9da996
Author: Miklos Vajna 
AuthorDate: Wed Jun 5 12:13:14 2024 +0200
Commit: Miklos Vajna 
CommitDate: Wed Jun 5 14:49:36 2024 +0200

tdf#161417 RTF export: handle endnotes at section ends

Similar to commit 566c7017a84e3d573de85a6d986b81d3f59de0fa (tdf#160984
sw continuous endnotes: DOCX: export of  pos == sectEnd,
2024-05-29), but this is RTF, not DOCX.

Additional complexity is that it's not enough to just write endnotes
(sect end) or enddoc (doc end) to export the position, also et and
ndnhere needs writing, otherwise Word ignores this.

Last bit is to ignore section formats which are not nullptr but are -1,
ignore these in RtfAttributeOutput::SectionBreak(), similar to how
DocxAttributeOutput::SectionBreak() does the same already.

Change-Id: I2327c979d5af402eb15523d97149f6409fcf4adf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168468
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/qa/extras/rtfexport/rtfexport8.cxx 
b/sw/qa/extras/rtfexport/rtfexport8.cxx
index 33219edcfe9d..347b39c68563 100644
--- a/sw/qa/extras/rtfexport/rtfexport8.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport8.cxx
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace css;
 
@@ -173,6 +174,36 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf158586_lostFrame)
 verify();
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testEndnotesAtSectEndRTF)
+{
+// Given a document, endnotes at collected at section end:
+createSwDoc();
+{
+SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+pWrtShell->SplitNode();
+pWrtShell->Up(/*bSelect=*/false);
+pWrtShell->Insert("x");
+pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 1, 
/*bBasicCall=*/false);
+SwSectionData aSection(SectionType::Content, 
pWrtShell->GetUniqueSectionName());
+pWrtShell->StartAction();
+SfxItemSetFixed 
aSet(pWrtShell->GetAttrPool());
+aSet.Put(SwFormatEndAtTextEnd(FTNEND_ATTXTEND));
+pWrtShell->InsertSection(aSection, );
+pWrtShell->EndAction();
+pWrtShell->InsertFootnote(OUString(), /*bEndNote=*/true);
+}
+
+// When saving to DOC:
+saveAndReload(mpFilter);
+
+// Then make sure the endnote position is section end:
+SwDoc* pDoc = getSwDoc();
+SwSectionFormats& rSections = pDoc->GetSections();
+SwSectionFormat* pFormat = rSections[0];
+// Without the accompanying fix in place, this test would have failed, 
endnotes were at doc end.
+CPPUNIT_ASSERT(pFormat->GetEndAtTextEnd().IsAtEnd());
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testTdf158983)
 {
 auto verify = [this]() {
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx 
b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 2c9f92aaa245..8721e2f0d99b 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -97,6 +97,7 @@
 #include "rtfexport.hxx"
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 using namespace sw::util;
@@ -1367,6 +1368,23 @@ void RtfAttributeOutput::SectionBreak(sal_uInt8 nC, bool 
/*bBreakAfter*/,
 m_rExport.SectionProperties(*pSectionInfo);
 break;
 }
+
+// Endnotes included in the section:
+if (!pSectionInfo)
+{
+return;
+}
+const SwSectionFormat* pSectionFormat = pSectionInfo->pSectionFormat;
+if (!pSectionFormat || pSectionFormat == 
reinterpret_cast(sal_IntPtr(-1)))
+{
+// MSWordExportBase::WriteText() can set the section format to -1, 
ignore.
+return;
+}
+if (!pSectionFormat->GetEndAtTextEnd().IsAtEnd())
+{
+return;
+}
+m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_ENDNHERE);
 }
 
 void RtfAttributeOutput::StartSection()
diff --git a/sw/source/filter/ww8/rtfexport.cxx 
b/sw/source/filter/ww8/rtfexport.cxx
index 8acd96461ac6..88a3086c6dfc 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -70,6 +70,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 using namespace ::com::sun::star;
 
@@ -798,7 +801,8 @@ ErrCode RtfExport::ExportDocument_Impl()
 // enable it on a per-section basis. OTOH don't always enable it as it
 // breaks moving of drawings - so write it only in case there is really a
 // protected section in the document.
-for (auto const& pSectionFormat : m_rDoc.GetSections())
+SwSectionFormats& rSections = m_rDoc.GetSections();
+for (auto const& pSectionFormat : rSections)
 {
 if (!pSectionFormat->IsInUndo() && 

core.git: sw/qa sw/source

2024-06-05 Thread Mike Kaganski (via logerrit)
 sw/qa/extras/uiwriter/uiwriter9.cxx |   29 +
 sw/source/core/undo/unins.cxx   |   12 
 2 files changed, 37 insertions(+), 4 deletions(-)

New commits:
commit 31f46cec1406bb39453f5d909da1321980b0e405
Author: Mike Kaganski 
AuthorDate: Wed Jun 5 10:43:07 2024 +0500
Commit: Mike Kaganski 
CommitDate: Wed Jun 5 12:39:27 2024 +0200

tdf#144752: UNDO/REDO: make sure to select the replaced content

In the specific case of the bug, the non-empty selection means that
the spell check won't skip the word with the cursor. But this also
establishes consistency with other Undo/Redo cases, which generally
select the text.

Change-Id: Ib7c1c911908dc59947e610d735907be7a363ca87
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168423
Reviewed-by: Mike Kaganski 
Tested-by: Jenkins

diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx 
b/sw/qa/extras/uiwriter/uiwriter9.cxx
index a0918742a438..d35abf0b9b2f 100644
--- a/sw/qa/extras/uiwriter/uiwriter9.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter9.cxx
@@ -648,6 +648,35 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf161172)
 CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty(para, 
u"NumberingLevel"_ustr));
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf144752)
+{
+// Undoing/redoing a replacement must select the new text
+createSwDoc();
+SwXTextDocument* pDoc = dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pDoc);
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+
+emulateTyping(*pDoc, u"Some Text");
+CPPUNIT_ASSERT(!pWrtShell->HasSelection());
+// Select "Text", and replace with "Word"
+pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect*/ true, 4, 
/*bBasicCall*/ false);
+pWrtShell->Replace(u"Word"_ustr, false);
+pWrtShell->EndOfSection();
+CPPUNIT_ASSERT(!pWrtShell->HasSelection());
+
+// Undo and check, that the "Text" is selected
+dispatchCommand(mxComponent, ".uno:Undo", {});
+// Without the fix, this would fail
+CPPUNIT_ASSERT(pWrtShell->HasSelection());
+CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, pWrtShell->GetSelText());
+
+// Redo and check, that the "Word" is selected
+dispatchCommand(mxComponent, ".uno:Redo", {});
+CPPUNIT_ASSERT(pWrtShell->HasSelection());
+CPPUNIT_ASSERT_EQUAL(u"Word"_ustr, pWrtShell->GetSelText());
+}
+
 } // end of anonymous namespace
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx
index f47dd38c214d..56229b8296a0 100644
--- a/sw/source/core/undo/unins.cxx
+++ b/sw/source/core/undo/unins.cxx
@@ -672,7 +672,10 @@ void SwUndoReplace::Impl::UndoImpl(::sw::UndoRedoContext & 
rContext)
 rPam.GetPoint()->Assign( m_nEndNd - m_nOffset, m_nEndCnt );
 pDoc->getIDocumentContentOperations().DeleteAndJoin(rPam);
 }
-rPam.DeleteMark();
+if (*rPam.GetMark() == *rPam.GetPoint())
+rPam.DeleteMark();
+else
+rPam.Normalize(false);
 pNd = pDoc->GetNodes()[ m_nSttNd - m_nOffset ]->GetTextNode();
 OSL_ENSURE( pNd, "Dude, where's my TextNode?" );
 }
@@ -712,8 +715,6 @@ void SwUndoReplace::Impl::UndoImpl(::sw::UndoRedoContext & 
rContext)
 }
 }
 }
-
-rPam.GetPoint()->Assign( m_nSttNd, m_nSttCnt );
 }
 
 void SwUndoReplace::Impl::RedoImpl(::sw::UndoRedoContext & rContext)
@@ -751,7 +752,10 @@ void SwUndoReplace::Impl::RedoImpl(::sw::UndoRedoContext & 
rContext)
 }
 
 rDoc.getIDocumentContentOperations().ReplaceRange( rPam, m_sIns, m_bRegExp 
);
-rPam.DeleteMark();
+if (*rPam.GetMark() == *rPam.GetPoint())
+rPam.DeleteMark();
+else
+rPam.Normalize(false);
 }
 
 void SwUndoReplace::Impl::SetEnd(SwPaM const& rPam)


core.git: sw/qa sw/source

2024-06-05 Thread Miklos Vajna (via logerrit)
 sw/qa/writerfilter/rtftok/data/endnote-at-section-end.rtf |   15 +
 sw/qa/writerfilter/rtftok/rtfdispatchflag.cxx |   23 ++
 sw/source/writerfilter/rtftok/rtfdispatchflag.cxx |7 +++-
 3 files changed, 44 insertions(+), 1 deletion(-)

New commits:
commit ad8fa1b5912a04f4cc016965175315e4784fa229
Author: Miklos Vajna 
AuthorDate: Wed Jun 5 09:34:14 2024 +0200
Commit: Miklos Vajna 
CommitDate: Wed Jun 5 10:38:18 2024 +0200

tdf#161417 RTF import: handle endnotes at section ends

This is similar to commit 2d2dd56e0b2dc708f1f758d7fc9a1263ff09b83c
(tdf#160984 sw continuous endnotes: DOCX: import  pos ==
sectEnd, 2024-05-28), but that was for DOCX import, this is for RTF
import.

Change-Id: I6772f78360f681d18559556e71526eb76670bec2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168424
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/qa/writerfilter/rtftok/data/endnote-at-section-end.rtf 
b/sw/qa/writerfilter/rtftok/data/endnote-at-section-end.rtf
new file mode 100644
index ..945bd42c24c9
--- /dev/null
+++ b/sw/qa/writerfilter/rtftok/data/endnote-at-section-end.rtf
@@ -0,0 +1,15 @@
+{ tf1
+\paperw11906\paperh16838\margl1134\margr1134\margt1134\margb1134
+endnoteset1
+\pard\plain
+First
+\sect\sectd\sbknonendnhere
+second
++{ootnotetnalt\pard\plain
++}
+\sect\sectd\sbknonendnhere\pard\plain
+third
+\par
+}
diff --git a/sw/qa/writerfilter/rtftok/rtfdispatchflag.cxx 
b/sw/qa/writerfilter/rtftok/rtfdispatchflag.cxx
index 8c660435a3a6..62fb089e29d3 100644
--- a/sw/qa/writerfilter/rtftok/rtfdispatchflag.cxx
+++ b/sw/qa/writerfilter/rtftok/rtfdispatchflag.cxx
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 
@@ -100,6 +101,28 @@ CPPUNIT_TEST_FIXTURE(Test, testTblOverlap)
 // "can overlap".
 CPPUNIT_ASSERT(!bAllowOverlap);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testEndnoteAtSectionEndRTFImport)
+{
+// Given a document with at-section-end endnotes enabled:
+// When loading that document:
+loadFromFile(u"endnote-at-section-end.rtf");
+
+// Go to the second paragraph, which is inside Word's second section:
+uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xParaEnumAccess(xTextDocument->getText(),
+  
uno::UNO_QUERY);
+uno::Reference xParaEnum = 
xParaEnumAccess->createEnumeration();
+xParaEnum->nextElement();
+uno::Reference xPara(xParaEnum->nextElement(), 
uno::UNO_QUERY);
+uno::Reference xSection;
+xPara->getPropertyValue("TextSection") >>= xSection;
+bool bEndnoteIsCollectAtTextEnd = false;
+xSection->getPropertyValue("EndnoteIsCollectAtTextEnd") >>= 
bEndnoteIsCollectAtTextEnd;
+// Without the accompanying fix in place, this test would have failed, 
endnotes were always at
+// document end.
+CPPUNIT_ASSERT(bEndnoteIsCollectAtTextEnd);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/writerfilter/rtftok/rtfdispatchflag.cxx 
b/sw/source/writerfilter/rtftok/rtfdispatchflag.cxx
index dfc5be5b1e05..acd753fe6eb3 100644
--- a/sw/source/writerfilter/rtftok/rtfdispatchflag.cxx
+++ b/sw/source/writerfilter/rtftok/rtfdispatchflag.cxx
@@ -925,8 +925,13 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
 break;
 case RTFKeyword::AENDDOC:
 // Noop, this is the default in Writer.
+break;
 case RTFKeyword::AENDNOTES:
-// Noop
+{
+auto pValue = new RTFValue(NS_ooxml::LN_Value_ST_EdnPos_sectEnd);
+m_aSettingsTableSprms.set(NS_ooxml::LN_CT_EdnProps_pos, pValue);
+}
+break;
 case RTFKeyword::AFTNRSTCONT:
 // Noop, this is the default in Writer.
 case RTFKeyword::AFTNRESTART:


core.git: sw/qa sw/source

2024-06-05 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/data/tdf157533.fodt |  438 ++
 sw/qa/extras/uiwriter/uiwriter6.cxx   |   56 +++
 sw/source/core/frmedt/feshview.cxx|   20 +
 3 files changed, 511 insertions(+), 3 deletions(-)

New commits:
commit 3e0650fb166cac116a43f6ce5d03bd69830e37b8
Author: László Németh 
AuthorDate: Wed Jun 5 01:39:48 2024 +0200
Commit: László Németh 
CommitDate: Wed Jun 5 10:04:58 2024 +0200

tdf#157533 sw: fix cursor position deselecting formula in table

Fix lost cursor by deselecting formula object anchored as
character as single content of table cells. In this case, the
cursor was positioned inside the frame of the formula,
disappeared in a flash.

Fix also bad cursor position by deselecting formula object
anchored as character at beginning of text lines in table
content.

Follow-up to commit 014e5f559a9acf319af24c721dbe6b0bc3bc5882
"tdf#161360 sw: fix cursor position deselecting image in table".

Change-Id: Ia1a96359f473071c4cead580322aa9c1af1d3f24
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168416
Reviewed-by: László Németh 
Tested-by: Jenkins

diff --git a/sw/qa/extras/uiwriter/data/tdf157533.fodt 
b/sw/qa/extras/uiwriter/data/tdf157533.fodt
new file mode 100644
index ..a35061acc4bf
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf157533.fodt
@@ -0,0 +1,438 @@
+
+
+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">
+ 
2023-09-30T17:41:02.606002023-09-30T23:03:25.64100PT7M1S2LibreOfficeDev/24.8.0.0.alpha1$Linux_X86_64
 
LibreOffice_project/57c56b7b826c02868e48120432363fcb8f9e394a
+ 
+  
+   0
+   0
+   39266
+   22809
+   true
+   false
+   
+
+ view2
+ 11132
+ 2501
+ 0
+ 0
+ 39264
+ 22807
+ 0
+ 1
+ false
+ 100
+ false
+ false
+ false
+ false
+ false
+ false
+
+   
+  
+ 
+ 
+  
+   http://openoffice.org/2004/office; 
xmlns:xlink="http://www.w3.org/1999/xlink"/>
+  
+ 
+ 
+  
+  
+  
+  
+ 
+ 
+  
+   
+   
+
+   
+   
+  
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+   
+  
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+  
+  
+  
+   
+   
+  
+  
+   
+   
+  
+  
+   
+   
+  
+  
+   
+   
+  
+  
+   
+   
+  
+  
+   
+   
+  
+  
+   
+   
+  
+  
+   
+   
+  
+  
+   
+   
+  
+  
+   
+   
+  
+  
+   
+   
+  
+  
+   
+   
+  
+  
+   
+   
+  
+  
+   
+   
+  
+  
+   
+   
+  
+  
+   
+   
+  
+  
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+  
+ 
+ 
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+
+   
+  
+  
+   
+
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   

core.git: sw/qa sw/source

2024-06-04 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/ww8export/ww8export4.cxx |   31 +++
 sw/source/filter/ww8/wrtww8.cxx   |   13 +
 2 files changed, 44 insertions(+)

New commits:
commit 24ab535087991f1ce8dee9a561476bc0a987bac5
Author: Miklos Vajna 
AuthorDate: Tue Jun 4 13:43:23 2024 +0200
Commit: Miklos Vajna 
CommitDate: Tue Jun 4 14:46:53 2024 +0200

tdf#161417 DOC export: handle endnotes at section ends

Similar to commit 566c7017a84e3d573de85a6d986b81d3f59de0fa (tdf#160984
sw continuous endnotes: DOCX: export of  pos == sectEnd,
2024-05-29), but this is for DOC, not DOCX.

Change-Id: I4301d97115ba48f7ed1dacfdd5b29336bdaf9e63
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168401
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/ww8export/ww8export4.cxx 
b/sw/qa/extras/ww8export/ww8export4.cxx
index b52e2b8f77f1..187e18267463 100644
--- a/sw/qa/extras/ww8export/ww8export4.cxx
+++ b/sw/qa/extras/ww8export/ww8export4.cxx
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace
 {
@@ -122,6 +123,36 @@ DECLARE_WW8EXPORT_TEST(testTdf141649_conditionalText, 
"tdf141649_conditionalText
 getParagraph(1, "trueResult");
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testEndnotesAtSectEndDOC)
+{
+// Given a document, endnotes at collected at section end:
+createSwDoc();
+{
+SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+pWrtShell->SplitNode();
+pWrtShell->Up(/*bSelect=*/false);
+pWrtShell->Insert("x");
+pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 1, 
/*bBasicCall=*/false);
+SwSectionData aSection(SectionType::Content, 
pWrtShell->GetUniqueSectionName());
+pWrtShell->StartAction();
+SfxItemSetFixed 
aSet(pWrtShell->GetAttrPool());
+aSet.Put(SwFormatEndAtTextEnd(FTNEND_ATTXTEND));
+pWrtShell->InsertSection(aSection, );
+pWrtShell->EndAction();
+pWrtShell->InsertFootnote(OUString(), /*bEndNote=*/true);
+}
+
+// When saving to DOC:
+saveAndReload("MS Word 97");
+
+// Then make sure the endnote position is section end:
+SwDoc* pDoc = getSwDoc();
+SwSectionFormats& rSections = pDoc->GetSections();
+SwSectionFormat* pFormat = rSections[0];
+// Without the accompanying fix in place, this test would have failed, 
endnotes were at doc end.
+CPPUNIT_ASSERT(pFormat->GetEndAtTextEnd().IsAtEnd());
+}
+
 DECLARE_WW8EXPORT_TEST(testTdf90408, "tdf90408.doc")
 {
 uno::Reference xRun(getRun(getParagraph(1), 1), 
uno::UNO_QUERY_THROW);
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index a14412469cf8..467a7c18949a 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -87,6 +87,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "sprmids.hxx"
 
 #include 
@@ -493,6 +494,18 @@ static void WriteDop( WW8Export& rWrt )
 rDop.cParas = rDStat.nPara;
 rDop.cLines = rDStat.nPara;
 
+SwSectionFormats& rSections = rWrt.m_rDoc.GetSections();
+if (!rSections.empty())
+{
+SwSectionFormat* pFormat = rSections[0];
+bool bEndnAtEnd = pFormat->GetEndAtTextEnd().IsAtEnd();
+if (bEndnAtEnd)
+{
+// DopBase.epc: this is normally 3 (end of document), change this 
to end of section.
+rDop.epc = 0;
+}
+}
+
 SwDocShell *pDocShell(rWrt.m_rDoc.GetDocShell());
 OSL_ENSURE(pDocShell, "no SwDocShell");
 uno::Reference xDocProps;


core.git: sw/qa sw/source

2024-06-01 Thread Tibor Nagy (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf159897.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx   |   11 +++
 sw/source/filter/ww8/attributeoutputbase.hxx |2 +-
 sw/source/filter/ww8/docxattributeoutput.cxx |6 +-
 sw/source/filter/ww8/docxattributeoutput.hxx |2 +-
 sw/source/filter/ww8/rtfattributeoutput.cxx  |3 ++-
 sw/source/filter/ww8/rtfattributeoutput.hxx  |3 ++-
 sw/source/filter/ww8/wrtw8nds.cxx|4 ++--
 sw/source/filter/ww8/ww8attributeoutput.hxx  |2 +-
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |   16 +++-
 sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx |3 +++
 11 files changed, 43 insertions(+), 9 deletions(-)

New commits:
commit 6c583b38bc96b397f1a742127ea7ac99cadd024f
Author: Tibor Nagy 
AuthorDate: Mon May 27 14:56:37 2024 +0200
Commit: Nagy Tibor 
CommitDate: Sat Jun 1 13:50:26 2024 +0200

tdf#159897 docx import: fix ScreenTip of hyperlink

Note: if the ScreenTip contains double quote marks, the link will be
broken after the import

Change-Id: I4ed3e4e9e87335407e01d50cc5c440d04598a33f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168105
Tested-by: Jenkins
Reviewed-by: Nagy Tibor 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf159897.docx 
b/sw/qa/extras/ooxmlexport/data/tdf159897.docx
new file mode 100644
index ..7b3d5c228105
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf159897.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index e487bbf00015..3e1ebb45e24b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -572,6 +572,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf154369, "tdf154369.docx")
 "color"_ostr, "00527d55");
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testScreenTip)
+{
+loadAndSave("tdf159897.docx");
+
+xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml");
+
+// Hyperlink with ScreenTip
+assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:hyperlink"_ostr, 
"tooltip"_ostr,
+"This is a hyperlink");
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testEmptyObjectRange)
 {
 // Before the fix, this failed an assertion like this:
diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx 
b/sw/source/filter/ww8/attributeoutputbase.hxx
index 4ce7f495cc3b..a6845c56b633 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -203,7 +203,7 @@ public:
 virtual void EndRuby( const SwTextNode& rNode, sal_Int32 nPos ) = 0;
 
 /// Output URL start.
-virtual bool StartURL( const OUString& rUrl, const OUString& rTarget ) = 0;
+virtual bool StartURL(const OUString& rUrl, const OUString& rTarget, const 
OUString& rName = OUString()) = 0;
 
 /// Output URL end.
 virtual bool EndURL(bool isAtEndOfParagraph) = 0;
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 827d037b274c..97a4c038c736 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3911,7 +3911,7 @@ void DocxAttributeOutput::WriteBookmarkInActParagraph( 
const OUString& rName, sa
 m_aBookmarksOfParagraphEnd.insert(std::pair(nLastRunPos, rName));
 }
 
-bool DocxAttributeOutput::StartURL( const OUString& rUrl, const OUString& 
rTarget )
+bool DocxAttributeOutput::StartURL(const OUString& rUrl, const OUString& 
rTarget, const OUString& rName)
 {
 OUString sMark;
 OUString sUrl;
@@ -3983,6 +3983,10 @@ bool DocxAttributeOutput::StartURL( const OUString& 
rUrl, const OUString& rTarge
 {
 m_pHyperlinkAttrList->add(FSNS(XML_w, XML_tgtFrame), rTarget);
 }
+else if (!rName.isEmpty())
+{
+m_pHyperlinkAttrList->add(FSNS(XML_w, XML_tooltip), rName);
+}
 }
 
 return true;
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx 
b/sw/source/filter/ww8/docxattributeoutput.hxx
index 063cb02bbc69..d9cddce059c7 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -253,7 +253,7 @@ public:
 virtual void EndRuby(const SwTextNode& rNode, sal_Int32 nPos) override;
 
 /// Output URL start.
-virtual bool StartURL( const OUString& rUrl, const OUString& rTarget ) 
override;
+virtual bool StartURL( const OUString& rUrl, const OUString& rTarget, 
const OUString& rName = OUString() ) override;
 
 /// Output URL end.
 virtual bool EndURL(bool) override;
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx 
b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 5b0e89de1e73..2c9f92aaa245 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -547,7 +547,8 @@ void 

core.git: sw/qa sw/source

2024-05-31 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter6.cxx |   62 
 sw/source/core/frmedt/feshview.cxx  |   24 +
 2 files changed, 86 insertions(+)

New commits:
commit 014e5f559a9acf319af24c721dbe6b0bc3bc5882
Author: László Németh 
AuthorDate: Fri May 31 12:38:12 2024 +0200
Commit: László Németh 
CommitDate: Fri May 31 20:46:16 2024 +0200

tdf#161360 sw: fix cursor position deselecting image in table

In tables, when the selected image was anchored as character
at beginning of the table row, pressing Escape resulted completely
lost text cursor (after a short blinking, not visible, missing
typing etc.) or – in the case of floating tables – cursor in
a bad position (after the table instead of before the image).

Change-Id: Ib49211ec3531110fc8f5f65fb700318884519666
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168289
Reviewed-by: László Németh 
Tested-by: Jenkins

diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index aedec9304791..a27f506095b3 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -1683,6 +1683,68 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf161332)
 CPPUNIT_ASSERT_EQUAL(SelectionType::Frame, eType2);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf161360)
+{
+createSwDoc("tdf160842.fodt");
+SwDoc* pDoc = getSwDoc();
+CPPUNIT_ASSERT(pDoc);
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+// the cursor is not in the table
+CPPUNIT_ASSERT(!pWrtShell->IsCursorInTable());
+
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+auto pPage = dynamic_cast(pLayout->Lower());
+CPPUNIT_ASSERT(pPage);
+const SwSortedObjs& rPageObjs = *pPage->GetSortedObjs();
+CPPUNIT_ASSERT_EQUAL(static_cast(1), rPageObjs.size());
+auto pPageFly = dynamic_cast(rPageObjs[0]);
+CPPUNIT_ASSERT(pPageFly);
+auto pTable = dynamic_cast(pPageFly->GetLower());
+CPPUNIT_ASSERT(pTable);
+auto pRow1 = pTable->GetLower();
+CPPUNIT_ASSERT(pRow1->IsRowFrame());
+auto pCellA1 = pRow1->GetLower();
+CPPUNIT_ASSERT(pCellA1);
+const SwRect& rCellA1Rect = pCellA1->getFrameArea();
+auto nRowHeight = rCellA1Rect.Height();
+
+// select image by clicking on it at the center of the upper cell
+Point ptFrom(rCellA1Rect.Left() + rCellA1Rect.Width() / 2, 
rCellA1Rect.Top() + nRowHeight / 2);
+vcl::Window& rEditWin = pDoc->GetDocShell()->GetView()->GetEditWin();
+Point aFrom = rEditWin.LogicToPixel(ptFrom);
+MouseEvent aClickEvent(aFrom, 1, MouseEventModifiers::SIMPLECLICK, 
MOUSE_LEFT);
+rEditWin.MouseButtonDown(aClickEvent);
+rEditWin.MouseButtonUp(aClickEvent);
+
+// Then make sure that the image is selected:
+SelectionType eType = pWrtShell->GetSelectionType();
+CPPUNIT_ASSERT_EQUAL(SelectionType::Graphic, eType);
+
+// select the text frame instead of the image
+// by pressing Escape
+dispatchCommand(mxComponent, ".uno:Escape", {});
+
+// Then make sure that the cursor in the table:
+SelectionType eType2 = pWrtShell->GetSelectionType();
+// This was false (only SelectionType::Text)
+bool bCursorInTable = eType2 == (SelectionType::Text | 
SelectionType::Table);
+CPPUNIT_ASSERT(bCursorInTable);
+
+// select the text frame by pressing Escape again
+dispatchCommand(mxComponent, ".uno:Escape", {});
+
+eType2 = pWrtShell->GetSelectionType();
+CPPUNIT_ASSERT_EQUAL(SelectionType::Frame, eType2);
+
+// deselect the text frame by pressing Escape again
+dispatchCommand(mxComponent, ".uno:Escape", {});
+
+eType2 = pWrtShell->GetSelectionType();
+// The text cursor is after the floating table
+CPPUNIT_ASSERT_EQUAL(SelectionType::Text, eType2);
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf115132)
 {
 createSwDoc();
diff --git a/sw/source/core/frmedt/feshview.cxx 
b/sw/source/core/frmedt/feshview.cxx
index c10a87110d8e..9a8d7304b4cc 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -191,6 +191,7 @@ bool SwFEShell::SelectObj( const Point& rPt, sal_uInt8 
nFlag, SdrObject *pObj )
 ( 
pOldSelFly->GetFormat()->GetProtect().IsContentProtected()
  && !IsReadOnlyAvailable() ))
 {
+SdrObject *pOldObj = 
rMrkList.GetMark(0)->GetMarkedSdrObj();
 // If a fly is deselected, which contains graphic, OLE or
 // otherwise, the cursor should be removed from it.
 // Similar if a fly with protected content is deselected.
@@ -201,6 +202,29 @@ bool SwFEShell::SelectObj( const Point& rPt, sal_uInt8 
nFlag, SdrObject *pObj )
 bool bUnLockView = !IsViewLocked();
 LockView( true );
 SetCursor( aPt, true );
+

core.git: sw/qa sw/source

2024-05-31 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/data/endnote-cont-separator.docx |binary
 sw/qa/core/layout/paintfrm.cxx |   27 +
 sw/source/core/inc/ftnfrm.hxx  |1 
 sw/source/core/layout/findfrm.cxx  |   11 
 sw/source/core/layout/paintfrm.cxx |   16 ++--
 5 files changed, 52 insertions(+), 3 deletions(-)

New commits:
commit 6450159e0e7c5fac9c998087e99f3fec602ff84d
Author: Miklos Vajna 
AuthorDate: Thu May 30 15:23:45 2024 +0200
Commit: Miklos Vajna 
CommitDate: Fri May 31 17:01:33 2024 +0200

tdf#160984 sw continuous endnotes: fix the endnote continuation separator 
len

See e.g.
,
one remaining difference for the Word vs Writer note separator is the
length of the endnote continuation separator: it's body frame width in
Word, shorter in Writer.

Seems this is specific to the endnote continuation separator, i.e.
normal endnote separator, footnote separator and footnote continuation
separator is not affected. Additionally, it's really footnote vs
endnote: if you put footnotes to the end of the document in Word, it
still doesn't make the separator longer.

Fix the problem by extending SwFootnoteContFrame::PaintLine() to handle
this: if in Word compat mode, first note frame is a follow endnote
frame, then paint the longer separator.

The usual render test way via SfxObjectShell::GetPreviewMetaFile() only
works with 1st pages and we want to assert the 2nd page here, so go via
DocumentToGraphicRenderer, similar to how
EPUBExportFilter::CreateMetafiles() does it.

Change-Id: Ia0ba1138070f1a68f62ea6f5a6a85fbe0f76d482
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168263
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/core/layout/data/endnote-cont-separator.docx 
b/sw/qa/core/layout/data/endnote-cont-separator.docx
new file mode 100644
index ..2e01a5c91354
Binary files /dev/null and b/sw/qa/core/layout/data/endnote-cont-separator.docx 
differ
diff --git a/sw/qa/core/layout/paintfrm.cxx b/sw/qa/core/layout/paintfrm.cxx
index a5213c57d639..464979c988a6 100644
--- a/sw/qa/core/layout/paintfrm.cxx
+++ b/sw/qa/core/layout/paintfrm.cxx
@@ -10,6 +10,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -188,6 +189,32 @@ CPPUNIT_TEST_FIXTURE(Test, 
testInlineEndnoteSeparatorPosition)
 // i.e. the separator wasn't 2 inches long, but was shorter vs Word.
 CPPUNIT_ASSERT_EQUAL(static_cast(2880), 
nEndnoteSeparatorLength);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testEndnoteContSeparator)
+{
+// Given a document with a Word-style endnote continuation separator:
+createSwDoc("endnote-cont-separator.docx");
+
+// When rendering page 2:
+sal_Int32 nPage = 2;
+DocumentToGraphicRenderer aRenderer(mxComponent, /*bSelectionOnly=*/false);
+Size aSize = aRenderer.getDocumentSizeInPixels(nPage);
+Graphic aGraphic = aRenderer.renderToGraphic(nPage, aSize, aSize, 
COL_WHITE,
+ /*bExtOutDevData=*/false);
+auto& xMetaFile = const_cast(aGraphic.GetGDIMetaFile());
+
+// Then make sure the separator length is correct:
+MetafileXmlDump aDumper;
+xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, xMetaFile);
+auto nEndnoteSeparatorStart = getXPath(pXmlDoc, "//polygon/point[1]"_ostr, 
"x"_ostr).toInt32();
+auto nEndnoteSeparatorEnd = getXPath(pXmlDoc, "//polygon/point[2]"_ostr, 
"x"_ostr).toInt32();
+sal_Int32 nEndnoteSeparatorLength = nEndnoteSeparatorEnd - 
nEndnoteSeparatorStart;
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 9360 (page print area width)
+// - Actual  : 2880 (2 inches)
+// i.e. the separator was too short vs Word.
+CPPUNIT_ASSERT_EQUAL(static_cast(9360), 
nEndnoteSeparatorLength);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/inc/ftnfrm.hxx b/sw/source/core/inc/ftnfrm.hxx
index 558c4941bf06..7331ef07d100 100644
--- a/sw/source/core/inc/ftnfrm.hxx
+++ b/sw/source/core/inc/ftnfrm.hxx
@@ -51,6 +51,7 @@ public:
 SwFootnoteContFrame( SwFrameFormat*, SwFrame* );
 
 const SwFootnoteFrame* FindFootNote() const;
+const SwFootnoteFrame* FindEndNote() const;
 
 static inline SwFootnoteFrame* AppendChained(SwFrame* pThis, bool 
bDefaultFormat);
 static inline SwFootnoteFrame* PrependChained(SwFrame* pThis, bool 
bDefaultFormat);
diff --git a/sw/source/core/layout/findfrm.cxx 
b/sw/source/core/layout/findfrm.cxx
index e83f4f8414a0..5f0cc8a0f256 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -698,6 +698,17 @@ const SwFootnoteFrame* SwFootnoteContFrame::FindFootNote() 
const
 return nullptr;
 }
 
+const SwFootnoteFrame* 

core.git: sw/qa sw/source

2024-05-31 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx |   11 +++
 sw/source/core/doc/number.cxx  |5 -
 sw/source/filter/ww8/wrtw8num.cxx  |   11 ++-
 3 files changed, 25 insertions(+), 2 deletions(-)

New commits:
commit 71c49057deb1a696e4b0ce9d2091aaa28572b57a
Author: Justin Luth 
AuthorDate: Mon May 20 14:28:59 2024 -0400
Commit: Justin Luth 
CommitDate: Fri May 31 15:27:14 2024 +0200

tdf#149258 sw ms export: no separator for NONE numbering level

This is to benefit ODT->DOCX.

LO does not show the separators specified after a numbering level
that has no numbering type (since LO 7.2.5).
However, MSO does show any specified separators.
So export this the way that LO sees it.

Note that in the very odd case where an MSO user actually wanted
these separators to be visible, LO fails to show them,
and thus this will end up exporting as "data loss". How sad.

make CppunitTest_sw_ooxmlexport21 \
CPPUNIT_TEST_NAME=testTdf156105_percentSuffix

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

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index baeba733afcc..e487bbf00015 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -298,6 +298,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf156105_percentSuffix, 
"tdf156105_percentSuffix.o
 // given a numbered list with a non-escaping percent symbol in the prefix 
and suffix
 CPPUNIT_ASSERT_EQUAL(OUString("(%)[%]"),
  getProperty(getParagraph(3), 
"ListLabelString"));
+
+// tdf#149258 - NONE number should not export separator since LO doesn't 
currently show it
+CPPUNIT_ASSERT_EQUAL_MESSAGE("showing levels 1, 2, and 4", 
OUString("(%)1.1.1[%]"),
+ getProperty(getParagraph(4), 
"ListLabelString"));
+if (isExported())
+{
+xmlDocUniquePtr pXmlNum = parseExport("word/numbering.xml");
+// The 3rd level is NONE. If we include the separator, MS Word will 
display it.
+assertXPath(pXmlNum, 
"/w:numbering/w:abstractNum[1]/w:lvl[4]/w:lvlText"_ostr, "val"_ostr,
+"(%)%1.%2.%3%4[%]");
+}
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMarginVML, 
"tdf160049_anchorMarginVML.docx")
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index f43ab140b60d..e811f7b83540 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -763,8 +763,11 @@ OUString SwNumRule::MakeNumString( const 
SwNumberTree::tNumberVector & rNumVecto
 // Numbering disabled - replacement is empty
 // And we should skip all level string content until next 
level marker:
 // so %1%.%2%.%3% with second level as NONE will result 1.1, 
not 1..1
+
+// NOTE: if changed, fix MSWordExportBase::NumberingLevel to 
match new behaviour.
+
 sal_Int32 nPositionNext = sLevelFormat.indexOf('%', nPosition 
+ sFind.getLength());
-if (nPosition >= 0 && nPositionNext >= nPosition)
+if (nPosition >= 0 && nPositionNext > nPosition)
 {
 sLevelFormat = sLevelFormat.replaceAt(nPosition, 
nPositionNext - nPosition, u"");
 }
diff --git a/sw/source/filter/ww8/wrtw8num.cxx 
b/sw/source/filter/ww8/wrtw8num.cxx
index 4c56472bb6b3..e8f7b197ed59 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -489,9 +489,18 @@ void MSWordExportBase::NumberingLevel(
 sal_Int32 nFnd = sNumStr.indexOf(sSrch);
 if (-1 != nFnd)
 {
+sal_Int32 nLen = sSrch.getLength();
+if (i < nLvl && rRule.Get(i).GetNumberingType() == 
SVX_NUM_NUMBER_NONE)
+{
+// LO doesn't show this level, so don't export its 
separator
+const OUString sSrch2("%" + OUString::number(i + 2) + 
"%");
+const sal_Int32 nFnd2 = sNumStr.indexOf(sSrch2, nFnd);
+if (-1 != nFnd2)
+nLen = nFnd2 - nFnd;
+}
 *pLvlPos = static_cast(nFnd + 1);
 ++pLvlPos;
-sNumStr = sNumStr.replaceAt(nFnd, sSrch.getLength(), 
rtl::OUStringChar(static_cast(i)));
+sNumStr = sNumStr.replaceAt(nFnd, nLen, 
OUStringChar(static_cast(i)));
 }
 }
 }


core.git: sw/qa sw/source

2024-05-31 Thread Miklos Vajna (via logerrit)
 sw/qa/writerfilter/dmapper/DomainMapper_Impl.cxx |   23 +++
 sw/qa/writerfilter/dmapper/data/clearing-break-sect-end.docx |binary
 sw/source/writerfilter/dmapper/DomainMapper.cxx  |4 -
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |5 ++
 sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx |3 +
 5 files changed, 33 insertions(+), 2 deletions(-)

New commits:
commit e00479404af5058b982c447e485af995d552e372
Author: Miklos Vajna 
AuthorDate: Fri May 31 09:00:18 2024 +0200
Commit: Miklos Vajna 
CommitDate: Fri May 31 12:58:00 2024 +0200

tdf#161318 sw clearing break: fix this at section end

Regression from commit 19bca24486315cc35f873486e6a2dd18394d0614
(tdf#126287: docx import: use defered linebreak, 2022-02-07), the bugdoc
has a single paragraph in the first section, containing a clearing
break, which is lost. This leads to overlapping text as the text is
shifted up.

Seems the intention was to avoid a line break at the very end of the
document, as that can lead to an empty page with "next page" section
breaks, with non-clearing line breaks.

Fix the problem by only doing this for non-clearing line breaks: that
keeps the old use-case working, but the new, clearing line break then
shifts down the text, so no text overlap happens.

Switching from appendTextPortion() to HandleLineBreak() helps because
HandleLineBreak() does exactly appendTextPortion("
") in the
non-clearing case, but knows about the stream stack's line break clear
status.

Change-Id: I38868eeeac55e20e86b668e9baf7e0d6a4976608
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168278
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/qa/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/qa/writerfilter/dmapper/DomainMapper_Impl.cxx
index 825e615fb574..963db22c4c28 100644
--- a/sw/qa/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/qa/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -411,6 +411,29 @@ CPPUNIT_TEST_FIXTURE(Test, testRedlinedShapeThenSdt)
 CPPUNIT_ASSERT_EQUAL(u"ContentControl"_ustr,
  
xPortion->getPropertyValue("TextPortionType").get());
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testClearingBreakSectEnd)
+{
+// Given a file with a single-paragraph section, ends with a clearing 
break:
+// When importing that document:
+loadFromFile(u"clearing-break-sect-end.docx");
+
+// Then make sure the clearing break is not lost before a cont sect break:
+uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xParaEnumAccess(xTextDocument->getText(),
+  
uno::UNO_QUERY);
+uno::Reference xParaEnum = 
xParaEnumAccess->createEnumeration();
+uno::Reference 
xPortionEnumAccess(xParaEnum->nextElement(),
+ 
uno::UNO_QUERY);
+uno::Reference xPortionEnum = 
xPortionEnumAccess->createEnumeration();
+uno::Reference xPortion(xPortionEnum->nextElement(), 
uno::UNO_QUERY);
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: LineBreak
+// - Actual  : Text
+// i.e. the clearing break at sect end was lost, leading to text overlap.
+CPPUNIT_ASSERT_EQUAL(u"LineBreak"_ustr,
+ 
xPortion->getPropertyValue("TextPortionType").get());
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/writerfilter/dmapper/data/clearing-break-sect-end.docx 
b/sw/qa/writerfilter/dmapper/data/clearing-break-sect-end.docx
new file mode 100644
index ..5052b2dd1649
Binary files /dev/null and 
b/sw/qa/writerfilter/dmapper/data/clearing-break-sect-end.docx differ
diff --git a/sw/source/writerfilter/dmapper/DomainMapper.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper.cxx
index 9144acaf79f7..72f88fc2a1a3 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper.cxx
@@ -4347,13 +4347,13 @@ void DomainMapper::lcl_utext(const sal_Unicode *const 
data_, size_t len)
 else if (len == 1 && sText[0] == ' ')
 {
 // Clear "last" one linebreak at end of section
-if (m_pImpl->GetIsLastParagraphInSection() && 
m_pImpl->isBreakDeferred(LINE_BREAK))
+if (m_pImpl->GetIsLastParagraphInSection() && 
m_pImpl->isBreakDeferred(LINE_BREAK) && !m_pImpl->HasLineBreakClear())
 m_pImpl->clearDeferredBreak(LINE_BREAK);
 // And emit all other linebreaks
 while (m_pImpl->isBreakDeferred(LINE_BREAK))
 {
 m_pImpl->clearDeferredBreak(LINE_BREAK);
-m_pImpl->appendTextPortion(u"
"_ustr, m_pImpl->GetTopContext());
+m_pImpl->HandleLineBreak(m_pImpl->GetTopContext());
 }
 }
 else if (len == 1 && sText[0] == ' ' )
diff --git 

core.git: sw/qa sw/source

2024-05-29 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx   |3 ---
 sw/source/filter/ww8/docxattributeoutput.cxx |4 
 2 files changed, 4 insertions(+), 3 deletions(-)

New commits:
commit a2b00082114b443962715a671b8bbb17733d6453
Author: Justin Luth 
AuthorDate: Mon May 27 20:31:54 2024 -0400
Commit: Justin Luth 
CommitDate: Thu May 30 01:21:48 2024 +0200

tdf#131098 docx export: write fill property of graphic

All these are round-tripping (at least at a basic level):
- bitmap
- hatch
- solid color
- transparency (unit test)

make CppunitTest_sw_ooxmlexport21 \
CPPUNIT_TEST_NAME=testTdf131098_imageFill

No existing unit tests had an image with a fill.

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

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index 901a0b161d6a..baeba733afcc 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -534,9 +534,6 @@ DECLARE_OOXMLEXPORT_TEST(testTdf126533_pageBitmap, 
"tdf126533_pageBitmap.docx")
 
 DECLARE_OOXMLEXPORT_TEST(testTdf131098_imageFill, "tdf131098_imageFill.docx")
 {
-if (isExported())
-return;
-
 // given a document with an image background transparency (blue-white)
 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT,
  getProperty(getShape(1), 
"FillStyle"));
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 971f27df0314..827d037b274c 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5411,6 +5411,10 @@ void DocxAttributeOutput::FlyFrameGraphic( const 
SwGrfNode* pGrfNode, const Size
 m_pSerializer->singleElementNS(XML_a, XML_avLst);
 m_pSerializer->endElementNS( XML_a, XML_prstGeom );
 
+m_rDrawingML.SetFS(m_pSerializer); // to be sure that we write to the 
right stream
+if (xShapePropSet)
+m_rDrawingML.WriteFill(xShapePropSet, awt::Size(aSize.Width(), 
aSize.Height()));
+
 const SvxBoxItem& rBoxItem = pFrameFormat->GetBox();
 const SvxBorderLine* pLeft = rBoxItem.GetLine(SvxBoxItemLine::LEFT);
 const SvxBorderLine* pRight = rBoxItem.GetLine(SvxBoxItemLine::RIGHT);


core.git: sw/qa sw/source

2024-05-29 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf131098_imageFill.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx |   11 +++
 sw/source/writerfilter/dmapper/GraphicImport.cxx   |   52 -
 3 files changed, 61 insertions(+), 2 deletions(-)

New commits:
commit 2862f1989591f4666ed0f7b994c80a0d0fd8ae52
Author: Justin Luth 
AuthorDate: Mon May 27 16:48:04 2024 -0400
Commit: Justin Luth 
CommitDate: Thu May 30 01:20:18 2024 +0200

tdf#131098 oox import: apply fill properties to graphic

The fill properties picked up by oox import
were not being transferred to the final graphic.

For some reason, the shape didn't import at all
if I copied over the Fill*Name properties.

All these are importing (at least at a basic level):
- bitmap
- hatch
- solid color
- transparency (unit test)

make CppunitTest_sw_ooxmlexport21 \
CPPUNIT_TEST_NAME=testTdf131098_imageFill

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

diff --git a/sw/qa/extras/ooxmlexport/data/tdf131098_imageFill.docx 
b/sw/qa/extras/ooxmlexport/data/tdf131098_imageFill.docx
new file mode 100644
index ..b663bdf72ac4
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf131098_imageFill.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index 1c55be3df2cf..901a0b161d6a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -532,6 +532,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf126533_pageBitmap, 
"tdf126533_pageBitmap.docx")
 
"/rels:Relationships/rels:Relationship[@Target='media/image1.jpeg']"_ostr, 1);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf131098_imageFill, "tdf131098_imageFill.docx")
+{
+if (isExported())
+return;
+
+// given a document with an image background transparency (blue-white)
+CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT,
+ getProperty(getShape(1), 
"FillStyle"));
+CPPUNIT_ASSERT_EQUAL(Color(0x729fcf), getProperty(getShape(1), 
"FillColor"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf154369, "tdf154369.docx")
 {
 //Unit test for bug fix in tdf#154369
diff --git a/sw/source/writerfilter/dmapper/GraphicImport.cxx 
b/sw/source/writerfilter/dmapper/GraphicImport.cxx
index b7621f776f4e..bab91d2b7fe0 100644
--- a/sw/source/writerfilter/dmapper/GraphicImport.cxx
+++ b/sw/source/writerfilter/dmapper/GraphicImport.cxx
@@ -1953,8 +1953,56 @@ rtl::Reference 
GraphicImport::createGraphicObject(uno::Ref
 uno::Any(m_pImpl->m_eColorMode));
 }
 
-xGraphicObject->setPropertyValue(getPropertyName( PROP_BACK_COLOR 
),
-uno::Any( GraphicImport_Impl::nFillColor ));
+// copy the image fill area properties
+xGraphicObject->setPropertyValue("FillBackground",
+ 
xShapeProps->getPropertyValue("FillBackground"));
+xGraphicObject->setPropertyValue("FillBitmap",
+ 
xShapeProps->getPropertyValue("FillBitmap"));
+xGraphicObject->setPropertyValue(
+"FillBitmapLogicalSize", 
xShapeProps->getPropertyValue("FillBitmapLogicalSize"));
+xGraphicObject->setPropertyValue("FillBitmapMode",
+ 
xShapeProps->getPropertyValue("FillBitmapMode"));
+xGraphicObject->setPropertyValue("FillBitmapOffsetX",
+ 
xShapeProps->getPropertyValue("FillBitmapOffsetX"));
+xGraphicObject->setPropertyValue(
+"FillBitmapPositionOffsetX",
+xShapeProps->getPropertyValue("FillBitmapPositionOffsetX"));
+xGraphicObject->setPropertyValue(
+"FillBitmapPositionOffsetY",
+xShapeProps->getPropertyValue("FillBitmapPositionOffsetY"));
+xGraphicObject->setPropertyValue(
+"FillBitmapRectanglePoint",
+xShapeProps->getPropertyValue("FillBitmapRectanglePoint"));
+xGraphicObject->setPropertyValue("FillBitmapSizeX",
+ 
xShapeProps->getPropertyValue("FillBitmapSizeX"));
+xGraphicObject->setPropertyValue("FillBitmapSizeY",
+ 
xShapeProps->getPropertyValue("FillBitmapSizeY"));
+xGraphicObject->setPropertyValue("FillBitmapStretch",
+ 
xShapeProps->getPropertyValue("FillBitmapStretch"));
+xGraphicObject->setPropertyValue("FillBitmapTile",
+ 
xShapeProps->getPropertyValue("FillBitmapTile"));
+

core.git: sw/qa sw/source

2024-05-29 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter6.cxx |   63 
 sw/source/core/layout/flylay.cxx|   38 ++---
 2 files changed, 96 insertions(+), 5 deletions(-)

New commits:
commit dece7d80c31c3c489859200bc93d9c948a535cbf
Author: László Németh 
AuthorDate: Tue May 21 13:20:24 2024 +0200
Commit: László Németh 
CommitDate: Wed May 29 23:43:47 2024 +0200

tdf#161261 sw: fix lost size of image resized in fixed-height cell

A fixed-height cell can contain a bigger image, which is cropped by
cell boundaries. It was not possible to resize this image with a simple 
drag & drop, because its size changed to the cell size immediately.
Now it's possible, like MSO does.

Follow-up to commit 30de13743f144aced83bc43d310592f82788c910
"tdf#160836 sw: resize rows at images cropped by row height".

Change-Id: I6b4e911432e784a96d393ee225ce69a1f2986d56
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168186
Tested-by: Jenkins
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index fb3ecb357bcd..6322120748da 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -1559,6 +1560,68 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf160836)
 CPPUNIT_ASSERT_EQUAL(tools::Long(1980), pCellA1->getFrameArea().Height());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf161261)
+{
+createSwDoc("tdf160842.fodt");
+SwDoc* pDoc = getSwDoc();
+CPPUNIT_ASSERT(pDoc);
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+// the cursor is not in the table
+CPPUNIT_ASSERT(!pWrtShell->IsCursorInTable());
+
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+auto pPage = dynamic_cast(pLayout->Lower());
+CPPUNIT_ASSERT(pPage);
+const SwSortedObjs& rPageObjs = *pPage->GetSortedObjs();
+CPPUNIT_ASSERT_EQUAL(static_cast(1), rPageObjs.size());
+auto pPageFly = dynamic_cast(rPageObjs[0]);
+CPPUNIT_ASSERT(pPageFly);
+auto pTable = dynamic_cast(pPageFly->GetLower());
+CPPUNIT_ASSERT(pTable);
+auto pRow1 = pTable->GetLower();
+CPPUNIT_ASSERT(pRow1->IsRowFrame());
+auto pCellA1 = pRow1->GetLower();
+CPPUNIT_ASSERT(pCellA1);
+const SwRect& rCellA1Rect = pCellA1->getFrameArea();
+auto nRowHeight = rCellA1Rect.Height();
+
+// select image by clicking on it at the center of the upper cell
+Point ptFrom(rCellA1Rect.Left() + rCellA1Rect.Width() / 2, 
rCellA1Rect.Top() + nRowHeight / 2);
+vcl::Window& rEditWin = pDoc->GetDocShell()->GetView()->GetEditWin();
+Point aFrom = rEditWin.LogicToPixel(ptFrom);
+MouseEvent aClickEvent(aFrom, 1, MouseEventModifiers::SIMPLECLICK, 
MOUSE_LEFT);
+rEditWin.MouseButtonDown(aClickEvent);
+rEditWin.MouseButtonUp(aClickEvent);
+
+// Then make sure that the image is selected:
+SelectionType eType = pWrtShell->GetSelectionType();
+CPPUNIT_ASSERT_EQUAL(SelectionType::Graphic, eType);
+
+uno::Reference xShape = getShape(2);
+CPPUNIT_ASSERT(xShape.is());
+
+// zoom image by drag & drop using right bottom handle of the image
+const SwRect& rSelRect = pWrtShell->GetAnyCurRect(CurRectType::Frame);
+Point ptFromHandle(rSelRect.Right(), rSelRect.Bottom());
+Point aFromHandle = rEditWin.LogicToPixel(ptFromHandle);
+Point ptTo(rSelRect.Left() + rSelRect.Width() * 1.5, rSelRect.Top() + 
rSelRect.Height() * 1.5);
+Point aTo = rEditWin.LogicToPixel(ptTo);
+MouseEvent aClickEvent2(aFromHandle, 1, MouseEventModifiers::SIMPLECLICK, 
MOUSE_LEFT);
+rEditWin.MouseButtonDown(aClickEvent2);
+MouseEvent aClickEvent3(aTo, 0, MouseEventModifiers::SIMPLEMOVE, 
MOUSE_LEFT);
+rEditWin.MouseMove(aClickEvent3);
+rEditWin.MouseMove(aClickEvent3);
+MouseEvent aClickEvent4(aTo, 1, MouseEventModifiers::SIMPLECLICK, 
MOUSE_LEFT);
+rEditWin.MouseButtonUp(aClickEvent4);
+Scheduler::ProcessEventsToIdle();
+
+// Make sure image is greater than before, instead of minimizing it to the 
cell size
+// This was 8707 and 6509
+CPPUNIT_ASSERT_GREATER(sal_Int32(1), xShape->getSize().Width);
+CPPUNIT_ASSERT_GREATER(sal_Int32(8000), xShape->getSize().Height);
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf115132)
 {
 createSwDoc();
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index 1a39b735d2d8..42ea0332f6eb 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -1409,17 +1409,45 @@ bool CalcClipRect( const SdrObject *pSdrObj, SwRect 
, bool bMove )
 {
 const SwFrame *pUp = pFly->GetAnchorFrame()->GetUpper();
 SwRectFnSet aRectFnSet(pFly->GetAnchorFrame());
+bool 

core.git: sw/qa sw/source

2024-05-29 Thread Miklos Vajna (via logerrit)
 sw/qa/filter/ww8/ww8.cxx |   30 +++
 sw/source/filter/ww8/docxattributeoutput.cxx |   13 +++
 sw/source/filter/ww8/docxattributeoutput.hxx |2 -
 sw/source/filter/ww8/docxexport.cxx  |4 +--
 4 files changed, 46 insertions(+), 3 deletions(-)

New commits:
commit 566c7017a84e3d573de85a6d986b81d3f59de0fa
Author: Miklos Vajna 
AuthorDate: Wed May 29 13:34:25 2024 +0200
Commit: Miklos Vajna 
CommitDate: Wed May 29 20:10:50 2024 +0200

tdf#160984 sw continuous endnotes: DOCX: export of  pos == 
sectEnd

In case a DOCX file is re-exported to Word and it collected endnotes at
section end, this setting was lost on save.

The relevant markup seems to be  -> , though that's a per-section setting in Writer, and is
a per-doc setting in Word.

Fix the problem by doing it similar to
DocxExport::WriteDocumentBackgroundFill(), which takes the first page
style in a similar case; here we take the first section format.

This is meant to be good enough for the DOCX editing case, where we know
all sections have the same endnote position properties anyway.

Change-Id: I95508296e31c9be34196bdc0da2177101647abf9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168187
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/filter/ww8/ww8.cxx b/sw/qa/filter/ww8/ww8.cxx
index 4cbbfe5fbf31..070565345a2d 100644
--- a/sw/qa/filter/ww8/ww8.cxx
+++ b/sw/qa/filter/ww8/ww8.cxx
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace
 {
@@ -564,6 +565,35 @@ CPPUNIT_TEST_FIXTURE(Test, testNullPointerDereference)
 createSwDoc("null-pointer-dereference.doc");
 CPPUNIT_ASSERT_EQUAL(6, getPages());
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testEndnotesAtSectEnd)
+{
+// Given a document, endnotes at collected at section end:
+createSwDoc();
+SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+pWrtShell->SplitNode();
+pWrtShell->Up(/*bSelect=*/false);
+pWrtShell->Insert("x");
+pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 1, 
/*bBasicCall=*/false);
+SwSectionData aSection(SectionType::Content, 
pWrtShell->GetUniqueSectionName());
+pWrtShell->StartAction();
+SfxItemSetFixed 
aSet(pWrtShell->GetAttrPool());
+aSet.Put(SwFormatEndAtTextEnd(FTNEND_ATTXTEND));
+pWrtShell->InsertSection(aSection, );
+pWrtShell->EndAction();
+pWrtShell->InsertFootnote(OUString(), /*bEndNote=*/true);
+
+// When saving to DOCX:
+save("Office Open XML Text");
+
+// Then make sure the endnote position is section end:
+xmlDocUniquePtr pXmlDoc = parseExport("word/settings.xml");
+OUString aPos = getXPath(pXmlDoc, "/w:settings/w:endnotePr/w:pos"_ostr, 
"val"_ostr);
+// Without the accompanying fix in place, this test would have failed with:
+// - XPath '/w:settings/w:endnotePr/w:pos' number of nodes is incorrect
+// i.e. the default position was used: document end.
+CPPUNIT_ASSERT_EQUAL(OUString("sectEnd"), aPos);
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 1532ecf72c81..971f27df0314 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -127,6 +127,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -8780,6 +8781,18 @@ void DocxAttributeOutput::WriteFootnoteEndnotePr( 
::sax_fastparser::FSHelperPtr
 const SwEndNoteInfo& info, int listtag )
 {
 fs->startElementNS(XML_w, tag);
+
+SwSectionFormats& rSections = m_rExport.m_rDoc.GetSections();
+if (!rSections.empty())
+{
+SwSectionFormat* pFormat = rSections[0];
+bool bEndnAtEnd = pFormat->GetEndAtTextEnd().IsAtEnd();
+if (bEndnAtEnd)
+{
+fs->singleElementNS(XML_w, XML_pos, FSNS(XML_w, XML_val), 
"sectEnd");
+}
+}
+
 OString aCustomFormat;
 OString fmt = lcl_ConvertNumberingType(info.m_aFormat.GetNumberingType(), 
nullptr, aCustomFormat);
 if (!fmt.isEmpty() && aCustomFormat.isEmpty())
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx 
b/sw/source/filter/ww8/docxattributeoutput.hxx
index b1da698c3dec..063cb02bbc69 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -1109,7 +1109,7 @@ public:
 void FootnotesEndnotes( bool bFootnotes );
 
 /// writes the footnotePr/endnotePr (depending on tag) section
-static void WriteFootnoteEndnotePr( ::sax_fastparser::FSHelperPtr const & 
fs, int tag, const SwEndNoteInfo& info, int listtag );
+void WriteFootnoteEndnotePr( ::sax_fastparser::FSHelperPtr const & fs, int 
tag, const SwEndNoteInfo& info, int listtag );
 
 bool HasPostitFields() const;
 enum class hasProperties { no, yes };
diff --git a/sw/source/filter/ww8/docxexport.cxx 

core.git: sw/qa sw/source

2024-05-29 Thread Mike Kaganski (via logerrit)
 sw/qa/extras/layout/layout2.cxx   |5 ++---
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx |6 ++
 sw/source/core/inc/frame.hxx  |1 +
 sw/source/core/layout/calcmove.cxx|6 ++
 sw/source/core/layout/flowfrm.cxx |9 +
 sw/source/core/layout/sectfrm.cxx |2 +-
 sw/source/core/layout/tabfrm.cxx  |   13 +
 sw/source/core/layout/trvlfrm.cxx |   16 
 8 files changed, 54 insertions(+), 4 deletions(-)

New commits:
commit fc1e6a64bd0517a7e67f08860c29b44d030220eb
Author: Mike Kaganski 
AuthorDate: Tue May 28 09:04:51 2024 +0500
Commit: Mike Kaganski 
CommitDate: Wed May 29 13:17:30 2024 +0200

tdf#161202: lowers shouldn't move forward because of lack of space

... in hidden section. So make sure to set heights of lowers to zero, too.
testOldComplexMergeTableInTable turned out to be a nice test for this.

Change-Id: I334aaaf2becf0ac1ff61faed2e5f697f344c78d4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168151
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index 56c6991fce5e..dc81b5e2296e 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -858,7 +858,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf152872)
 assertXPath(pXmlDoc, "/root/page[1]/body/txt"_ostr, 2);
 assertXPath(pXmlDoc, 
"/root/page/body/txt[1]/SwParaPortion/SwLineLayout"_ostr, "portion"_ostr,
 "C DE");
-assertXPath(pXmlDoc, "/root/page/body/txt[2]/SwParaPortion"_ostr, 0); // 5 
is empty and hidden
+// 5 is empty and hidden
 assertXPath(pXmlDoc, "/root/page/body/txt[2]/infos/bounds"_ostr, 
"height"_ostr, "0");
 
 dispatchCommand(mxComponent, ".uno:ControlCodes", {});
@@ -880,7 +880,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf152872)
 // 5 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 work...
-assertXPath(pXmlDoc, "/root/page/body/txt[5]/SwParaPortion"_ostr, 0); // 5 
is empty
 assertXPath(pXmlDoc, "/root/page/body/txt[5]/infos/bounds"_ostr, 
"height"_ostr, "0");
 
 dispatchCommand(mxComponent, ".uno:ControlCodes", {});
@@ -891,7 +890,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf152872)
 assertXPath(pXmlDoc, "/root/page[1]/body/txt"_ostr, 2);
 assertXPath(pXmlDoc, 
"/root/page/body/txt[1]/SwParaPortion/SwLineLayout"_ostr, "portion"_ostr,
 "C DE");
-assertXPath(pXmlDoc, "/root/page/body/txt[2]/SwParaPortion"_ostr, 0); // 5 
is empty and hidden
+// 5 is empty and hidden
 assertXPath(pXmlDoc, "/root/page/body/txt[2]/infos/bounds"_ostr, 
"height"_ostr, "0");
 }
 
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index db504be317c1..4a2ac4bbbfd2 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -319,6 +319,12 @@ CPPUNIT_TEST_FIXTURE(Test, testOldComplexMergeTableInTable)
 {
 loadAndSave("ooo96040-2.odt");
 parseExport("word/document.xml");
+
+// Check tdf#161202 - this document has all kinds of tables inside hidden 
sections.
+// The page count must be 13, but for unclear reason, it is 12 in some 
tests on Linux
+// (maybe the layout hasn't finished?).
+// Without the fix, it was 52.
+CPPUNIT_ASSERT_LESSEQUAL(13, getPages());
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testHyperlinkContainingPlaceholderField)
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index 4f0df45e2d30..9972248e9744 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -903,6 +903,7 @@ public:
 bool IsProtected() const;
 
 virtual bool IsHiddenNow() const;
+void MakeValidZeroHeight();
 
 bool IsColLocked()  const { return mbColLocked; }
 virtual bool IsDeleteForbidden() const { return mnForbidDelete > 0; }
diff --git a/sw/source/core/layout/calcmove.cxx 
b/sw/source/core/layout/calcmove.cxx
index 6e8112308002..dbd6ffe88b91 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -965,6 +965,9 @@ void SwLayoutFrame::MakeAll(vcl::RenderContext* 
/*pRenderContext*/)
 const SwLayNotify aNotify( this );
 bool bVert = IsVertical();
 
+if (IsHiddenNow())
+MakeValidZeroHeight();
+
 SwRectFn fnRect = ( IsNeighbourFrame() == bVert )? fnRectHori : ( 
IsVertLR() ? (IsVertLRBT() ? fnRectVertL2RB2T : fnRectVertL2R) : fnRectVert );
 
 std::optional oAccess;
@@ -1281,6 +1284,9 @@ void SwContentFrame::MakeAll(vcl::RenderContext* 
/*pRenderContext*/)
 return;
 }
 
+if (IsHiddenNow())
+MakeValidZeroHeight();
+
 std::optional oDeleteGuard(std::in_place, this);
 LockJoin();
 

core.git: sw/qa sw/source

2024-05-29 Thread Stephan Bergmann (via logerrit)
 sw/qa/extras/uiwriter/uiwriter6.cxx |   63 
 sw/source/core/layout/flylay.cxx|   38 ++---
 2 files changed, 5 insertions(+), 96 deletions(-)

New commits:
commit db94d1079a83eae9ac0c8d92f4547698d016daf8
Author: Stephan Bergmann 
AuthorDate: Mon May 27 10:57:41 2024 +0200
Commit: Stephan Bergmann 
CommitDate: Wed May 29 10:38:41 2024 +0200

Revert "tdf#161261 sw: fix lost size of image resized in fixed-height cell"

This reverts commit 4da6f52f5fd164082fd42fc58fc7d31da567c924 plus follow-up
24f65bf5940adb0aa3590443752110119e2bea5e "Fix typo".  It caused
CppunitTest_sw_uiwriter6 to fail with

> /sw/source/core/layout/flylay.cxx:1426:51: runtime error: downcast of 
address 0x606000c4b620 which does not point to an object of type 'const 
SwDrawContact'
> 0x606000c4b620: note: object is of type 'SwFlyDrawContact'
>  00 00 00 00  50 3d 2f b8 99 7f 00 00  c0 3d 2f b8 99 7f 00 00  00 00 00 
00 00 00 00 00  d0 64 50 00
>   ^~~
>   vptr for 'SwFlyDrawContact'
> #0 0x7f99ae257936 in CalcClipRect(SdrObject const*, SwRect&, bool) 
/sw/source/core/layout/flylay.cxx:1426:51
> #1 0x7f99ad5b2607 in SwDrawView::TakeDragLimit(SdrDragMode, 
tools::Rectangle&) const /sw/source/core/draw/dview.cxx:694:13
> #2 0x7f99c317c1a0 in SdrDragView::BegDragObj(Point const&, 
OutputDevice*, SdrHdl*, short, SdrDragMethod*) 
/svx/source/svdraw/svddrgv.cxx:199:21
> #3 0x7f99c18eef25 in E3dView::BegDragObj(Point const&, OutputDevice*, 
SdrHdl*, short, SdrDragMethod*) /svx/source/engine3d/view3d.cxx:1243:21
> #4 0x7f99adcfa821 in SwFEShell::BeginDrag(Point const*, bool) 
/sw/source/core/frmedt/feshview.cxx:741:20
> #5 0x7f99b3ea5ffd in SwWrtShell::BeginFrameDrag(Point const*, bool) 
/sw/source/uibase/wrtsh/select.cxx:761:20
> #6 0x7f99b27a8238 in SwWrtShell::Drag(Point const*, bool) 
/sw/source/uibase/inc/wrtsh.hxx:124:56
> #7 0x7f99b2742135 in SwEditWin::MouseMove(MouseEvent const&) 
/sw/source/uibase/docvw/edtwin.cxx:4489:25
> #8 0x7f99dcdc6f64 in testTdf161261::TestBody() 
/sw/qa/extras/uiwriter/uiwriter6.cxx:1613:14

()

Change-Id: Idf0c0c75d39a28671c852fc526549439892d0902
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168177
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index 6322120748da..fb3ecb357bcd 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -36,7 +36,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 
@@ -1560,68 +1559,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf160836)
 CPPUNIT_ASSERT_EQUAL(tools::Long(1980), pCellA1->getFrameArea().Height());
 }
 
-CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf161261)
-{
-createSwDoc("tdf160842.fodt");
-SwDoc* pDoc = getSwDoc();
-CPPUNIT_ASSERT(pDoc);
-SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
-CPPUNIT_ASSERT(pWrtShell);
-// the cursor is not in the table
-CPPUNIT_ASSERT(!pWrtShell->IsCursorInTable());
-
-SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
-auto pPage = dynamic_cast(pLayout->Lower());
-CPPUNIT_ASSERT(pPage);
-const SwSortedObjs& rPageObjs = *pPage->GetSortedObjs();
-CPPUNIT_ASSERT_EQUAL(static_cast(1), rPageObjs.size());
-auto pPageFly = dynamic_cast(rPageObjs[0]);
-CPPUNIT_ASSERT(pPageFly);
-auto pTable = dynamic_cast(pPageFly->GetLower());
-CPPUNIT_ASSERT(pTable);
-auto pRow1 = pTable->GetLower();
-CPPUNIT_ASSERT(pRow1->IsRowFrame());
-auto pCellA1 = pRow1->GetLower();
-CPPUNIT_ASSERT(pCellA1);
-const SwRect& rCellA1Rect = pCellA1->getFrameArea();
-auto nRowHeight = rCellA1Rect.Height();
-
-// select image by clicking on it at the center of the upper cell
-Point ptFrom(rCellA1Rect.Left() + rCellA1Rect.Width() / 2, 
rCellA1Rect.Top() + nRowHeight / 2);
-vcl::Window& rEditWin = pDoc->GetDocShell()->GetView()->GetEditWin();
-Point aFrom = rEditWin.LogicToPixel(ptFrom);
-MouseEvent aClickEvent(aFrom, 1, MouseEventModifiers::SIMPLECLICK, 
MOUSE_LEFT);
-rEditWin.MouseButtonDown(aClickEvent);
-rEditWin.MouseButtonUp(aClickEvent);
-
-// Then make sure that the image is selected:
-SelectionType eType = pWrtShell->GetSelectionType();
-CPPUNIT_ASSERT_EQUAL(SelectionType::Graphic, eType);
-
-uno::Reference xShape = getShape(2);
-CPPUNIT_ASSERT(xShape.is());
-
-// zoom image by drag & drop using right bottom handle of the image
-const SwRect& rSelRect = pWrtShell->GetAnyCurRect(CurRectType::Frame);
-Point ptFromHandle(rSelRect.Right(), rSelRect.Bottom());
-Point aFromHandle = rEditWin.LogicToPixel(ptFromHandle);
-Point 

core.git: sw/qa sw/source

2024-05-28 Thread Miklos Vajna (via logerrit)
 sw/qa/writerfilter/dmapper/SettingsTable.cxx|   22 
 sw/qa/writerfilter/dmapper/data/endnote-at-section-end.docx |binary
 sw/source/writerfilter/dmapper/PropertyMap.cxx  |9 
 sw/source/writerfilter/dmapper/SettingsTable.cxx|   13 +++
 sw/source/writerfilter/dmapper/SettingsTable.hxx|2 +
 5 files changed, 45 insertions(+), 1 deletion(-)

New commits:
commit 2d2dd56e0b2dc708f1f758d7fc9a1263ff09b83c
Author: Miklos Vajna 
AuthorDate: Tue May 28 13:26:05 2024 +0200
Commit: Miklos Vajna 
CommitDate: Tue May 28 17:13:08 2024 +0200

tdf#160984 sw continuous endnotes: DOCX: import  pos == sectEnd

Word can have per-section endnotes, but if endnotes are collected at the
end of the section vs document end is a per-document setting.

The DOC import already handles this in wwSectionManager::InsertSection()
when it constructs an SwFormatEndAtTextEnd with FTNEND_ATTXTEND.

Fix the problem by doing the same in writerfilter: in case settings.xml
wants at-section-end endnotes, set EndnoteIsCollectAtTextEnd to true
when applying section properties.

The export side still needs doing.

Change-Id: Ibad9c2d62a2945ee42877c849482feee60a50178
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168148
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/qa/writerfilter/dmapper/SettingsTable.cxx 
b/sw/qa/writerfilter/dmapper/SettingsTable.cxx
index 503b28d45c95..ef94a60fc544 100644
--- a/sw/qa/writerfilter/dmapper/SettingsTable.cxx
+++ b/sw/qa/writerfilter/dmapper/SettingsTable.cxx
@@ -11,6 +11,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -87,6 +88,27 @@ CPPUNIT_TEST_FIXTURE(Test, testAddVerticalFrameOffsetsRTF)
 // i.e. table top should be ~2748, but was less, leading to an overlap.
 CPPUNIT_ASSERT_GREATER(nFlyBottom, nTableTop);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testEndnoteAtSectionEnd)
+{
+// Given a document with at-section-end endnotes enabled:
+loadFromFile(u"endnote-at-section-end.docx");
+
+// Go to the second paragraph, which is inside Word's second section:
+uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xParaEnumAccess(xTextDocument->getText(),
+  
uno::UNO_QUERY);
+uno::Reference xParaEnum = 
xParaEnumAccess->createEnumeration();
+xParaEnum->nextElement();
+uno::Reference xPara(xParaEnum->nextElement(), 
uno::UNO_QUERY);
+uno::Reference xSection;
+xPara->getPropertyValue("TextSection") >>= xSection;
+bool bEndnoteIsCollectAtTextEnd = false;
+xSection->getPropertyValue("EndnoteIsCollectAtTextEnd") >>= 
bEndnoteIsCollectAtTextEnd;
+// Without the accompanying fix in place, this test would have failed, 
endnotes were always at
+// document end.
+CPPUNIT_ASSERT(bEndnoteIsCollectAtTextEnd);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/writerfilter/dmapper/data/endnote-at-section-end.docx 
b/sw/qa/writerfilter/dmapper/data/endnote-at-section-end.docx
new file mode 100644
index ..cf61262c7d59
Binary files /dev/null and 
b/sw/qa/writerfilter/dmapper/data/endnote-at-section-end.docx differ
diff --git a/sw/source/writerfilter/dmapper/PropertyMap.cxx 
b/sw/source/writerfilter/dmapper/PropertyMap.cxx
index f52d37764402..02951c73cbcd 100644
--- a/sw/source/writerfilter/dmapper/PropertyMap.cxx
+++ b/sw/source/writerfilter/dmapper/PropertyMap.cxx
@@ -74,6 +74,8 @@
 #include 
 #include 
 
+#include 
+
 using namespace com::sun::star;
 
 namespace writerfilter::dmapper {
@@ -756,7 +758,7 @@ void SectionPropertyMap::DontBalanceTextColumns()
 }
 }
 
-void SectionPropertyMap::ApplySectionProperties( const uno::Reference< 
beans::XPropertySet >& xSection, DomainMapper_Impl& /*rDM_Impl*/ )
+void SectionPropertyMap::ApplySectionProperties( const uno::Reference< 
beans::XPropertySet >& xSection, DomainMapper_Impl& rDM_Impl )
 {
 try
 {
@@ -765,6 +767,11 @@ void SectionPropertyMap::ApplySectionProperties( const 
uno::Reference< beans::XP
 std::optional< PropertyMap::Property > pProp = getProperty( 
PROP_WRITING_MODE );
 if ( pProp )
 xSection->setPropertyValue( "WritingMode", pProp->second );
+
+if (rDM_Impl.GetSettingsTable()->GetEndnoteIsCollectAtSectionEnd())
+{
+
xSection->setPropertyValue(UNO_NAME_ENDNOTE_IS_COLLECT_AT_TEXT_END, 
uno::Any(true));
+}
 }
 }
 catch ( uno::Exception& )
diff --git a/sw/source/writerfilter/dmapper/SettingsTable.cxx 
b/sw/source/writerfilter/dmapper/SettingsTable.cxx
index 4d6fe6b13441..57f6566c2135 100644
--- a/sw/source/writerfilter/dmapper/SettingsTable.cxx
+++ b/sw/source/writerfilter/dmapper/SettingsTable.cxx
@@ -120,6 +120,8 @@ struct SettingsTable_Impl
 bool m_bGutterAtTop = false;
 bool 

core.git: sw/qa sw/source

2024-05-27 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/data/inline-endnote-section-delete.docx |binary
 sw/qa/core/layout/ftnfrm.cxx  |   31 ++
 sw/source/core/layout/ftnfrm.cxx  |4 +
 3 files changed, 34 insertions(+), 1 deletion(-)

New commits:
commit 3f2d0414686a8f9a042413c47c4c8ffa5d61f436
Author: Miklos Vajna 
AuthorDate: Mon May 27 09:41:18 2024 +0200
Commit: Miklos Vajna 
CommitDate: Mon May 27 11:27:34 2024 +0200

tdf#160984 sw continuous endnotes: fix crash on loading 
forum-mso-en-7731.docx

Regression from commit 1ae5ea3f78cca11ba18f2dd1a06f875263336a3b
(tdf#160984 sw continuous endnotes: enable DOCX import, 2024-05-21), the
bugdoc crashed in SwSectionFrame::GetEndSectFormat_().

What seems to happen is that the first endnote is added to page 1, then
more content is inserted, so the endnote is moved to page 2, which
leaves an empty endnote section on page 1, which is marked for deletion
in SwSectionFrame::MakeAll(), and will be deleted in
SwRootFrame::DeleteEmptySct_(). At some point (after marking for
deletion, before deletion) SwFootnoteBossFrame::AppendFootnote() tries
to find the first endnote section in the layout, and finds this section,
but it crashes because there is no SwSection attached to it, as marking
for deletion in SwSectionFrame::DelEmpty() clears that.

Fix the problem by ignoring to-be-deleted sections in
SwFootnoteBossFrame::AppendFootnote(): this way a new, usable section
will be created and the to-be-deleted section go away as the layout
finishes.

An alternative would be to check for SwSectionFrame::GetSection()
earlier, as we iterate on pages (hoping that this way we find a later
page that has a not-dead endnote section), but that leads to 6 pages
instead of 4 pages for the bugdoc, so don't go that way.

Change-Id: I9a21cbccb5a088314520c7ade55dbdf9966d1265
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168084
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/qa/core/layout/data/inline-endnote-section-delete.docx 
b/sw/qa/core/layout/data/inline-endnote-section-delete.docx
new file mode 100644
index ..bf3d3e60d890
Binary files /dev/null and 
b/sw/qa/core/layout/data/inline-endnote-section-delete.docx differ
diff --git a/sw/qa/core/layout/ftnfrm.cxx b/sw/qa/core/layout/ftnfrm.cxx
index a7640e26ca9a..98387be6a983 100644
--- a/sw/qa/core/layout/ftnfrm.cxx
+++ b/sw/qa/core/layout/ftnfrm.cxx
@@ -17,6 +17,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 /// Covers sw/source/core/layout/ftnfrm.cxx fixes.
 class Test : public SwModelTestBase
@@ -122,4 +124,33 @@ CPPUNIT_TEST_FIXTURE(Test, testInlineEndnotePosition)
 CPPUNIT_ASSERT_EQUAL(static_cast(269), nEndnoteContTopMargin);
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testInlineEndnoteSectionDelete)
+{
+// Given a document, ContinuousEndnotes is true, 3 pages, endnodes start 
on page 2:
+// When laying out that document:
+createSwDoc("inline-endnote-section-delete.docx");
+
+// First page: just body text:
+SwDoc* pDoc = getSwDoc();
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+auto pPage = pLayout->Lower()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage->GetLower()->IsBodyFrame());
+auto pBodyFrame = static_cast(pPage->GetLower());
+CPPUNIT_ASSERT(!pBodyFrame->GetLastLower()->IsSctFrame());
+// Second page: ends with endnotes:
+pPage = pPage->GetNext()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage->GetLower()->IsBodyFrame());
+pBodyFrame = static_cast(pPage->GetLower());
+CPPUNIT_ASSERT(pBodyFrame->GetLastLower()->IsSctFrame());
+auto pSection = static_cast(pBodyFrame->GetLastLower());
+CPPUNIT_ASSERT(pSection->IsEndNoteSection());
+// Third page: just endnotes:
+pPage = pPage->GetNext()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage->GetLower()->IsBodyFrame());
+pBodyFrame = static_cast(pPage->GetLower());
+CPPUNIT_ASSERT(pBodyFrame->GetLower()->IsSctFrame());
+pSection = static_cast(pBodyFrame->GetLower());
+CPPUNIT_ASSERT(pSection->IsEndNoteSection());
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index 548d8228063e..bb35d1c1025c 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -1626,7 +1626,9 @@ void SwFootnoteBossFrame::AppendFootnote( SwContentFrame 
*pRef, SwTextFootnote *
 pEndnoteSection = pPage->GetEndNoteSection();
 }
 // If there are no endnotes sections yet, create one at the end of 
the document.
-if (!pEndnoteSection)
+// Ignore sections which are already marked for deletion, they 
don't have an SwSection
+// anymore, so not usable for us.
+if (!pEndnoteSection || 

core.git: sw/qa sw/source

2024-05-24 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter6.cxx |   63 
 sw/source/core/layout/flylay.cxx|   38 ++---
 2 files changed, 96 insertions(+), 5 deletions(-)

New commits:
commit 4da6f52f5fd164082fd42fc58fc7d31da567c924
Author: László Németh 
AuthorDate: Tue May 21 13:20:24 2024 +0200
Commit: László Németh 
CommitDate: Fri May 24 19:46:46 2024 +0200

tdf#161261 sw: fix lost size of image resized in fixed-height cell

A fixed-height cell can contain a bigger image, which is cropped by
cell boundaries. It was not possible to resize this image with a simple 
drag & drop, because its size changed to the cell size immediately.
Now it's possible, like MSO does.

Follow-up to commit 30de13743f144aced83bc43d310592f82788c910
"tdf#160836 sw: resize rows at images cropped by row height".

Change-Id: I9d63e6e526135b6d8541f904c363b9186bb3cfc4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168023
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index fb3ecb357bcd..6322120748da 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -1559,6 +1560,68 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf160836)
 CPPUNIT_ASSERT_EQUAL(tools::Long(1980), pCellA1->getFrameArea().Height());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf161261)
+{
+createSwDoc("tdf160842.fodt");
+SwDoc* pDoc = getSwDoc();
+CPPUNIT_ASSERT(pDoc);
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+// the cursor is not in the table
+CPPUNIT_ASSERT(!pWrtShell->IsCursorInTable());
+
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+auto pPage = dynamic_cast(pLayout->Lower());
+CPPUNIT_ASSERT(pPage);
+const SwSortedObjs& rPageObjs = *pPage->GetSortedObjs();
+CPPUNIT_ASSERT_EQUAL(static_cast(1), rPageObjs.size());
+auto pPageFly = dynamic_cast(rPageObjs[0]);
+CPPUNIT_ASSERT(pPageFly);
+auto pTable = dynamic_cast(pPageFly->GetLower());
+CPPUNIT_ASSERT(pTable);
+auto pRow1 = pTable->GetLower();
+CPPUNIT_ASSERT(pRow1->IsRowFrame());
+auto pCellA1 = pRow1->GetLower();
+CPPUNIT_ASSERT(pCellA1);
+const SwRect& rCellA1Rect = pCellA1->getFrameArea();
+auto nRowHeight = rCellA1Rect.Height();
+
+// select image by clicking on it at the center of the upper cell
+Point ptFrom(rCellA1Rect.Left() + rCellA1Rect.Width() / 2, 
rCellA1Rect.Top() + nRowHeight / 2);
+vcl::Window& rEditWin = pDoc->GetDocShell()->GetView()->GetEditWin();
+Point aFrom = rEditWin.LogicToPixel(ptFrom);
+MouseEvent aClickEvent(aFrom, 1, MouseEventModifiers::SIMPLECLICK, 
MOUSE_LEFT);
+rEditWin.MouseButtonDown(aClickEvent);
+rEditWin.MouseButtonUp(aClickEvent);
+
+// Then make sure that the image is selected:
+SelectionType eType = pWrtShell->GetSelectionType();
+CPPUNIT_ASSERT_EQUAL(SelectionType::Graphic, eType);
+
+uno::Reference xShape = getShape(2);
+CPPUNIT_ASSERT(xShape.is());
+
+// zoom image by drag & drop using right bottom handle of the image
+const SwRect& rSelRect = pWrtShell->GetAnyCurRect(CurRectType::Frame);
+Point ptFromHandle(rSelRect.Right(), rSelRect.Bottom());
+Point aFromHandle = rEditWin.LogicToPixel(ptFromHandle);
+Point ptTo(rSelRect.Left() + rSelRect.Width() * 1.5, rSelRect.Top() + 
rSelRect.Height() * 1.5);
+Point aTo = rEditWin.LogicToPixel(ptTo);
+MouseEvent aClickEvent2(aFromHandle, 1, MouseEventModifiers::SIMPLECLICK, 
MOUSE_LEFT);
+rEditWin.MouseButtonDown(aClickEvent2);
+MouseEvent aClickEvent3(aTo, 0, MouseEventModifiers::SIMPLEMOVE, 
MOUSE_LEFT);
+rEditWin.MouseMove(aClickEvent3);
+rEditWin.MouseMove(aClickEvent3);
+MouseEvent aClickEvent4(aTo, 1, MouseEventModifiers::SIMPLECLICK, 
MOUSE_LEFT);
+rEditWin.MouseButtonUp(aClickEvent4);
+Scheduler::ProcessEventsToIdle();
+
+// Make sure image is greater than before, instead of minimizing it to the 
cell size
+// This was 8707 and 6509
+CPPUNIT_ASSERT_GREATER(sal_Int32(1), xShape->getSize().Width);
+CPPUNIT_ASSERT_GREATER(sal_Int32(8000), xShape->getSize().Height);
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf115132)
 {
 createSwDoc();
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index 1a39b735d2d8..92ad07ba4481 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -1409,17 +1409,45 @@ bool CalcClipRect( const SdrObject *pSdrObj, SwRect 
, bool bMove )
 {
 const SwFrame *pUp = pFly->GetAnchorFrame()->GetUpper();
 SwRectFnSet aRectFnSet(pFly->GetAnchorFrame());
+bool bOnlyCellFrame = pUp->IsCellFrame();

core.git: sw/qa sw/source

2024-05-24 Thread Miklos Vajna (via logerrit)
 sw/qa/uitest/data/keep-aspect-ratio.odt |binary
 sw/qa/uitest/ui/frmdlg/frmdlg.py|   20 
 sw/source/ui/frmdlg/frmpage.cxx |6 +-
 sw/source/uibase/inc/frmpage.hxx|1 +
 4 files changed, 26 insertions(+), 1 deletion(-)

New commits:
commit a3150fc8a59662ce8630cfc64fec9cd083ac7d36
Author: Miklos Vajna 
AuthorDate: Fri May 24 12:06:55 2024 +0200
Commit: Miklos Vajna 
CommitDate: Fri May 24 13:58:07 2024 +0200

tdf#145972 sw image dialog: fix bad rel width w/ pt units and kept aspect 
ratio

Regression from commit 02c435082058ecf7f9d4d73cb47d31d0218dc10d (sw keep
aspect ratio: add filter for this setting, 2021-06-07), once UI units
are set to poins (instead of cms), the image dialog for the bugdoc was
showing 5% width instead of 48%.

48% is roughtly correct, visually the image is taking half of the body
frame width. Previously the bad rel size didn't happen because we didn't
save the "keep aspect ratio" to documents, so it was off by the time the
dialog was initialized.

Fix the problem by introducing a new flag, so we can differentiate
between the user changine the width or height vs the dialog being
initialized. RelSizeClickHdl() is meant to adjust the other axis in the
user case, and this is not wanted in the init case.

A higher level fix would be to make sure once aspect ratio is kept,
that ratio is stored in documents explicitly, so we can say 50% wide
with e.g. 4:3 ratio, that would avoid all this trouble by even looking
at the calculated sizes when we want to work with percents. This storing
of the aspect ratio is not done here.

Change-Id: I901e7f6d5e6f7f1349d7beeb05985ddbf99a34a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168015
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/qa/uitest/data/keep-aspect-ratio.odt 
b/sw/qa/uitest/data/keep-aspect-ratio.odt
new file mode 100644
index ..2545b34e91f7
Binary files /dev/null and b/sw/qa/uitest/data/keep-aspect-ratio.odt differ
diff --git a/sw/qa/uitest/ui/frmdlg/frmdlg.py b/sw/qa/uitest/ui/frmdlg/frmdlg.py
index aa2d4fba7aff..a37062c1d392 100644
--- a/sw/qa/uitest/ui/frmdlg/frmdlg.py
+++ b/sw/qa/uitest/ui/frmdlg/frmdlg.py
@@ -150,4 +150,24 @@ class Test(UITestCase):
 # complexity.
 self.assertEqual(visible, "false")
 
+def test_keep_aspect_ratio_init(self):
+# Change from inch to pt to hit the rounding error. 6 means Point, see
+# officecfg/registry/schema/org/openoffice/Office/Writer.xcs.
+with 
self.ui_test.set_config('/org.openoffice.Office.Writer/Layout/Other/MeasureUnit',
 6):
+# Given a document with an image, width is relative:
+with 
self.ui_test.load_file(get_url_for_data_file("keep-aspect-ratio.odt")) as 
xComponent:
+xComponent.CurrentController.select(xComponent.DrawPage[0])
+# Wait until SwTextShell is replaced with SwDrawShell after 
120 ms, as set in the SwView
+# ctor.
+time.sleep(0.2)
+# When opening the image properties dialog:
+with 
self.ui_test.execute_dialog_through_command(".uno:FrameDialog") as xDialog:
+xWidth = xDialog.getChild("width")
+frame_width = get_state_as_dict(xWidth)["Value"]
+# Then make sure the width is 48%:
+# Without the accompanying fix in place, this test would have 
failed with:
+# AssertionError: '5' != '48'
+# i.e. the reported size was close to zero instead of ~half of 
the page width.
+self.assertEqual(frame_width, "48")
+
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index 589af7dbb0a0..bd58f2ab7246 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -2182,7 +2182,7 @@ IMPL_LINK( SwFramePage, ModifyHdl, 
weld::MetricSpinButton&, rEdit, void )
 {
 SwTwips nWidth  = static_cast< SwTwips 
>(m_xWidthED->DenormalizePercent(m_xWidthED->get_value(FieldUnit::TWIP)));
 SwTwips nHeight = static_cast< SwTwips 
>(m_xHeightED->DenormalizePercent(m_xHeightED->get_value(FieldUnit::TWIP)));
-if (m_xFixedRatioCB->get_active())
+if (m_xFixedRatioCB->get_active() && !m_bIgnoreFixedRatio)
 {
 if ( == m_xWidthED->get())
 {
@@ -2385,14 +2385,18 @@ void SwFramePage::Init(const SfxItemSet& rSet)
 !m_xRelWidthCB->get_active())
 {
 m_xRelWidthCB->set_active(true);
+m_bIgnoreFixedRatio = true;
 RelSizeClickHdl(*m_xRelWidthCB);
+m_bIgnoreFixedRatio = false;
 m_xWidthED->set_value(rSize.GetWidthPercent(), FieldUnit::PERCENT);
 }
 if (rSize.GetHeightPercent() && rSize.GetHeightPercent() != 
SwFormatFrameSize::SYNCED &&
 

core.git: sw/qa sw/source

2024-05-24 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/paintfrm.cxx |   10 ++
 sw/source/core/layout/paintfrm.cxx |9 -
 2 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 755f3bebd96ec7ae43b1dcf247f907b9c15c1995
Author: Miklos Vajna 
AuthorDate: Fri May 24 10:51:31 2024 +0200
Commit: Miklos Vajna 
CommitDate: Fri May 24 12:36:21 2024 +0200

tdf#160984 sw continuous endnotes: fix the endnote separator length

See
,
Word has a longer separator line for the foot/endnote than Writer for
this bugdoc.

Writer defaults to 25% of the body frame width in the SwPageFootnoteInfo
ctor, and we don't seem to change that in the DOCX import. Word has a
static 2 inches setting, which is only reduced if it would go outside
the body frame.

Fix the problem by extending SwFootnoteContFrame::PaintLine() in the
DocumentSettingId::CONTINUOUS_ENDNOTES case to do the same.

I searched the OOXML spec and the MS implementer notes, they don't
specify this 2 inches length, but it seems static: the value doesn't
change with the page size. With this, the single-section bugdoc is now
rendered fine.

Change-Id: I3bb23680937580179b8d37c940ea14e0f80fc7f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168009
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/qa/core/layout/paintfrm.cxx b/sw/qa/core/layout/paintfrm.cxx
index 8e7154db2501..a5213c57d639 100644
--- a/sw/qa/core/layout/paintfrm.cxx
+++ b/sw/qa/core/layout/paintfrm.cxx
@@ -177,6 +177,16 @@ CPPUNIT_TEST_FIXTURE(Test, 
testInlineEndnoteSeparatorPosition)
 // - Actual  : 2060
 // i.e. the upper spacing was too low.
 CPPUNIT_ASSERT_EQUAL(static_cast(2164), nEndnoteSeparatorY);
+
+// Also make sure the separator length is correct:
+auto nEndnoteSeparatorStart = getXPath(pXmlDoc, "//polygon/point[1]"_ostr, 
"x"_ostr).toInt32();
+auto nEndnoteSeparatorEnd = getXPath(pXmlDoc, "//polygon/point[2]"_ostr, 
"x"_ostr).toInt32();
+sal_Int32 nEndnoteSeparatorLength = nEndnoteSeparatorEnd - 
nEndnoteSeparatorStart;
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 2880
+// - Actual  : 2340
+// i.e. the separator wasn't 2 inches long, but was shorter vs Word.
+CPPUNIT_ASSERT_EQUAL(static_cast(2880), 
nEndnoteSeparatorLength);
 }
 }
 
diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index b139a75094da..a0d5f0d8a629 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -5772,7 +5772,7 @@ void SwFootnoteContFrame::PaintLine( const SwRect& rRect,
 SwTwips nPrtWidth = aRectFnSet.GetWidth(getFramePrintArea());
 Fraction aFract( nPrtWidth, 1 );
 aFract *= rInf.GetWidth();
-const SwTwips nWidth = static_cast(aFract);
+SwTwips nWidth = static_cast(aFract);
 
 SwTwips nX = aRectFnSet.GetPrtLeft(*this);
 switch ( rInf.GetAdj() )
@@ -5803,6 +5803,13 @@ void SwFootnoteContFrame::PaintLine( const SwRect& rRect,
 // Word style: instead of fixed value, upper spacing is 60% of all 
space.
 auto nPrintAreaTop = 
static_cast(getFramePrintArea().Top());
 aPoint.setY(getFrameArea().Pos().Y() + nPrintAreaTop * 0.6);
+
+// Length is 2 inches, but don't paint outside the container frame.
+nWidth = o3tl::convert(2, o3tl::Length::in, o3tl::Length::twip);
+if (nWidth > nPrtWidth)
+{
+nWidth = nPrtWidth;
+}
 }
 oLineRect.emplace(aPoint, Size(nWidth, rInf.GetLineWidth()));
 }


core.git: sw/qa sw/source

2024-05-23 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/paintfrm.cxx |   20 
 sw/source/core/layout/paintfrm.cxx |   27 ---
 2 files changed, 40 insertions(+), 7 deletions(-)

New commits:
commit f1d0b4e34a1f467e9f54baa7ac31ca28fdae3efb
Author: Miklos Vajna 
AuthorDate: Thu May 23 15:31:05 2024 +0200
Commit: Miklos Vajna 
CommitDate: Thu May 23 21:01:31 2024 +0200

tdf#160984 sw continuous endnotes: fix the endnote separator position

See , the
total height of the endnote separator is now correct, but the
distribution of upper space, line width, lower space is still bad, when
compared to Word.

Our model is 2 spacings and a line width, while Word seems to simply
split the amount of available space: 60% goes above the separator and
the rest goes below.

Fix the problem by breaking up the monster expression for the separator
rectangle in SwFootnoteContFrame::PaintLine(), and then the compat +
horizontal case can do the 60% spacing in the Word compat mode.

The width of the separator is still not correct.

Change-Id: Ic065c138041892225b3c1b7d4bd64d4f1c625611
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167990
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/qa/core/layout/paintfrm.cxx b/sw/qa/core/layout/paintfrm.cxx
index b5990648b20f..8e7154db2501 100644
--- a/sw/qa/core/layout/paintfrm.cxx
+++ b/sw/qa/core/layout/paintfrm.cxx
@@ -158,6 +158,26 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitTableMergedBorder)
 // bottom border.
 CPPUNIT_ASSERT_EQUAL(static_cast(2), aHorizontalBorderEnds.size());
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testInlineEndnoteSeparatorPosition)
+{
+// Given a document with a Word-style endnote separator:
+createSwDoc("inline-endnote-position.docx");
+SwDocShell* pDocShell = getSwDocShell();
+
+// When rendering that document:
+std::shared_ptr xMetaFile = pDocShell->GetPreviewMetaFile();
+
+// Then make sure the separator upper spacing is 60% of all space, 
matching Word:
+MetafileXmlDump aDumper;
+xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile);
+auto nEndnoteSeparatorY = getXPath(pXmlDoc, "//polygon/point[1]"_ostr, 
"y"_ostr).toInt32();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 2164
+// - Actual  : 2060
+// i.e. the upper spacing was too low.
+CPPUNIT_ASSERT_EQUAL(static_cast(2164), nEndnoteSeparatorY);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 8c0f4f876847..b139a75094da 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -5788,13 +5788,26 @@ void SwFootnoteContFrame::PaintLine( const SwRect& 
rRect,
 assert(false);
 }
 SwTwips nLineWidth = rInf.GetLineWidth();
-const SwRect aLineRect = aRectFnSet.IsVert() ?
-SwRect( 
Point(getFrameArea().Left()+getFrameArea().Width()-rInf.GetTopDist()-nLineWidth,
-  nX), Size( nLineWidth, nWidth ) )
-: SwRect( Point( nX, getFrameArea().Pos().Y() + rInf.GetTopDist() 
),
-Size( nWidth, rInf.GetLineWidth()));
-if ( aLineRect.HasArea() && rInf.GetLineStyle() != 
SvxBorderLineStyle::NONE)
-PaintBorderLine( rRect, aLineRect , pPage, (),
+std::optional oLineRect;
+if (aRectFnSet.IsVert())
+{
+
oLineRect.emplace(Point(getFrameArea().Left()+getFrameArea().Width()-rInf.GetTopDist()-nLineWidth,
+  nX), Size( nLineWidth, nWidth ) );
+}
+else
+{
+Point aPoint(nX, getFrameArea().Pos().Y() + rInf.GetTopDist());
+const IDocumentSettingAccess& rIDSA = 
GetFormat()->getIDocumentSettingAccess();
+if (rIDSA.get(DocumentSettingId::CONTINUOUS_ENDNOTES))
+{
+// Word style: instead of fixed value, upper spacing is 60% of all 
space.
+auto nPrintAreaTop = 
static_cast(getFramePrintArea().Top());
+aPoint.setY(getFrameArea().Pos().Y() + nPrintAreaTop * 0.6);
+}
+oLineRect.emplace(aPoint, Size(nWidth, rInf.GetLineWidth()));
+}
+if ( oLineRect->HasArea() && rInf.GetLineStyle() != 
SvxBorderLineStyle::NONE)
+PaintBorderLine( rRect, *oLineRect , pPage, (),
 rInf.GetLineStyle() );
 }
 


core.git: sw/qa

2024-05-23 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/rtfexport/rtfexport8.cxx |  540 --
 1 file changed, 322 insertions(+), 218 deletions(-)

New commits:
commit a4ec8307e342bd83e287b197ffac822ac7e9f599
Author: Miklos Vajna 
AuthorDate: Thu May 23 08:06:53 2024 +0200
Commit: Miklos Vajna 
CommitDate: Thu May 23 09:46:38 2024 +0200

CppunitTest_sw_rtfexport8: avoid DECLARE_RTFEXPORT_TEST

No need to go via Writer-specific macros here.

Change-Id: I10256d2cd8d214489b52600ccbb45b0ba1526950
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167979
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/qa/extras/rtfexport/rtfexport8.cxx 
b/sw/qa/extras/rtfexport/rtfexport8.cxx
index e05eb817d07f..33219edcfe9d 100644
--- a/sw/qa/extras/rtfexport/rtfexport8.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport8.cxx
@@ -53,133 +53,191 @@ public:
 }
 };
 
-DECLARE_RTFEXPORT_TEST(testTdf155663, "piccrop.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf155663)
 {
-auto const xShape(getShape(1));
-if (!isExported())
-{
-CPPUNIT_ASSERT_EQUAL(sal_Int32(2004), xShape->getSize().Height);
-CPPUNIT_ASSERT_EQUAL(sal_Int32(2004), xShape->getSize().Width);
-}
-else // bit of rounding loss?
-{
-CPPUNIT_ASSERT_EQUAL(sal_Int32(2013), xShape->getSize().Height);
-CPPUNIT_ASSERT_EQUAL(sal_Int32(2013), xShape->getSize().Width);
-}
-CPPUNIT_ASSERT_EQUAL(sal_Int32(123), 
getProperty(xShape, "GraphicCrop").Top);
-CPPUNIT_ASSERT_EQUAL(sal_Int32(123),
- getProperty(xShape, 
"GraphicCrop").Bottom);
-CPPUNIT_ASSERT_EQUAL(sal_Int32(123),
- getProperty(xShape, 
"GraphicCrop").Left);
-CPPUNIT_ASSERT_EQUAL(sal_Int32(123),
- getProperty(xShape, 
"GraphicCrop").Right);
+auto verify = [this]() {
+auto const xShape(getShape(1));
+if (!isExported())
+{
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2004), xShape->getSize().Height);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2004), xShape->getSize().Width);
+}
+else // bit of rounding loss?
+{
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2013), xShape->getSize().Height);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2013), xShape->getSize().Width);
+}
+CPPUNIT_ASSERT_EQUAL(sal_Int32(123),
+ getProperty(xShape, 
"GraphicCrop").Top);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(123),
+ getProperty(xShape, 
"GraphicCrop").Bottom);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(123),
+ getProperty(xShape, 
"GraphicCrop").Left);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(123),
+ getProperty(xShape, 
"GraphicCrop").Right);
+};
+createSwDoc("piccrop.rtf");
+verify();
+saveAndReload(mpFilter);
+verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf158586_0, "tdf158586_pageBreak0.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf158586_0)
 {
-// The specified page break must be lost because it is in a text frame
-CPPUNIT_ASSERT_EQUAL(1, getPages());
-CPPUNIT_ASSERT_EQUAL(1, getParagraphs());
-
-// There should be no empty paragraph at the start
-xmlDocUniquePtr pLayout = parseLayoutDump();
-assertXPath(pLayout, "//anchored"_ostr, 1);
-assertXPathContent(pLayout, "/root/page[1]/body//txt"_ostr, "First page");
+auto verify = [this]() {
+// The specified page break must be lost because it is in a text frame
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+CPPUNIT_ASSERT_EQUAL(1, getParagraphs());
+
+// There should be no empty paragraph at the start
+xmlDocUniquePtr pLayout = parseLayoutDump();
+assertXPath(pLayout, "//anchored"_ostr, 1);
+assertXPathContent(pLayout, "/root/page[1]/body//txt"_ostr, "First 
page");
+};
+createSwDoc("tdf158586_pageBreak0.rtf");
+verify();
+saveAndReload(mpFilter);
+verify();
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf158586_0B, "tdf158586_pageBreak0B.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf158586_0B)
 {
-// The specified page break must be lost because it is in a text frame
-CPPUNIT_ASSERT_EQUAL(1, getPages());
-CPPUNIT_ASSERT_EQUAL(1, getParagraphs());
-
-// There should be no empty paragraph at the start
-xmlDocUniquePtr pLayout = parseLayoutDump();
-assertXPath(pLayout, "//anchored"_ostr, 1);
-assertXPathContent(pLayout, "/root/page[1]/body//txt"_ostr, "First page");
+auto verify = [this]() {
+// The specified page break must be lost because it is in a text frame
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+CPPUNIT_ASSERT_EQUAL(1, getParagraphs());
+
+// There should be no empty paragraph at the start
+xmlDocUniquePtr pLayout = parseLayoutDump();
+assertXPath(pLayout, "//anchored"_ostr, 1);
+assertXPathContent(pLayout, "/root/page[1]/body//txt"_ostr, "First 
page");
+};

core.git: sw/qa

2024-05-23 Thread Xisco Fauli (via logerrit)
 sw/qa/extras/globalfilter/globalfilter.cxx |4 ++-
 sw/qa/extras/htmlimport/htmlimport.cxx |   12 +
 sw/qa/extras/layout/layout.cxx |1 
 sw/qa/extras/layout/layout2.cxx|7 +
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx |1 
 sw/qa/extras/uiwriter/uiwriter.cxx |2 +
 sw/qa/extras/uiwriter/uiwriter2.cxx|1 
 sw/qa/extras/uiwriter/uiwriter3.cxx|2 +
 sw/qa/extras/uiwriter/uiwriter4.cxx|4 +++
 sw/qa/extras/uiwriter/uiwriter5.cxx|   20 
 sw/qa/extras/uiwriter/uiwriter6.cxx|   18 --
 sw/qa/extras/uiwriter/uiwriter7.cxx|   35 ++---
 sw/qa/extras/uiwriter/uiwriter8.cxx|9 ++-
 sw/qa/extras/ww8import/ww8import.cxx   |1 
 sw/qa/uibase/shells/shells.cxx |5 +++-
 15 files changed, 103 insertions(+), 19 deletions(-)

New commits:
commit 16a56dfccbd3abd01ec370ce611880ad5c2cb8b8
Author: Xisco Fauli 
AuthorDate: Wed May 22 10:45:47 2024 +0200
Commit: Xisco Fauli 
CommitDate: Thu May 23 09:35:31 2024 +0200

sw/qa: warning C6011: Dereferencing NULL pointer

Change-Id: I2e84af9463b82600079660a1b136bc9a85d8eb0d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167925
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx 
b/sw/qa/extras/globalfilter/globalfilter.cxx
index 79b9d71c7265..d4ef7c16fd20 100644
--- a/sw/qa/extras/globalfilter/globalfilter.cxx
+++ b/sw/qa/extras/globalfilter/globalfilter.cxx
@@ -199,7 +199,9 @@ void Test::testLinkedGraphicRT()
 CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
sal_uLong(864900), aGraphic.GetSizeBytes());
 
 // Check if linked graphic is registered in LinkManager
-sfx2::LinkManager& rLinkManager = 
pTextDoc->GetDocShell()->GetDoc()->GetEditShell()->GetLinkManager();
+SwEditShell* const 
pEditShell(pTextDoc->GetDocShell()->GetDoc()->GetEditShell());
+CPPUNIT_ASSERT(pEditShell);
+sfx2::LinkManager& rLinkManager = pEditShell->GetLinkManager();
 CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), size_t(1), 
rLinkManager.GetLinks().size());
 const tools::SvRef & rLink = 
rLinkManager.GetLinks()[0];
 CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), 
rLink->GetLinkSourceName().indexOf("linked_graphic.jpg") >= 0);
diff --git a/sw/qa/extras/htmlimport/htmlimport.cxx 
b/sw/qa/extras/htmlimport/htmlimport.cxx
index e7880c3427e9..74c93ae1d064 100644
--- a/sw/qa/extras/htmlimport/htmlimport.cxx
+++ b/sw/qa/extras/htmlimport/htmlimport.cxx
@@ -49,7 +49,9 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testPictureImport)
 SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get());
 CPPUNIT_ASSERT(pTextDoc);
 // The document contains two pictures stored as a link.
-sfx2::LinkManager& rLinkManager = 
pTextDoc->GetDocShell()->GetDoc()->GetEditShell()->GetLinkManager();
+SwEditShell* const 
pEditShell(pTextDoc->GetDocShell()->GetDoc()->GetEditShell());
+CPPUNIT_ASSERT(pEditShell);
+sfx2::LinkManager& rLinkManager = pEditShell->GetLinkManager();
 CPPUNIT_ASSERT_EQUAL(size_t(2), rLinkManager.GetLinks().size());
 rLinkManager.Remove(0,2);
 CPPUNIT_ASSERT_EQUAL(size_t(0), rLinkManager.GetLinks().size());
@@ -106,8 +108,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, 
testInlinedImagesPageAndParagraph)
 
 // The document contains embedded pictures inlined for PageBackground and
 // ParagraphBackground, check for their existence after import
-SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
-SwEditShell* pEditShell = pDoc->GetEditShell();
+SwEditShell* const 
pEditShell(pTextDoc->GetDocShell()->GetDoc()->GetEditShell());
 CPPUNIT_ASSERT(pEditShell);
 
 // images are not linked, check for zero links
@@ -210,8 +211,9 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testImageWidthAuto)
 createSwWebDoc("image-width-auto.html");
 SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get());
 CPPUNIT_ASSERT(pTextDoc);
-SwTextAttr const*const 
pAttr(pTextDoc->GetDocShell()->GetDoc()->GetEditShell()->
-GetCursor()->GetPointNode().GetTextNode()->GetTextAttrForCharAt(0, 
RES_TXTATR_FLYCNT));
+SwEditShell* const 
pEditShell(pTextDoc->GetDocShell()->GetDoc()->GetEditShell());
+CPPUNIT_ASSERT(pEditShell);
+SwTextAttr const*const 
pAttr(pEditShell->GetCursor()->GetPointNode().GetTextNode()->GetTextAttrForCharAt(0,
 RES_TXTATR_FLYCNT));
 CPPUNIT_ASSERT(pAttr);
 SwFrameFormat const*const pFmt(pAttr->GetFlyCnt().GetFrameFormat());
 SwFormatFrameSize const& rSize(pFmt->GetFormatAttr(RES_FRM_SIZE));
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 95f5eb8a93d2..3fd9a4819da6 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -3490,6 +3490,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf144347)
 
 

core.git: sw/qa sw/source xmloff/qa

2024-05-22 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/data/fly-rel-width-rounding.odt |binary
 sw/qa/core/layout/fly.cxx |   25 ++
 sw/source/core/layout/fly.cxx |5 ++--
 xmloff/qa/unit/text.cxx   |4 +--
 4 files changed, 30 insertions(+), 4 deletions(-)

New commits:
commit 080afd6a345e5dffd924100b5a3ff9c028f5b094
Author: Miklos Vajna 
AuthorDate: Wed May 22 08:47:32 2024 +0200
Commit: Miklos Vajna 
CommitDate: Wed May 22 10:27:36 2024 +0200

Related: tdf#145972 sw images: fix rounding error in relative size 
calculation

Open the bugdoc, see that the image is roughly half of the page width,
right click, properties, UI shows that the width of the image is 5% of
the width of the entire page. This only happens if tools -> options ->
writer -> general sets the UI units to points, the default cm case is
fine.

This went wrong with commit 9e8712ed6f9fb5dbd971e352a5709bd45fadc74f (sw
image dialog: fix fallback width/height for images with relative sizes,
2022-03-17), because the layout size started to matter more after that
commit. This lead to the nWidth !=
m_xWidthED->get_value(FieldUnit::TWIP) check in SwFramePage::Init() to
be true, because 11906 * 0.48 is 5714.88, so you got 5714 in the layout,
but got 5715 with rounding in SwFramePage::Reset() (which tries to calc
the page width based on the 48% and the fly width). And once we had that
mismatch, we went down the wrong path.

Fix the problem by using rtl::math::round() in SwFlyFrame::CalcRel(), so
the relative width twips value is 5715 everywhere: once we have
consisteny, the UI value is correct, too.

Note that the original bugdoc needs more fixing, this just fixes the
bugdoc where KeepRatio is false.

Change-Id: I1e8782c95a0cf9d97375c36d41134735c01f3e46
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167916
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/core/layout/data/fly-rel-width-rounding.odt 
b/sw/qa/core/layout/data/fly-rel-width-rounding.odt
new file mode 100644
index ..b70b9e51a917
Binary files /dev/null and b/sw/qa/core/layout/data/fly-rel-width-rounding.odt 
differ
diff --git a/sw/qa/core/layout/fly.cxx b/sw/qa/core/layout/fly.cxx
index 47cfb40fa6e7..81df20af3b35 100644
--- a/sw/qa/core/layout/fly.cxx
+++ b/sw/qa/core/layout/fly.cxx
@@ -86,6 +86,31 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitFlyNegativeHeight)
 }
 }
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testFlyRelWithRounding)
+{
+// Given a document where page width is 21.001cm (11906 twips), and the 
image width is 48% of
+// the page width:
+createSwDoc("fly-rel-width-rounding.odt");
+
+// When laying out that document:
+SwDoc* pDoc = getSwDoc();
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+
+// Then make sure that we calculate the width of the fly correctly:
+auto pPage = pLayout->GetLower()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage->GetSortedObjs());
+SwSortedObjs& rPageObjs = *pPage->GetSortedObjs();
+CPPUNIT_ASSERT_EQUAL(static_cast(1), rPageObjs.size());
+auto pFly = rPageObjs[0]->DynCastFlyFrame()->DynCastFlyAtContentFrame();
+CPPUNIT_ASSERT(pFly);
+tools::Long nFlyWidth = pFly->getFrameArea().Width();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 5715
+// - Actual  : 5714
+// i.e. 5714.88 was truncated, not rounded.
+CPPUNIT_ASSERT_EQUAL(static_cast(5715), nFlyWidth);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 549681ca7227..a3c9ac84e7c2 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -70,6 +70,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -2845,9 +2846,9 @@ Size SwFlyFrame::CalcRel( const SwFormatFrameSize  ) 
const
 }
 
 if ( rSz.GetWidthPercent() && rSz.GetWidthPercent() != 
SwFormatFrameSize::SYNCED )
-aRet.setWidth( nRelWidth * rSz.GetWidthPercent() / 100 );
+aRet.setWidth(rtl::math::round(double(nRelWidth) * 
rSz.GetWidthPercent() / 100));
 if ( rSz.GetHeightPercent() && rSz.GetHeightPercent() != 
SwFormatFrameSize::SYNCED )
-aRet.setHeight( nRelHeight * rSz.GetHeightPercent() / 100 );
+aRet.setHeight(rtl::math::round(double(nRelHeight) * 
rSz.GetHeightPercent() / 100));
 
 if ( rSz.GetHeight() && rSz.GetWidthPercent() == 
SwFormatFrameSize::SYNCED )
 {
diff --git a/xmloff/qa/unit/text.cxx b/xmloff/qa/unit/text.cxx
index 1679af04bc1f..f95e07e42578 100644
--- a/xmloff/qa/unit/text.cxx
+++ b/xmloff/qa/unit/text.cxx
@@ -508,11 +508,11 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testRelativeWidth)
 
 xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr);

core.git: sw/qa

2024-05-21 Thread Andrea Gelmini (via logerrit)
 sw/qa/extras/uiwriter/uiwriter8.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 0a6f0d7ea70783b10f27c64977d5f34aeac1ef8a
Author: Andrea Gelmini 
AuthorDate: Fri May 17 22:33:10 2024 +0200
Commit: Julien Nabet 
CommitDate: Tue May 21 22:12:33 2024 +0200

Fix typo

Change-Id: Id44f05e97f04bfd624f3fe12dc729659183963d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167800
Reviewed-by: Julien Nabet 
Tested-by: Jenkins

diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx 
b/sw/qa/extras/uiwriter/uiwriter8.cxx
index e1924b16a512..cf65368249af 100644
--- a/sw/qa/extras/uiwriter/uiwriter8.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter8.cxx
@@ -979,7 +979,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, 
testInsertAutoTextIntoListFromParaStyle)
 CPPUNIT_ASSERT_EQUAL(SfxItemState::DEFAULT, 
pSet->GetItemState(RES_MARGIN_TEXTLEFT, false));
 CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, 
pSet->GetItemState(RES_MARGIN_TEXTLEFT, true));
 CPPUNIT_ASSERT_EQUAL(u"ListAndIndents"_ustr, 
rNode.GetTextColl()->GetName());
-CPPUNIT_ASSERT_EQUAL(u"more"_ustr, rNode.GetText()); // pre-exising 
list item
+CPPUNIT_ASSERT_EQUAL(u"more"_ustr, rNode.GetText()); // pre-existing 
list item
 CPPUNIT_ASSERT_EQUAL(pNumRule, rNode.GetNumRule());
 CPPUNIT_ASSERT_EQUAL(pTextLeftMargin->GetTextLeft(),
  rNode.GetAttr(RES_MARGIN_TEXTLEFT).GetTextLeft());


core.git: sw/qa

2024-05-21 Thread Noel Grandin (via logerrit)
 sw/qa/api/SwXAutoTextContainer.cxx|4 ++--
 sw/qa/api/SwXBodyText.cxx |3 ++-
 sw/qa/api/SwXBookmark.cxx |   12 ++--
 sw/qa/api/SwXBookmarks.cxx|   10 +-
 sw/qa/api/SwXChapterNumbering.cxx |4 ++--
 sw/qa/api/SwXDocumentIndex.cxx|   10 +-
 sw/qa/api/SwXDocumentIndexMark.cxx|6 +++---
 sw/qa/api/SwXDocumentIndexes.cxx  |8 
 sw/qa/api/SwXDocumentSettings.cxx |8 +---
 sw/qa/api/SwXFieldEnumeration.cxx |   16 +---
 sw/qa/api/SwXFootnote.cxx |6 +++---
 sw/qa/api/SwXFootnoteProperties.cxx   |5 +++--
 sw/qa/api/SwXFootnoteText.cxx |9 +
 sw/qa/api/SwXFootnotes.cxx|8 
 sw/qa/api/SwXFrames.cxx   |   10 +-
 sw/qa/api/SwXHeadFootText.cxx |   13 +++--
 sw/qa/api/SwXNumberingRules.cxx   |   11 ++-
 sw/qa/api/SwXParagraphEnumeration.cxx |   10 ++
 sw/qa/api/SwXReferenceMark.cxx|   13 +++--
 sw/qa/api/SwXReferenceMarks.cxx   |   16 +---
 sw/qa/api/SwXStyleFamilies.cxx|6 +++---
 sw/qa/api/SwXTableCellText.cxx|   14 +++---
 sw/qa/api/SwXTextEmbeddedObjects.cxx  |   13 +++--
 sw/qa/api/SwXTextField.cxx|   16 
 sw/qa/api/SwXTextFieldMasters.cxx |6 +++---
 sw/qa/api/SwXTextFieldTypes.cxx   |7 ---
 sw/qa/api/SwXTextFrame.cxx|8 
 sw/qa/api/SwXTextSections.cxx |   10 +-
 sw/qa/api/SwXTextTable.cxx|5 +++--
 sw/qa/api/SwXTextTables.cxx   |   14 +++---
 sw/qa/api/terminate.cxx   |4 ++--
 31 files changed, 151 insertions(+), 134 deletions(-)

New commits:
commit 6725ae0d7d6f2d677fbf62bc58bfd83c4418f485
Author: Noel Grandin 
AuthorDate: Tue May 21 12:00:20 2024 +0200
Commit: Noel Grandin 
CommitDate: Tue May 21 15:39:35 2024 +0200

loplugin:ostr in sw/qa/api

Change-Id: Ib8ad745095eceb588e502c44644136d943e79013
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167894
Reviewed-by: Noel Grandin 
Tested-by: Jenkins

diff --git a/sw/qa/api/SwXAutoTextContainer.cxx 
b/sw/qa/api/SwXAutoTextContainer.cxx
index 1f1fc3df1d49..5812e1ec0c44 100644
--- a/sw/qa/api/SwXAutoTextContainer.cxx
+++ b/sw/qa/api/SwXAutoTextContainer.cxx
@@ -35,10 +35,10 @@ class SwXAutoTextContainer final : public UnoApiTest,
 {
 public:
 SwXAutoTextContainer()
-: UnoApiTest("")
+: UnoApiTest(u""_ustr)
 , XElementAccess(cppu::UnoType::get())
 , XIndexAccess(3)
-, XNameAccess("crdbus50")
+, XNameAccess(u"crdbus50"_ustr)
 {
 }
 
diff --git a/sw/qa/api/SwXBodyText.cxx b/sw/qa/api/SwXBodyText.cxx
index 69fb22a959b2..3db54633e441 100644
--- a/sw/qa/api/SwXBodyText.cxx
+++ b/sw/qa/api/SwXBodyText.cxx
@@ -89,7 +89,8 @@ void SwXBodyText::tearDown()
 
 Reference SwXBodyText::init()
 {
-component_ = loadFromDesktop("private:factory/swriter", 
"com.sun.star.text.TextDocument");
+component_
+= loadFromDesktop(u"private:factory/swriter"_ustr, 
u"com.sun.star.text.TextDocument"_ustr);
 Reference xTextDocument(component_, UNO_QUERY_THROW);
 Reference xMSF(component_, UNO_QUERY_THROW);
 
diff --git a/sw/qa/api/SwXBookmark.cxx b/sw/qa/api/SwXBookmark.cxx
index ca6c02d81f8b..3e6bf37eacbb 100644
--- a/sw/qa/api/SwXBookmark.cxx
+++ b/sw/qa/api/SwXBookmark.cxx
@@ -34,8 +34,8 @@ class SwXBookmark final : public UnoApiTest,
 {
 public:
 SwXBookmark()
-: UnoApiTest("")
-, XNamed("Bookmark")
+: UnoApiTest(u""_ustr)
+, XNamed(u"Bookmark"_ustr)
 {
 }
 
@@ -43,7 +43,7 @@ public:
 {
 UnoApiTest::setUp();
 mxDesktop.set(frame::Desktop::create(mxComponentContext));
-mxComponent = loadFromDesktop("private:factory/swriter");
+mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr);
 CPPUNIT_ASSERT(mxComponent.is());
 }
 
@@ -55,13 +55,13 @@ public:
 Reference xText = xTextDocument->getText();
 Reference xCursor = xText->createTextCursor();
 
-Reference 
xBookmark(xMSF->createInstance("com.sun.star.text.Bookmark"),
-UNO_QUERY_THROW);
+Reference xBookmark(
+xMSF->createInstance(u"com.sun.star.text.Bookmark"_ustr), 
UNO_QUERY_THROW);
 
 xText->insertTextContent(xCursor, xBookmark, false);
 mxTextRange = Reference(xCursor, UNO_QUERY_THROW);
 mxTextContent = Reference(
-xMSF->createInstance("com.sun.star.text.Bookmark"), 
UNO_QUERY_THROW);
+xMSF->createInstance(u"com.sun.star.text.Bookmark"_ustr), 
UNO_QUERY_THROW);
 
 return Reference(xBookmark, UNO_QUERY_THROW);
 }
diff --git a/sw/qa/api/SwXBookmarks.cxx b/sw/qa/api/SwXBookmarks.cxx
index 34babbbd3ce8..a3162f0053b6 100644
--- 

core.git: sw/qa sw/source

2024-05-21 Thread Tibor Nagy (via logerrit)
 sw/qa/uitest/writer_tests2/formatBulletsNumbering.py |7 +++
 sw/source/core/doc/docnum.cxx|5 -
 2 files changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 708d619e32f251f06af8e8a057bf802627b81fbd
Author: Tibor Nagy 
AuthorDate: Sat May 18 23:31:56 2024 +0200
Commit: Nagy Tibor 
CommitDate: Tue May 21 11:00:04 2024 +0200

fix crash when push the Bullets button on the toolbar and then press the

dropdown part of the button

caused by commit I40cfc39501006146f7c6c04a1f3c7cf877c6f1c4
(tdf#161056 Show bullets used in document in bullets dropdown)

Change-Id: I215d7cb677825821917a4fd8c498deaaab9fc9b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167838
Tested-by: Jenkins
Reviewed-by: Nagy Tibor 

diff --git a/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py 
b/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py
index b3c5484964d4..abf090f7d16e 100644
--- a/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py
+++ b/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py
@@ -259,4 +259,11 @@ class formatBulletsNumbering(UITestCase):
 
self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "73")
 
 
+   def test_bullets_and_numbering_document_bullet_list(self):
+with self.ui_test.create_doc_in_start_center("writer"):
+self.xUITest.executeCommand(".uno:DefaultBullet")
+# Without the fix in place, this test would have crashed here
+self.xUITest.executeCommand(".uno:DocumentBulletList")
+
+
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index adf0f5b9f699..c4afeac7c50f 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -2534,8 +2534,11 @@ std::vector SwDoc::GetUsedBullets()
 for (int nLevel=0; nLevel<10; ++nLevel)
 {
 const SwNumFormat& rFormat = (*mpNumRuleTable)[nRule]->Get(nLevel);
-if (SVX_NUM_CHAR_SPECIAL != rFormat.GetNumberingType())
+if (SVX_NUM_CHAR_SPECIAL != rFormat.GetNumberingType()
+|| !rFormat.GetBulletFont().has_value())
+{
 continue;
+}
 vcl::Font aFont(*rFormat.GetBulletFont());
 sal_UCS4 cBullet = rFormat.GetBulletChar();
 OUString sBullet(, 1);


core.git: sw/qa sw/source

2024-05-21 Thread Miklos Vajna (via logerrit)
 sw/qa/writerfilter/cppunittests/filter/WriterFilter.cxx  | 
  26 ++
 sw/qa/writerfilter/cppunittests/filter/data/inline-endnote-and-footnote.docx 
|binary
 sw/source/writerfilter/filter/WriterFilter.cxx   | 
   1 
 3 files changed, 27 insertions(+)

New commits:
commit 1ae5ea3f78cca11ba18f2dd1a06f875263336a3b
Author: Miklos Vajna 
AuthorDate: Tue May 21 08:15:53 2024 +0200
Commit: Miklos Vajna 
CommitDate: Tue May 21 10:42:40 2024 +0200

tdf#160984 sw continuous endnotes: enable DOCX import

This was working for DOC already.

For DOCX, this was already enabled once with commit
f9982c24066d6dd2f938cc20176af0f196bc018f (tdf#58521 DOCX import: enable
ContinuousEndnotes compat flag, 2021-07-13), but then it was reverted
later with commit commit eeda1b35a6e87d5349545464da33d997c52f15e3
(Revert "tdf#58521 DOCX import: enable ContinuousEndnotes compat flag",
2021-08-10), because of tdf#143456.

Enable it again, now that the section-based layout seems good enough to
handle larger number of endnotes, e.g. the 48 endnotes from tdf#143456.

Change-Id: Id221f31f9208e84db2c358546d4d6ceea991b6b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167881
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/writerfilter/cppunittests/filter/WriterFilter.cxx 
b/sw/qa/writerfilter/cppunittests/filter/WriterFilter.cxx
index 10b8cab57a45..e084f0fa52ee 100644
--- a/sw/qa/writerfilter/cppunittests/filter/WriterFilter.cxx
+++ b/sw/qa/writerfilter/cppunittests/filter/WriterFilter.cxx
@@ -50,6 +50,32 @@ CPPUNIT_TEST_FIXTURE(Test, testDoNotMirrorRtlDrawObjs)
 // i.e. the shape was on the left margin.
 CPPUNIT_ASSERT_GREATER(nBodyRight, nShapeLeft);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testInlineEndnoteAndFootnoteDOCX)
+{
+// Given a DOCX file with an endnote and then a footnote:
+loadFromFile(u"inline-endnote-and-footnote.docx");
+
+// When laying out that document:
+uno::Reference xModel(mxComponent, uno::UNO_QUERY);
+css::uno::Reference xDumper(xModel->getCurrentController(), 
uno::UNO_QUERY);
+OString aDump = xDumper->dump("layout").toUtf8();
+auto pCharBuffer = reinterpret_cast(aDump.getStr());
+xmlDocUniquePtr pXmlDoc(xmlParseDoc(pCharBuffer));
+
+// Then make sure the footnote is below the endnote:
+// Without the accompanying fix in place, this test would have failed with:
+// - xpath should match exactly 1 node
+// i.e. the endnote was also in the footnote container, not at the end of 
the body text.
+sal_Int32 nEndnoteTop
+= getXPath(pXmlDoc, 
"/root/page/body/section/column/ftncont/ftn/infos/bounds"_ostr,
+   "top"_ostr)
+  .toInt32();
+sal_Int32 nFootnoteTop
+= getXPath(pXmlDoc, "/root/page/ftncont/ftn/infos/bounds"_ostr, 
"top"_ostr).toInt32();
+// Endnote at the end of body text, footnote at page bottom.
+CPPUNIT_ASSERT_LESS(nFootnoteTop, nEndnoteTop);
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git 
a/sw/qa/writerfilter/cppunittests/filter/data/inline-endnote-and-footnote.docx 
b/sw/qa/writerfilter/cppunittests/filter/data/inline-endnote-and-footnote.docx
new file mode 100644
index ..84343b8afa45
Binary files /dev/null and 
b/sw/qa/writerfilter/cppunittests/filter/data/inline-endnote-and-footnote.docx 
differ
diff --git a/sw/source/writerfilter/filter/WriterFilter.cxx 
b/sw/source/writerfilter/filter/WriterFilter.cxx
index 742ae2bbeee2..ee8131f95ae3 100644
--- a/sw/source/writerfilter/filter/WriterFilter.cxx
+++ b/sw/source/writerfilter/filter/WriterFilter.cxx
@@ -333,6 +333,7 @@ void WriterFilter::setTargetDocument(const 
uno::Reference& xDo
 // rely on default for HyphenateURLs=false
 // rely on default for 
APPLY_TEXT_ATTR_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH=true
 xSettings->setPropertyValue("DoNotMirrorRtlDrawObjs", uno::Any(true));
+xSettings->setPropertyValue("ContinuousEndnotes", uno::Any(true));
 }
 
 void WriterFilter::setSourceDocument(const uno::Reference& 
xDoc)


core.git: sw/qa sw/source

2024-05-21 Thread Jaume Pujantell (via logerrit)
 sw/qa/writerfilter/cppunittests/ooxml/data/recursive_header_rels.docx |binary
 sw/qa/writerfilter/cppunittests/ooxml/ooxml.cxx   |7 
+++
 sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx|3 
++-
 sw/source/writerfilter/ooxml/OOXMLDocumentImpl.hxx|2 ++
 4 files changed, 11 insertions(+), 1 deletion(-)

New commits:
commit e39c57022afbe84601f58ef5bae0f12e69d33fc5
Author: Jaume Pujantell 
AuthorDate: Fri May 17 16:44:12 2024 +0200
Commit: Miklos Vajna 
CommitDate: Tue May 21 08:33:10 2024 +0200

writerfilter: avoid infinit loop when resolving embeddings on docx

If a docx file contains a loop on the .rels files for headers and/or footers
the code would enter an infinite recursion while looking for embeddings.

Change-Id: I2122fd6b1677812f561e96a9511a61b0e938e94a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167784
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git 
a/sw/qa/writerfilter/cppunittests/ooxml/data/recursive_header_rels.docx 
b/sw/qa/writerfilter/cppunittests/ooxml/data/recursive_header_rels.docx
new file mode 100644
index ..8000760017ed
Binary files /dev/null and 
b/sw/qa/writerfilter/cppunittests/ooxml/data/recursive_header_rels.docx differ
diff --git a/sw/qa/writerfilter/cppunittests/ooxml/ooxml.cxx 
b/sw/qa/writerfilter/cppunittests/ooxml/ooxml.cxx
index c146560ed352..5cbd9e219449 100644
--- a/sw/qa/writerfilter/cppunittests/ooxml/ooxml.cxx
+++ b/sw/qa/writerfilter/cppunittests/ooxml/ooxml.cxx
@@ -62,6 +62,13 @@ CPPUNIT_TEST_FIXTURE(Test, testFloatingTableLeak)
 CPPUNIT_ASSERT(xParagraph->supportsService("com.sun.star.text.Paragraph"));
 CPPUNIT_ASSERT(!xParaEnum->hasMoreElements());
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testRecursiveHeaderRels)
+{
+// Given a document with self-referencing rels in a header/footer:
+loadFromFile(u"recursive_header_rels.docx");
+// It should not crash/hang on load
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx 
b/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx
index 0530969fbccc..0fdf1b927956 100644
--- a/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx
+++ b/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx
@@ -762,8 +762,9 @@ void OOXMLDocumentImpl::resolveEmbeddingsStream(const 
OOXMLStream::Pointer_t& pS
 {
 importSubStreamRelations(pStream, OOXMLStream::CHARTS);
 }
-if(bHeaderFooterFound)
+if (bHeaderFooterFound && 
!maSeenStreams.contains(customTarget))
 {
+maSeenStreams.insert(customTarget);
 try
 {
 OOXMLStream::Pointer_t Stream = 
OOXMLDocumentFactory::createStream(pStream, streamType);
diff --git a/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.hxx 
b/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.hxx
index 87aae13ab94f..ee8a01972f93 100644
--- a/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.hxx
+++ b/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.hxx
@@ -30,6 +30,7 @@
 
 #include 
 #include 
+#include 
 
 namespace writerfilter::ooxml
 {
@@ -55,6 +56,7 @@ class OOXMLDocumentImpl : public OOXMLDocument
 css::uno::Reference mxEmbeddings;
 css::uno::Sequence < css::beans::PropertyValue > mxEmbeddingsList;
 std::vector m_aEmbeddings;
+std::set maSeenStreams;
 bool mbIsSubstream;
 bool mbSkipImages;
 /// How many paragraphs equal to 1 percent?


core.git: sw/qa sw/source

2024-05-20 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf156105_percentSuffix.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx|7 ++
 sw/source/core/doc/number.cxx |   33 +++---
 3 files changed, 15 insertions(+), 25 deletions(-)

New commits:
commit 65e226aff6a946ae4884b9f5afdccaa1c745bcd4
Author: Justin Luth 
AuthorDate: Fri May 17 12:17:26 2024 -0400
Commit: Justin Luth 
CommitDate: Mon May 20 15:40:38 2024 +0200

tdf#156105 sw: trust SvxNumberFormat GetPrefix/GetSuffix

After LO 7.4 (backported to 7.2.5) created this
function that manually identifies the Prefix/Suffix,
there was some work done to ensure
GetPrefix and GetSuffix were trustworthy in
LO 7.5's commit 835cda561217bd8c53af2de927158dd5712b06c0
Author: Justin Luth on Tue Aug 2 13:30:31 2022 -0400
related tdf#150197: use SetListFormat or SetPrefix/Suffix
GetListFormat DEPENDS on having managed prefix/suffix itself...

So, lets make sure we use and fix these functions in only one place.

make CppunitTest_sw_ooxmlexport21 \
CPPUNIT_TEST_NAME=testTdf156105_percentSuffix

Change-Id: I44c021a200ba45960e39983087c6af268751fbc1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167792
Reviewed-by: Justin Luth 
Reviewed-by: Vasily Melenchuk 
Tested-by: Jenkins

diff --git a/sw/qa/extras/ooxmlexport/data/tdf156105_percentSuffix.odt 
b/sw/qa/extras/ooxmlexport/data/tdf156105_percentSuffix.odt
new file mode 100644
index ..a5319f7a9522
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf156105_percentSuffix.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index 01c42d0ea34d..6cfbe8d783fc 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -293,6 +293,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf158597, "tdf158597.docx")
 }
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf156105_percentSuffix, 
"tdf156105_percentSuffix.odt")
+{
+// given a numbered list with a non-escaping percent symbol in the prefix 
and suffix
+CPPUNIT_ASSERT_EQUAL(OUString("(%)[%]"),
+ getProperty(getParagraph(3), 
"ListLabelString"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMarginVML, 
"tdf160049_anchorMarginVML.docx")
 {
 // given a VML (Word 2003) document with a LEFT "column/text" anchored 
image
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index c92d2af29a7d..f43ab140b60d 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -721,32 +721,15 @@ OUString SwNumRule::MakeNumString( const 
SwNumberTree::tNumberVector & rNumVecto
 
 if (rMyNFormat.GetNumberingType() == SVX_NUM_NUMBER_NONE)
 {
-if (!rMyNFormat.HasListFormat()) {
-OUString sRet = bInclStrings ? rMyNFormat.GetPrefix() + 
rMyNFormat.GetSuffix() : OUString();
-StripNonDelimiter(sRet);
-return sRet;
-}
-
-// If numbering is disabled for this level we should emit just 
prefix/suffix
-// Remove everything between first %1% and last %n% (including markers)
-OUString sLevelFormat = rMyNFormat.GetListFormat(bInclStrings && 
!bHideNonNumerical);
-
-if (bInclStrings && bHideNonNumerical) {
-// If hiding non numerical text, we need to strip the prefix and 
suffix properly, so let's add them manually
-OUString sPrefix = rMyNFormat.GetPrefix();
-OUString sSuffix = rMyNFormat.GetSuffix();
+// since numbering is disabled for this level,
+// only emit prefix/suffix (unless they are not wanted either)
+if (!bInclStrings)
+return OUString();
 
-StripNonDelimiter(sPrefix);
-StripNonDelimiter(sSuffix);
-
-sLevelFormat = sPrefix + sLevelFormat + sSuffix;
-}
-
-sal_Int32 nFirstPosition = sLevelFormat.indexOf("%");
-sal_Int32 nLastPosition = sLevelFormat.lastIndexOf("%");
-if (nFirstPosition >= 0 && nLastPosition >= nFirstPosition)
-sLevelFormat = sLevelFormat.replaceAt(nFirstPosition, 
nLastPosition - nFirstPosition + 1, u"");
-return sLevelFormat;
+OUString sRet = rMyNFormat.GetPrefix() + rMyNFormat.GetSuffix();
+if (bHideNonNumerical)
+StripNonDelimiter(sRet);
+return sRet;
 }
 
 css::lang::Locale aLocale( LanguageTag::convertToLocale(nLang));


core.git: sw/qa sw/source

2024-05-19 Thread Mike Kaganski (via logerrit)
 sw/qa/extras/uiwriter/data/tdf161172.fodt |   35 +
 sw/qa/extras/uiwriter/uiwriter9.cxx   |   41 ++
 sw/source/core/doc/docfmt.cxx |   10 ++-
 3 files changed, 80 insertions(+), 6 deletions(-)

New commits:
commit bb5740bb4c79c6c9507d4dc127e9f4bac78afc2f
Author: Mike Kaganski 
AuthorDate: Sun May 19 13:40:49 2024 +0500
Commit: Mike Kaganski 
CommitDate: Sun May 19 12:36:09 2024 +0200

tdf#161172: Also record history for !bChangeOfListStyleAtParagraph

Change-Id: I6443d7ef76a27ac3ab75f88edd271a8b36e06c14
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167839
Reviewed-by: Mike Kaganski 
Tested-by: Jenkins

diff --git a/sw/qa/extras/uiwriter/data/tdf161172.fodt 
b/sw/qa/extras/uiwriter/data/tdf161172.fodt
new file mode 100644
index ..08cea575cc60
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf161172.fodt
@@ -0,0 +1,35 @@
+
+
+
+ 
+  
+  
+  
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+  
+ 
+ 
+  
+ 
+ 
+  
+ 
+ 
+  
+   
+
+ foo
+
+   
+  
+ 
+
\ No newline at end of file
diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx 
b/sw/qa/extras/uiwriter/uiwriter9.cxx
index d8b10279a827..a0918742a438 100644
--- a/sw/qa/extras/uiwriter/uiwriter9.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter9.cxx
@@ -607,6 +607,47 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf160898)
 pWrtShell->SelAll();
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf161172)
+{
+// Given a paragraph manually made a member of a list:
+createSwDoc("tdf161172.fodt");
+auto para = getParagraph(1);
+
+// Check initial state: the first paragraph has "No_list" para style, 
"Num_1" numbering style,
+// numbering level 0, and "Num1_lvl1_1" numbering label.
+CPPUNIT_ASSERT_EQUAL(u"No_list"_ustr, getProperty(para, 
u"ParaStyleName"_ustr));
+CPPUNIT_ASSERT_EQUAL(u"Num_1"_ustr, getProperty(para, 
u"NumberingStyleName"_ustr));
+CPPUNIT_ASSERT_EQUAL(u"Num1_lvl1_1"_ustr, getProperty(para, 
u"ListLabelString"_ustr));
+CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty(para, 
u"NumberingLevel"_ustr));
+
+// Assign "Num_1_lvl2" paragraph style to the first paragraph. The style 
is associated with
+// "Num_1" numbering style, level 1.
+dispatchCommand(mxComponent, u".uno:StyleApply"_ustr,
+{ comphelper::makePropertyValue(u"FamilyName"_ustr, 
u"ParagraphStyles"_ustr),
+  comphelper::makePropertyValue(u"Style"_ustr, 
u"Num_1_lvl2"_ustr) });
+
+// Check that the respective properties got correctly applied
+CPPUNIT_ASSERT_EQUAL(u"Num_1_lvl2"_ustr, getProperty(para, 
u"ParaStyleName"_ustr));
+CPPUNIT_ASSERT_EQUAL(u"Num_1"_ustr, getProperty(para, 
u"NumberingStyleName"_ustr));
+CPPUNIT_ASSERT_EQUAL(u"Num1_lvl2_1"_ustr, getProperty(para, 
u"ListLabelString"_ustr));
+CPPUNIT_ASSERT_EQUAL(sal_Int16(1), getProperty(para, 
u"NumberingLevel"_ustr));
+
+// Undo
+dispatchCommand(mxComponent, u".uno:Undo"_ustr, {});
+
+// Check that the numbering properties got correctly restored
+CPPUNIT_ASSERT_EQUAL(u"No_list"_ustr, getProperty(para, 
u"ParaStyleName"_ustr));
+CPPUNIT_ASSERT_EQUAL(u"Num_1"_ustr, getProperty(para, 
u"NumberingStyleName"_ustr));
+// Without the fix, this would fail with
+// - Expected: Num1_lvl1_1
+// - Actual  : Num1_lvl2_1
+CPPUNIT_ASSERT_EQUAL(u"Num1_lvl1_1"_ustr, getProperty(para, 
u"ListLabelString"_ustr));
+// Without the fix, this would fail with
+// - Expected: 0
+// - Actual  : 1
+CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty(para, 
u"NumberingLevel"_ustr));
+}
+
 } // end of anonymous namespace
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 6690ae418831..722d3dba8c0d 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1046,14 +1046,12 @@ static bool lcl_SetTextFormatColl( SwNode* pNode, void* 
pArgs )
 }
 }
 
+std::optional oRegH;
+if (pPara->pHistory)
+oRegH.emplace(, rTNd, pPara->pHistory);
+
 if ( bChangeOfListStyleAtParagraph )
 {
-std::unique_ptr< SwRegHistory > pRegH;
-if ( pPara->pHistory )
-{
-pRegH.reset(new SwRegHistory(, rTNd, 
pPara->pHistory));
-}
-
 pCNd->ResetAttr( RES_PARATR_NUMRULE );
 
 // reset all list attributes


  1   2   3   4   5   6   7   8   9   10   >