[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-09-20 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/data/tdf147507.fodt |   77 ++
 sw/qa/extras/uiwriter/uiwriter2.cxx   |   19 +++
 sw/source/core/doc/docredln.cxx   |6 +-
 3 files changed, 101 insertions(+), 1 deletion(-)

New commits:
commit 139e95a317441867e8ca564aea36a47061ec8765
Author: László Németh 
AuthorDate: Mon Sep 19 11:24:19 2022 +0200
Commit: Xisco Fauli 
CommitDate: Tue Sep 20 08:39:57 2022 +0200

tdf#147507 sw: fix crash with Reject All around not content nodes

Regression from commit f3bec764ddbf3fd3ae986f034c89626bf22940e0
"tdf144058 sw track changes: fix table deletion at paragraph join".

Conflicts:
sw/source/core/doc/docredln.cxx

(chrery-picked from commit 7462f728df54c28cea659dbf9aa92070019b489f)

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

diff --git a/sw/qa/extras/uiwriter/data/tdf147507.fodt 
b/sw/qa/extras/uiwriter/data/tdf147507.fodt
new file mode 100644
index ..bd579a4b85c7
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf147507.fodt
@@ -0,0 +1,77 @@
+
+http://www.w3.org/1999/xlink; 
xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle: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:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d: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:config="urn:oas
 is:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:officeooo="http://openoffice.org/2009/office; 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:formx="urn:openoffice:names:
 experimental:ooxml-odf-interop:xmlns:form:1.0" 
xmlns:css3t="http://www.w3.org/TR/css3-text/; office:version="1.2" 
office:mimetype="application/vnd.oasis.opendocument.text">
+ 
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+
+   
+   
+
+   
+   
+
+   
+  
+  
+   
+  
+ 
+ 
+  
+   
+
+ 
+  
+   Author
+   2004-01-12T03:00:00
+  
+ 
+
+
+ 
+  
+   Author
+   2004-01-05T21:45:00
+  
+ 
+
+   
+   a
+   
+   
+
+
+
+ 
+  
+ 
+ 
+  
+ 
+
+   
+   s
+  
+ 
+
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index f4f8cd679a7e..fa80a05ff247 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -2070,6 +2070,25 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf144058)
 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xTables->getCount());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf147507)
+{
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf147507.fodt");
+
+// turn on red-lining and show changes
+pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | 
RedlineFlags::ShowDelete
+  | 
RedlineFlags::ShowInsert);
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+CPPUNIT_ASSERT_MESSAGE(
+"redlines should be visible",
+
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+// select all, backspace and reject all crashed
+dispatchCommand(mxComponent, ".uno:SelectAll", {});
+dispatchCommand(mxComponent, ".uno:SwBackSpace", {});
+dispatchCommand(mxComponent, ".uno:RejectAllTrackedChanges", {});
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf119019)
 {
 // check handling of overlapping redlines
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index c6d469678fa3..d95551f543f3 100644
--- a/sw/source/core/doc/docredln.cxx
+++ 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source xmloff/source

2022-09-15 Thread Mike Kaganski (via logerrit)
 sw/qa/extras/odfexport/data/table-in-frame-in-table-in-header-base.odt |binary
 sw/qa/extras/odfexport/odfexport.cxx   |   14 
+++
 sw/source/filter/xml/xmltble.cxx   |   40 
++
 sw/source/filter/xml/xmltexte.hxx  |4 +
 xmloff/source/text/txtparae.cxx|3 
 5 files changed, 45 insertions(+), 16 deletions(-)

New commits:
commit c43b50bf027def7054bc15187d61d61d9b132bd7
Author: Mike Kaganski 
AuthorDate: Tue Sep 13 20:42:22 2022 +0300
Commit: Xisco Fauli 
CommitDate: Thu Sep 15 10:09:43 2022 +0200

tdf#150927: properly handle nesting in tables

This re-implements the relevant part of commit
35021cd56b3b4e38035804087f215c80085564be, to follow the same
recursion logic that is used in SwXMLExport::ExportTable.

Additionally, it found a place where XML was still emitted
when collecting autostyles (breaks were exported); fixed.

Change-Id: I3b7eed06e0eca9ad20304b45db4c3e9d72478c9b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139901
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit 58cb4fc7d17ae5b339c5ed6ae139e6ef2433c927)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139843
Reviewed-by: Xisco Fauli 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139930

diff --git 
a/sw/qa/extras/odfexport/data/table-in-frame-in-table-in-header-base.odt 
b/sw/qa/extras/odfexport/data/table-in-frame-in-table-in-header-base.odt
new file mode 100644
index ..44dbf0bdec69
Binary files /dev/null and 
b/sw/qa/extras/odfexport/data/table-in-frame-in-table-in-header-base.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx 
b/sw/qa/extras/odfexport/odfexport.cxx
index a907a3981cce..d57712f593bc 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -3154,6 +3154,20 @@ DECLARE_ODFEXPORT_EXPORTONLY_TEST(tdf135942, 
"nestedTableInFooter.odt")
 assertXPath(pXmlDoc, 
"/office:document-styles/office:automatic-styles/style:style[@style:family='table']",
 2);
 }
 
+CPPUNIT_TEST_FIXTURE(Test, tdf150927)
+{
+// Similar to tdf135942
+
+loadAndReload("table-in-frame-in-table-in-header-base.odt");
+// All table autostyles should be collected, including nested, and must 
not crash.
+
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+xmlDocUniquePtr pXmlDoc = parseExport("styles.xml");
+
+assertXPath(pXmlDoc, 
"/office:document-styles/office:automatic-styles/style:style[@style:family='table']",
 2);
+}
+
 DECLARE_ODFEXPORT_TEST(testGutterLeft, "gutter-left.odt")
 {
 CPPUNIT_ASSERT_EQUAL(1, getPages());
diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx
index 3655949f522c..fae84d9be2c8 100644
--- a/sw/source/filter/xml/xmltble.cxx
+++ b/sw/source/filter/xml/xmltble.cxx
@@ -1209,6 +1209,30 @@ void SwXMLTextParagraphExport::exportTableAutoStyles() {
 }
 }
 
+void SwXMLTextParagraphExport::CollectTableLinesAutoStyles(const SwTableLines& 
rLines,
+   SwFrameFormat& 
rFormat, bool _bProgress)
+{
+// Follow SwXMLExport::ExportTableLines/ExportTableLine/ExportTableBox
+for (const SwTableLine* pLine : rLines)
+{
+for (SwTableBox* pBox : pLine->GetTabBoxes())
+{
+if (pBox->getRowSpan() <= 0)
+continue;
+if (pBox->GetSttNd())
+{
+if (rtl::Reference xCell = 
SwXCell::CreateXCell(, pBox))
+exportText(xCell, true /*bAutoStyles*/, _bProgress, true 
/*bExportParagraph*/);
+}
+else
+{
+// no start node -> merged cells: export subtable in cell
+CollectTableLinesAutoStyles(pBox->GetTabLines(), rFormat, 
_bProgress);
+}
+}
+}
+}
+
 void SwXMLTextParagraphExport::exportTable(
 const Reference < XTextContent > & rTextContent,
 bool bAutoStyles, bool _bProgress )
@@ -1245,21 +1269,7 @@ void SwXMLTextParagraphExport::exportTable(
 maTableNodes.push_back(pTableNd);
 m_TableFormats.emplace(pTableNd, 
::std::make_pair(SwXMLTextParagraphExport::FormatMap(), 
SwXMLTextParagraphExport::FormatMap()));
 // Collect all tables inside cells of this table, too
-const auto aCellNames = pXTable->getCellNames();
-for (const OUString& rCellName : aCellNames)
-{
-
css::uno::Reference xCell(
-pXTable->getCellByName(rCellName), 
css::uno::UNO_QUERY);
-if (!xCell)
-continue;
-auto xEnumeration = xCell->createEnumeration();
-while 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-09-05 Thread Vasily Melenchuk (via logerrit)
 sw/qa/extras/htmlexport/htmlexport.cxx |   57 +
 sw/source/filter/html/wrthtml.cxx  |3 +
 2 files changed, 59 insertions(+), 1 deletion(-)

New commits:
commit f5003b9b1b44a16e28b1c3080d11347e5b365e1e
Author: Vasily Melenchuk 
AuthorDate: Fri Aug 26 16:32:57 2022 +0300
Commit: Xisco Fauli 
CommitDate: Mon Sep 5 14:44:07 2022 +0200

tdf#114769: sw html export: better handling for relative URLs

Usage of INetURLObject makes sense only in case of full URLs,
but once relative one is provided it will contain invalid data.

Change-Id: Icc5e191e2337a3dd9a76c660b1c7709551099a1a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138875
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 
(cherry picked from commit 599da3fa69805ebf8dee4517855fd8706e19d11d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138979
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139409

diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index cc30027f906d..51af126b9bb1 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -2237,6 +2237,63 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testImageKeepRatio)
 assertXPath(pDoc, "/html/body/p/img", "height", "auto");
 }
 
+CPPUNIT_TEST_FIXTURE(HtmlExportTest, testTdf114769)
+{
+// Create document from scratch since relative urls to filesystem can be 
replaced
+// by absolute during save/load
+SwDoc* pDoc = createSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+pWrtShell->Insert("Hyperlink1");
+pWrtShell->SplitNode();
+pWrtShell->Insert("Hyperlink2");
+pWrtShell->SplitNode();
+pWrtShell->Insert("Hyperlink3");
+pWrtShell->SplitNode();
+pWrtShell->Insert("Hyperlink4");
+pWrtShell->SplitNode();
+pWrtShell->Insert("Hyperlink5");
+pWrtShell->SplitNode();
+
+// Normal external URL
+uno::Reference xRun(getRun(getParagraph(1), 1), 
uno::UNO_QUERY);
+xRun->setPropertyValue("HyperLinkURL", 
uno::Any(OUString("http://libreoffice.org/;)));
+
+// Bookmark reference
+xRun.set(getRun(getParagraph(2), 1), uno::UNO_QUERY);
+xRun->setPropertyValue("HyperLinkURL", 
uno::Any(OUString("#some_bookmark")));
+
+// Filesystem absolute link
+xRun.set(getRun(getParagraph(3), 1), uno::UNO_QUERY);
+xRun->setPropertyValue("HyperLinkURL", uno::Any(OUString("C:\\test.txt")));
+
+// Filesystem relative link
+xRun.set(getRun(getParagraph(4), 1), uno::UNO_QUERY);
+xRun->setPropertyValue("HyperLinkURL", 
uno::Any(OUString("..\\..\\test.odt")));
+
+// Filesystem relative link
+xRun.set(getRun(getParagraph(5), 1), uno::UNO_QUERY);
+xRun->setPropertyValue("HyperLinkURL", 
uno::Any(OUString(".\\another.odt")));
+
+// Export
+uno::Reference xStorable(mxComponent, uno::UNO_QUERY);
+uno::Sequence aStoreProperties
+= { comphelper::makePropertyValue("FilterName", OUString("HTML 
(StarWriter)")) };
+xStorable->storeToURL(maTempFile.GetURL(), aStoreProperties);
+
+htmlDocUniquePtr pHtmlDoc = parseHtml(maTempFile);
+CPPUNIT_ASSERT(pHtmlDoc);
+
+CPPUNIT_ASSERT_EQUAL(OUString("http://libreoffice.org/;),
+ getXPath(pHtmlDoc, "/html/body/p[1]/a", "href"));
+CPPUNIT_ASSERT_EQUAL(OUString("#some_bookmark"),
+ getXPath(pHtmlDoc, "/html/body/p[2]/a", "href"));
+CPPUNIT_ASSERT_EQUAL(OUString("C:\\test.txt"), getXPath(pHtmlDoc, 
"/html/body/p[3]/a", "href"));
+CPPUNIT_ASSERT_EQUAL(OUString("..\\..\\test.odt"),
+ getXPath(pHtmlDoc, "/html/body/p[4]/a", "href"));
+CPPUNIT_ASSERT_EQUAL(OUString(".\\another.odt"),
+ getXPath(pHtmlDoc, "/html/body/p[5]/a", "href"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/wrthtml.cxx 
b/sw/source/filter/html/wrthtml.cxx
index df4cef472ca2..0dafeb86c8d1 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -1266,7 +1266,8 @@ OUString SwHTMLWriter::convertHyperlinkHRefValue(const 
OUString& rURL)
 {
 // Link is not started from "#", so looks like external link. Encode 
this URL.
 INetURLObject aURL(sURL);
-sURL = aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
+if (!aURL.HasError())
+sURL = aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
 }
 return URIHelper::simpleNormalizedMakeRelative( GetBaseURL(), sURL );
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source writerfilter/source

2022-08-04 Thread Vasily Melenchuk (via logerrit)
 sw/qa/extras/odfexport/odfexport.cxx  |6 +-
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx|4 -
 sw/source/core/doc/doclay.cxx |   11 +++-
 sw/source/core/doc/textboxhelper.cxx  |3 -
 sw/source/core/unocore/unotext.cxx|   21 +++--
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   49 +++---
 writerfilter/source/dmapper/GraphicImport.cxx |   11 ++--
 7 files changed, 61 insertions(+), 44 deletions(-)

New commits:
commit 679e3e050e4b08bfad335b86d23572518d82ff34
Author: Vasily Melenchuk 
AuthorDate: Mon Dec 27 13:54:23 2021 +0300
Commit: Thorsten Behrens 
CommitDate: Fri Aug 5 01:26:34 2022 +0200

tdf#143703 sw: always assign name for fly section

Previously generated name was assigned only if not in doc
reading mode. But there is no guarantee that it will be assigned
later. Better to insert any name in SwDoc::MakeFlySection_() and
later it can be overwritten, but fly will definitely have
any unique name.

* Some test failed because GraphicImport_Impl::applyName() overwrote the
  name with a different generated one.

* This breaks chaining of VML shapes, see test testTDF87348.

  The code introduced in commit 091fe76b6329b4bb974987554369cbfadd8f2401
  in DomainMapper_Impl::ChainTextFrames() breaks if the text frame
  already has a name; it's a bit confusing which names there come from
  the file and which come from the API, and it also mixes 2 different
  cases of VML chaining and DrawingML chaining that look like they
  should be using different data.

* This also breaks moving flys anchored at-char in flys into them in
  SwXText::convertToTextFrame(), see ooxmlexport13 testFlyInFly.

  This kind of worked by accident before: the fly is copied and then the
  original deleted, keeping the same name (with help of
  SwDoc::mbCopyIsMove); with no name it would compare the SdrObject
  pointer, which is different for the new copy, now the name is the
  same.

  Fix this by only moving flys anchored at the edge of the selection
  back inoto the body; it turns out that Word actually supports at-char
  anchors in text frames, but only if it's a VML shape or Compatibility
  Mode or whatever; i wasn't able to do it in a document created from
  scratch.

  This is a bit tricky to ignore the nodes added for floating tables as
  seen in ooxmlexport10 testFloatingTablesAnchor.

* Another change is required in SwDoc::SetFlyName() because of
  testTdf127732, as it would rename a frame named "Frame1" to "Frame2"
  when called to rename it to "Frame1".

* Some tests failed because after MakeFlySection_() assigns a name it is
  immediately unconditionally overwritten; replace that with asserts

Change-Id: I46752a4413ba3a9e981eccd1e153b3aaf8053781
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127556
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 4d6243693c228703394c00164276f8326447beb9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137764
Reviewed-by: Thorsten Behrens 

diff --git a/sw/qa/extras/odfexport/odfexport.cxx 
b/sw/qa/extras/odfexport/odfexport.cxx
index 87e2aead4997..a907a3981cce 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -941,7 +941,7 @@ DECLARE_ODFEXPORT_TEST(testTdf134987, "tdf134987.docx")
 OUString aMediaType;
 // checking first object (formula)
 {
-uno::Reference 
xEOSupplier(xAccess->getByName("1"), uno::UNO_QUERY);
+uno::Reference 
xEOSupplier(xAccess->getByName("Object1"), uno::UNO_QUERY);
 uno::Reference 
xObj(xEOSupplier->getEmbeddedObject());
 CPPUNIT_ASSERT(xObj.is());
 
@@ -955,7 +955,7 @@ DECLARE_ODFEXPORT_TEST(testTdf134987, "tdf134987.docx")
 }
 // checking second object (chart)
 {
-uno::Reference 
xEOSupplier(xAccess->getByName("2"), uno::UNO_QUERY);
+uno::Reference 
xEOSupplier(xAccess->getByName("Object2"), uno::UNO_QUERY);
 uno::Reference 
xObj(xEOSupplier->getEmbeddedObject());
 CPPUNIT_ASSERT(xObj.is());
 
@@ -969,7 +969,7 @@ DECLARE_ODFEXPORT_TEST(testTdf134987, "tdf134987.docx")
 }
 // checking third object (chart)
 {
-uno::Reference 
xEOSupplier(xAccess->getByName("3"), uno::UNO_QUERY);
+uno::Reference 
xEOSupplier(xAccess->getByName("Object3"), uno::UNO_QUERY);
 uno::Reference 
xObj(xEOSupplier->getEmbeddedObject());
 CPPUNIT_ASSERT(xObj.is());
 
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index 609d3f7f30b6..045c1e1d405b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -58,11 +58,11 @@ DECLARE_SW_EXPORT_TEST(testFlyInFly, 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-07-19 Thread Attila Bakos (NISZ) (via logerrit)
 sw/qa/extras/uiwriter/data/tdf142715.odt |binary
 sw/qa/extras/uiwriter/uiwriter3.cxx  |   34 +++
 sw/source/core/doc/textboxhelper.cxx |   13 +--
 3 files changed, 36 insertions(+), 11 deletions(-)

New commits:
commit 8e75da583db160b15ca55d74b3a2c64b1d034e33
Author: Attila Bakos (NISZ) 
AuthorDate: Thu Jun 30 15:48:07 2022 +0200
Commit: Xisco Fauli 
CommitDate: Tue Jul 19 09:45:44 2022 +0200

tdf#142715 sw: fix crash on exit when textbox inserted to table

This reverts commit 06e2cbb31d0ea703df872b91eb8eacdcaced7653
"tdf#130805 SwTextBoxHelper::create: fix frame position in shape"
which caused this regression. That fix is not necessary any more: 
synchronization does the same without crashing.

Note: according to this, unit test of commit 
06e2cbb31d0ea703df872b91eb8eacdcaced7653 wasn't removed.

Change-Id: I45bc15d3cf6a5d93b8c54cb4e68018702e58efff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136674
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 9188d7389c06496905c351a936b85974c1ae516f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136982
Tested-by: Jenkins
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137047

diff --git a/sw/qa/extras/uiwriter/data/tdf142715.odt 
b/sw/qa/extras/uiwriter/data/tdf142715.odt
new file mode 100644
index ..70682a54056c
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf142715.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 068a14113a0b..d4175ccc93a5 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -3920,6 +3921,39 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf103612)
 "Text after section");
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testCrashOnExit)
+{
+// Load the bugdoc with a table and a textbox shape inside.
+CPPUNIT_ASSERT(createSwDoc(DATA_DIRECTORY, "tdf142715.odt"));
+// Get the textbox selected
+CPPUNIT_ASSERT_EQUAL(1, getShapes());
+auto xShape = getShape(1);
+CPPUNIT_ASSERT(xShape);
+uno::Reference xModel(mxComponent, uno::UNO_QUERY);
+CPPUNIT_ASSERT(xModel);
+uno::Reference xController = 
xModel->getCurrentController();
+CPPUNIT_ASSERT(xController);
+uno::Reference xSelection(xController, 
uno::UNO_QUERY);
+CPPUNIT_ASSERT(xSelection);
+CPPUNIT_ASSERT(xSelection->select(uno::Any(xShape)));
+CPPUNIT_ASSERT(xSelection->getSelection().hasValue());
+uno::Reference xProperties(xShape, uno::UNO_QUERY);
+// Check if the textbox is selected
+CPPUNIT_ASSERT_EQUAL(true, 
xProperties->getPropertyValue("TextBox").get());
+// Remove the textbox
+dispatchCommand(mxComponent, ".uno:RemoveTextBox", {});
+Scheduler::ProcessEventsToIdle();
+CPPUNIT_ASSERT_EQUAL(false, 
xProperties->getPropertyValue("TextBox").get());
+// Readd the textbox (to run the textboxhelper::create() method)
+dispatchCommand(mxComponent, ".uno:AddTextBox", {});
+Scheduler::ProcessEventsToIdle();
+CPPUNIT_ASSERT_EQUAL(true, 
xProperties->getPropertyValue("TextBox").get());
+// save and reload
+reload("writer8", "tdf142715_.odt");
+// Before the fix this crashed here and could not reopen.
+CPPUNIT_ASSERT_MESSAGE("Crash on exit, isn't it?", mxComponent);
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf97899)
 {
 SwDoc* pDoc = createSwDoc();
diff --git a/sw/source/core/doc/textboxhelper.cxx 
b/sw/source/core/doc/textboxhelper.cxx
index 418c69927228..413424cb93b0 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -93,17 +93,8 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape, 
SdrObject* pObject, bool bCo
 pShape->GetDoc()->GetDocShell()->GetBaseModel(), uno::UNO_QUERY);
 uno::Reference 
xTextContentAppend(xTextDocument->getText(),
 
uno::UNO_QUERY);
-try
-{
-uno::Reference XSourceShape(pObject->getUnoShape(),
-uno::UNO_QUERY_THROW);
-xTextContentAppend->insertTextContentWithProperties(
-xTextFrame, uno::Sequence(), 
XSourceShape->getAnchor());
-}
-catch (uno::Exception&)
-{
-xTextContentAppend->appendTextContent(xTextFrame, 
uno::Sequence());
-}
+xTextContentAppend->appendTextContent(xTextFrame, 
uno::Sequence());
+
 // Link FLY and DRAW formats, so it becomes a text box (needed for 
syncProperty calls).
 uno::Reference xRealTextFrame(xTextFrame, 
uno::UNO_QUERY);
 auto pTextFrame = dynamic_cast(xRealTextFrame.get());


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-07-14 Thread Michael Stahl (via logerrit)
 sw/qa/extras/odfimport/data/tdf149978.fodt |   53 +
 sw/qa/extras/odfimport/odfimport.cxx   |   12 ++
 sw/source/core/txtnode/thints.cxx  |9 ++--
 3 files changed, 69 insertions(+), 5 deletions(-)

New commits:
commit 7a8f2c7e3a16dae6bdc891fb969e673527e45615
Author: Michael Stahl 
AuthorDate: Wed Jul 13 16:11:29 2022 +0200
Commit: Thorsten Behrens 
CommitDate: Thu Jul 14 23:04:18 2022 +0200

tdf#149978 sw: ODF import: fix nondeterministic automatic styles

The problem is that in SwpHints::TryInsertHint() there is a check for
IsInXMLImport() that is presumably an optimization to avoid the
potentially expensive call to BuildPortions().

While LO would only produce 1 text:span referencing an automatic style
around any given character content, this is not required by ODF, and so
other producers may legitimately produce such nested text:span elements.

Unfortunately the current SwpHints::Insert() isn't deterministic, the
RES_TXTATR_AUTOFMT with same start/end will be compared by address in
CompareSwpHtStart() (whereas RES_TXTATR_CHARFMT has a sort number for
this), so the result is going to be a random order.

Change-Id: Id62a7ff5fb85dbe42b7e1a27b0d8b36b74cf1100
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137033
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit d7827f712ddd21a6c1e151f54dc6eba5c12690da)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137057
Reviewed-by: Thorsten Behrens 

diff --git a/sw/qa/extras/odfimport/data/tdf149978.fodt 
b/sw/qa/extras/odfimport/data/tdf149978.fodt
new file mode 100644
index ..5c4840c258fc
--- /dev/null
+++ b/sw/qa/extras/odfimport/data/tdf149978.fodt
@@ -0,0 +1,53 @@
+
+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:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 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:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing: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:ooo="http://openoffice.org/2004/office; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d: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:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="ur
 n:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:xforms="http://www.w3.org/2002/xforms; office:version="1.3" 
office:mimetype="application/vnd.oasis.opendocument.text">
+
+  
+  
+  
+
+
+  
+
+
+  
+
+
+
+  
+
+  
+  
+
+  
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+   foo bar baz
+   foo bar baz
+   foo bar baz
+   foo bar baz
+   foo bar baz
+   foo bar baz
+   foo bar baz
+   foo bar baz
+   foo bar baz
+   foo bar baz
+
+
+
+
diff --git a/sw/qa/extras/odfimport/odfimport.cxx 
b/sw/qa/extras/odfimport/odfimport.cxx
index 9c177f981aa4..b6f242601f5f 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -371,6 +371,18 @@ CPPUNIT_TEST_FIXTURE(Test, testDateFormFormats)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf149978)
+{
+load(mpTestDocumentPath, "tdf149978.fodt");
+// on Linux the bug 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-07-14 Thread Michael Stahl (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx |3 +-
 sw/qa/extras/uiwriter/uiwriter2.cxx|2 -
 sw/source/core/crsr/callnk.cxx |   42 -
 sw/source/core/inc/UndoTable.hxx   |8 +
 sw/source/core/undo/untbl.cxx  |2 +
 5 files changed, 43 insertions(+), 14 deletions(-)

New commits:
commit dadaf930d14283f96cc06741d2eec6d846e59f7f
Author: Michael Stahl 
AuthorDate: Mon Jul 11 19:20:33 2022 +0200
Commit: Miklos Vajna 
CommitDate: Thu Jul 14 16:49:07 2022 +0200

sw: fix spurious layout invalidation from ~SwCallLink()

This code was added in commit 56b2cf0c10d9caa01ebae1d80465e342d046a85c
"sw-collapse-empty-table-par-like-html.diff" and leaves us to guess
what it should do.

Apparently it's trying to replicate a Word feature where an empty
paragraph at the end of a table cell and preceded by a nested table is
effectively hidden, *unless* the user moves the cursor into it, at which
point it grows to its ordinary height.

The problem is that this is implemented by invalidating the position of
any table once the cursor is moved into it, causing it to be
reformatted, at potentially great expense, regardless if the cursor is
actually on a paragraph that may be hidden.

Also limit invalidations to when the cursor has actually moved to a
different node.

To fix tdf#105330, un-collapse a paragraph after Undo, requires
additionally doing the same notification from
SwUndoInsTable::UndoImpl() because the SwCallLink won't see the removed
table any more.

Mysteriously this causes the test SwLayoutWriter2 testTdf124261 to fail
in Jenkins, but only on MacOSX so impossible to debug; tb86 fails with:

layout2.cxx:2227:testTdf124261::TestBody
equality assertion failed
- Expected: 1721
- Actual  : 5437

... and tb84 with:

layout2.cxx:2227:testTdf124261::TestBody
equality assertion failed
- Expected: 1721
- Actual  : 3740

Change-Id: Ifd55097735d3675e6b82264f455baa44e9c9e30a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136963
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit c605283ad6785dea762feab5fdffd9d27e75c292)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137034
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index d7d0784e7285..8ffd2a9e5673 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -1403,7 +1403,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf88496)
 // Switch off repeating header, there is no place for it.
 // Now there are only 3 pages with complete table content
 // instead of a 51-page long table only with header.
-CPPUNIT_ASSERT_EQUAL(2, getPages());
+CPPUNIT_ASSERT_EQUAL(3, getPages());
+// (this appears to have the correct result now?)
 // FIXME: this actually has 3 pages but SwWrtShell::SttPg() puts the cursor
 // into the single SwTextFrame in the follow-flow-row at the top of the
 // table but that SwTextFrame 1105 should not exist and the cursor ends up
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index f895b59ba402..f4f8cd679a7e 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -4061,7 +4061,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf147006)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf124261)
 {
-#if !defined(_WIN32)
+#if !defined(_WIN32) && !defined(MACOSX)
 // Make sure that pressing a key in a btlr cell frame causes an immediate, 
correct repaint.
 SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf124261.docx");
 SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
diff --git a/sw/source/core/crsr/callnk.cxx b/sw/source/core/crsr/callnk.cxx
index 50a1fc99eec9..c4f2ccdff10e 100644
--- a/sw/source/core/crsr/callnk.cxx
+++ b/sw/source/core/crsr/callnk.cxx
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 SwCallLink::SwCallLink( SwCursorShell & rSh )
 : m_rShell( rSh )
@@ -60,24 +61,36 @@ SwCallLink::SwCallLink( SwCursorShell & rSh )
 }
 }
 
-static void lcl_notifyRow(const SwContentNode* pNode, SwCursorShell & rShell)
+namespace sw {
+
+/**
+  An empty paragraph inside a table with a nested table preceding it
+  should be hidden, unless the cursor is positioned in the paragraph.
+
+  If the cursor is now (or was previously) inside such a paragraph,
+  send a size change notification on the row frame to force reformatting.
+ */
+void NotifyTableCollapsedParagraph(const SwContentNode *const pNode, 
SwCursorShell *const pShell)
 {
 if ( !pNode )
 return;
 
-SwFrame *const pMyFrame = pNode->getLayoutFrame( rShell.GetLayout() );
+SwFrame *const pMyFrame = 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-06-20 Thread Michael Stahl (via logerrit)
 sw/qa/extras/uiwriter/uiwriter2.cxx |   95 
 sw/source/core/doc/DocumentContentOperationsManager.cxx |4 
 sw/source/core/doc/docedt.cxx   |7 +
 sw/source/core/inc/UndoRedline.hxx  |8 +
 sw/source/core/inc/mvsave.hxx   |2 
 sw/source/core/undo/unredln.cxx |   32 +
 6 files changed, 142 insertions(+), 6 deletions(-)

New commits:
commit 03834f003c56e6646e3b274c418acd4fc344fd8e
Author: Michael Stahl 
AuthorDate: Wed Jun 15 15:08:16 2022 +0200
Commit: Thorsten Behrens 
CommitDate: Mon Jun 20 08:56:59 2022 +0200

tdf#135976 sw: preserve flys on backspace/delete with redlining enabled

This is a continuation of commit 85376a02348810812d515ee72140dbf56f2b6040
for the case when redlining is turned on.

Also try to restore the anchors in SwUndoRedlineDelete.

(regression from commit 3345feb67f2c49a1b76639965b56968e1c5f03ee)

Change-Id: I4199f5755398d469a606618c037ad9756cb7aeba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135909
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 932a8efce878547bfd81521d0cf1ddfe8dc33ec6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135968
Reviewed-by: Thorsten Behrens 

diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 645ef94d762a..f895b59ba402 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1117,6 +1118,100 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf139982)
 CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetFlyCount(FLYCNTTYPE_FRM));
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf135976)
+{
+SwDoc* const pDoc = createSwDoc();
+SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+pWrtShell->Insert("foobar");
+
+pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 2, 
/*bBasicCall=*/false);
+SwFormatAnchor anchor(RndStdIds::FLY_AT_CHAR);
+anchor.SetAnchor(pWrtShell->GetCursor()->GetPoint());
+SfxItemSet flySet(pDoc->GetAttrPool(), svl::Items);
+flySet.Put(anchor);
+SwFrameFormat const* pFly = pWrtShell->NewFlyFrame(flySet, 
/*bAnchValid=*/true);
+CPPUNIT_ASSERT(pFly != nullptr);
+
+// turn on redlining and show changes
+pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | 
RedlineFlags::ShowDelete
+  | 
RedlineFlags::ShowInsert);
+dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+CPPUNIT_ASSERT_MESSAGE(
+"redlines should be visible",
+
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+CPPUNIT_ASSERT(pWrtShell->GetLayout()->IsHideRedlines());
+
+CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetFlyCount(FLYCNTTYPE_FRM));
+CPPUNIT_ASSERT_EQUAL(size_t(1), 
pWrtShell->GetLayout()->GetLastPage()->GetSortedObjs()->size());
+CPPUNIT_ASSERT_EQUAL(sal_Int32(4), 
pFly->GetAnchor().GetContentAnchor()->nContent.GetIndex());
+
+pWrtShell->UnSelectFrame();
+pWrtShell->SttEndDoc(/*bStart=*/false);
+pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, 
/*bBasicCall=*/false);
+
+pWrtShell->DelLeft();
+pWrtShell->DelLeft();
+
+CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetFlyCount(FLYCNTTYPE_FRM));
+// the problem was that the fly was deleted from the layout
+CPPUNIT_ASSERT_EQUAL(size_t(1), 
pWrtShell->GetLayout()->GetLastPage()->GetSortedObjs()->size());
+// check that the anchor was moved outside the redline
+CPPUNIT_ASSERT_EQUAL(sal_Int32(3), 
pFly->GetAnchor().GetContentAnchor()->nContent.GetIndex());
+
+pWrtShell->Undo(2);
+
+CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetFlyCount(FLYCNTTYPE_FRM));
+CPPUNIT_ASSERT_EQUAL(size_t(1), 
pWrtShell->GetLayout()->GetLastPage()->GetSortedObjs()->size());
+// check that the anchor was restored
+CPPUNIT_ASSERT_EQUAL(sal_Int32(4), 
pFly->GetAnchor().GetContentAnchor()->nContent.GetIndex());
+
+pWrtShell->Redo(2);
+
+CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetFlyCount(FLYCNTTYPE_FRM));
+CPPUNIT_ASSERT_EQUAL(size_t(1), 
pWrtShell->GetLayout()->GetLastPage()->GetSortedObjs()->size());
+CPPUNIT_ASSERT_EQUAL(sal_Int32(3), 
pFly->GetAnchor().GetContentAnchor()->nContent.GetIndex());
+
+pWrtShell->Undo(2);
+
+CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetFlyCount(FLYCNTTYPE_FRM));
+CPPUNIT_ASSERT_EQUAL(size_t(1), 
pWrtShell->GetLayout()->GetLastPage()->GetSortedObjs()->size());
+CPPUNIT_ASSERT_EQUAL(sal_Int32(4), 
pFly->GetAnchor().GetContentAnchor()->nContent.GetIndex());
+

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-06-17 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/htmlexport/htmlexport.cxx  |   41 
 sw/source/filter/html/htmlatr.cxx   |   12 +++--
 sw/source/filter/html/htmlnumwriter.cxx |4 ++-
 sw/source/filter/html/wrthtml.hxx   |3 +-
 4 files changed, 56 insertions(+), 4 deletions(-)

New commits:
commit 8581413deb7715dde56b84739e71301f12a4e326
Author: Miklos Vajna 
AuthorDate: Thu Jun 16 15:55:23 2022 +0200
Commit: Michael Stahl 
CommitDate: Fri Jun 17 10:33:18 2022 +0200

sw HTML export, XHTML mode: fix lost  with a list header + item

There is a general mismatch between XHTML and Writer lists: XHTML can
only contain list items (for ordered or unordered lists), while Writer
can contain list headers and list items. List headers have no bullet or
number at the start, list items are the normal text nodes.

Commit 8c2607ae3ce143586e623532b8ae5288277ec3ac (sw HTML export, XHTML
mode: fix lost  when last list item is not numbered, 2022-02-21)
fixed the list item end side of this problem: if all text nodes in a
list are headers, then don't write ul/ol at all, otherwise end list
headers with  as well to make sure the output XML is valid.
However, this created a mis-match, the starting  for list headers in
a list which have non-header text nodes at as was not adapted.

Fix the problem by extending OutHTML_SwFormat() so list headers in a
list with non-header text nodes always have a  and , and this
condition is the same on the start/end side.

Calculating if at least one text node is non-header in a list may not be
cheap, so reuse the already calculated info from
OutHTML_NumberBulletListStart() in OutHTML_SwFormat().

Change-Id: I3817a489f16166fc5b4c33ee64e2283c41a4402c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135999
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit b2bee5a4db5552c4d408800908ca717b4ea2564a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135990
Reviewed-by: Xisco Fauli 
(cherry picked from commit 472a40b022ef685610faa663421a00cfe6121c24)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136019
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index f95f08d4c6de..cc30027f906d 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -1534,6 +1534,47 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testPartiallyNumberedList)
 
"/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ol/reqif-xhtml:li/reqif-xhtml:p",
 2);
 }
 
+CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testListHeaderAndItem)
+{
+// Given a document with a list, first para is not numbered, but the 
second is:
+loadURL("private:factory/swriter", nullptr);
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+pWrtShell->Insert("not numbered");
+SwDoc* pDoc = pWrtShell->GetDoc();
+sal_uInt16 nPos = pDoc->MakeNumRule(pDoc->GetUniqueNumRuleName());
+SwNumRule* pNumRule = pDoc->GetNumRuleTable()[nPos];
+{
+SwNode& rNode = pWrtShell->GetCursor()->GetPoint()->nNode.GetNode();
+SwTextNode& rTextNode = *rNode.GetTextNode();
+rTextNode.SetAttr(SwNumRuleItem(pNumRule->GetName()));
+rTextNode.SetCountedInList(false);
+}
+pWrtShell->SplitNode();
+pWrtShell->Insert2("numbered");
+{
+SwNode& rNode = pWrtShell->GetCursor()->GetPoint()->nNode.GetNode();
+SwTextNode& rTextNode = *rNode.GetTextNode();
+rTextNode.SetAttr(SwNumRuleItem(pNumRule->GetName()));
+}
+
+// When exporting to ReqIF:
+ExportToReqif();
+
+// Then make sure the output is well-formed xhtml:
+SvMemoryStream aStream;
+HtmlExportTest::wrapFragment(maTempFile, aStream);
+xmlDocUniquePtr pXmlDoc = parseXmlStream();
+// Without the accompanying fix in place, this test would have failed:
+// Entity: line 3: parser error : Opening and ending tag mismatch: ol line 
3 and li
+// not 
numbered
+CPPUNIT_ASSERT(pXmlDoc);
+// Make sure that in case the list has a header and an item, then both are 
wrapped in an 
+// element.
+assertXPath(pXmlDoc,
+
"/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ol/reqif-xhtml:li/reqif-xhtml:p",
 2);
+}
+
 CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testBlockQuoteNoMargin)
 {
 // Given a document with some text, para style set to Quotations, no 
bottom margin:
diff --git a/sw/source/filter/html/htmlatr.cxx 
b/sw/source/filter/html/htmlatr.cxx
index c7c227b46864..60a7f1556c71 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -686,11 +686,12 @@ static void OutHTML_SwFormat( Writer& rWrt, const 
SwFormat& rFormat,
 if( nNewDefListLvl != rHWrt.m_nDefListLvl )
 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-06-15 Thread Michael Stahl (via logerrit)
 sw/qa/extras/uiwriter/uiwriter2.cxx |   50 
 sw/source/core/doc/DocumentContentOperationsManager.cxx |9 ++
 sw/source/core/doc/docedt.cxx   |4 -
 sw/source/core/inc/mvsave.hxx   |2 
 4 files changed, 62 insertions(+), 3 deletions(-)

New commits:
commit b7ab83bd96c70932c2223c8d0b3bc0f24327cef2
Author: Michael Stahl 
AuthorDate: Fri Jun 10 16:26:40 2022 +0200
Commit: Thorsten Behrens 
CommitDate: Thu Jun 16 00:09:02 2022 +0200

tdf#139982 sw: preserve flys in Replace with redlining enabled

The problem is that there isn't a redline type "Replace" so it's
represented as Delete+Insert.

To prevent the flys anchored in the text from being deleted, move the
anchors to the point between the old (deleted) and new (inserted) text.

(regression from commit 28b77c89dfcafae82cf2a6d85731b643ff9290e5)

Change-Id: Ib600c9dbfb9421917e4b8d61195c48cf0b364f06
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135604
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 
(cherry picked from commit 646c6ddd91a98afddf914e3889cb269fc814c060)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135737
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 32bc25ef6386..645ef94d762a 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -1067,6 +1067,56 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf140007)
  
pDoc->GetNodes()[SwNodeOffset(11)]->GetTextNode()->GetText());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf139982)
+{
+SwDoc* const pDoc = createSwDoc();
+SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+// turn on redlining and show changes
+pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | 
RedlineFlags::ShowDelete
+  | 
RedlineFlags::ShowInsert);
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+CPPUNIT_ASSERT_MESSAGE(
+"redlines should be visible",
+
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+pWrtShell->Insert("helloo");
+
+pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, 
/*bBasicCall=*/false);
+{
+SwFormatAnchor anchor(RndStdIds::FLY_AT_CHAR);
+anchor.SetAnchor(pWrtShell->GetCursor()->GetPoint());
+SfxItemSet flySet(pDoc->GetAttrPool(), svl::Items);
+flySet.Put(anchor);
+SwFrameFormat const* pFly = pWrtShell->NewFlyFrame(flySet, 
/*bAnchValid=*/true);
+CPPUNIT_ASSERT(pFly != nullptr);
+}
+
+pWrtShell->SttEndDoc(true);
+pWrtShell->EndPara(/*bSelect=*/true);
+
+CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetFlyCount(FLYCNTTYPE_FRM));
+
+pWrtShell->Replace("hello", true);
+
+// the problem was that a redline delete with the same author as redline
+// insert has its text deleted immediately, including anchored flys.
+CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetFlyCount(FLYCNTTYPE_FRM));
+
+pWrtShell->Undo();
+
+CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetFlyCount(FLYCNTTYPE_FRM));
+
+pWrtShell->Redo();
+
+CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetFlyCount(FLYCNTTYPE_FRM));
+
+pWrtShell->Undo();
+
+CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetFlyCount(FLYCNTTYPE_FRM));
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf39721)
 {
 // FIXME: disabled on Windows because of a not reproducible problem (not 
related to the patch)
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index a52884f8c43a..2a5ec2918db4 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -4596,6 +4596,14 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( 
SwPaM& rPam, const OUSt
 InsertItemSet( aTmpRange, aSet );
 }
 
+// tdf#139982: Appending the redline may immediately delete flys
+// anchored in the previous text if it's inside an insert redline.
+// Also flys will be deleted if the redline is accepted. Move them
+// to the position between the previous text and the new text,
+// there the chance of surviving both accept and reject is best.
+SaveFlyArr flys;
+SaveFlyInRange(aDelPam, *aDelPam.End(), flys, false);
+
 if (m_rDoc.GetIDocumentUndoRedo().DoesUndo())
 {
 m_rDoc.GetIDocumentUndoRedo().AppendUndo(
@@ -4606,6 +4614,7 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( 
SwPaM& rPam, const OUSt
   

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-06-14 Thread Michael Stahl (via logerrit)
 sw/qa/extras/uiwriter/uiwriter2.cxx |   87 
 sw/source/core/undo/unins.cxx   |5 +-
 2 files changed, 90 insertions(+), 2 deletions(-)

New commits:
commit 7df50ecd9dea623058dc7bf9095fd13d9bb49860
Author: Michael Stahl 
AuthorDate: Thu Jun 9 18:58:06 2022 +0200
Commit: Xisco Fauli 
CommitDate: Tue Jun 14 12:42:03 2022 +0200

tdf#140007 sw: fix SwUndoReplace

(regression from commit d6b0e84b236b78f4b21bd16e46dda3fa0876096d)

Change-Id: I1facf1584a349d1d087438f4e6fd3a63a80c6f7e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135585
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 45613274794636ba98d0e978fe872511297d275d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135549
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 992c10290429..32bc25ef6386 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -980,6 +980,93 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf131912)
 CPPUNIT_ASSERT_EQUAL(OUString("foo"), pWrtShell->GetCursor()->GetText());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf140007)
+{
+SwDoc* const pDoc = createSwDoc();
+SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+pWrtShell->Insert("foo");
+pWrtShell->SplitNode();
+pWrtShell->Insert("bar");
+pWrtShell->SplitNode();
+pWrtShell->Insert("baz");
+CPPUNIT_ASSERT_EQUAL(SwNodeOffset(13), pDoc->GetNodes().Count());
+CPPUNIT_ASSERT_EQUAL(OUString("foo"),
+ 
pDoc->GetNodes()[SwNodeOffset(9)]->GetTextNode()->GetText());
+CPPUNIT_ASSERT_EQUAL(OUString("bar"),
+ 
pDoc->GetNodes()[SwNodeOffset(10)]->GetTextNode()->GetText());
+CPPUNIT_ASSERT_EQUAL(OUString("baz"),
+ 
pDoc->GetNodes()[SwNodeOffset(11)]->GetTextNode()->GetText());
+
+pWrtShell->SttEndDoc(true);
+pWrtShell->EndPara(false);
+pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/true, 1, 
/*bBasicCall=*/false);
+pWrtShell->Replace(" ", true);
+CPPUNIT_ASSERT_EQUAL(SwNodeOffset(12), pDoc->GetNodes().Count());
+CPPUNIT_ASSERT_EQUAL(OUString("foo bar"),
+ 
pDoc->GetNodes()[SwNodeOffset(9)]->GetTextNode()->GetText());
+CPPUNIT_ASSERT_EQUAL(OUString("baz"),
+ 
pDoc->GetNodes()[SwNodeOffset(10)]->GetTextNode()->GetText());
+
+pWrtShell->SttEndDoc(true);
+pWrtShell->EndPara(false);
+pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/true, 1, 
/*bBasicCall=*/false);
+pWrtShell->Replace(" ", true);
+CPPUNIT_ASSERT_EQUAL(OUString("foo bar baz"),
+ 
pDoc->GetNodes()[SwNodeOffset(9)]->GetTextNode()->GetText());
+CPPUNIT_ASSERT_EQUAL(SwNodeOffset(11), pDoc->GetNodes().Count());
+
+pWrtShell->Undo();
+
+CPPUNIT_ASSERT_EQUAL(SwNodeOffset(12), pDoc->GetNodes().Count());
+CPPUNIT_ASSERT_EQUAL(OUString("foo bar"),
+ 
pDoc->GetNodes()[SwNodeOffset(9)]->GetTextNode()->GetText());
+CPPUNIT_ASSERT_EQUAL(OUString("baz"),
+ 
pDoc->GetNodes()[SwNodeOffset(10)]->GetTextNode()->GetText());
+
+pWrtShell->Undo();
+
+CPPUNIT_ASSERT_EQUAL(SwNodeOffset(13), pDoc->GetNodes().Count());
+CPPUNIT_ASSERT_EQUAL(OUString("foo"),
+ 
pDoc->GetNodes()[SwNodeOffset(9)]->GetTextNode()->GetText());
+CPPUNIT_ASSERT_EQUAL(OUString("bar"),
+ 
pDoc->GetNodes()[SwNodeOffset(10)]->GetTextNode()->GetText());
+CPPUNIT_ASSERT_EQUAL(OUString("baz"),
+ 
pDoc->GetNodes()[SwNodeOffset(11)]->GetTextNode()->GetText());
+
+pWrtShell->Redo();
+
+CPPUNIT_ASSERT_EQUAL(SwNodeOffset(12), pDoc->GetNodes().Count());
+CPPUNIT_ASSERT_EQUAL(OUString("foo bar"),
+ 
pDoc->GetNodes()[SwNodeOffset(9)]->GetTextNode()->GetText());
+CPPUNIT_ASSERT_EQUAL(OUString("baz"),
+ 
pDoc->GetNodes()[SwNodeOffset(10)]->GetTextNode()->GetText());
+
+pWrtShell->Redo();
+
+CPPUNIT_ASSERT_EQUAL(OUString("foo bar baz"),
+ 
pDoc->GetNodes()[SwNodeOffset(9)]->GetTextNode()->GetText());
+CPPUNIT_ASSERT_EQUAL(SwNodeOffset(11), pDoc->GetNodes().Count());
+
+pWrtShell->Undo();
+
+CPPUNIT_ASSERT_EQUAL(SwNodeOffset(12), pDoc->GetNodes().Count());
+CPPUNIT_ASSERT_EQUAL(OUString("foo bar"),
+ 
pDoc->GetNodes()[SwNodeOffset(9)]->GetTextNode()->GetText());
+CPPUNIT_ASSERT_EQUAL(OUString("baz"),
+ 
pDoc->GetNodes()[SwNodeOffset(10)]->GetTextNode()->GetText());
+
+pWrtShell->Undo();
+
+CPPUNIT_ASSERT_EQUAL(SwNodeOffset(13), pDoc->GetNodes().Count());
+CPPUNIT_ASSERT_EQUAL(OUString("foo"),
+ 
pDoc->GetNodes()[SwNodeOffset(9)]->GetTextNode()->GetText());
+  

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-06-14 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/htmlexport/htmlexport.cxx |8 +++-
 sw/source/filter/html/css1atr.cxx  |   21 +++--
 2 files changed, 26 insertions(+), 3 deletions(-)

New commits:
commit 3263893a50e3cdb40b69811b0829ea2c74de8731
Author: Miklos Vajna 
AuthorDate: Fri Jun 10 09:12:33 2022 +0200
Commit: Michael Stahl 
CommitDate: Tue Jun 14 11:23:20 2022 +0200

sw XHTML export: avoid writing default transparent background for ReqIF

We started writing properties of tables and rows since commit
c3c3303516c3da9372dce3f05f38f15a104e961c (sw XHTML export: output table
/ table row background format using CSS, 2022-05-10).

In case the SwTableLine has an explicit SvxBrushItem with its color set
to COL_TRANSPARENT, we turn that into a "background: transparent" CSS by
default. This is a 1:1 mapping from the doc model, but HTML defaults to
this already, so this is considered as noise.

Extend IgnorePropertyForReqIF() to filter out these unwanted defaults,
and fix SwHTMLWriter::OutCSS1_Property(), because it used to not pass
the CSS value for the filter function.

The behavior for table cells is unchanged, we continue to not export
cell properties (in the ReqIF case) at all.

Change-Id: Idbcd07809e159def694f4de017eebc7ad4104575
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135576
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit 04cc6e079e3122c183054fde046c054ed6c7b737)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135707
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index 68175f6d077c..f95f08d4c6de 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -2134,10 +2134,14 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testTableBackground)
 pWrtShell->SetTabBackground(aBrush);
 pWrtShell->Down(/*bSelect=*/false);
 pWrtShell->SplitNode();
-pWrtShell->InsertTable(aInsertTableOptions, /*nRows=*/1, /*nCols=*/1);
+pWrtShell->InsertTable(aInsertTableOptions, /*nRows=*/2, /*nCols=*/1);
 pWrtShell->MoveTable(GotoPrevTable, fnTableStart);
 aBrush.SetColor(0x00ff00);
 pWrtShell->SetRowBackground(aBrush);
+pWrtShell->Down(/*bSelect=*/false);
+// Second row has an explicit transparent background.
+aBrush.SetColor(COL_TRANSPARENT);
+pWrtShell->SetRowBackground(aBrush);
 
 // When exporting to reqif-xhtml:
 ExportToReqif();
@@ -2154,6 +2158,8 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testTableBackground)
 assertXPath(pXmlDoc, "//reqif-xhtml:table[2]/reqif-xhtml:tr[1]", "style",
 "background: #00ff00");
 assertXPathNoAttribute(pXmlDoc, 
"//reqif-xhtml:table[2]/reqif-xhtml:tr[1]", "bgcolor");
+// Second row has no explicit style, the default is not written.
+assertXPathNoAttribute(pXmlDoc, 
"//reqif-xhtml:table[2]/reqif-xhtml:tr[2]", "style");
 }
 
 CPPUNIT_TEST_FIXTURE(HtmlExportTest, testImageKeepRatio)
diff --git a/sw/source/filter/html/css1atr.cxx 
b/sw/source/filter/html/css1atr.cxx
index 3cb646e0f1de..b4c8ce82cf02 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -185,9 +185,21 @@ OString lclConvToHex(sal_uInt16 nHex)
 bool IgnorePropertyForReqIF(bool bReqIF, std::string_view rProperty, 
std::string_view rValue,
 std::optional oMode)
 {
-if (!bReqIF || (oMode.has_value() && *oMode != 
sw::Css1Background::TableCell))
+if (!bReqIF)
 return false;
 
+if (oMode.has_value() && *oMode != sw::Css1Background::TableCell)
+{
+// Table or row.
+if (rProperty == sCSS1_P_background && rValue == "transparent")
+{
+// This is the default already.
+return true;
+}
+
+return false;
+}
+
 // Only allow these two keys, nothing else in ReqIF mode.
 if (rProperty == sCSS1_P_text_decoration)
 {
@@ -244,7 +256,12 @@ void SwHTMLWriter::OutCSS1_Property( const char *pProp,
  const OUString *pSVal,
  std::optional oMode )
 {
-if (IgnorePropertyForReqIF(mbReqIF, pProp, sVal, oMode))
+OString aPropertyValue(sVal);
+if (aPropertyValue.isEmpty() && pSVal)
+{
+aPropertyValue = pSVal->toUtf8();
+}
+if (IgnorePropertyForReqIF(mbReqIF, pProp, aPropertyValue, oMode))
 return;
 
 OStringBuffer sOut;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-06-10 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/htmlexport/htmlexport.cxx |5 +--
 sw/source/filter/html/css1atr.cxx  |   45 +
 sw/source/filter/html/wrthtml.hxx  |   24 -
 3 files changed, 43 insertions(+), 31 deletions(-)

New commits:
commit 2744a1d2a2ccc6ddf8c5c939af6480a5e72b9e1a
Author: Miklos Vajna 
AuthorDate: Fri Jun 10 08:08:52 2022 +0200
Commit: Miklos Vajna 
CommitDate: Fri Jun 10 13:04:34 2022 +0200

sw XHTML export: avoid writing background of table cells in ReqIF mode

ReqIF mostly forbids using CSS styling on elements:
IgnorePropertyForReqIF() only allows 2 CSS keys by default.

This restriction was relaxed in commit
c3c3303516c3da9372dce3f05f38f15a104e961c (sw XHTML export: output table
/ table row background format using CSS, 2022-05-10), to allow
background for tables and table rows, using CSS markup. An unwanted side
effect of this is background for table cells, which is still considered
invalid. To make this nontrivial to fix, Css1Background::Table is used
to track formatting for all of tables, rows and cells.

Fix the problem by extending Css1Background with a TableRow and
TableCell and then audit all uses of Css1Background::Table to explicitly
say if they mean table, row or cell. This keeps table and row
backgrounds, but fixes the unwanted cell background.

Also document the 3 functions doing the export of table / row / cell
background export to improve readability.

Change-Id: I03301b1fd25593cbe83489dbf140e80138d4a0de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135570
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit d701eff3519287db599a2612a635bc5f610ba082)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135542
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index d1fc3ff34dfa..68175f6d077c 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -802,9 +802,8 @@ DECLARE_HTMLEXPORT_TEST(testReqIfTable, "reqif-table.xhtml")
 //  was missing, so the XHTML fragment wasn't a valid
 // xhtml.BlkStruct.class type anymore.
 assertXPath(pDoc, "/html/body/div/table/tr/th", 1);
-// Make sure that row background is written using CSS.
-OUString aStyle = getXPath(pDoc, "/html/body/div/table/tr/th", "style");
-CPPUNIT_ASSERT(aStyle.startsWith("background: "));
+// Make sure that the cell background is not written using CSS.
+assertXPathNoAttribute(pDoc, "/html/body/div/table/tr/th", "style");
 // The attribute was present, which is not valid in reqif-xhtml.
 assertXPathNoAttribute(pDoc, "/html/body/div/table/tr/th", "bgcolor");
 }
diff --git a/sw/source/filter/html/css1atr.cxx 
b/sw/source/filter/html/css1atr.cxx
index ea79c225..3cb646e0f1de 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -103,14 +103,6 @@ using editeng::SvxBorderLine;
 
 namespace {
 
-enum class Css1Background {
-Attr= 1,
-Page= 2,
-Table   = 3,
-Fly = 4,
-Section = 5
-};
-
 enum class Css1FrameSize {
 NONE   = 0x00,
 Width  = 0x01,
@@ -153,7 +145,7 @@ static Writer& OutCSS1_SvxULSpace_SvxLRSpace( Writer& rWrt,
 static Writer& OutCSS1_SvxULSpace_SvxLRSpace( Writer& rWrt,
 const SfxItemSet& rItemSet );
 static Writer& OutCSS1_SvxBrush( Writer& rWrt, const SfxPoolItem& rHt,
- Css1Background nMode,
+ sw::Css1Background nMode,
  const OUString *pGraphicName );
 static Writer& OutCSS1_SvxBrush( Writer& rWrt, const SfxPoolItem& rHt );
 static Writer& OutCSS1_SwFormatFrameSize( Writer& rWrt, const SfxPoolItem& rHt,
@@ -191,9 +183,9 @@ OString lclConvToHex(sal_uInt16 nHex)
 }
 
 bool IgnorePropertyForReqIF(bool bReqIF, std::string_view rProperty, 
std::string_view rValue,
-bool bTable)
+std::optional oMode)
 {
-if (!bReqIF || bTable)
+if (!bReqIF || (oMode.has_value() && *oMode != 
sw::Css1Background::TableCell))
 return false;
 
 // Only allow these two keys, nothing else in ReqIF mode.
@@ -250,9 +242,9 @@ public:
 void SwHTMLWriter::OutCSS1_Property( const char *pProp,
  std::string_view sVal,
  const OUString *pSVal,
- bool bTable )
+ std::optional oMode )
 {
-if (IgnorePropertyForReqIF(mbReqIF, pProp, sVal, bTable))
+if (IgnorePropertyForReqIF(mbReqIF, pProp, sVal, oMode))
 return;
 
 OStringBuffer sOut;
@@ -1765,7 +1757,7 @@ Writer& OutCSS1_BodyTagStyleOpt( Writer& rWrt, const 
SfxItemSet& rItemSet )
   

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-05-30 Thread Vasily Melenchuk (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf149200.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx   |   15 +++
 sw/source/filter/ww8/docxattributeoutput.cxx |2 +-
 3 files changed, 16 insertions(+), 1 deletion(-)

New commits:
commit de0312e81c86d3a9a1fdf1e4be4df32e2a4c6546
Author: Vasily Melenchuk 
AuthorDate: Wed May 25 17:15:53 2022 +0300
Commit: Xisco Fauli 
CommitDate: Mon May 30 13:14:41 2022 +0200

tdf#149200: docx export: transparent color fix

If there is no color value we should not also try to write
transparency information: otherwise w:srgbClr will have no
parameter value and MS Word won't open such documents.

Change-Id: Id67f174c5ae9aadf90ae54c126aef9a43ff3ba17
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134945
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135121

diff --git a/sw/qa/extras/ooxmlexport/data/tdf149200.docx 
b/sw/qa/extras/ooxmlexport/data/tdf149200.docx
new file mode 100644
index ..811f594b64f4
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf149200.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index 7915ade87d6d..90b923d0a612 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -393,6 +393,21 @@ DECLARE_OOXMLEXPORT_TEST(testTdf148132, "tdf148132.docx")
 }
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf149200)
+{
+loadAndSave("tdf149200.docx");
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+
+// Ensure there is no unexpected invalid structure 
+// There is just one run property
+xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, 
"count(/w:document/w:body/w:p[1]/w:r[1]/w:rPr/*)");
+CPPUNIT_ASSERT(pXmlObj);
+CPPUNIT_ASSERT_EQUAL(double(1), pXmlObj->floatval);
+// And it is a color definition with themeColor
+CPPUNIT_ASSERT_EQUAL(OUString("dark1"), getXPath(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:r[1]/w:rPr/w:color", "themeColor"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf148273_sectionBulletFormatLeak, 
"tdf148273_sectionBulletFormatLeak.docx")
 {
 // get a paragraph with bullet point after section break
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index a6da6244898a..f31342d3074d 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3064,7 +3064,7 @@ void DocxAttributeOutput::WriteCollectedRunProperties()
 {
 const char* pVal = nullptr;
 m_pColorAttrList->getAsChar(FSNS(XML_w, XML_val), pVal);
-if (pVal == nullptr || std::string_view("auto") != pVal)
+if (pVal != nullptr && std::string_view("auto") != pVal)
 {
 m_pSerializer->startElementNS(XML_w14, XML_textFill);
 m_pSerializer->startElementNS(XML_w14, XML_solidFill);


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source writerfilter/source

2022-05-24 Thread Michael Stahl (via logerrit)
 sw/qa/extras/mailmerge/data/grabbagtest.docx |binary
 sw/qa/extras/mailmerge/data/onecell.xlsx |binary
 sw/qa/extras/mailmerge/mailmerge.cxx |   92 +++
 sw/source/core/doc/docnew.cxx|9 ++
 sw/source/ui/dbui/mmresultdialogs.cxx|8 ++
 writerfilter/source/dmapper/DomainMapper.cxx |2 
 6 files changed, 98 insertions(+), 13 deletions(-)

New commits:
commit 30c171ab3dc07a0a8423775619631f6ad514f916
Author: Michael Stahl 
AuthorDate: Fri May 20 20:56:56 2022 +0200
Commit: Caolán McNamara 
CommitDate: Tue May 24 12:37:18 2022 +0200

sw: copy grab bags in mail merge

Otherwise formatting may get lost when the result is stored as DOCX.

Change-Id: I62cbeb1fc9f120dd9c424daf5dc0471686715537
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134694
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 123d3a9301c90925c23cfb4806d7b0be01b975d6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134762
Reviewed-by: Caolán McNamara 

diff --git a/sw/qa/extras/mailmerge/data/grabbagtest.docx 
b/sw/qa/extras/mailmerge/data/grabbagtest.docx
new file mode 100644
index ..4b40f1fb4e94
Binary files /dev/null and b/sw/qa/extras/mailmerge/data/grabbagtest.docx differ
diff --git a/sw/qa/extras/mailmerge/data/onecell.xlsx 
b/sw/qa/extras/mailmerge/data/onecell.xlsx
new file mode 100644
index ..972f6b3c5fc5
Binary files /dev/null and b/sw/qa/extras/mailmerge/data/onecell.xlsx differ
diff --git a/sw/qa/extras/mailmerge/mailmerge.cxx 
b/sw/qa/extras/mailmerge/mailmerge.cxx
index e1fee48d74da..663d04f0afbe 100644
--- a/sw/qa/extras/mailmerge/mailmerge.cxx
+++ b/sw/qa/extras/mailmerge/mailmerge.cxx
@@ -16,7 +16,9 @@
 
 #include 
 #include 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -77,7 +79,7 @@ public:
  * calling executeMailMerge() after modifying the job arguments.
  */
 void executeMailMergeTest( const char* filename, const char* datasource, 
const char* tablename,
-   bool file, int selection, const char* column )
+   char const*const filter, int selection, const 
char* column )
 {
 maMMtestFilename = filename;
 header();
@@ -89,7 +91,7 @@ public:
 const OUString aURI( m_directories.getURLFromSrc(mpTestDocumentPath) + 
OUString::createFromAscii(datasource) );
 const OUString aPrefix = column ? OUString::createFromAscii( column ) 
: "LOMM_";
 const OUString aDBName = registerDBsource( aURI, aWorkDir );
-initMailMergeJobAndArgs( filename, tablename, aDBName, aPrefix, 
aWorkDir, file, selection, column != nullptr );
+initMailMergeJobAndArgs( filename, tablename, aDBName, aPrefix, 
aWorkDir, filter, selection, column != nullptr );
 
 verify();
 finish();
@@ -138,7 +140,8 @@ public:
 }
 
 void initMailMergeJobAndArgs( const char* filename, const char* tablename, 
const OUString ,
-  const OUString , const OUString 
, bool file, int nDataSets,
+  const OUString , const OUString 
,
+  char const*const filter, int nDataSets,
   const bool bPrefixIsColumn )
 {
 uno::Reference< task::XJob > xJob( 
getMultiServiceFactory()->createInstance( "com.sun.star.text.MailMerge" ), 
uno::UNO_QUERY_THROW );
@@ -146,13 +149,16 @@ public:
 
 mMMargs.reserve( 15 );
 
-mMMargs.emplace_back( UNO_NAME_OUTPUT_TYPE, uno::Any( file ? 
text::MailMergeType::FILE : text::MailMergeType::SHELL ) );
+mMMargs.emplace_back( UNO_NAME_OUTPUT_TYPE, uno::Any( filter ? 
text::MailMergeType::FILE : text::MailMergeType::SHELL ) );
 mMMargs.emplace_back( UNO_NAME_DOCUMENT_URL, uno::Any(
  ( OUString( 
m_directories.getURLFromSrc(mpTestDocumentPath) + 
OUString::createFromAscii(filename)) ) ) );
 mMMargs.emplace_back( UNO_NAME_DATA_SOURCE_NAME, uno::Any( aDBName ) );
 mMMargs.emplace_back( UNO_NAME_OUTPUT_URL, uno::Any( aWorkDir ) );
-if (file)
+if (filter)
+{
 mMMargs.emplace_back( UNO_NAME_FILE_NAME_PREFIX, uno::Any( aPrefix 
) );
+mMMargs.emplace_back(UNO_NAME_SAVE_FILTER, 
uno::Any(OUString::createFromAscii(filter)));
+}
 
 if (bPrefixIsColumn)
 mMMargs.emplace_back( UNO_NAME_FILE_NAME_FROM_COLUMN, uno::Any( 
true ) );
@@ -256,7 +262,7 @@ public:
 /**
  Loads number-th document from mail merge. Requires file output from mail 
merge.
 */
-void loadMailMergeDocument( int number )
+void loadMailMergeDocument(int number, char const*const ext = ".odt")
 {
 OUString name;
 if (!msMailMergeOutputPrefix.isEmpty())
@@ -268,7 +274,7 @@ public:
 aURLObj.SetSmartURL( msMailMergeDocumentURL );
 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-05-24 Thread Hossein (via logerrit)
 sw/qa/extras/uiwriter/data/simplefooter.docx |binary
 sw/qa/extras/uiwriter/uiwriter.cxx   |   22 ++
 sw/source/filter/ww8/wrtw8sty.cxx|8 
 3 files changed, 30 insertions(+)

New commits:
commit 7b09579295579045c4ad76578df09356f3d5b8d0
Author: Hossein 
AuthorDate: Fri May 20 15:20:40 2022 +0200
Commit: Xisco Fauli 
CommitDate: Tue May 24 09:35:49 2022 +0200

tdf#149184 DOCX: fix crash removing footer, then saving to doc

When openeing the simplefooter.docx, after removing the footer and
exporting to .doc, LibreOffice crashes. This regression was
introduced with 88e6a1bfeac86e0c89d2ff08c908c2b5ae061177 which is
titled: "DOCX: export hidden (shared) headers/footers".

The current patch fixes this problem by checking to see if the header
or footer text is there or not.

A unit test is added to avoid this problem in the future. One can run
the test with:

make CPPUNIT_TEST_NAME="testTdf149184" -sr CppunitTest_sw_uiwriter7

Change-Id: I5586561677b3c490e49b4b10bd987aecdf3fc134
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134684
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134829

diff --git a/sw/qa/extras/uiwriter/data/simplefooter.docx 
b/sw/qa/extras/uiwriter/data/simplefooter.docx
new file mode 100644
index ..006c85ab7cc8
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/simplefooter.docx differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index b7593759971b..0aea38d4bbe7 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -50,6 +50,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -290,6 +291,7 @@ public:
 void testTdf92648();
 void testTdf103978_backgroundTextShape();
 void testTdf117225();
+void testTdf149184();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest);
 CPPUNIT_TEST(testReplaceForward);
@@ -411,6 +413,7 @@ public:
 CPPUNIT_TEST(testTdf92648);
 CPPUNIT_TEST(testTdf103978_backgroundTextShape);
 CPPUNIT_TEST(testTdf117225);
+CPPUNIT_TEST(testTdf149184);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -4691,6 +4694,25 @@ void SwUiWriterTest::testTdf117225()
 CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
 }
 
+void SwUiWriterTest::testTdf149184()
+{
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "simplefooter.docx");
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+// Removing the footer for all styles
+pWrtShell->ChangeHeaderOrFooter(u"", false, false, false);
+// export to simplefooter.doc
+uno::Reference xStorable(mxComponent, uno::UNO_QUERY);
+uno::Sequence aStoreProps = 
comphelper::InitPropertySequence({
+{ "FilterName", uno::Any(OUString("MS Word 97")) },
+});
+utl::TempFile aTempFile;
+aTempFile.EnableKillingFile();
+// Without the fix in place, the test fails with:
+// [CUT] sw_uiwriter7
+// Segmentation fault (core dumped)
+// [_RUN_] testTdf149184::TestBody
+xStorable->storeToURL(aTempFile.GetURL(), aStoreProps);
+}
 
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx 
b/sw/source/filter/ww8/wrtw8sty.cxx
index 9f103627d576..4126b9f88a50 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -2087,6 +2087,10 @@ void MSWordExportBase::WriteHeaderFooterText( const 
SwFormat& rFormat, bool bHea
 m_bHasHdr = true;
 const SwFormatHeader& rHd = rFormat.GetHeader();
 OSL_ENSURE( rHd.GetHeaderFormat(), "Header text is not here" );
+
+if ( !rHd.GetHeaderFormat() )
+return;
+
 pContent = ()->GetContent();
 }
 else
@@ -2094,6 +2098,10 @@ void MSWordExportBase::WriteHeaderFooterText( const 
SwFormat& rFormat, bool bHea
 m_bHasFtr = true;
 const SwFormatFooter& rFt = rFormat.GetFooter();
 OSL_ENSURE( rFt.GetFooterFormat(), "Footer text is not here" );
+
+if ( !rFt.GetFooterFormat() )
+return;
+
 pContent = ()->GetContent();
 }
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source writerfilter/source

2022-05-18 Thread Vasily Melenchuk (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf148455_1.docx|binary
 sw/qa/extras/ooxmlexport/data/tdf148455_2.docx|binary
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx|   24 ++
 sw/source/filter/ww8/docxattributeoutput.cxx  |9 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   10 +++--
 5 files changed, 41 insertions(+), 2 deletions(-)

New commits:
commit 270e8967a720166205263cf695aedb00f8f7ecd9
Author: Vasily Melenchuk 
AuthorDate: Mon May 16 21:21:51 2022 +0300
Commit: Xisco Fauli 
CommitDate: Wed May 18 16:46:56 2022 +0200

tdf#148455 docx import/export: improvements to lvlOverride

On save LO was just emitting w:lvlOverride to actual level
where override does happen. But MS Word won't accept override
for next level if there are no overrides for previous ones.

For example, if we are overriding level 3 we should also emit
empty lvlOverride for levels 0-2.

Provided fix did cause some problems on DOCX import: overrides
were applied to current level, but in this context current !=
actual level where override did happen.

Change-Id: Ia00dd9a5990f7f122027e8126f411642c32da189
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134411
Tested-by: Jenkins
Tested-by: Gabor Kelemen 
Reviewed-by: Thorsten Behrens 
(cherry picked from commit 198381eb32edcc3e82d0f23df65f0804a08b44e6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134452
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf148455_1.docx 
b/sw/qa/extras/ooxmlexport/data/tdf148455_1.docx
new file mode 100644
index ..295d3ee744c7
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf148455_1.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/data/tdf148455_2.docx 
b/sw/qa/extras/ooxmlexport/data/tdf148455_2.docx
new file mode 100644
index ..3cde58ce5a77
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf148455_2.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index 41c188a3532e..9e17190c0260 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -321,6 +321,30 @@ DECLARE_OOXMLEXPORT_TEST(testTdf144668, "tdf144668.odt")
 CPPUNIT_ASSERT_EQUAL(OUString("[001]"), getProperty(xPara2, 
"ListLabelString"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf148455_1, "tdf148455_1.docx")
+{
+uno::Reference xPara2(getParagraph(3, u"1.1.1"), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("1.1.1."), getProperty(xPara2, 
"ListLabelString"));
+}
+
+DECLARE_OOXMLEXPORT_TEST(testTdf148455_2, "tdf148455_2.docx")
+{
+xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+if (!pXmlDoc)
+   return; // initial import, no further checks
+
+// Find list id for restarted list
+sal_Int32 nListId = getXPath(pXmlDoc, 
"/w:document/w:body/w:p[3]/w:pPr/w:numPr/w:numId", "val").toInt32();
+
+xmlDocUniquePtr pNumberingDoc = parseExport("word/numbering.xml");
+
+// Ensure we have empty lvlOverride for levels 0 - 1
+getXPath(pNumberingDoc, "/w:numbering/w:num[@w:numId='" + 
OString::number(nListId) +"']/w:lvlOverride[@w:ilvl='0']", "");
+getXPath(pNumberingDoc, "/w:numbering/w:num[@w:numId='" + 
OString::number(nListId) +"']/w:lvlOverride[@w:ilvl='1']", "");
+// And normal overrride for level 2
+getXPath(pNumberingDoc, "/w:numbering/w:num[@w:numId='" + 
OString::number(nListId) +"']/w:lvlOverride[@w:ilvl='2']/w:startOverride", 
"val");
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testTdf147978enhancedPathABVW)
 {
 load(DATA_DIRECTORY, "tdf147978_enhancedPath_commandABVW.odt");
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 7bddf3121813..6f8a24acd255 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7715,6 +7715,7 @@ void DocxAttributeOutput::OverrideNumberingDefinition(
 SwNumRule const& rAbstractRule = 
*(*m_rExport.m_pUsedNumTable)[nAbstractNum - 1];
 sal_uInt8 const nLevels = static_cast(rRule.IsContinusNum()
 ? WW8ListManager::nMinLevel : WW8ListManager::nMaxLevel);
+sal_uInt8 nPreviousOverrideLevel = 0;
 for (sal_uInt8 nLevel = 0; nLevel < nLevels; ++nLevel)
 {
 const auto levelOverride = rLevelOverrides.find(nLevel);
@@ -7724,6 +7725,14 @@ void DocxAttributeOutput::OverrideNumberingDefinition(
 // or we have a level numbering override
 if (bListsAreDifferent || levelOverride != rLevelOverrides.end())
 {
+// If there are "gaps" in w:lvlOverride numbers, MS Word can have 
issues with numbering.
+// So we need to emit empty override tokens up to current one.
+while (nPreviousOverrideLevel < nLevel)
+{
+m_pSerializer->singleElementNS(XML_w, XML_lvlOverride, 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-05-18 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/htmlexport/htmlexport.cxx  |   34 +
 sw/source/filter/html/htmlflywriter.cxx |   50 
 2 files changed, 78 insertions(+), 6 deletions(-)

New commits:
commit 4bced2b78b3e22730c12d9729f5633ae1a3a35c8
Author: Miklos Vajna 
AuthorDate: Tue May 17 16:11:25 2022 +0200
Commit: Xisco Fauli 
CommitDate: Wed May 18 10:17:33 2022 +0200

sw HTML export: avoid pixel height when height is scale and width is 
relative

Commit b17180a84cb4561b8a7bbf9e2281c91fffd56f87 (write out image size in
html export for 'keep ratio' images, 2021-06-29) changed the sw HTML
export to write the layout size of images in case one dimension is "keep
ratio" and the other is some more concrete value.

This is useful in case that other dimension is a fixed value, because
"keep ratio" on the UI only means to keep the ratio as the size changes,
it does not mean that the ratio will be the original ratio of the
bitmap. However, it's problematic to write this layout size of the "keep
ratio" dimension when the other dimension is relative, as this will mean
the image's aspect ratio will change if the user resizes the browser
window.

Fix the problem by extending the way we write the "height" and "width"
of fly frames:

1) Write a percentage in case of relative sizes

2) Write an explicit "auto" (or just omit the attribute in XHTML mode)
   in case the size is "keep ratio" and the other dimension is a
   relative size

3) Write the layout size in other cases (fixed size or "keep ratio", but
   the other dimension is a fixed size)

Note that HTML itself has no concept of relative sizes where 100% is not
the parent's size (e.g. page, not paragraph) and also has no concept of
keeping an aspect ratio which is not the aspect ratio of the bitmap, so
those cases remain unchanged.

Change-Id: Ic5c7dc4d697160eff81e960a2f7d335fb78ab7c0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134482
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit 9e3eee88338c45424b24040f731083f9f59cfbe2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134450
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index 752352efe9f6..d1fc3ff34dfa 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -2157,6 +2157,40 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testTableBackground)
 assertXPathNoAttribute(pXmlDoc, 
"//reqif-xhtml:table[2]/reqif-xhtml:tr[1]", "bgcolor");
 }
 
+CPPUNIT_TEST_FIXTURE(HtmlExportTest, testImageKeepRatio)
+{
+// Given a document with an image: width is relative, height is "keep 
ratio":
+createSwDoc();
+uno::Reference xFactory(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xTextGraphic(
+xFactory->createInstance("com.sun.star.text.TextGraphicObject"), 
uno::UNO_QUERY);
+xTextGraphic->setPropertyValue("AnchorType",
+   
uno::Any(text::TextContentAnchorType_AS_CHARACTER));
+xTextGraphic->setPropertyValue("RelativeWidth", 
uno::Any(static_cast(42)));
+xTextGraphic->setPropertyValue("IsSyncHeightToWidth", uno::Any(true));
+uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xBodyText = xTextDocument->getText();
+uno::Reference xCursor(xBodyText->createTextCursor());
+uno::Reference xTextContent(xTextGraphic, 
uno::UNO_QUERY);
+xBodyText->insertTextContent(xCursor, xTextContent, false);
+
+// When exporting to HTML:
+uno::Reference xStorable(mxComponent, uno::UNO_QUERY);
+uno::Sequence aStoreProperties = {
+comphelper::makePropertyValue("FilterName", OUString("HTML 
(StarWriter)")),
+};
+xStorable->storeToURL(maTempFile.GetURL(), aStoreProperties);
+
+// Then make sure that the width is not a fixed size, that would break on 
resizing the browser
+// window:
+htmlDocUniquePtr pDoc = parseHtml(maTempFile);
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: auto
+// - Actual  : 2
+// i.e. a static (CSS pixel) height was written.
+assertXPath(pDoc, "/html/body/p/img", "height", "auto");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/htmlflywriter.cxx 
b/sw/source/filter/html/htmlflywriter.cxx
index 2aee659fc6e8..5eff1441760f 100644
--- a/sw/source/filter/html/htmlflywriter.cxx
+++ b/sw/source/filter/html/htmlflywriter.cxx
@@ -987,22 +987,60 @@ void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& 
aHtml, const SwFrameForma
 ((nPercentWidth && nPercentWidth!=255) || aPixelSz.Width()) )
 {
 OString sWidth;
-if (nPercentWidth && nPercentWidth != 255)
-

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-05-17 Thread Michael Stahl (via logerrit)
 sw/qa/extras/uiwriter/uiwriter.cxx  |   38 
 sw/source/core/doc/DocumentContentOperationsManager.cxx |5 ++
 2 files changed, 43 insertions(+)

New commits:
commit 085ae759c1dc10a40cf3be95201c1028e847d012
Author: Michael Stahl 
AuthorDate: Tue May 17 16:08:39 2022 +0200
Commit: Xisco Fauli 
CommitDate: Tue May 17 21:28:25 2022 +0200

tdf#147220 sw_redlinehide: update frames in ReplaceRangeImpl()

Change-Id: Ie5d62eaec01a3b06ff1bd6070510384641ea7ad3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134483
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 1f8795df957c18c5c06bf1d68d0d60b1d30f015d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134448
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index d38c33364803..b7593759971b 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -138,6 +138,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace
 {
@@ -693,6 +694,43 @@ void SwUiWriterTest::testTdf67238()
 
CPPUNIT_ASSERT(!((rTable.GetTableBox("C3"))->GetFrameFormat()->GetProtect()).IsContentProtected());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf147220)
+{
+SwDoc* pDoc = createSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+pWrtShell->Insert(u"él");
+
+// hide and enable
+dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+CPPUNIT_ASSERT(pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+CPPUNIT_ASSERT(
+
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+CPPUNIT_ASSERT(pWrtShell->GetLayout()->IsHideRedlines());
+
+pWrtShell->GoStartSentence();
+pWrtShell->SetMark();
+pWrtShell->GoEndSentence();
+
+// this did not remove the original text from the layout
+pWrtShell->Replace(u"Él", false);
+
+// currently the deleted text is before the replacement text, not sure if
+// that is really required
+CPPUNIT_ASSERT_EQUAL(OUString(u"élÉl"),
+
pWrtShell->GetCursor()->GetPoint()->nNode.GetNode().GetTextNode()->GetText());
+CPPUNIT_ASSERT_EQUAL(OUString(u"Él"),
+static_cast(pWrtShell->GetCursor()->GetPoint()->nNode.GetNode().GetTextNode()->getLayoutFrame(nullptr))->GetText());
+
+SwRedlineTable const& 
rRedlines(pDoc->getIDocumentRedlineAccess().GetRedlineTable());
+CPPUNIT_ASSERT_EQUAL(SwRedlineTable::size_type(2), rRedlines.size());
+CPPUNIT_ASSERT_EQUAL(RedlineType::Delete, rRedlines[0]->GetType());
+CPPUNIT_ASSERT_EQUAL(OUString(u"él"), rRedlines[0]->GetText());
+CPPUNIT_ASSERT_EQUAL(RedlineType::Insert, rRedlines[1]->GetType());
+CPPUNIT_ASSERT_EQUAL(OUString(u"Él"), rRedlines[1]->GetText());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf135978)
 {
 SwDoc* pDoc = createSwDoc();
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 11f91cfe38b5..965a9024a57d 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -4597,7 +4597,12 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( 
SwPaM& rPam, const OUSt
 m_rDoc.GetIDocumentUndoRedo().AppendUndo(
 std::make_unique( aDelPam, 
SwUndoId::REPLACE ));
 }
+// add redline similar to DeleteAndJoinWithRedlineImpl()
+std::shared_ptr const 
pCursor(m_rDoc.CreateUnoCursor(*aDelPam.GetMark()));
+pCursor->SetMark();
+*pCursor->GetPoint() = *aDelPam.GetPoint();
 m_rDoc.getIDocumentRedlineAccess().AppendRedline( new 
SwRangeRedline( RedlineType::Delete, aDelPam ), true);
+sw::UpdateFramesForAddDeleteRedline(m_rDoc, *pCursor);
 
 *rPam.GetMark() = *aDelPam.GetMark();
 if (m_rDoc.GetIDocumentUndoRedo().DoesUndo())


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-05-17 Thread Caolán McNamara (via logerrit)
 sw/qa/extras/layout/data/tdf123163-1.docx |binary
 sw/qa/extras/layout/layout.cxx|6 ++
 sw/source/core/layout/fly.cxx |4 +++-
 3 files changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 611f1e5e6637610295d449c286d3d6981dd735aa
Author: Caolán McNamara 
AuthorDate: Fri Sep 10 19:51:41 2021 +0100
Commit: Caolán McNamara 
CommitDate: Tue May 17 21:00:21 2022 +0200

sw: fix assert in SwObjectFormatterTextFrame

sw/source/core/layout/objectformattertxtfrm.cxx:237: virtual bool 
SwObjectFormatterTextFrame::DoFormatObj(SwAnchoredObject&, bool): Assertion 
`GetPageFrame().GetPhyPageNum() == GetPgNumOfCollected(nIdx)' failed.

The problem is that there are multiple (9) flys on text frame 324.

In the loop in CalcContent(), frame 324 starts out on page 13, then
with the first/second fly moves to page 12, then with the 3rd fly moves
forward to page 13 - but the pPageFrame that is passed to
SwObjectFormatter::FormatObj() was fetched outside of the loop.

(regression from commit c799de145f7e289f31e3669646e5bd12814e6c5e
 and commit 533a998e540b0f04068c876dde0e74adc3f79c93)

Change-Id: Iae573900b4b6558634bfed161e5c95bd5ba27151
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121924
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 7d20dc2ca69711c61fb1593ad85ccdef282c978d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134447
Reviewed-by: Caolán McNamara 

diff --git a/sw/qa/extras/layout/data/tdf123163-1.docx 
b/sw/qa/extras/layout/data/tdf123163-1.docx
new file mode 100644
index ..3f8865cb49b1
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf123163-1.docx differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 4122d3725b88..66ea7c193c39 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -3064,6 +3064,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf116501)
 createSwDoc(DATA_DIRECTORY, "tdf116501.odt");
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf123163)
+{
+//just care it doesn't assert
+createSwDoc(DATA_DIRECTORY, "tdf123163-1.docx");
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testAbi11870)
 {
 //just care it doesn't assert
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 1a0a93e5fc01..e54f88c274a2 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -1528,11 +1528,13 @@ void CalcContent( SwLayoutFrame *pLay, bool bNoColl )
 {
 bool bAgain = false;
 bool bRestartLayoutProcess = false;
-SwPageFrame* pPageFrame = pFrame->FindPageFrame();
 size_t nCnt = pFrame->GetDrawObjs()->size();
 size_t i = 0;
 while ( i < nCnt )
 {
+// pFrame can move to a different page in FormatObj()
+SwPageFrame *const pPageFrame = pFrame->FindPageFrame();
+
 // #i28701#
 SwAnchoredObject* pAnchoredObj = 
(*pFrame->GetDrawObjs())[i];
 assert(pAnchoredObj);


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-05-12 Thread Vasily Melenchuk (via logerrit)
 sw/qa/extras/ww8export/data/tdf142840.odt |binary
 sw/qa/extras/ww8export/ww8export3.cxx |   17 +
 sw/source/filter/ww8/wrtw8nds.cxx |7 +--
 3 files changed, 22 insertions(+), 2 deletions(-)

New commits:
commit f2bf1cc2a9a4a09ec16900e91949e1669963c392
Author: Vasily Melenchuk 
AuthorDate: Fri Apr 29 11:10:48 2022 +0300
Commit: Michael Stahl 
CommitDate: Thu May 12 11:21:14 2022 +0200

tdf#142840: doc export: use BookmarkToWord() for hyperlinks

Inernal hyperlinks to bookmarks should not contain spaces. This
is not required for RTF or DOC: MS Word is okay with spaces there
(unlike in DOCX). But since we are replacing spaces in bookmark
names we should do this also in links to these bookmarks.

Change-Id: I7a3e530817572ed53032c2be1ad96f8e8498bac3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133590
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 
(cherry picked from commit d45315c8eb91862958b29ead09cec58e03a80096)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134177
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/ww8export/data/tdf142840.odt 
b/sw/qa/extras/ww8export/data/tdf142840.odt
new file mode 100644
index ..27af4cdb5e6a
Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf142840.odt differ
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx 
b/sw/qa/extras/ww8export/ww8export3.cxx
index 8e894c711457..330fb8b6bb2c 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -988,6 +988,23 @@ DECLARE_WW8EXPORT_TEST(testTdf136814, "tdf136814.odt")
 }
 
 
+DECLARE_WW8EXPORT_TEST(testTdf142840, "tdf142840.odt")
+{
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+uno::Reference xBookmarksSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xBookmarksByIdx(xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY);
+uno::Reference xBookmarksByName = 
xBookmarksSupplier->getBookmarks();
+
+// Ensure space are replaced by underscore in bookmark name (it was 
working before, but ensure this)
+CPPUNIT_ASSERT_EQUAL(static_cast(1), 
xBookmarksByIdx->getCount());
+CPPUNIT_ASSERT(xBookmarksByName->hasByName("Chapter_1"));
+CPPUNIT_ASSERT(!xBookmarksByName->hasByName("Chapter 1"));
+
+// And hyperlink is referring bookmark with underscore also (this was 
broken)
+CPPUNIT_ASSERT_EQUAL(OUString("#Chapter_1"), 
getProperty(getRun(getParagraph(1), 1), "HyperLinkURL"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx 
b/sw/source/filter/ww8/wrtw8nds.cxx
index 6081ab30af1d..ff23fc6fa9c1 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -1028,8 +1028,11 @@ bool WW8AttributeOutput::AnalyzeURL( const OUString& 
rUrl, const OUString& rTarg
 if ( !sURL.isEmpty() )
 sURL = URIHelper::simpleNormalizedMakeRelative( 
m_rWW8Export.GetWriter().GetBaseURL(), sURL );
 
-if ( bBookMarkOnly )
-sURL = FieldString( ww::eHYPERLINK );
+if (bBookMarkOnly)
+{
+sURL = FieldString(ww::eHYPERLINK);
+*pMark = BookmarkToWord(*pMark);
+}
 else
 sURL = FieldString( ww::eHYPERLINK ) + "\"" + sURL + "\"";
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-05-03 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter3.cxx |   40 +---
 sw/source/core/fields/cellfml.cxx   |5 +---
 sw/source/core/table/swtable.cxx|3 +-
 3 files changed, 41 insertions(+), 7 deletions(-)

New commits:
commit b47b35e0ab6efceeaa2dbe8b598c21afa5944d67
Author: László Németh 
AuthorDate: Thu Apr 28 19:48:52 2022 +0200
Commit: Xisco Fauli 
CommitDate: Tue May 3 16:29:33 2022 +0200

tdf#146573 sw: recalculate cells with footnotes

Commit 915d3eebc1dc4f18d7a1992db801ee8313ee46c0
"tdf#39828 sw: fix table formula calculation at track changes"
allowed to use footnotes in value cells unintentionally.
The only problem was that modifying cells with footnotes didn't
trigger formula recalculation in text tables, according to the
incomplete SwTableBox::IsValidNumTextNd(). Instead of
asking formula recalculation pressing F9, now IsValidNumTextNd
was extended to skip footnotes, similar to the already
skipped comments.

Also clean-up to testTdf39828 (remove copy-paste code), and
clean-up to commit 915d3eebc1dc4f18d7a1992db801ee8313ee46c0
"tdf#39828 sw: fix table formula calculation at track changes"
to avoid of unnecessary calls of GetRedlineText(), which
is an expensive call, especially when there are a lot of redlines
with overlapping (see commit d467cd0dd9e9cf3b018859a592e2638527bc7add
"tdf#135683 speedup DocumentRedlineManager::GetRedlinePos").

Change-Id: I00243ef0985805414723e26fe26d6e9c04ce86cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133579
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 978e22f8cfb3db573bed3fd4b14a515cf090f7e5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133722
Tested-by: Jenkins

diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 3c453ab313da..1b90efde6bac 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -3005,9 +3005,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf87199)
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf39828)
 {
 SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf39828.fodt");
-SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
-
-pWrtShell->GotoNextTOXBase();
 
 // show changes
 pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::ShowDelete
@@ -3036,6 +3033,43 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf39828)
 CPPUNIT_ASSERT_EQUAL(OUString("8"), xCellA4->getString());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf146573)
+{
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf39828.fodt");
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+// remove redlines, add a footnote, and change the value
+// of the cell with the footnote
+dispatchCommand(mxComponent, ".uno:AcceptAllTrackedChanges", {});
+Scheduler::ProcessEventsToIdle();
+pWrtShell->Right(CRSR_SKIP_CELLS, /*bSelect=*/false, /*nCount=*/1, 
/*bBasicCall=*/false);
+dispatchCommand(mxComponent, ".uno:InsertFootnote", {});
+dispatchCommand(mxComponent, ".uno:PageUp", {}); // leave footnote
+pWrtShell->Left(CRSR_SKIP_CELLS, /*bSelect=*/false, /*nCount=*/1, 
/*bBasicCall=*/false);
+pWrtShell->Left(CRSR_SKIP_CELLS, /*bSelect=*/true, /*nCount=*/1, 
/*bBasicCall=*/false);
+pWrtShell->Insert("100");
+
+// trigger recalculation by leaving the cell
+pWrtShell->Down(/*bSelect=*/false, /*nCount=*/1);
+
+uno::Reference xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xIndexAccess(xTextTablesSupplier->getTextTables(),
+ uno::UNO_QUERY);
+uno::Reference xTextTable(xIndexAccess->getByIndex(0), 
uno::UNO_QUERY);
+
+CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xTextTable->getRows()->getCount());
+
+uno::Reference xCellA1(xTextTable->getCellByName("A1"), 
uno::UNO_QUERY);
+// value "100" and footnote index "1"
+CPPUNIT_ASSERT_EQUAL(OUString("1001"), xCellA1->getString());
+uno::Reference xCellA3(xTextTable->getCellByName("A3"), 
uno::UNO_QUERY);
+// This was 4 (missing recalculation)
+CPPUNIT_ASSERT_EQUAL(OUString("102"), xCellA3->getString());
+uno::Reference xCellA4(xTextTable->getCellByName("A4"), 
uno::UNO_QUERY);
+// This was 8 (missing recalculation)
+CPPUNIT_ASSERT_EQUAL(OUString("204"), xCellA4->getString());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132603)
 {
 createSwDoc();
diff --git a/sw/source/core/fields/cellfml.cxx 
b/sw/source/core/fields/cellfml.cxx
index f74b80401596..7306b0fef8c8 100644
--- a/sw/source/core/fields/cellfml.cxx
+++ b/sw/source/core/fields/cellfml.cxx
@@ -152,9 +152,8 @@ double SwTableBox::GetValue( SwTableCalcPara& rCalcPara ) 
const
 OUString sText = pTextNd->GetText();
 
 // use text of the tracked changes
-if ( sText != pTextNd->GetRedlineText() &&
-   

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-04-30 Thread László Németh (via logerrit)
 sw/qa/uitest/writer_tests/trackedChanges.py |   30 
 sw/source/uibase/misc/redlndlg.cxx  |   27 +
 2 files changed, 57 insertions(+)

New commits:
commit 0844dd442e9805788ed940055c74d070e184121a
Author: László Németh 
AuthorDate: Thu Apr 7 17:58:06 2022 +0200
Commit: László Németh 
CommitDate: Sat Apr 30 19:24:37 2022 +0200

tdf#147179 sw: select tracked row change in Manage Changes

In Manage Changes dialog window, selecting items
of list of changes results selection of the associated
text changes in the main text, as a visual feedback.
From commit eebe4747d2d13545004937bb0267ccfc8ab9d63f,
text changes of deleted/inserted rows or tables are
listed under a single "tracked row" list item, as its
children. Selecting a "tracked row" list item in
Manage Changes resulted incomplete text selection in
the main text: only the first text change in the first
cell was selected instead of all associated text changes
of tracked row(s) or table.

Note: Manage Changes supports multiple selections,
i.e. it's possible to select multiple list items by
Ctrl + click, and select ranges by Shift + click.
This commit does the same with redlines of tracked
row changes.

Follow-up to commit eebe4747d2d13545004937bb0267ccfc8ab9d63f
"tdf#144270 sw: manage tracked table (row) deletion/insertion".

(cherry-picked from commit a21ef822f9769ded6ff834dbfa347cf0e5f913fd)

Conflicts:
sw/qa/uitest/writer_tests/trackedChanges.py

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

diff --git a/sw/qa/uitest/writer_tests/trackedChanges.py 
b/sw/qa/uitest/writer_tests/trackedChanges.py
index dea49c28673f..1c458694d734 100644
--- a/sw/qa/uitest/writer_tests/trackedChanges.py
+++ b/sw/qa/uitest/writer_tests/trackedChanges.py
@@ -7,6 +7,7 @@
 
 from uitest.framework import UITestCase
 from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, 
type_text
+from libreoffice.uno.propertyvalue import mkPropertyValues
 
 class trackedchanges(UITestCase):
 
@@ -319,4 +320,33 @@ class trackedchanges(UITestCase):
 tables = document.getTextTables()
 self.assertEqual(3, len(tables))
 
+def test_tdf147179(self):
+with 
self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as 
document:
+xWriterDoc = self.xUITest.getTopFocusWindow()
+xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+tables = document.getTextTables()
+self.assertEqual(3, len(tables))
+
+# Select text of the tracked row, not only text of its first cell
+with 
self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges",
 close_button="close") as xTrackDlg:
+changesList = xTrackDlg.getChild("writerchanges")
+
+# select second tracked table row in tree list
+changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"DOWN"}))
+xToolkit = 
self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
+while get_state_as_dict(xWriterEdit)["SelectedText"] != 'klj':
+xToolkit.processEventsToIdle()
+
+# this was "j" (only text of the first cell was selected, not 
text of the row)
+
self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "klj" )
+
+# select first tracked table row in tree list
+changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"UP"}))
+while get_state_as_dict(xWriterEdit)["SelectedText"] != 'bca':
+xToolkit.processEventsToIdle()
+
+# this was "a" (only text of the first cell was selected, not 
text of the row)
+
self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "bca" )
+
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/source/uibase/misc/redlndlg.cxx 
b/sw/source/uibase/misc/redlndlg.cxx
index a8099859455d..b3ca574b492d 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -1121,6 +1121,33 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, GotoHdl, Timer *, 
void)
 pSh->EnterAddMode();
 }
 }
+
+// select all redlines of tracked table rows
+std::unique_ptr 
xChild(rTreeView.make_iterator( &*xActEntry ));
+if ( rTreeView.iter_children(*xChild) )
+{
+RedlinData *pData = 
reinterpret_cast(rTreeView.get_id(*xChild).toInt64());
+// disabled for 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-04-28 Thread Caolán McNamara (via logerrit)
 sw/qa/extras/layout/data/forcepoint93-1.rtf |binary
 sw/qa/extras/layout/data/forcepoint93-2.rtf |binary
 sw/qa/extras/layout/layout.cxx  |7 +++
 sw/source/core/inc/frame.hxx|   11 +--
 sw/source/core/layout/objectformattertxtfrm.cxx |2 ++
 sw/source/core/layout/wsfrm.cxx |2 +-
 6 files changed, 15 insertions(+), 7 deletions(-)

New commits:
commit 5277b953b2984cba8f867c9c750e8bc510a5
Author: Caolán McNamara 
AuthorDate: Sun Mar 27 12:36:25 2022 +0100
Commit: Michael Stahl 
CommitDate: Thu Apr 28 10:30:21 2022 +0200

forcepoint#93 fix crash on layout of specific rtf

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

diff --git a/sw/qa/extras/layout/data/forcepoint93-1.rtf 
b/sw/qa/extras/layout/data/forcepoint93-1.rtf
new file mode 100644
index ..bbe5ecfb78f2
Binary files /dev/null and b/sw/qa/extras/layout/data/forcepoint93-1.rtf differ
diff --git a/sw/qa/extras/layout/data/forcepoint93-2.rtf 
b/sw/qa/extras/layout/data/forcepoint93-2.rtf
new file mode 100644
index ..bcc5f3dc8855
Binary files /dev/null and b/sw/qa/extras/layout/data/forcepoint93-2.rtf differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index c78273685865..4122d3725b88 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2523,6 +2523,13 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint92)
 createSwDoc(DATA_DIRECTORY, "forcepoint92.doc");
 }
 
+//just care it doesn't crash/assert
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint93)
+{
+createSwDoc(DATA_DIRECTORY, "forcepoint93-1.rtf");
+createSwDoc(DATA_DIRECTORY, "forcepoint93-2.rtf");
+}
+
 //just care it doesn't crash/assert
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint94)
 {
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index 3b1414002140..f634b7280f73 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -444,7 +444,7 @@ protected:
 bool mbColLocked : 1;  // lock Grow/Shrink for column-wise section
   // or fly frames, will be set in Format
 bool m_isInDestroy : 1;
-bool mbForbidDelete : 1;
+int mnForbidDelete;
 
 void ColLock()  { mbColLocked = true; }
 void ColUnlock(){ mbColLocked = false; }
@@ -885,7 +885,7 @@ public:
 bool IsProtected() const;
 
 bool IsColLocked()  const { return mbColLocked; }
-virtual bool IsDeleteForbidden() const { return mbForbidDelete; }
+virtual bool IsDeleteForbidden() const { return mnForbidDelete > 0; }
 
 /// this is the only way to delete a SwFrame instance
 static void DestroyFrame(SwFrame *const pFrame);
@@ -925,8 +925,8 @@ public:
 void RegisterToFormat( SwFormat& rFormat );
 void ValidateThisAndAllLowers( const sal_uInt16 nStage );
 
-void ForbidDelete()  { mbForbidDelete = true; }
-void AllowDelete(){ mbForbidDelete = false; }
+void ForbidDelete() { ++mnForbidDelete; }
+void AllowDelete() { assert(mnForbidDelete > 0); --mnForbidDelete; }
 
 drawinglayer::attribute::SdrAllFillAttributesHelperPtr 
getSdrAllFillAttributesHelper() const;
 bool supportsFullDrawingLayerFillAttributeSet() const;
@@ -1263,8 +1263,7 @@ public:
 //it in e.g. SwSectionFrame::MergeNext etc because we will need it
 //again after the SwFrameDeleteGuard dtor
 explicit SwFrameDeleteGuard(SwFrame* pFrame)
-: m_pForbidFrame((pFrame && !pFrame->IsDeleteForbidden()) ?
-pFrame : nullptr)
+: m_pForbidFrame(pFrame)
 {
 if (m_pForbidFrame)
 m_pForbidFrame->ForbidDelete();
diff --git a/sw/source/core/layout/objectformattertxtfrm.cxx 
b/sw/source/core/layout/objectformattertxtfrm.cxx
index d0fa8cf1be84..2fb0ced81291 100644
--- a/sw/source/core/layout/objectformattertxtfrm.cxx
+++ b/sw/source/core/layout/objectformattertxtfrm.cxx
@@ -879,6 +879,8 @@ void 
SwObjectFormatterTextFrame::FormatAnchorFrameAndItsPrevs( SwTextFrame& _rAn
 // Thus, check for valid .
 while ( pFrame && pFrame != pSectFrame )
 {
+SwFrameDeleteGuard aDeleteFrameGuard(pFrame);
+
 if ( pFrame->IsLayoutFrame() )
 lcl_FormatContentOfLayoutFrame( 
static_cast(pFrame) );
 else
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 294ce003..62c99a5f6e87 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -317,7 +317,7 @@ SwFrame::SwFrame( sw::BroadcastingModify *pMod, SwFrame* 
pSib )
 mbInfSct ( false ),
 mbColLocked(false),
 m_isInDestroy(false),
-mbForbidDelete(false)
+mnForbidDelete(0)
 {
 OSL_ENSURE( pMod, "No 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-04-27 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter3.cxx  |  113 +++
 sw/source/uibase/dochdl/swdtflvr.cxx |   26 ++--
 2 files changed, 135 insertions(+), 4 deletions(-)

New commits:
commit c52acf9d1935b95a8279b760212553c0c3b4b267
Author: László Németh 
AuthorDate: Tue Apr 26 12:29:29 2022 +0200
Commit: Xisco Fauli 
CommitDate: Wed Apr 27 10:49:31 2022 +0200

tdf#148791 tdf#64902 tdf#127759 sw: fix row insert/paste

Table insertion mode and Paste as Rows Above inserted
only a single row above, and overwrite the next ones in
the following cases (instead of inserting/pasting rows
above according to the clipboard table content):

The table stored in the clipboard

– has centered, right or not paragraph starting alignment;

– or its resource table has a table header with 2 or more
  repeating rows, and the clipboard content contains the
  same amount or less rows (it doesn't matter, that
  the copied rows weren't header rows originally).

The reason was that parsing of the HTML clipboard content
which is used for counting the row count of the clipboard
content hadn't handle the following cases:

– different table aligment results  elements with
  greater indentation level in the HTML extract, according
  to the new root element ,  or ;

– copying rows from a table with row header always starts
  with  in the HTML extract, i.e. detecting 
  can fail, because there could be only  in the
  HTML extract (see Case 2 above).

Follow-up to commit 0c8b1efbad48fa9697c0b1afbe4753bbbc3c4c5c
"tdf#127759 Writer: add table row/column insert mode" and
commit 7efae60f3625a58f8a617c80f2a55a695fbaef36
"tdf#64902 Writer table: Paste Special->Rows Above".

Change-Id: I466cea20705bc5dd5455e22842da7dfa6631ba81
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133445
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 2fbf0f418ccb25010add33449d4e42b8b3f7fd0b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133411
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 26ca4e8db96f..3c453ab313da 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -2267,6 +2267,119 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf141391)
 assertXPath(pXmlDoc, "/root/page[1]/body/tab/row[2]/cell[1]/txt/Text", 
"Portion", "hello");
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf148791)
+{
+// test Paste as Rows Above with centered table alignment
+
+// load a 2-row table
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf116789.fodt");
+CPPUNIT_ASSERT(pDoc);
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+
+// select and copy the table, and Paste As Rows Above
+
+dispatchCommand(mxComponent, ".uno:SelectTable", {});
+dispatchCommand(mxComponent, ".uno:Copy", {});
+// remove the selection and positionate the cursor at beginning of A2
+pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, 
/*bBasicCall=*/false);
+pWrtShell->Up(/*bSelect=*/false);
+dispatchCommand(mxComponent, ".uno:PasteRowsBefore", {});
+Scheduler::ProcessEventsToIdle();
+
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+// Paste as Rows Above results 4-row table with default table aligment
+assertXPath(pXmlDoc, "/root/page[1]/body/tab/row", 4);
+assertXPath(pXmlDoc, "/root/page[1]/body/tab/row[1]/cell[1]/txt/Text", 
"Portion", "hello");
+assertXPath(pXmlDoc, "/root/page[1]/body/tab/row[3]/cell[1]/txt/Text", 
"Portion", "hello");
+
+// set table alignment to center, select and copy the table again
+uno::Reference xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xIndexAccess(xTextTablesSupplier->getTextTables(),
+ uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+
+uno::Reference xTextTable(xIndexAccess->getByIndex(0), 
uno::UNO_QUERY);
+
+// Default table alignment
+CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::FULL,
+ getProperty(xTextTable, "HoriOrient"));
+
+//CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty(xTextTable, 
"TableTemplateName"));
+uno::Reference xTableProps(xTextTable, 
uno::UNO_QUERY_THROW);
+
+xTableProps->setPropertyValue("HoriOrient", 
uno::makeAny(text::HoriOrientation::CENTER));
+
+CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER,
+ getProperty(xTextTable, "HoriOrient"));
+
+dispatchCommand(mxComponent, ".uno:SelectTable", {});
+dispatchCommand(mxComponent, ".uno:Copy", {});
+// remove the selection and positionate the cursor at beginning of A2
+pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-04-26 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter3.cxx |   91 
 sw/source/core/frmedt/fecopy.cxx|   14 +++--
 2 files changed, 100 insertions(+), 5 deletions(-)

New commits:
commit f0254aaea7d4a6a261731f76c99cb06f1b5ab2b1
Author: László Németh 
AuthorDate: Fri Apr 22 20:34:32 2022 +0200
Commit: Xisco Fauli 
CommitDate: Tue Apr 26 09:25:25 2022 +0200

tdf#141391 sw: don't paste as nested table in first cell paragraph

Paste table content overwrote cells of the row(s) only if the text
cursor was at the beginning of the table cell, otherwise the table
cells on the clipboard were inserted as a nested table.

This was a UX regression from commit 
7600a2942ce2b9dac66836105bed6620d55abec2
"fdo#37156 insert table copy as nested table in non-starting cell position"
especially when the user clicked not exactly at the beginning of a
cell, which containing a 1-line text or data.

Since commit 1e278d1d0cfb1d5375195aa764739f00633f21e8
"tdf#37156 Writer menu: Paste as Nested table" it's possible to
force nesting (but not overwriting yet), this commit revert partially
commit 7600a2942ce2b9dac66836105bed6620d55abec2: if the text cursor
is there in the first paragraph of the cell, Paste table content
overwrites the row, not embedding a nested table in the cell
at the cursor position. This change results also better interoperability
with the existing document editors.

Note: table and text selection were checked with the change, too.

Details:

Heuristics to allow copying table rows or nesting tables
without using Edit -> Paste Special -> Paste as Nested Table:

At "table selection" (i.e. when cell(s) completely selected),
or if the text selection starts in the first paragraph, or if
there is no selection and the text cursor is there in the first
paragraph, overwrite content of the cell(s). Otherwise insert
a nested table, i.e. if nothing selected and the cursor is not
in the first paragraph, or the selected text doesn't contain
the first paragraph of the cell.

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

diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 03b2bc92b307..26ca4e8db96f 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -2176,6 +2176,97 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf148345)
 assertXPath(pXmlDoc, "/root/page[1]/body/tab/row", 2);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf141391)
+{
+// table insertion in the first paragraph of the cell
+// overwrites the row content, instead of inserting a nested table
+
+// load a 2-row table
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf116789.fodt");
+CPPUNIT_ASSERT(pDoc);
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+
+// select the table, and copy it into at paragraph start of cell "A2"
+
+dispatchCommand(mxComponent, ".uno:SelectTable", {});
+dispatchCommand(mxComponent, ".uno:Copy", {});
+// remove the selection and positionate the cursor at beginning of A2
+pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, 
/*bBasicCall=*/false);
+dispatchCommand(mxComponent, ".uno:Paste", {});
+Scheduler::ProcessEventsToIdle();
+
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+// 3-row, overwriting cells of the second row and inserting a new row
+// with the 2-row clipboard table content
+assertXPath(pXmlDoc, "/root/page[1]/body/tab/row", 3);
+assertXPath(pXmlDoc, "/root/page[1]/body/tab/row[2]/cell[1]/txt/Text", 
"Portion", "hello");
+
+// Undo
+
+dispatchCommand(mxComponent, ".uno:Undo", {});
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+// 2 rows again, no copied text content
+assertXPath(pXmlDoc, "/root/page[1]/body/tab/row", 2);
+assertXPath(pXmlDoc, "/root/page[1]/body/tab/row[2]/cell[1]/Text", 0);
+
+// insert the 2-row table into the second paragraph of cell "A2" as a 
nested table
+// For this it's enough to positionate the text cursor not in the first 
paragraph
+
+// insert some text and an empty paragraph
+pWrtShell->Insert("Some text...");
+pWrtShell->SplitNode();
+Scheduler::ProcessEventsToIdle();
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "/root/page[1]/body/tab/row", 2);
+assertXPath(pXmlDoc, "/root/page[1]/body/tab/row[2]/cell[1]/txt", 2);
+assertXPath(pXmlDoc, "/root/page[1]/body/tab/row[2]/cell[1]/txt[1]/Text", 
"Portion",
+"Some text...");
+ 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-04-25 Thread Michael Stahl (via logerrit)
 sw/qa/extras/uiwriter/uiwriter.cxx |   51 +
 sw/source/core/txtnode/ndtxt.cxx   |5 +++
 2 files changed, 56 insertions(+)

New commits:
commit f4740811b65076d9a84c098f466a02143fcfec06
Author: Michael Stahl 
AuthorDate: Fri Apr 22 19:26:47 2022 +0200
Commit: Caolán McNamara 
CommitDate: Mon Apr 25 17:41:10 2022 +0200

tdf#135978 sw_redlinehide: recreate fly frames anchored to subsequent nodes

... in SwTextNode::JoinNext().

The 2nd node is deleted, so its frame is deleted, and if it is the start
of a merged frame, fly frames on the node itself will be recreated
already, but those on subseqent nodes need an extra call.

Change-Id: I1846334f5560b720d3d275610bc8b07973f6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/15
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 98ae340307786c8fe18addc3714c9b859fdf12dd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133371
Reviewed-by: Caolán McNamara 

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index 1e6f8be07b06..d38c33364803 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -693,6 +693,57 @@ void SwUiWriterTest::testTdf67238()
 
CPPUNIT_ASSERT(!((rTable.GetTableBox("C3"))->GetFrameFormat()->GetProtect()).IsContentProtected());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf135978)
+{
+SwDoc* pDoc = createSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+pWrtShell->Insert("foobar");
+pWrtShell->SplitNode();
+pWrtShell->Insert("bazquux");
+
+CPPUNIT_ASSERT(pWrtShell->IsEndOfDoc());
+
+SwFormatAnchor anchor(RndStdIds::FLY_AT_CHAR);
+anchor.SetAnchor(pWrtShell->GetCursor()->GetPoint());
+SfxItemSet flySet(pDoc->GetAttrPool(), svl::Items);
+flySet.Put(anchor);
+SwFlyFrameFormat const* pFly = dynamic_cast(
+pWrtShell->NewFlyFrame(flySet, /*bAnchValid=*/true));
+CPPUNIT_ASSERT(pFly != nullptr);
+CPPUNIT_ASSERT(pFly->GetFrame() != nullptr);
+// move cursor back to body
+pWrtShell->SttEndDoc(/*bStt=*/false);
+
+// hide and enable
+dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+
+CPPUNIT_ASSERT(pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+CPPUNIT_ASSERT(
+
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+CPPUNIT_ASSERT(pWrtShell->GetLayout()->IsHideRedlines());
+
+pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 4, 
/*bBasicCall=*/false);
+pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 6, 
/*bBasicCall=*/false);
+pWrtShell->Delete();
+
+// now split
+pWrtShell->SttEndDoc(/*bStt=*/true);
+pWrtShell->SplitNode();
+CPPUNIT_ASSERT(pFly->GetFrame() != nullptr);
+
+// the problem was that undo removed the fly frame from the layout
+pWrtShell->Undo();
+CPPUNIT_ASSERT(pFly->GetFrame() != nullptr);
+
+pWrtShell->Redo();
+CPPUNIT_ASSERT(pFly->GetFrame() != nullptr);
+
+pWrtShell->Undo();
+CPPUNIT_ASSERT(pFly->GetFrame() != nullptr);
+}
+
 void SwUiWriterTest::testFdo75110()
 {
 SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "fdo75110.odt");
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 4d109a8add1c..5c8a501386fa 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -884,6 +884,11 @@ void CheckResetRedlineMergeFlag(SwTextNode & rNode, 
Recreate const eRecreateMerg
 {
 
assert(pFrame->GetMergedPara()->listener.IsListeningTo());
 assert(rNode.GetIndex() <= 
pFrame->GetMergedPara()->pLastNode->GetIndex());
+// tdf#135978 Join: recreate fly frames anchored to subsequent 
nodes
+if (eRecreateMerged == sw::Recreate::ThisNode)
+{
+AddRemoveFlysAnchoredToFrameStartingAtNode(*pFrame, rNode, 
nullptr);
+}
 }
 eMode = sw::FrameMode::New; // Existing is not idempotent!
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-04-19 Thread Vasily Melenchuk (via logerrit)
 sw/qa/uitest/writer_tests7/tdf144439.py |3 +--
 sw/source/core/doc/number.cxx   |2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 90715026e5a19956ef449694937893c0c76bea21
Author: Vasily Melenchuk 
AuthorDate: Mon Apr 18 14:36:37 2022 +0300
Commit: Xisco Fauli 
CommitDate: Tue Apr 19 11:16:58 2022 +0200

tdf#147472: sw: bug in numbering with previous level NONE

Previous fix for tdf#146257 was not complete and was not able to
take care of disabled numebering started just at beginning of the
numbering string.

UI test test_tdf144439_outline with modifications is covering this
situation. No need in extra testcases.

Change-Id: Id17838cec7fb4fb039f9b457b7ee9ad3ab345678
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133124
Tested-by: Jenkins
Reviewed-by: Vasily Melenchuk 
(cherry picked from commit a31a7b53c42eef3a8007766c60ec5a2539054a7c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133135
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/uitest/writer_tests7/tdf144439.py 
b/sw/qa/uitest/writer_tests7/tdf144439.py
index 6797260f7240..4862375834e8 100644
--- a/sw/qa/uitest/writer_tests7/tdf144439.py
+++ b/sw/qa/uitest/writer_tests7/tdf144439.py
@@ -69,8 +69,7 @@ class tdf144439(UITestCase):
 Paragraphs = document.Text.createEnumeration()
 Para1 = Paragraphs.nextElement()
 self.assertEqual(Para1.String, "Outline2")
-# Well, this looks strange, but we asked to show 1 & 2 levels and 
1st is without numbering
-self.assertEqual(Para1.getPropertyValue("ListLabelString"), ".1")
+self.assertEqual(Para1.getPropertyValue("ListLabelString"), "1")
 
 with 
self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as 
xDialog:
 # Select level "1"
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index 8a5b9c5d7c60..4e446cbf215c 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -705,7 +705,7 @@ OUString SwNumRule::MakeNumString( const 
SwNumberTree::tNumberVector & rNumVecto
 OUString sFind("%" + OUString::number(i + 1) + "%");
 sal_Int32 nPositionToken = sLevelFormat.indexOf(sFind);
 sal_Int32 nPositionNextToken = sLevelFormat.indexOf('%', 
nPositionToken + sFind.getLength());
-if (nPositionToken > 0 && nPositionNextToken >= nPositionToken)
+if (nPositionToken >= 0 && nPositionNextToken >= 
nPositionToken)
 {
 sLevelFormat = sLevelFormat.replaceAt(nPositionToken, 
nPositionNextToken - nPositionToken, u"");
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-04-16 Thread Xisco Fauli (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf148494.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx   |   12 
 sw/source/filter/ww8/ww8atr.cxx  |4 ++--
 3 files changed, 14 insertions(+), 2 deletions(-)

New commits:
commit dfacd800395b95837a24a1f33267b46f96efd5de
Author: Xisco Fauli 
AuthorDate: Fri Apr 15 17:55:21 2022 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Sat Apr 16 20:41:51 2022 +0200

tdf#148494: export: Always add space separator

Otherwise, the macro is saved as MACROBUTTONAllCaps
instead of MACROBUTTON AllCaps

Change-Id: Id1288e23f21ce72884bc1197f171e255ea7458f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133077
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133082
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf148494.docx 
b/sw/qa/extras/ooxmlexport/data/tdf148494.docx
new file mode 100644
index ..c60c73a206fb
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf148494.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index 51f0d9fb9345..c0b693247828 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -68,6 +68,18 @@ CPPUNIT_TEST_FIXTURE(Test, testParaStyleNumLevel)
 assertXPath(pXmlDoc, 
"/w:styles/w:style[@w:styleId='Mystyle']/w:pPr/w:numPr/w:ilvl", "val", "1");
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf148494)
+{
+loadAndSave("tdf148494.docx");
+
+xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+
+// Without the fix in place, this test would have failed with
+// - Expected:  MACROBUTTON AllCaps Hello World
+// - Actual  :  MACROBUTTONAllCaps Hello World
+assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:r[3]/w:instrText", " 
MACROBUTTON AllCaps Hello World ");
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf137466, "tdf137466.docx")
 {
 xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index cbafa7a909a0..8d5ac4e888fa 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -3312,8 +3312,8 @@ void AttributeOutputBase::TextField( const SwFormatField& 
rField )
 break;
 case SwFieldIds::Macro:
 {
-const OUString sStr = " MACROBUTTON"
-+ 
pField->GetPar1().replaceFirst("StarOffice.Standard.Modul1.", " ")
+const OUString sStr = " MACROBUTTON "
++ 
pField->GetPar1().replaceFirst("StarOffice.Standard.Modul1.", "")
 + " "
 + lcl_GetExpandedField(*pField);
 GetExport().OutputField( pField, ww::eMACROBUTTON, sStr );


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-04-08 Thread Miklos Vajna (via logerrit)
 sw/qa/core/doc/doc.cxx|   28 
 sw/source/core/doc/docfly.cxx |2 +-
 2 files changed, 29 insertions(+), 1 deletion(-)

New commits:
commit 267555f2458e6670a03013a5def67e87d6dc56cd
Author: Miklos Vajna 
AuthorDate: Thu Apr 7 16:59:32 2022 +0200
Commit: Michael Stahl 
CommitDate: Fri Apr 8 11:12:53 2022 +0200

sw: keep URL when applying frame style on images

It seems that the intention is to reset properties which are possible to
set in a style when applying a style. For example the paragraph
alignment can be defined in a paragraph style, so reset that on style
apply.

URLs on frames can't be defined for frame styles, so it looks incorrect
to reset the URL of a frame/image on style apply, fix this.

Change-Id: Ie3a57b654cf06b9512b25d2dc103d15cd83727b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132675
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit 97c18cf32a9a3088b5a51e2b0d535d8caf5daca8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132697
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/core/doc/doc.cxx b/sw/qa/core/doc/doc.cxx
index 0d39c2fbd508..43894afa03dc 100644
--- a/sw/qa/core/doc/doc.cxx
+++ b/sw/qa/core/doc/doc.cxx
@@ -197,6 +197,34 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testIMEGrouping)
 #endif
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testImageHyperlinkStyle)
+{
+// Given a document with an image with a hyperlink:
+loadURL("private:factory/swriter", nullptr);
+uno::Reference xFactory(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xDocument(mxComponent, uno::UNO_QUERY);
+uno::Reference xText = xDocument->getText();
+uno::Reference xCursor = xText->createTextCursor();
+uno::Reference xImage(
+xFactory->createInstance("com.sun.star.text.TextGraphicObject"), 
uno::UNO_QUERY);
+xText->insertTextContent(xCursor, xImage, /*bAbsorb=*/false);
+uno::Reference xImageProps(xImage, uno::UNO_QUERY);
+OUString aExpected = "http://www.example.com;;
+xImageProps->setPropertyValue("HyperLinkURL", uno::makeAny(aExpected));
+
+// When applying a frame style on it:
+xImageProps->setPropertyValue("FrameStyleName", 
uno::makeAny(OUString("Frame")));
+
+// Then make sure that the hyperlink is not lost:
+auto aActual = getProperty(xImageProps, "HyperLinkURL");
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: http://www.example.com
+// - Actual  :
+// i.e. the link was lost, even if the frame style dialog doesn't allow 
specifying a link on
+// frames.
+CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx
index 6b73f1f756b5..db9518b2cecd 100644
--- a/sw/source/core/doc/docfly.cxx
+++ b/sw/source/core/doc/docfly.cxx
@@ -700,7 +700,7 @@ bool SwDoc::SetFrameFormatToFly( SwFrameFormat& rFormat, 
SwFrameFormat& rNewForm
 rFormat.ResetFormatAttr( RES_PRINT, RES_SURROUND );
 rFormat.ResetFormatAttr( RES_LR_SPACE, RES_UL_SPACE );
 rFormat.ResetFormatAttr( RES_BACKGROUND, RES_COL );
-rFormat.ResetFormatAttr( RES_URL, RES_EDIT_IN_READONLY );
+rFormat.ResetFormatAttr( RES_EDIT_IN_READONLY );
 
 if( !bFrameSz )
 rFormat.SetFormatAttr( aFrameSz );


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-04-07 Thread Michael Stahl (via logerrit)
 sw/qa/extras/uiwriter/data/variable-field-table-row-split-header.fodt |  270 
++
 sw/qa/extras/uiwriter/uiwriter3.cxx   |   73 ++
 sw/source/core/doc/DocumentFieldsManager.cxx  |   25 
 sw/source/core/doc/docfld.cxx |   45 +
 sw/source/core/docnode/node2lay.cxx   |   77 ++
 sw/source/core/fields/expfld.cxx  |3 
 sw/source/core/inc/docfld.hxx |   11 
 sw/source/core/inc/node2lay.hxx   |6 
 8 files changed, 477 insertions(+), 33 deletions(-)

New commits:
commit 855e2af1bf6eb216d63ca7baeb9161c7cd501a42
Author: Michael Stahl 
AuthorDate: Tue Apr 5 18:27:35 2022 +0200
Commit: Thorsten Behrens 
CommitDate: Fri Apr 8 00:48:27 2022 +0200

sw: fix expansion of SetGetExpField in headers with split table rows

The problem is that a get field in a header on page N may calculate and
show values that do not take into account a set field on page N-1.

This happens if a table row with multiple columns is split across the
pages: SwGetExpField::ChangeExpansion() calls GetBodyTextNode(), which
returns the first node in the first column that is on page N, but in the
SwNodes array this node is *before* any node in columns 2..M, any of
which may be on page N-1 in the layout.

So try to fix this by adding a page number to SetGetExpField and using
that as the highest priority in operator<().

This is a bit risky because some of the places that create
SetGetExpField don't have a frame to get the page number from; try to
adapt all that call into MakeFieldList(), while leaving unrelated ones
such as in MakeSetList() unchanged.

Change-Id: Ied2a897ad34f0faf1ef3d50baad07b23fafd49bd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132641
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 9dc6e2c9062725ef1f9d7e321cae5f4dbe8ca749)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132645
Reviewed-by: Thorsten Behrens 

diff --git 
a/sw/qa/extras/uiwriter/data/variable-field-table-row-split-header.fodt 
b/sw/qa/extras/uiwriter/data/variable-field-table-row-split-header.fodt
new file mode 100644
index ..9d3668b6b2ee
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/variable-field-table-row-split-header.fodt
@@ -0,0 +1,270 @@
+
+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:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 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:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing: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:ooo="http://openoffice.org/2004/office; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d: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:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="ur
 n:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:xforms="http://www.w3.org/2002/xforms; office:version="1.3" 
office:mimetype="application/vnd.oasis.opendocument.text">
+ 
2022-04-06T17:07:05.9473620632022-04-06T17:17:45.832216066PT10M42S2LibreOfficeDev/7.4.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/a5b31508f860f07ec86cda3cf992fcea2bee68ef
+ 
+  
+  
+  
+ 
+ 
+  
+  
+  
+   
+   
+
+   
+   
+  
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-04-05 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter3.cxx |   53 
 sw/source/uibase/app/docsh2.cxx |   42 
 2 files changed, 95 insertions(+)

New commits:
commit 4494e24c29d9a673964feb9c637b13122ee17f87
Author: László Németh 
AuthorDate: Mon Apr 4 18:46:17 2022 +0200
Commit: László Németh 
CommitDate: Tue Apr 5 15:15:19 2022 +0200

tdf#148345 sw: reject all tracked row deletion in Hide Changes

In Hide Changes mode, undeleted rows didn't reappear at applying
Reject All for tracked row deletions.

See also commit a74c51025fa4519caaf461492e4ed8e68bd34885
"tdf#146962 sw: hide deleted row at deletion in Hide Changes".

Change-Id: I55d76fb0165fefc330934c5a2a6b018904d3a1a8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132527
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit d4e2ed9324bd736275f07577ba81c974a0a70eb1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132391

diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 559d47641a99..13d62a49ef58 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -2050,6 +2050,59 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf147347)
 assertXPath(pXmlDoc, "/root/page[1]/body/tab/row", 2);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf148345)
+{
+// load a 2-row table, set Hide Changes mode and delete the first row with 
change tracking
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf116789.fodt");
+CPPUNIT_ASSERT(pDoc);
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+
+// enable redlining
+dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+// hide changes
+dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+CPPUNIT_ASSERT(pWrtShell->GetLayout()->IsHideRedlines());
+
+dispatchCommand(mxComponent, ".uno:DeleteRows", {});
+
+// Without the fix in place, the deleted row would be visible
+
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+// This was 2
+assertXPath(pXmlDoc, "/root/page[1]/body/tab/row", 1);
+
+// check it in Show Changes mode
+
+dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+CPPUNIT_ASSERT(!pWrtShell->GetLayout()->IsHideRedlines());
+
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+// 2 rows are visible now
+assertXPath(pXmlDoc, "/root/page[1]/body/tab/row", 2);
+
+// check it in Hide Changes mode again
+
+dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+CPPUNIT_ASSERT(pWrtShell->GetLayout()->IsHideRedlines());
+
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+// only a single row is visible again
+assertXPath(pXmlDoc, "/root/page[1]/body/tab/row", 1);
+
+// tdf#148227 check Reject All of tracked table row deletion
+
+dispatchCommand(mxComponent, ".uno:RejectAllTrackedChanges", {});
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+// This was 1
+assertXPath(pXmlDoc, "/root/page[1]/body/tab/row", 2);
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135014)
 {
 createSwDoc();
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 063b74e7da4a..a18526663555 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -69,6 +69,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1296,6 +1297,39 @@ void SwDocShell::Execute(SfxRequest& rReq)
 break;
 }
 
+// tables with tracked deletion need Show Changes
+bool bHideChanges = pWrtShell && pWrtShell->GetLayout() &&
+pWrtShell->GetLayout()->IsHideRedlines();
+bool bChangedHideChanges = false;
+if ( bHideChanges )
+{
+SwTableNode* pOldTableNd = nullptr;
+const SwRedlineTable& aRedlineTable = 
rRedlineAccess.GetRedlineTable();
+for (SwRedlineTable::size_type n = 0; n < 
aRedlineTable.size(); ++n)
+{
+const SwRangeRedline* pRedline = aRedlineTable[n];
+if ( pRedline->GetType() == RedlineType::Delete )
+{
+SwTableNode* pTableNd =
+
pRedline->GetPoint()->nNode.GetNode().FindTableNode();
+if ( pTableNd && pTableNd !=
+pOldTableNd && 
pTableNd->GetTable().HasDeletedRow() )
+{
+SfxBoolItem aShow(FN_REDLINE_SHOW, true);
+SfxViewShell* pViewShell = GetView()
+? GetView()
+  

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source xmloff/source

2022-04-05 Thread Michael Stahl (via logerrit)
 sw/qa/extras/odfimport/data/forcepoint101.fodt  |   13 +
 sw/qa/extras/odfimport/odfimport.cxx|6 ++
 sw/source/core/unocore/unodraw.cxx  |4 +++-
 sw/source/core/unocore/unoframe.cxx |1 +
 xmloff/source/text/XMLTextShapeImportHelper.cxx |   15 ++-
 5 files changed, 33 insertions(+), 6 deletions(-)

New commits:
commit 5188a1aa3c6ca44e6bdf0991546109fcd3ab3400
Author: Michael Stahl 
AuthorDate: Mon Apr 4 17:19:51 2022 +0200
Commit: Caolán McNamara 
CommitDate: Tue Apr 5 10:44:41 2022 +0200

forcepoint#101 sw: fix inserting at-page shapes to not set anchor pos

The problem is that for an at-page anchor SwXDrawPage::add() sets an
anchor position, but then a fieldmark is inserted and the node with the
anchor position is deleted.

The code that sets the surprising anchor position for at-page shape was
added in commit cf345e026fc0378c4436173c8064717c7db4d538 "Fix #91289#:
Draw objects anchored at page but without page number" and is similar to
the code for fly-frames added in commit
2e6d999cf8ceacabb94b11feee6ee0808c2a75bc "If no page number is given for
page bound frames, calculate it using cursor" except that it is missing
a check for GetPageNum() == 0, for no obvious reason.

The matching code to replace the anchor position with a page number is
in SwFlyFrameFormat::MakeFrames() and was added in commit
572a48cd16f6ce3a68ffead44a975698954dfe11 "Fix #85019#: Insertion of
flyframes without correct pagenumber"; it's not clear if this is only
needed for shapes inserted via the above 2 UNO APIs or also for shapes
inserted via UI.

Then there is the issue that the page number is set in
XMLTextShapeImportHelper::addShape() only after the shape is inserted,
which was added and commented in commit
b5fc47fe5c2892dd712e2bda922656eacbd932f1, earlier than all the above
commits; testing shows that if the page number is set before inserting
the shape, the shape ends up on the expected page anyway.

Let's change this:
1. the page number is set before inserting the shape
2. at-page anchor with page number is left as is
3. at-page anchor without page number gets anchor position and is changed
   to at-char

Change-Id: I2f874bec8424de5eee94cf022e3b49382eaa55f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132479
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132530
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/sw/qa/extras/odfimport/data/forcepoint101.fodt 
b/sw/qa/extras/odfimport/data/forcepoint101.fodt
new file mode 100644
index ..7210888262dc
--- /dev/null
+++ b/sw/qa/extras/odfimport/data/forcepoint101.fodt
@@ -0,0 +1,13 @@
+
+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:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 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:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing: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:ooo="http://openoffice.org/2004/office; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d: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:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="ur
 n:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:xforms="http://www.w3.org/2002/xforms; 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-04-04 Thread Caolán McNamara (via logerrit)
 sw/qa/extras/layout/data/forcepoint99.html |binary
 sw/qa/extras/layout/layout.cxx |6 ++
 sw/source/core/text/itrform2.cxx   |   15 +++
 sw/source/core/text/itrform2.hxx   |2 ++
 sw/source/core/text/porlay.cxx |4 +++-
 5 files changed, 22 insertions(+), 5 deletions(-)

New commits:
commit 0a34ac386187c5ca328aebc27851c2a2ff38f293
Author: Caolán McNamara 
AuthorDate: Fri Apr 1 16:52:06 2022 +0100
Commit: Caolán McNamara 
CommitDate: Mon Apr 4 20:57:24 2022 +0200

forcepoint#99 SwTextFormatter unaware that FirstOfBorderMerge was deleted

READ of size 8 at 0x606000a49e50 thread T0
#0 0x7f7ab6214bf5 in SwPosSize::Height() const 
/home/caolan/LibreOffice/core-asan/sw/source/core/text/possiz.hxx:49:37
#1 0x7f7ab636c311 in 
SwTextFormatter::MergeCharacterBorder(SwLinePortion&, SwLinePortion const*, 
SwTextFormatInfo&) 
/home/caolan/LibreOffice/core-asan/sw/source/core/text/itrform2.cxx:2807:43
#2 0x7f7ab636ae08 in SwTextFormatter::InsertPortion(SwTextFormatInfo&, 
SwLinePortion*) 
/home/caolan/LibreOffice/core-asan/sw/source/core/text/itrform2.cxx:354:13
#3 0x7f7ab6371db1 in SwTextFormatter::BuildPortions(SwTextFormatInfo&) 
/home/caolan/LibreOffice/core-asan/sw/source/core/text/itrform2.cxx:709:9
#4 0x7f7ab638b2ac in SwTextFormatter::FormatLine(o3tl::strong_int) 
/home/caolan/LibreOffice/core-asan/sw/source/core/text/itrform2.cxx:1701:9
#5 0x7f7ab62a8ad1 in SwTextFrame::FormatLine(SwTextFormatter&, bool) 
/home/caolan/LibreOffice/core-asan/sw/source/core/text/frmform.cxx:1212:44
#6 0x7f7ab62af1cc in SwTextFrame::Format_(SwTextFormatter&, 
SwTextFormatInfo&, bool) 
/home/caolan/LibreOffice/core-asan/sw/source/core/text/frmform.cxx:1571:23
#7 0x7f7ab62b1f17 in SwTextFrame::Format_(OutputDevice*, 
SwParaPortion*) 
/home/caolan/LibreOffice/core-asan/sw/source/core/text/frmform.cxx:1743:5
#8 0x7f7ab62b5260 in SwTextFrame::Format(OutputDevice*, SwBorderAttrs 
const*) 
/home/caolan/LibreOffice/core-asan/sw/source/core/text/frmform.cxx:1932:17
#9 0x7f7ab5dbdabd in SwContentFrame::MakeAll(OutputDevice*) 
/home/caolan/LibreOffice/core-asan/sw/source/core/layout/calcmove.cxx:1514:17

0x606000a49e50 is located 16 bytes inside of 56-byte region 
[0x606000a49e40,0x606000a49e78)
freed by thread T0 here:
#0 0x4fe1f7 in operator delete(void*) 
(/home/caolan/LibreOffice/core-asan/instdir/program/soffice.bin+0x4fe1f7)
#1 0x7f7ab6486d35 in SwTextPortion::~SwTextPortion() 
/home/caolan/LibreOffice/core-asan/sw/source/core/text/portxt.hxx:26:7
#2 0x7f7ab63da0c9 in SwLineLayout::CalcLine(SwTextFormatter&, 
SwTextFormatInfo&) 
/home/caolan/LibreOffice/core-asan/sw/source/core/text/porlay.cxx:430:21
#3 0x7f7ab6435413 in SwMultiPortion::CalcSize(SwTextFormatter&, 
SwTextFormatInfo&) 
/home/caolan/LibreOffice/core-asan/sw/source/core/text/pormulti.cxx:75:15
#4 0x7f7ab6457749 in 
SwTextFormatter::BuildMultiPortion(SwTextFormatInfo&, SwMultiPortion&) 
/home/caolan/LibreOffice/core-asan/sw/source/core/text/pormulti.cxx:2090:16
#5 0x7f7ab636f12c in SwTextFormatter::BuildPortions(SwTextFormatInfo&) 
/home/caolan/LibreOffice/core-asan/sw/source/core/text/itrform2.cxx:550:21
#6 0x7f7ab638b2ac in SwTextFormatter::FormatLine(o3tl::strong_int) 
/home/caolan/LibreOffice/core-asan/sw/source/core/text/itrform2.cxx:1701:9
#7 0x7f7ab62a8ad1 in SwTextFrame::FormatLine(SwTextFormatter&, bool) 
/home/caolan/LibreOffice/core-asan/sw/source/core/text/frmform.cxx:1212:44
#8 0x7f7ab62af1cc in SwTextFrame::Format_(SwTextFormatter&, 
SwTextFormatInfo&, bool) 
/home/caolan/LibreOffice/core-asan/sw/source/core/text/frmform.cxx:1571:23
#9 0x7f7ab62b1f17 in SwTextFrame::Format_(OutputDevice*, 
SwParaPortion*) 
/home/caolan/LibreOffice/core-asan/sw/source/core/text/frmform.cxx:1743:5
#10 0x7f7ab62b5260 in SwTextFrame::Format(OutputDevice*, SwBorderAttrs 
const*) 
/home/caolan/LibreOffice/core-asan/sw/source/core/text/frmform.cxx:1932:17
#11 0x7f7ab5dbdabd in SwContentFrame::MakeAll(OutputDevice*) 
/home/caolan/LibreOffice/core-asan/sw/source/core/layout/calcmove.cxx:1514:17

similar seen in the past as:

commit 96acebb72211b4718eb3038c427df37b55b17b0b
Date:   Tue May 14 01:49:03 2019 +0800

tdf#124937 reset m_pFirstOfBorderMerge before truncate.

commit ecd855794b22c0f7e6fb2f362b566c4d9c5f624a
Date:   Mon Jan 15 22:29:31 2018 +0100

tdf#114536 sw: fix use-after-free in 
SwTextFormatter::MergeCharacterBorder()

Change-Id: Iad855f382a0daf50dac2537d4a91bfeaa9ff3799
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132439
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit b46baea4d1cce81c56ee0d82fbdc352921445fa7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132380
Reviewed-by: 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-04-04 Thread Caolán McNamara (via logerrit)
 sw/qa/extras/layout/data/forcepoint103.html |binary
 sw/qa/extras/layout/layout.cxx  |6 ++
 sw/source/core/layout/layact.cxx|   12 +++-
 sw/source/core/layout/tabfrm.cxx|1 +
 4 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 934b5a9cd658be0dabe18fec0f7bc29943050bd2
Author: Caolán McNamara 
AuthorDate: Sun Apr 3 17:07:45 2022 +0100
Commit: Caolán McNamara 
CommitDate: Mon Apr 4 20:54:38 2022 +0200

forcepoint#103 avoid crash on layout of specific html

return early if the prev frame was unexpectedly deleted

and another similar case to forcepoint#100 and drop a
SwBorderAttrAccess to allow the cache entry to be removed
in SwCache::DeleteObj

Change-Id: Ia83fe8911e2f6071a28d69c3089a96e3b87cc548
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132487
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132494
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/layout/data/forcepoint103.html 
b/sw/qa/extras/layout/data/forcepoint103.html
new file mode 100644
index ..006a6d340ef0
Binary files /dev/null and b/sw/qa/extras/layout/data/forcepoint103.html differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 18c766904615..9ba5927f3e41 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2547,6 +2547,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint102)
 createSwDoc(DATA_DIRECTORY, "forcepoint102.rtf");
 }
 
+//just care it doesn't crash/assert
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint103)
+{
+createSwWebDoc(DATA_DIRECTORY, "forcepoint103.html");
+}
+
 //just care it doesn't crash/assert
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf147485Forcepoint)
 {
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index da6e7c938f6b..b2b246e5eb2f 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -59,6 +59,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1693,7 +1694,10 @@ bool SwLayAction::FormatContent(SwPageFrame *const pPage)
 // We do this so we don't have to search later on.
 const bool bNxtCnt = IsCalcLayout() && !pContent->GetFollow();
 const SwContentFrame *pContentNext = bNxtCnt ? 
pContent->GetNextContentFrame() : nullptr;
-const SwContentFrame *pContentPrev = pContent->GetPrev() ? 
pContent->GetPrevContentFrame() : nullptr;
+SwContentFrame* const pContentPrev = pContent->GetPrev() ? 
pContent->GetPrevContentFrame() : nullptr;
+std::optional oPrevDeleteListener;
+if (pContentPrev)
+oPrevDeleteListener.emplace(*pContentPrev);
 
 const SwLayoutFrame*pOldUpper  = pContent->GetUpper();
 const SwTabFrame *pTab = pContent->FindTabFrame();
@@ -1772,6 +1776,12 @@ bool SwLayAction::FormatContent(SwPageFrame *const pPage)
 bool bSetContent = true;
 if ( pContentPrev )
 {
+if (oPrevDeleteListener->WasDeleted())
+{
+SAL_WARN("sw", "ContentPrev was deleted");
+return false;
+}
+
 if ( !pContentPrev->isFrameAreaDefinitionValid() && 
pPage->IsAnLower( pContentPrev ) )
 {
 pPage->InvalidateContent();
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index c9683f6956e4..a650663de659 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -2548,6 +2548,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* 
pRenderContext)
 }
 }
 
+oAccess.reset();
 const bool bSplitError = !Split( nDeadLine, bTryToSplit, ( 
bTableRowKeep && !(bAllowSplitOfRow || bEmulateTableKeepSplitAllowed) ) );
 
 // tdf#130639 don't start table on a new page after the 
fallback "switch off repeating header"


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-04-04 Thread Caolán McNamara (via logerrit)
 sw/qa/extras/layout/data/forcepoint102.rtf |  178 +
 sw/qa/extras/layout/layout.cxx |   18 +-
 sw/source/core/text/txtfrm.cxx |8 +
 3 files changed, 197 insertions(+), 7 deletions(-)

New commits:
commit 1c4ebab83edb8fe70282f6467700a56c3aff6c1b
Author: Caolán McNamara 
AuthorDate: Sun Apr 3 17:07:45 2022 +0100
Commit: Caolán McNamara 
CommitDate: Mon Apr 4 20:53:44 2022 +0200

forcepoint#102 refetch pPara if it might have been destroyed

by SwTextFly::Relax

READ of size 8 at 0x616006d9ab08 thread T0
#0 0x7f5c56a0fbe5 in Size::Height() const include/tools/gen.hxx:213:52
#1 0x7f5c56a0fb98 in Size::getHeight() const 
include/tools/gen.hxx:219:55
#2 0x7f5c56a040f0 in SwRect::IsEmpty() const sw/inc/swrect.hxx:306:21
#3 0x7f5c56dbb018 in SwRect::HasArea() const sw/inc/swrect.hxx:302:13
#4 0x7f5c58571d04 in SwTextFrame::Prepare(PrepareHint, void const*, 
bool) sw/source/core/text/txtfrm.cxx:2986:45

0x616006d9ab08 is located 136 bytes inside of 608-byte region 
[0x616006d9aa80,0x616006d9ace0)
freed by thread T0 here:
#0 0x4fe1f7 in operator delete(void*) 
(instdir/program/soffice.bin+0x4fe1f7)
#1 0x7f5c584602c5 in SwParaPortion::~SwParaPortion() 
sw/source/core/text/porlay.cxx:2557:1
#2 0x7f5c5850b997 in 
std::default_delete::operator()(SwParaPortion*) const 
/usr/bin/../lib/gcc/x86_64-redhat-linux/11/../../../../include/c++/11/bits/unique_ptr.h:85:2
#3 0x7f5c5850b826 in std::__uniq_ptr_impl >::reset(SwParaPortion*) 
/usr/bin/../lib/gcc/x86_64-redhat-linux/11/../../../../include/c++/11/bits/unique_ptr.h:182:4
#4 0x7f5c5850b630 in std::unique_ptr >::reset(SwParaPortion*) 
/usr/bin/../lib/gcc/x86_64-redhat-linux/11/../../../../include/c++/11/bits/unique_ptr.h:456:7
#5 0x7f5c5850960d in SwTextLine::SetPara(SwParaPortion*, bool) 
sw/source/core/text/txtcache.hxx:45:17
#6 0x7f5c58509e7d in SwTextFrame::ClearPara() 
sw/source/core/text/txtcache.cxx:113:24
#7 0x7f5c5855606e in SwTextFrame::Init() 
sw/source/core/text/txtfrm.cxx:758:9
#8 0x7f5c585735c4 in SwTextFrame::Prepare(PrepareHint, void const*, 
bool) sw/source/core/text/txtfrm.cxx:3090:17
#9 0x7f5c57ecafb4 in lcl_NotifyContent(SdrObject const*, 
SwContentFrame*, SwRect const&, PrepareHint) 
sw/source/core/layout/frmtool.cxx:3367:15
#10 0x7f5c57ec968b in Notify_Background(SdrObject const*, SwPageFrame*, 
SwRect const&, PrepareHint, bool) sw/source/core/layout/frmtool.cxx:3443:9
#11 0x7f5c57958669 in lcl_NotifyBackgroundOfObj(SwDrawContact const&, 
SdrObject const&, tools::Rectangle const*) 
sw/source/core/draw/dcontact.cxx:951:13
#12 0x7f5c579556bc in SwDrawContact::Changed_(SdrObject const&, 
SdrUserCallType, tools::Rectangle const*) 
sw/source/core/draw/dcontact.cxx:1233:21
#13 0x7f5c57953b8d in SwDrawContact::Changed(SdrObject const&, 
SdrUserCallType, tools::Rectangle const&) 
sw/source/core/draw/dcontact.cxx:1009:5
#14 0x7f5c96008baf in SdrObject::SendUserCall(SdrUserCallType, 
tools::Rectangle const&) const svx/source/svdraw/svdobj.cxx:2767:22
#15 0x7f5c9601befa in SdrObject::Resize(Point const&, Fraction const&, 
Fraction const&, bool) svx/source/svdraw/svdobj.cxx:1561:5
#16 0x7f5c57da650c in SwAnchoredDrawObject::GetObjBoundRect() const 
sw/source/core/layout/anchoreddrawobject.cxx:733:22
#17 0x7f5c57dae236 in SwAnchoredObject::GetObjRectWithSpaces() const 
sw/source/core/layout/anchoredobject.cxx:569:31
#18 0x7f5c5853c39e in SwTextFly::InitAnchoredObjList() 
sw/source/core/text/txtfly.cxx:900:48
#19 0x7f5c58537b0c in SwTextFly::GetAnchoredObjList() const 
sw/source/core/inc/txtfly.hxx:311:44
#20 0x7f5c58532a5d in SwTextFly::ForEach(SwRect const&, SwRect*, bool) 
const sw/source/core/text/txtfly.cxx:1067:56
#21 0x7f5c58533eec in SwTextFly::IsAnyFrame() const 
sw/source/core/text/txtfly.cxx:405:12
#22 0x7f5c5832ccbe in SwTextFly::Relax() 
sw/source/core/inc/txtfly.hxx:337:17
#23 0x7f5c58571af5 in SwTextFrame::Prepare(PrepareHint, void const*, 
bool) sw/source/core/text/txtfrm.cxx:2976:48

Change-Id: Ibd0d4af69d2a8d74ad538afba7da53c864fa27b6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132480
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit f49d218a671df5f7a956ccb219dc46a5c8d0a53c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132485
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/layout/data/forcepoint102.rtf 
b/sw/qa/extras/layout/data/forcepoint102.rtf
new file mode 100644
index ..2a830ff73c10
--- /dev/null
+++ b/sw/qa/extras/layout/data/forcepoint102.rtf
@@ -0,0 +1,178 @@
+{\rtf1\ansh\ansicpg1252\uc1 \deff0\deflang1033\deflangfe1033{\fonttbl{\f0 
Times New Roman;}{\f1 Courier New;}{\f2 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-04-04 Thread Caolán McNamara (via logerrit)
 sw/qa/extras/layout/data/forcepoint89.html|binary
 sw/qa/extras/layout/data/forcepoint91.html|binary
 sw/qa/extras/layout/data/tdf147485-forcepoint.doc |binary
 sw/qa/extras/layout/layout.cxx|   25 --
 sw/source/core/layout/tabfrm.cxx  |2 +
 5 files changed, 25 insertions(+), 2 deletions(-)

New commits:
commit 4abce69fca83f5c98bb1fc0678cc1ce9cedd4750
Author: Caolán McNamara 
AuthorDate: Fri Mar 25 21:26:43 2022 +
Commit: Michael Stahl 
CommitDate: Mon Apr 4 19:14:34 2022 +0200

forcepoint#91 fix crash on layout of specific html

Change-Id: I145649e18f382c67ea34290f44fa219b7926127f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132129
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit be04a8072e4af30ca6ead36aa92d5f380cd9feb9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132483
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/layout/data/forcepoint89.html 
b/sw/qa/extras/layout/data/forcepoint89.html
new file mode 100644
index ..7998a2b0b979
Binary files /dev/null and b/sw/qa/extras/layout/data/forcepoint89.html differ
diff --git a/sw/qa/extras/layout/data/forcepoint91.html 
b/sw/qa/extras/layout/data/forcepoint91.html
new file mode 100644
index ..eacbd2e05ab8
Binary files /dev/null and b/sw/qa/extras/layout/data/forcepoint91.html differ
diff --git a/sw/qa/extras/layout/data/tdf147485-forcepoint.doc 
b/sw/qa/extras/layout/data/tdf147485-forcepoint.doc
new file mode 100644
index ..cb630efb8717
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf147485-forcepoint.doc 
differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 72db33e49b7c..489518c693ef 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2493,8 +2493,17 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testForcepointFootnoteFrame)
 createSwDoc(DATA_DIRECTORY, "forcepoint-swfootnoteframe-1.rtf");
 }
 
-//FIXME: disabled after failing again with fixed layout
-//CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint76) { 
createSwDoc(DATA_DIRECTORY, "forcepoint76-1.rtf"); }
+//just care it doesn't crash/assert
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint76)
+{
+createSwDoc(DATA_DIRECTORY, "forcepoint76-1.rtf");
+}
+
+//just care it doesn't crash/assert
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint89)
+{
+createSwWebDoc(DATA_DIRECTORY, "forcepoint89.html");
+}
 
 //just care it doesn't crash/assert
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint90)
@@ -2502,6 +2511,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint90)
 createSwDoc(DATA_DIRECTORY, "forcepoint90.rtf");
 }
 
+//just care it doesn't crash/assert
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint91)
+{
+createSwWebDoc(DATA_DIRECTORY, "forcepoint91.html");
+}
+
 //just care it doesn't crash/assert
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint92)
 {
@@ -2514,6 +2529,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint94)
 createSwWebDoc(DATA_DIRECTORY, "forcepoint94.html");
 }
 
+//just care it doesn't crash/assert
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf147485Forcepoint)
+{
+createSwDoc(DATA_DIRECTORY, "tdf147485-forcepoint.doc");
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf118058)
 {
 SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf118058.fodt");
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 7ee960a5684c..98f5229d4ba5 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -1616,6 +1616,8 @@ static bool lcl_InnerCalcLayout( SwFrame *pFrame,
 if ( pFrame->IsLayoutFrame() &&
  ( !_bOnlyRowsAndCells || pFrame->IsRowFrame() || 
pFrame->IsCellFrame() ) )
 {
+SwFrameDeleteGuard aDeleteGuard(pFrame);
+
 // #130744# An invalid locked table frame will
 // not be calculated => It will not become valid =>
 // Loop in lcl_RecalcRow(). Therefore we do not consider them for 
bRet.


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-04-03 Thread Michael Stahl (via logerrit)
 sw/qa/core/data/rtf/pass/forcepoint-96.rtf  |8 
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   31 
 2 files changed, 39 insertions(+)

New commits:
commit 542673c0d4c6a992113999101f2c1bf21e0c5c22
Author: Michael Stahl 
AuthorDate: Fri Apr 1 17:16:20 2022 +0200
Commit: Caolán McNamara 
CommitDate: Sun Apr 3 18:12:39 2022 +0200

forcepoint#96 sw: delete fieldmarks in DelFullPara()

The problem is that CorrAbs() will move any position of a fieldmark
that's in the deleted SwTextNodes to a different node that doesn't have
the CH_TXT_ATR_FIELD*.

Then it will inevitably crash later when it can't find its chars.

The other problem is that if there's only a CH_TXT_ATR_FIELDSEP in the
deleted nodes, that fieldmark would then be missing it.

Just delete fieldmarks with positions in deleted nodes, that should work
fine for the usual cases where DelFullPara() is called.

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

diff --git a/sw/qa/core/data/rtf/pass/forcepoint-96.rtf 
b/sw/qa/core/data/rtf/pass/forcepoint-96.rtf
new file mode 100644
index ..1e5a05d4801f
--- /dev/null
+++ b/sw/qa/core/data/rtf/pass/forcepoint-96.rtf
@@ -0,0 +1,8 @@
+{\rtf1
+\clvertalt
+\chpgn
+\clvertalb
+\cell
+\pard\intbl
+\cellx279
+}
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index c9f15ad54226..11f91cfe38b5 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -2255,6 +2255,37 @@ bool DocumentContentOperationsManager::DelFullPara( 
SwPaM& rPam )
 return false;
 }
 }
+
+// must delete all fieldmarks before CorrAbs(), or they'll remain
+// moved to wrong node without their CH_TXT_ATR_FIELD*
+// (note: deleteMarks() doesn't help here, in case of partially
+// selected fieldmarks; let's delete these as re-inserting their chars
+// elsewhere looks difficult)
+::std::set<::sw::mark::IFieldmark*> fieldmarks;
+for (SwNodeIndex i = aRg.aStart; i <= aRg.aEnd; ++i)
+{
+if (SwTextNode *const pTextNode = i.GetNode().GetTextNode())
+{
+for (sal_Int32 j = 0; j < pTextNode->GetText().getLength(); 
++j)
+{
+switch (pTextNode->GetText()[j])
+{
+case CH_TXT_ATR_FIELDSTART:
+case CH_TXT_ATR_FIELDEND:
+
fieldmarks.insert(m_rDoc.getIDocumentMarkAccess()->getFieldmarkAt(SwPosition(*pTextNode,
 j)));
+break;
+case CH_TXT_ATR_FIELDSEP:
+
fieldmarks.insert(m_rDoc.getIDocumentMarkAccess()->getFieldmarkFor(SwPosition(*pTextNode,
 j)));
+break;
+}
+}
+}
+}
+for (auto const pFieldMark : fieldmarks)
+{
+m_rDoc.getIDocumentMarkAccess()->deleteMark(pFieldMark);
+}
+
 // move bookmarks, redlines etc.
 if (aRg.aStart == aRg.aEnd) // only first CorrAbs variant handles this
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-03-31 Thread Caolán McNamara (via logerrit)
 sw/qa/extras/layout/data/forcepoint94.html |binary
 sw/qa/extras/layout/layout.cxx |6 ++
 sw/source/core/layout/ftnfrm.cxx   |3 +++
 3 files changed, 9 insertions(+)

New commits:
commit 3b6ea366796f7f7e04fb60b9394c91e4790b5c72
Author: Caolán McNamara 
AuthorDate: Sun Mar 27 20:51:48 2022 +0100
Commit: Michael Stahl 
CommitDate: Thu Mar 31 11:21:07 2022 +0200

forcepoint#94 fix crash on layout of specific html

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

diff --git a/sw/qa/extras/layout/data/forcepoint94.html 
b/sw/qa/extras/layout/data/forcepoint94.html
new file mode 100644
index ..8be788f8e4e5
Binary files /dev/null and b/sw/qa/extras/layout/data/forcepoint94.html differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index cd8307f1caa6..72db33e49b7c 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2508,6 +2508,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint92)
 createSwDoc(DATA_DIRECTORY, "forcepoint92.doc");
 }
 
+//just care it doesn't crash/assert
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint94)
+{
+createSwWebDoc(DATA_DIRECTORY, "forcepoint94.html");
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf118058)
 {
 SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf118058.fodt");
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index c41b315ad685..ba0cde71e7ea 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -2860,6 +2860,9 @@ bool SwContentFrame::MoveFootnoteCntFwd( bool bMakePage, 
SwFootnoteBossFrame *pO
 OSL_ENSURE( pTmp->IsTabFrame(), "GetNextSctLeaf: 
Wrong Type" );
 pTmpNxt = static_cast(pTmp);
 }
+// we will dereference pNewUp in the following 
MoveSubTree call
+// so it certainly should not be deleted before that
+SwFrameDeleteGuard aDeleteGuard(pNewUp);
 pTmpNxt->MoveSubTree( pTmpFootnote, pNewUp->GetNext() 
);
 }
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-03-30 Thread Caolán McNamara (via logerrit)
 sw/qa/extras/layout/data/forcepoint90.rtf |1 +
 sw/qa/extras/layout/layout.cxx|6 ++
 sw/source/core/layout/tabfrm.cxx  |   21 +++--
 3 files changed, 26 insertions(+), 2 deletions(-)

New commits:
commit 416cb37acae460b6ae8b175b5c5caf1601f030d4
Author: Caolán McNamara 
AuthorDate: Fri Mar 25 20:09:32 2022 +
Commit: Caolán McNamara 
CommitDate: Wed Mar 30 12:56:07 2022 +0200

forcepoint#90 fix crash on layout of specific rtf

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

diff --git a/sw/qa/extras/layout/data/forcepoint90.rtf 
b/sw/qa/extras/layout/data/forcepoint90.rtf
new file mode 100644
index ..82c26224292d
--- /dev/null
+++ b/sw/qa/extras/layout/data/forcepoint90.rtf
@@ -0,0 +1 @@

... etc. - the rest is truncated


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-03-29 Thread Caolán McNamara (via logerrit)
 sw/qa/extras/layout/data/forcepoint92.doc |binary
 sw/qa/extras/layout/layout.cxx|6 ++
 sw/source/core/layout/tabfrm.cxx  |8 +++-
 3 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 0d0cee5e48ca523f11540e9ae0ff022692fd9dca
Author: Caolán McNamara 
AuthorDate: Sun Mar 27 12:03:06 2022 +0100
Commit: Michael Stahl 
CommitDate: Tue Mar 29 11:38:00 2022 +0200

forcepoint#92 fix crash on layout of specific doc

Change-Id: Id40d25d05d10d641d071cddd2e1c84594ac777a6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132142
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132148
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/layout/data/forcepoint92.doc 
b/sw/qa/extras/layout/data/forcepoint92.doc
new file mode 100644
index ..49c4a7f11dfe
Binary files /dev/null and b/sw/qa/extras/layout/data/forcepoint92.doc differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 94edf650a359..bde69da4dde3 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2496,6 +2496,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testForcepointFootnoteFrame)
 //FIXME: disabled after failing again with fixed layout
 //CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint76) { 
createSwDoc(DATA_DIRECTORY, "forcepoint76-1.rtf"); }
 
+//just care it doesn't crash/assert
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint92)
+{
+createSwDoc(DATA_DIRECTORY, "forcepoint92.doc");
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf118058)
 {
 SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf118058.fodt");
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 7786f3aec4fc..b405a2124254 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2114,13 +2115,18 @@ void SwTabFrame::MakeAll(vcl::RenderContext* 
pRenderContext)
 }
 SwFootnoteBossFrame *pOldBoss = bFootnotesInDoc ? 
FindFootnoteBossFrame( true ) : nullptr;
 bool bReformat;
+std::optional oDeleteListener;
+if (pOldBoss)
+oDeleteListener.emplace(*pOldBoss);
 SwFrameDeleteGuard g(this);
 if ( MoveBwd( bReformat ) )
 {
+SAL_WARN_IF(oDeleteListener && oDeleteListener->WasDeleted(), 
"sw.layout", "SwFootnoteBossFrame unexpectedly deleted");
+
 aRectFnSet.Refresh(this);
 bMovedBwd = true;
 aNotify.SetLowersComplete( false );
-if ( bFootnotesInDoc )
+if (bFootnotesInDoc && !oDeleteListener->WasDeleted())
 MoveLowerFootnotes( nullptr, pOldBoss, nullptr, true );
 if ( bReformat || bKeep )
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-03-28 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter3.cxx |   10 +-
 sw/source/core/undo/untbl.cxx   |   20 +++-
 2 files changed, 28 insertions(+), 2 deletions(-)

New commits:
commit 8baae1fe3de398f1e6a01d1941f78e4088c0a697
Author: László Németh 
AuthorDate: Mon Mar 28 11:35:35 2022 +0200
Commit: Xisco Fauli 
CommitDate: Mon Mar 28 20:53:15 2022 +0200

tdf#148228 sw: fix Undo of tracked table deletion in Hide Changes mode

In Hide Changes mode, tables didn't reappear during
Undo of their tracked deletion, only by saving and
reloading the document.

Follow-up to commit 0c6221e1545e7b96d9df23cdc24302c28ae935b8
"tdf#148227 sw: fix Undo of tracked row deletion in Hide Changes mode".

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

diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 57f5e6649b70..559d47641a99 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -1988,7 +1988,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf146962)
 // only a single row is visible again
 assertXPath(pXmlDoc, "/root/page[1]/body/tab/row", 1);
 
-// check Undo
+// tdf#148227 check Undo of tracked table row deletion
 
 dispatchCommand(mxComponent, ".uno:Undo", {});
 discardDumpedLayout();
@@ -2040,6 +2040,14 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf147347)
 pXmlDoc = parseLayoutDump();
 // no visible row again
 assertXPath(pXmlDoc, "/root/page[1]/body/tab/row", 0);
+
+// tdf#148228 check Undo of tracked table deletion
+
+dispatchCommand(mxComponent, ".uno:Undo", {});
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+// This was 0
+assertXPath(pXmlDoc, "/root/page[1]/body/tab/row", 2);
 }
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135014)
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index d5536b01e624..d5c15a0fbc4a 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -952,14 +952,20 @@ void SaveTable::RestoreAttr( SwTable& rTable, bool 
bMdfyBox )
 
 pFormat->InvalidateInSwCache(RES_ATTRSET_CHG);
 
+// table without table frame
+bool bHiddenTable = true;
+
 // for safety, invalidate all TableFrames
 SwIterator aIter( *pFormat );
 for( SwTabFrame* pLast = aIter.First(); pLast; pLast = aIter.Next() )
+{
 if( pLast->GetTable() ==  )
 {
 pLast->InvalidateAll();
 pLast->SetCompletePaint();
+bHiddenTable = false;
 }
+}
 
 // fill FrameFormats with defaults (0)
 pFormat = nullptr;
@@ -986,7 +992,19 @@ void SaveTable::RestoreAttr( SwTable& rTable, bool 
bMdfyBox )
 m_bModifyBox = false;
 
 if ( bHideChanges )
-aTmpBox.MakeFrames( rTable );
+{
+if ( bHiddenTable )
+{
+SwTableNode* pTableNode = rTable.GetTableNode();
+pTableNode->DelFrames();
+SwNodeIndex aTableIdx( *pTableNode->EndOfSectionNode(), 1 );
+pTableNode->MakeOwnFrames();
+}
+else
+{
+aTmpBox.MakeFrames( rTable );
+}
+}
 }
 
 void SaveTable::SaveContentAttrs( SwDoc* pDoc )


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-03-28 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter3.cxx |8 
 sw/source/core/frmedt/tblsel.cxx|   11 ++-
 sw/source/core/undo/untbl.cxx   |   11 +++
 3 files changed, 29 insertions(+), 1 deletion(-)

New commits:
commit e07ea7a6f5f7059663e99daa97cbda5e63b141dd
Author: László Németh 
AuthorDate: Fri Mar 25 15:27:21 2022 +0100
Commit: Xisco Fauli 
CommitDate: Mon Mar 28 20:52:58 2022 +0200

tdf#148227 sw: fix Undo of tracked row deletion in Hide Changes mode

In Hide Changes mode, table rows didn't reappear during
Undo of tracked deletion of table rows, only by saving
and reloading the document.

Follow-up to commit a74c51025fa4519caaf461492e4ed8e68bd34885
"tdf#146962 sw: hide deleted row at deletion in Hide Changes"
and commit 794fd10af7361d5a64a0f8bfbe5c8b5f308617a5
"tdf#147347 sw: hide deleted table at deletion in Hide Changes".

Change-Id: I7ffe8a3687d1d385a549f7d438f7058d829ffd8c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132123
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 0c6221e1545e7b96d9df23cdc24302c28ae935b8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132049
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index b8cb857043b2..57f5e6649b70 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -1987,6 +1987,14 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf146962)
 pXmlDoc = parseLayoutDump();
 // only a single row is visible again
 assertXPath(pXmlDoc, "/root/page[1]/body/tab/row", 1);
+
+// check Undo
+
+dispatchCommand(mxComponent, ".uno:Undo", {});
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+// This was 1
+assertXPath(pXmlDoc, "/root/page[1]/body/tab/row", 2);
 }
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf147347)
diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx
index 80b797384859..b203281506cd 100644
--- a/sw/source/core/frmedt/tblsel.cxx
+++ b/sw/source/core/frmedt/tblsel.cxx
@@ -2336,6 +2336,10 @@ void FndBox_::MakeFrames( SwTable  )
 // And this for all instances of a table (for example in header/footer).
 sal_uInt16 nStPos = 0;
 sal_uInt16 nEndPos= rTable.GetTabLines().size() - 1;
+SwRootFrame* pLayout =
+
rTable.GetFrameFormat()->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout();
+bool bHideChanges = pLayout && pLayout->IsHideRedlines();
+
 if ( m_pLineBefore )
 {
 nStPos = rTable.GetTabLines().GetPos(
@@ -2389,9 +2393,14 @@ void FndBox_::MakeFrames( SwTable  )
 //  or is this the last Follow of the table 
 pUpperFrame = pTable;
 
+SwRedlineTable::size_type nRedlinePos = 0;
 for ( sal_uInt16 j = nStPos; j <= nEndPos; ++j )
-::lcl_InsertRow( *rTable.GetTabLines()[j],
+{
+SwTableLine * pLine = rTable.GetTabLines()[j];
+if ( !bHideChanges || !pLine->IsDeleted(nRedlinePos) )
+::lcl_InsertRow( *pLine,
 static_cast(pUpperFrame), 
pSibling );
+}
 if ( pUpperFrame->IsTabFrame() )
 static_cast(pUpperFrame)->SetCalcLowers();
 }
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index d3294b5446a3..d5536b01e624 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -34,6 +34,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -936,6 +938,12 @@ void SaveTable::RestoreAttr( SwTable& rTable, bool 
bMdfyBox )
 {
 m_bModifyBox = bMdfyBox;
 
+FndBox_ aTmpBox( nullptr, nullptr );
+bool bHideChanges = 
rTable.GetFrameFormat()->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout()->IsHideRedlines();
+// TODO delete/make frames only at changing line attribute TextChangesOnly 
(RES_PRINT) to true again
+if ( bHideChanges )
+aTmpBox.DelFrames( rTable );
+
 // first, get back attributes of TableFrameFormat
 SwFrameFormat* pFormat = rTable.GetFrameFormat();
 SfxItemSet& rFormatSet  = const_cast(static_cast(pFormat->GetAttrSet()));
@@ -976,6 +984,9 @@ void SaveTable::RestoreAttr( SwTable& rTable, bool bMdfyBox 
)
 
 m_aFrameFormats.clear();
 m_bModifyBox = false;
+
+if ( bHideChanges )
+aTmpBox.MakeFrames( rTable );
 }
 
 void SaveTable::SaveContentAttrs( SwDoc* pDoc )


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-03-17 Thread Vasily Melenchuk (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf146851_2.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx |   19 +++
 sw/source/core/txtnode/ndtxt.cxx   |3 +--
 sw/source/filter/ww8/wrtw8num.cxx  |3 +--
 4 files changed, 21 insertions(+), 4 deletions(-)

New commits:
commit c13c94b0ff103484e00403b034eef73ba1ea17c5
Author: Vasily Melenchuk 
AuthorDate: Sat Mar 12 09:07:53 2022 +0300
Commit: Thorsten Behrens 
CommitDate: Thu Mar 17 12:24:15 2022 +0100

tdf#146851: sw: even numbering=None is still a numbering

Text node containing a numbering rule with numbering format
with SVX_NUM_NUMBER_NONE is still a numbering: it will display
prefix, suffix and other numbering properties.

Change-Id: I52077824b4a1db2e9220701fdd514670490a59db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131410
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131648

diff --git a/sw/qa/extras/ooxmlexport/data/tdf146851_2.docx 
b/sw/qa/extras/ooxmlexport/data/tdf146851_2.docx
new file mode 100644
index ..fbd5f40a687e
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf146851_2.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index d8e15116eb48..9937d86b0f88 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -162,6 +162,25 @@ DECLARE_OOXMLEXPORT_TEST(testTdf146851_1, 
"tdf146851_1.docx")
 CPPUNIT_ASSERT_EQUAL(OUString("1/"), getProperty(xPara, 
"ListLabelString"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf146851_2, "tdf146851_2.docx")
+{
+// Ensure numbering on second para
+uno::Reference xPara;
+xPara.set(getParagraph(2, "."), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("Schedule"), getProperty(xPara, 
"ListLabelString"));
+
+// Refresh fields and ensure cross-reference to numbered para is okay
+uno::Reference xTextFieldsSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xFieldsAccess(xTextFieldsSupplier->getTextFields());
+
+uno::Reference(xFieldsAccess, 
uno::UNO_QUERY_THROW)->refresh();
+
+uno::Reference 
xFields(xFieldsAccess->createEnumeration());
+CPPUNIT_ASSERT(xFields->hasMoreElements());
+uno::Reference xTextField(xFields->nextElement(), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("Schedule"), 
xTextField->getPresentation(false));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf81507, "tdf81507.docx")
 {
 xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 4d576f479e5c..4d109a8add1c 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -3073,8 +3073,7 @@ bool SwTextNode::HasNumber(SwRootFrame const*const 
pLayout) const
 const SwNumFormat& 
aFormat(pRule->Get(lcl_BoundListLevel(GetActualListLevel(;
 
 // #i40041#
-bResult = aFormat.IsEnumeration() &&
-SVX_NUM_NUMBER_NONE != aFormat.GetNumberingType();
+bResult = aFormat.IsEnumeration();
 }
 
 return bResult;
diff --git a/sw/source/filter/ww8/wrtw8num.cxx 
b/sw/source/filter/ww8/wrtw8num.cxx
index 4836678172e9..e61ca56b5a8b 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -473,8 +473,7 @@ void MSWordExportBase::NumberingLevel(
 else
 {
 // Create level string
-if (SVX_NUM_NUMBER_NONE != rFormat.GetNumberingType() &&
-rFormat.HasListFormat())
+if (rFormat.HasListFormat())
 {
 sal_uInt8* pLvlPos = aNumLvlPos;
 sNumStr = rFormat.GetListFormat();


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-03-15 Thread Vasily Melenchuk (via logerrit)
 sw/qa/extras/odfexport/odfexport.cxx |2 -
 sw/qa/extras/ooxmlexport/data/tdf144563.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx   |   29 +++
 sw/qa/python/check_cross_references.py   |   10 -
 sw/source/core/doc/number.cxx|6 +
 5 files changed, 41 insertions(+), 6 deletions(-)

New commits:
commit 1a85d29bbc467354a5bc2d02e672fcdbffe5586d
Author: Vasily Melenchuk 
AuthorDate: Wed Mar 9 17:00:02 2022 +0300
Commit: Michael Stahl 
CommitDate: Tue Mar 15 11:36:38 2022 +0100

tdf#144563: remove final dot in cross-references to paragraph

It looks like in cross-references ending with dot (".") one last
dot is removed in case of MS Word. This is not a true for any other
suffixes after numeration.

Change-Id: I554e62cf45e643bf27823df5344e1689b5b6ae54
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131254
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131542
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/odfexport/odfexport.cxx 
b/sw/qa/extras/odfexport/odfexport.cxx
index f06778fc25b4..87e2aead4997 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -2794,7 +2794,7 @@ DECLARE_ODFEXPORT_TEST(testReferenceLanguage, 
"referencelanguage.odt")
 OUString const aFieldTexts[] = { "A 2", "Az Isten", "Az 50-esek",
 "A 2018-asok", "Az egyebek", "A fejezetek",
 u"Az „Őseinket...”", "a 2",
-"Az v.", "az 1", "Az e)", "az 1",
+"Az v", "az 1", "Az e)", "az 1",
 "Az (5)", "az 1", "A 2", "az 1" };
 uno::Reference xTextFieldsSupplier(mxComponent, 
uno::UNO_QUERY);
 // update "A (4)" to "Az (5)"
diff --git a/sw/qa/extras/ooxmlexport/data/tdf144563.docx 
b/sw/qa/extras/ooxmlexport/data/tdf144563.docx
new file mode 100644
index ..59d64d2d1bf3
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf144563.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index ec07a5a946f0..52465ed66d90 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -12,6 +12,9 @@
 #include 
 
 #include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -170,6 +173,32 @@ DECLARE_OOXMLEXPORT_TEST(testTdf81507, "tdf81507.docx")
 xmlXPathFreeObject(pXmlObj);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf144563, "tdf144563.docx")
+{
+uno::Reference xTextFieldsSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xFieldsAccess(xTextFieldsSupplier->getTextFields());
+
+// Refresh all cross-reference fields
+uno::Reference(xFieldsAccess, 
uno::UNO_QUERY_THROW)->refresh();
+
+// Verify values
+uno::Reference 
xFields(xFieldsAccess->createEnumeration());
+
+std::vector aExpectedValues = {
+// These field values are NOT in order in document: getTextFields did 
provide
+// fields in a strange but fixed order
+"1", "1", "1", "1", "1/", "1/", "1/", "1)", "1)", "1)", "1.)",
+"1.)", "1.)", "1..", "1..", "1..", "1.", "1.", "1.", "1", "1"
+};
+
+sal_uInt16 nIndex = 0;
+while (xFields->hasMoreElements())
+{
+uno::Reference xTextField(xFields->nextElement(), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(aExpectedValues[nIndex++], 
xTextField->getPresentation(false));
+}
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf144668, "tdf144668.odt")
 {
 uno::Reference xPara1(getParagraph(1, u"level1"), 
uno::UNO_QUERY);
diff --git a/sw/qa/python/check_cross_references.py 
b/sw/qa/python/check_cross_references.py
index 3c9319200ea7..7778ff5f2100 100644
--- a/sw/qa/python/check_cross_references.py
+++ b/sw/qa/python/check_cross_references.py
@@ -89,16 +89,16 @@ class CheckCrossReferences(unittest.TestCase):
 FieldResult1 = "*i*"
 FieldResult2 = "+b+*i*"
 FieldResult3 = "-1-+b+*i*"
-FieldResult4 = "1."
-FieldResult5 = "1."
-FieldResult6 = "A.1."
+FieldResult4 = "1"
+FieldResult5 = "1"
+FieldResult6 = "A.1"
 FieldResult7 = " 2.(a)"
 FieldResult8 = " 2.(b)"
-FieldResult9 = " 2."
+FieldResult9 = " 2"
 FieldResult10 = " 1.(a)"
 FieldResult11 = "(b)"
 FieldResult12 = "(a)"
-FieldResult13 = " 1."
+FieldResult13 = " 1"
 
 # variables for current field
 xField = self.getNextField()
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index 93a5c149f15c..8a5b9c5d7c60 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -882,6 +882,12 @@ OUString SwNumRule::MakeRefNumString( const SwNodeNum& 
rNodeNum,
   pWorkingNodeNum->GetLevelInListTree() >= 
nRestrictInclToThisLevel );
 }
 
+if (aRefNumStr.endsWith("."))
+{

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-03-11 Thread László Németh (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx   |8 +
 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx   |6 -
 sw/source/filter/ww8/docxattributeoutput.cxx |  147 ++-
 3 files changed, 108 insertions(+), 53 deletions(-)

New commits:
commit 554d95b2b4ece9cd570dfbad357bfedafc6a4dd1
Author: László Németh 
AuthorDate: Thu Mar 10 11:00:36 2022 +0100
Commit: László Németh 
CommitDate: Fri Mar 11 13:23:37 2022 +0100

tdf#147760 tdf#142902 DOCX export: anonymize date and moveFromRangeStart

Anonymization exported a zeroed w:date in change tracking
and commenting elements w:ins, w:del, w:moveFrom, w:moveTo,
w:cellIns, w:cellDel, w:comment, w:moveFromRangeStart and
w:moveToRangeStart instead of simply skipping it, according
to OOXML.

Also don't export w:date, if the imported DOCX was anonymized
by Word's Document Inspector, i.e. it doesn't contain w:date.

Fix also missing anonymization of author and date of
moveFromRangeStart and moveToRangeStart elements.

Follow-up to commit 2c51746997478ad5d0e7cc64aa6489769c473d43
"tdf#146171 DOCX: fix loss of change tracking, if no date",
commit 9e1e88ad5cf2dc0e9b188c60930445652a6c7519
"tdf#145720 DOCX export: fix loss of tracked moving" and
commit ded2452a52d21131347a0dc2e25c8161f20fcfad
"tdf#142902 DOCX export: remove personal info of comments and changes".

Change-Id: If79402e4723886ceab3b4b9c24e83793f87cd513
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131317
Tested-by: Jenkins
Reviewed-by: László Németh 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131343

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index d39c1fdd6bcd..d7d0784e7285 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -933,8 +933,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf145720, "tdf104797.docx")
 // mandatory authors and dates
 assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:moveFrom/w:moveFromRangeStart", "author", 
u"Tekijä");
 assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[2]/w:moveTo/w:moveToRangeStart", "author", u"Tekijä");
-assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:moveFrom/w:moveFromRangeStart", "date", 
"1970-01-01T00:00:00Z");
-assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[2]/w:moveTo/w:moveToRangeStart", "date", 
"1970-01-01T00:00:00Z");
+// no date (anonymized change)
+// This failed, date was exported as w:date="0-00-00T00:00:00Z", and 
later "1970-01-01T00:00:00Z"
+assertXPathNoAttribute(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:moveFrom/w:moveFromRangeStart",
+   "date");
+assertXPathNoAttribute(pXmlDoc, 
"/w:document/w:body/w:p[2]/w:moveTo/w:moveToRangeStart",
+   "date");
 }
 }
 
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
index 78db013bc159..ae8b96c99f66 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -653,6 +653,7 @@ CPPUNIT_TEST_FIXTURE(Test, 
testTdf146171_invalid_change_date)
 // false alarm? during ODF roundtrip:
 // 'Error: "1970-01-01" does not satisfy the "dateTime" type'
 // disable and check only the conversion of the invalid (zeroed) change 
date
+// -00-00T00:00:00Z, resulting loss of change tracking during ODF 
roundtrip
 // reload("writer8", "tdf146171.odt");
 reload("Office Open XML Text", "tdf146171.docx");
 
@@ -661,8 +662,9 @@ CPPUNIT_TEST_FIXTURE(Test, 
testTdf146171_invalid_change_date)
 assertXPath(pXmlDoc, "//w:ins", 4);
 // This was 0
 assertXPath(pXmlDoc, "//w:del", 1);
-// This was -00-00T00:00:00Z, resulting loss of change tracking during 
ODF roundtrip
-assertXPath(pXmlDoc, "//w:del", "date", "1970-01-01T00:00:00Z");
+// no date (anonymized change)
+// This failed, date was exported as w:date="1970-01-01T00:00:00Z" before 
fixing tdf#147760
+assertXPathNoAttribute(pXmlDoc, "//w:del", "date");
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTdf139580, "tdf139580.odt")
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 959e391e3e37..7bddf3121813 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1913,16 +1913,32 @@ void 
DocxAttributeOutput::DoWriteBookmarkTagEnd(sal_Int32 const nId)
 void DocxAttributeOutput::DoWriteMoveRangeTagStart(const OString & 
bookmarkName,
 bool bFrom, const SwRedlineData* pRedlineData)
 {
-const OUString ( SW_MOD()->GetRedlineAuthor( 
pRedlineData->GetAuthor() ) );
-OString aDate( DateTimeToOString( pRedlineData->GetTimeStamp() ) );
+bool bRemovePersonalInfo = SvtSecurityOptions::IsOptionSet(
+

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-03-10 Thread Michael Stahl (via logerrit)
 sw/qa/extras/uiwriter/uiwriter2.cxx |   30 ++
 sw/source/core/edit/edws.cxx|6 ++
 2 files changed, 36 insertions(+)

New commits:
commit ab0756c1b7509a034d0bb74251c519a090dedc7c
Author: Michael Stahl 
AuthorDate: Mon Mar 7 19:37:02 2022 +0100
Commit: Xisco Fauli 
CommitDate: Thu Mar 10 10:31:31 2022 +0100

tdf#147414 sw_redlinehide: fix cursor position after AutoCorrect

Change-Id: Ia06cd4e1a74a21788e4d0ddb5f0481e8a144d863
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131147
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit e2076b31a91d3882f3deeaa5d3d4659da0e4b17c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131134
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index d5f6f045da70..992c10290429 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -1545,6 +1545,36 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf109376)
 CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetFlyCount(FLYCNTTYPE_FRM));
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf147414)
+{
+SwDoc* const pDoc(createSwDoc());
+SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect());
+
+pWrtShell->Insert("Abc");
+
+// hide and enable
+dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+
+CPPUNIT_ASSERT(pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+CPPUNIT_ASSERT(
+
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+CPPUNIT_ASSERT(pWrtShell->GetLayout()->IsHideRedlines());
+
+pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, 
/*bBasicCall=*/false);
+// backspace
+pWrtShell->DelLeft();
+pWrtShell->AutoCorrect(corr, u' ');
+
+// problem was this was 1 i.e. before the deleted "b" while " " was 
inserted after
+CPPUNIT_ASSERT_EQUAL(sal_Int32(3),
+ 
pWrtShell->getShellCursor(false)->GetPoint()->nContent.GetIndex());
+CPPUNIT_ASSERT_EQUAL(
+OUString("Ab c"),
+
pWrtShell->getShellCursor(false)->GetPoint()->nNode.GetNode().GetTextNode()->GetText());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf147310)
 {
 SwDoc* pDoc = createSwDoc();
diff --git a/sw/source/core/edit/edws.cxx b/sw/source/core/edit/edws.cxx
index 293a5f9f7960..647e59e11b5b 100644
--- a/sw/source/core/edit/edws.cxx
+++ b/sw/source/core/edit/edws.cxx
@@ -266,6 +266,12 @@ void SwEditShell::AutoCorrect( SvxAutoCorrect& rACorr, 
bool bInsert,
 // FIXME: this _must_ be called with reference to the actual node text!
 SwTextFrame const*const pFrame(static_cast(pTNd->getLayoutFrame(GetLayout(;
 TextFrameIndex const nPos(pFrame->MapModelToViewPos(*pCursor->GetPoint()));
+// tdf#147414 sw_redlinehide: if cursor moved backward, it may be at the
+// start of a delete redline - but MapViewToModelPos() always returns end
+// of redline and it will be called when AutoCorrect actually inserts
+// something - so first normalize cursor point to end of redline so that
+// point will then be moved forward when something is inserted.
+*pCursor->GetPoint() = pFrame->MapViewToModelPos(nPos);
 OUString const& rMergedText(pFrame->GetText());
 rACorr.DoAutoCorrect( aSwAutoCorrDoc,
 rMergedText, sal_Int32(nPos),


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-03-10 Thread Michael Stahl (via logerrit)
 sw/qa/extras/uiwriter/uiwriter2.cxx |   46 
 sw/source/core/undo/undel.cxx   |5 +++
 2 files changed, 50 insertions(+), 1 deletion(-)

New commits:
commit d65b07c42206476ab471320c8261a96adad4d515
Author: Michael Stahl 
AuthorDate: Mon Mar 7 15:57:09 2022 +0100
Commit: Xisco Fauli 
CommitDate: Thu Mar 10 10:31:02 2022 +0100

tdf#147310 sw_redlinehide: recreate frames for whole table deleted

SwUndoDelete calls MakeFrames with end being end node of the table, but
it needs to be the following node (with a frame).

(regression from commit 723728cd358693b8f4bc9d913541aa4479f2bd48)

Change-Id: Id0974c8349be5aef9630822738eae9462bbcb4f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131112
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 6f20bcb152948a24dbe40ca2e6c4ecef2bebf853)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131131
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 4e9080bdc951..d5f6f045da70 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -1545,6 +1545,52 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf109376)
 CPPUNIT_ASSERT_EQUAL(size_t(1), pWrtShell->GetFlyCount(FLYCNTTYPE_FRM));
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf147310)
+{
+SwDoc* pDoc = createSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+
+// somehow bug happens only with 2 tables
+SwInsertTableOptions tableOpt(SwInsertTableFlags::DefaultBorder, 0);
+pWrtShell->InsertTable(tableOpt, 1, 1);
+pWrtShell->InsertTable(tableOpt, 1, 1);
+
+pWrtShell->SttEndDoc(/*bStart=*/true);
+
+pWrtShell->DeleteRow(false);
+pWrtShell->DeleteRow(false);
+
+{
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "/root/page/body/tab", 0);
+discardDumpedLayout();
+}
+pWrtShell->Undo();
+// this did not create frames for the table
+pWrtShell->Undo();
+{
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+// there are 2 tables
+assertXPath(pXmlDoc, "/root/page/body/tab", 2);
+discardDumpedLayout();
+}
+pWrtShell->Redo();
+pWrtShell->Redo();
+{
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "/root/page/body/tab", 0);
+discardDumpedLayout();
+}
+pWrtShell->Undo();
+pWrtShell->Undo();
+{
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+// there are 2 tables
+assertXPath(pXmlDoc, "/root/page/body/tab", 2);
+}
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf64242_optimizeTable)
 {
 SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf64242_optimizeTable.odt");
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index ed1cdf38794d..2d35811a9b86 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -1136,7 +1136,10 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & 
rContext)
 // don't include end node in the range: it may have been merged already
 // by the start node, or it may be merged by one of the moved nodes,
 // but if it isn't merged, its current frame(s) should be good...
-SwNodeIndex const end(rDoc.GetNodes(), m_bDelFullPara ? 
delFullParaEndNode : m_nEndNode);
+SwNodeIndex const end(rDoc.GetNodes(), m_bDelFullPara
+? delFullParaEndNode
+// tdf#147310 SwDoc::DeleteRowCol() may delete whole table - end 
must be node following table!
+: (m_nEndNode + (rDoc.GetNodes()[m_nSttNode]->IsTableNode() && 
rDoc.GetNodes()[m_nEndNode]->IsEndNode() ? 1 : 0)));
 ::MakeFrames(, start, end);
 }
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-03-07 Thread Michael Stahl (via logerrit)
 sw/qa/extras/uiwriter/uiwriter2.cxx |   38 
 sw/source/core/txtnode/ndtxt.cxx|4 +--
 2 files changed, 40 insertions(+), 2 deletions(-)

New commits:
commit c485690c48c92647b8edeca04be8cafcc8de9628
Author: Michael Stahl 
AuthorDate: Fri Mar 4 19:18:27 2022 +0100
Commit: Xisco Fauli 
CommitDate: Mon Mar 7 15:10:36 2022 +0100

tdf#140077 sw_redlinehide: fix crash on SplitNode()

The problem is that CutImpl() was called with nLen=0 and so returned
without sending any hint to SwTextFrame.

Then the MergedPara gets recreated, but the problem is that the
SwParaPortion is never invalidated so it still contains the portions of
the previous merged paragraph, and painting it will crash.

But it turns out that there isn't a hint that would actually work here;
instead, generalise a condition in SwTextNode::SplitContentNode()
to simply throw away the portions.

(regression from commit eb92dc08f2abf5ed088da0d736266f213adf00de)

Change-Id: I06091ca695ea9180b32e61ddb88ce64fbf20443e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131039
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 6518c45dc0c2fb67500af85b97ed40466fd1d1e0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131025
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 988225938a89..4e9080bdc951 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -1409,6 +1409,44 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, 
testTdf119571_keep_numbering_with_Reject)
 CPPUNIT_ASSERT_MESSAGE("Bad numbering", sNumName.isEmpty());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf140077)
+{
+SwDoc* const pDoc = createSwDoc();
+
+SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+// hide
+dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+
+pWrtShell->Insert("a");
+pWrtShell->SplitNode();
+pWrtShell->Insert("b");
+pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, 
/*bBasicCall=*/false);
+pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 1, 
/*bBasicCall=*/false);
+// enable
+dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+CPPUNIT_ASSERT_MESSAGE(
+"redlines should be visible",
+
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+CPPUNIT_ASSERT(pWrtShell->GetLayout()->IsHideRedlines());
+
+pWrtShell->Delete();
+pWrtShell->SttEndDoc(/*bStart=*/false);
+pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, 
/*bBasicCall=*/false);
+dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+
+// crashed in layout
+pWrtShell->SplitNode();
+
+pWrtShell->Undo();
+pWrtShell->Redo();
+pWrtShell->Undo();
+pWrtShell->Redo();
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf109376_redline)
 {
 SwDoc* pDoc = createSwDoc();
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 872e4cee96db..4d576f479e5c 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -653,9 +653,9 @@ SwTextNode *SwTextNode::SplitContentNode(const SwPosition & 
rPos,
 // Update the extents with new node; also inits merge flag,
 // so the MakeFramesForAdjacentContentNode below respects it
 pFrame->RegisterToNode(*pNode);
-if (pFrame->GetText().isEmpty())
+if (nSplitPos == 0)
 {
-// turns out it's empty - in this case, it was not
+// in this case, it was not
 // invalidated because Cut didn't sent it any hints,
 // so we have to invalidate it here!
 pFrame->Prepare(PrepareHint::Clear, nullptr, false);


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-03-02 Thread Michael Stahl (via logerrit)
 sw/qa/extras/layout/data/LIBREOFFICE-UXTSOREL.rtf |binary
 sw/qa/extras/layout/layout.cxx|9 +++
 sw/source/core/layout/objectformattertxtfrm.cxx   |   52 --
 3 files changed, 47 insertions(+), 14 deletions(-)

New commits:
commit b845927ed4e3987a578b0c8ded46ddbc7833e7ff
Author: Michael Stahl 
AuthorDate: Wed Feb 23 16:45:31 2022 +0100
Commit: Miklos Vajna 
CommitDate: Wed Mar 2 13:31:12 2022 +0100

sw: really prevent footnote frame against delete while it's moved

This reverts commit fe5d3fbfe63fe8b433776bd3a0508dd712b868b0
(on master only)

It turns out that checking a single column's IsMovingFootnotes() is not
enough - as frames can move both forwards and backwards the entire chain
of columns would need to be checked.

(Most callers of MoveLowerFootnotes() move forwards, but one place in
tabfrm.cxx moves from a follow to master.)

But it turns out that this is probably the wrong way in any case: most
likely the intention in FormatAnchorFrameAndItsPrevs() is to format
previous frames in the same layout environment, so if there is a section
or column inside a footnote then this upper should be formatted, while
if the footnote is inside a section or column this upper should not be
formatted; this should make calls during MoveFootnotes_() safe as it
should prevent the formatting of frames in the footnote boss moving a
footnote that is already being moved.

So tweak the fix in commit fa1bcc22921941b2cd8a0b32fe0d15655d12d607
a little to make it more general.

Also it was previously possible that for a section with columns,
both the section branch and the column branch was taken, which seems
supperfluous.

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130544
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 3f569ffc9238e6bf2915e78bf21c844ca5f1270d)

add a layout test to exercise UXTSOREL

Change-Id: I57b29dd7d73c08bdbf227676c4ce9034aabf418a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130493
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 10d46c0498b89350645cf45e744a528d3d8f1ac1)

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

diff --git a/sw/qa/extras/layout/data/LIBREOFFICE-UXTSOREL.rtf 
b/sw/qa/extras/layout/data/LIBREOFFICE-UXTSOREL.rtf
new file mode 100644
index ..1020269ae119
Binary files /dev/null and b/sw/qa/extras/layout/data/LIBREOFFICE-UXTSOREL.rtf 
differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 0c7a4dc13ff0..94edf650a359 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2478,6 +2478,15 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint75)
 createSwDoc(DATA_DIRECTORY, "forcepoint75-1.rtf");
 }
 
+// FIXME: apparently infinite loop on Mac
+#ifndef MACOSX
+//just care it doesn't crash/assert
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testUXTSOREL)
+{
+createSwDoc(DATA_DIRECTORY, "LIBREOFFICE-UXTSOREL.rtf");
+}
+#endif
+
 //just care it doesn't crash/assert
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepointFootnoteFrame)
 {
diff --git a/sw/source/core/layout/objectformattertxtfrm.cxx 
b/sw/source/core/layout/objectformattertxtfrm.cxx
index 26d503511064..d0fa8cf1be84 100644
--- a/sw/source/core/layout/objectformattertxtfrm.cxx
+++ b/sw/source/core/layout/objectformattertxtfrm.cxx
@@ -829,21 +829,46 @@ void 
SwObjectFormatterTextFrame::FormatAnchorFrameAndItsPrevs( SwTextFrame& _rAn
 // for follow text frames.
 if ( !_rAnchorTextFrame.IsFollow() )
 {
+// In case the anchor frame is in a column or section, format its
+// previous frames first - but don't jump out of the current layout
+// environment, e.g. from footnotes into the footnote boss.
+SwFrame * pSectFrame(nullptr);
+SwFrame * pColFrameOfAnchor(nullptr);
+for (SwFrame* pUpper = _rAnchorTextFrame.GetUpper();
+ pUpper != nullptr; pUpper = pUpper->GetUpper())
+{
+if (pUpper->IsCellFrame())
+{
+break; // apparently nothing to be done?
+}
+if (pUpper->IsFootnoteFrame())
+{
+SAL_INFO_IF(pColFrameOfAnchor == nullptr && 
pUpper->FindColFrame(),
+"sw.layout", "tdf#122894 skipping column for footnote in 
column");
+break; // stop: prevent crash in case footnotes are being moved
+}
+if (pUpper->IsSctFrame())
+{
+pColFrameOfAnchor = nullptr;
+pSectFrame = pUpper;
+break;
+}
+if (pColFrameOfAnchor != nullptr)
+{   // parent of column 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-03-01 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter3.cxx |   46 ++
 sw/source/core/doc/docnum.cxx   |4 +
 sw/source/core/frmedt/fetab.cxx |   92 ++--
 3 files changed, 126 insertions(+), 16 deletions(-)

New commits:
commit dc3f29bca53ef365ec12694feefe76f0e81eccfa
Author: László Németh 
AuthorDate: Mon Feb 28 12:35:27 2022 +0100
Commit: László Németh 
CommitDate: Tue Mar 1 14:09:57 2022 +0100

tdf#146962 sw: hide deleted row at deletion in Hide Changes

In Hide Changes mode, deleting table rows with change tracking
wasn't applied on the table layout immediately, only using Show
Changes and Hide Changes again. Now the deleted row removed from
the table instead leaving an empty table row (except the last
row of a wholly deleted table).

See also commit 95213407dfcbf34056037d60243ff915340d1a2e
"tdf#146622 sw crash fix: don't delete already deleted rows".

Change-Id: I864957cafa38e631a65db0670c7b566cb689f4cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130701
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit a74c51025fa4519caaf461492e4ed8e68bd34885)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130685
Tested-by: László Németh 

diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index d2123c33b20c..a7db089432e0 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -48,6 +48,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace
 {
@@ -1943,6 +1944,51 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf146622)
 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTables->getCount());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf146962)
+{
+// load a 2-row table, set Hide Changes mode and delete the first row with 
change tracking
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf116789.fodt");
+CPPUNIT_ASSERT(pDoc);
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+
+// enable redlining
+dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+// hide changes
+dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+CPPUNIT_ASSERT(pWrtShell->GetLayout()->IsHideRedlines());
+
+dispatchCommand(mxComponent, ".uno:DeleteRows", {});
+
+// Without the fix in place, the deleted row would be visible
+
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+// This was 2
+assertXPath(pXmlDoc, "/root/page[1]/body/tab/row", 1);
+
+// check it in Show Changes mode
+
+dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+CPPUNIT_ASSERT(!pWrtShell->GetLayout()->IsHideRedlines());
+
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+// 2 rows are visible now
+assertXPath(pXmlDoc, "/root/page[1]/body/tab/row", 2);
+
+// check it in Hide Changes mode again
+
+dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+CPPUNIT_ASSERT(pWrtShell->GetLayout()->IsHideRedlines());
+
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+// only a single row is visible again
+assertXPath(pXmlDoc, "/root/page[1]/body/tab/row", 1);
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135014)
 {
 createSwDoc();
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 12b23c2fbb42..2cbfb7a6a4df 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -1446,7 +1446,9 @@ GotoPrevLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame 
const*const pLayout)
 {
 if (rIndex.GetNode().IsTextNode())
 {
-if (rIndex.GetNode().GetRedlineMergeFlag() != SwNode::Merge::None)
+if (rIndex.GetNode().GetRedlineMergeFlag() != SwNode::Merge::None 
&&
+// not a tracked row deletion in Hide Changes mode
+rIndex.GetNode().GetTextNode()->getLayoutFrame(pLayout) )
 {
 rIndex = 
*static_cast(rIndex.GetNode().GetTextNode()->getLayoutFrame(pLayout))->GetMergedPara()->pFirstNode;
 }
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index ec9968271d3d..7bb2ff5edc68 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -328,32 +328,41 @@ bool SwFEShell::DeleteRow(bool bCompleteTable)
 
 CurrShell aCurr( this );
 
-// tracked deletion: remove only textbox content,
-// and set IsNoTracked table line property to false
-if ( GetDoc()->GetDocShell()->IsChangeRecording() )
-{
-// all rows have already had tracked row change in the table selection
-if ( !SwDoc::HasRowNotTracked( *getShellCursor( false ) ) )
-return false;
+bool bRecordChanges = GetDoc()->GetDocShell()->IsChangeRecording();
+ 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-02-28 Thread Michael Stahl (via logerrit)
 sw/qa/extras/layout/data/tdf143239-1-min.odt |binary
 sw/qa/extras/layout/layout.cxx   |   66 +++
 sw/source/core/layout/layact.cxx |3 +
 3 files changed, 69 insertions(+)

New commits:
commit 2bed04d49fda2e2005699b3ef884c5295e56d8ca
Author: Michael Stahl 
AuthorDate: Fri Feb 25 13:43:56 2022 +0100
Commit: Xisco Fauli 
CommitDate: Mon Feb 28 15:50:44 2022 +0100

tdf#143239 sw: layout: invalidate fly position when moving off page

It's possible that flags on the fly are all valid when it is moved off page
when SwLayAction::FormatContent() returns and then it may not be positioned
again, keeping its (wrong) position on the old page and will appear to be
invisible unless you click on it.

(regression from commits c799de145f7e289f31e3669646e5bd12814e6c5e
 and eb85de8e6b61fb3fcb6c03ae0145f7fe5478bccf)

Change-Id: If07d5af7b47eb288bef71d1b9e3459197b50fdc9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130535
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit b14bb255199e7d6db6ec9155b5d9237cb35fdba7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130548
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/layout/data/tdf143239-1-min.odt 
b/sw/qa/extras/layout/data/tdf143239-1-min.odt
new file mode 100644
index ..4271bfba775b
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf143239-1-min.odt differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 74b0d1e1aad3..79e06e3e3c17 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -1273,6 +1273,72 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testRedlineFlysInFootnote)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf143239)
+{
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf143239-1-min.odt");
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+{
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "/root/page[2]/body/txt[1]/anchored/fly", 1);
+assertXPath(pXmlDoc, 
"/root/page[2]/body/txt[1]/anchored/fly[1]/infos/bounds", "top",
+"18540");
+#ifndef MACOSX
+assertXPath(pXmlDoc, 
"/root/page[2]/body/txt[1]/anchored/fly[1]/infos/bounds", "left",
+"3559");
+#endif
+assertXPath(pXmlDoc, "/root/page[2]/body/txt[2]/anchored/fly", 1);
+assertXPath(pXmlDoc, 
"/root/page[2]/body/txt[2]/anchored/fly[1]/infos/bounds", "top",
+"23894");
+#ifndef MACOSX
+assertXPath(pXmlDoc, 
"/root/page[2]/body/txt[2]/anchored/fly[1]/infos/bounds", "left",
+"1964");
+#endif
+assertXPath(pXmlDoc, "/root/page[3]/body/txt[1]/anchored/fly", 1);
+assertXPath(pXmlDoc, 
"/root/page[3]/body/txt[1]/anchored/fly[1]/infos/bounds", "top",
+"35662");
+#ifndef MACOSX
+assertXPath(pXmlDoc, 
"/root/page[3]/body/txt[1]/anchored/fly[1]/infos/bounds", "left",
+"3129");
+#endif
+assertXPath(pXmlDoc, "/root/page", 3);
+discardDumpedLayout();
+}
+
+pWrtShell->SelAll();
+pWrtShell->Delete();
+pWrtShell->Undo();
+Scheduler::ProcessEventsToIdle();
+
+{
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+// now the 1st fly was on page 1, and the fly on page 2 was the 2nd one
+assertXPath(pXmlDoc, "/root/page[2]/body/txt[1]/anchored/fly", 1);
+assertXPath(pXmlDoc, 
"/root/page[2]/body/txt[1]/anchored/fly[1]/infos/bounds", "top",
+"18540");
+#ifndef MACOSX
+assertXPath(pXmlDoc, 
"/root/page[2]/body/txt[1]/anchored/fly[1]/infos/bounds", "left",
+"3559");
+#endif
+assertXPath(pXmlDoc, "/root/page[2]/body/txt[2]/anchored/fly", 1);
+assertXPath(pXmlDoc, 
"/root/page[2]/body/txt[2]/anchored/fly[1]/infos/bounds", "top",
+"23894");
+#ifndef MACOSX
+assertXPath(pXmlDoc, 
"/root/page[2]/body/txt[2]/anchored/fly[1]/infos/bounds", "left",
+"1964");
+#endif
+assertXPath(pXmlDoc, "/root/page[3]/body/txt[1]/anchored/fly", 1);
+assertXPath(pXmlDoc, 
"/root/page[3]/body/txt[1]/anchored/fly[1]/infos/bounds", "top",
+"35662");
+#ifndef MACOSX
+assertXPath(pXmlDoc, 
"/root/page[3]/body/txt[1]/anchored/fly[1]/infos/bounds", "left",
+"3129");
+#endif
+assertXPath(pXmlDoc, "/root/page", 3);
+discardDumpedLayout();
+}
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTableOverlapFooterFly)
 {
 // Load a document that has a fly anchored in the footer.
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 047a7ecf7a12..33a990a15a5a 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -1661,6 +1661,9 @@ bool 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-02-28 Thread Attila Bakos (NISZ) (via logerrit)
 sw/qa/extras/odfimport/data/tdf146597.odt |binary
 sw/qa/extras/odfimport/odfimport.cxx  |6 ++
 sw/source/core/draw/dcontact.cxx  |3 ++-
 3 files changed, 8 insertions(+), 1 deletion(-)

New commits:
commit e38ab299c109766a5a431e5c0fb6b2c59ae3025c
Author: Attila Bakos (NISZ) 
AuthorDate: Thu Feb 24 09:51:15 2022 +0100
Commit: László Németh 
CommitDate: Mon Feb 28 10:00:50 2022 +0100

tdf#146597 sw: fix freezing with GroupShape

in case it is anchored to character and wrap is none.

Regression from 8da3586cff9cc11cf5db985d19851f21f0d42eb8
"tdf#141220 sw: fix textbox popped out of off-page shape".

Note: This is a backport-compatible fix made also for the
7.3 backport. There will be a less urgent 7.4-only fix
for its unresolved group case soon.

Change-Id: I421c85e2dd16ad2649bc299fc4733d462be8d7b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130478
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit e835c2c0d3aff4f1ee5d29c9eaf36400b1aca6a7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130456
Tested-by: Jenkins

diff --git a/sw/qa/extras/odfimport/data/tdf146597.odt 
b/sw/qa/extras/odfimport/data/tdf146597.odt
new file mode 100644
index ..6dcc379cef4d
Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf146597.odt differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx 
b/sw/qa/extras/odfimport/odfimport.cxx
index fa79c7197f42..336cca824232 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -1328,5 +1328,11 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf146257)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf146597)
+{
+load(mpTestDocumentPath, "tdf146597.odt");
+// This was creashed before.
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index cb9618c44e8b..668288dac689 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -1342,7 +1342,8 @@ void SwDrawContact::Changed_( const SdrObject& rObj,
 
 // tdf#135198: keep text box together with its shape
 const SwPageFrame* rPageFrame = pAnchoredDrawObj->GetPageFrame();
-if (rPageFrame && rPageFrame->isFrameAreaPositionValid() && 
!rObj.getChildrenOfSdrObject())
+if (rPageFrame && rPageFrame->isFrameAreaPositionValid() && 
GetFormat()
+&& GetFormat()->GetOtherTextBoxFormat())
 {
 SwDoc* const pDoc = GetFormat()->GetDoc();
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-02-22 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/htmlexport/htmlexport.cxx  |   42 +
 sw/source/filter/html/htmlnumwriter.cxx |   46 ++--
 2 files changed, 69 insertions(+), 19 deletions(-)

New commits:
commit 81f90d4ab51ec7528fa2a9b14c0426a634971580
Author: Miklos Vajna 
AuthorDate: Mon Feb 21 16:38:51 2022 +0100
Commit: Xisco Fauli 
CommitDate: Tue Feb 22 10:35:53 2022 +0100

sw HTML export, XHTML mode: fix lost  when last list item is not 
numbered

This went wrong in 013a4f1f5c9ea5fb511568c53a7e76d1b365a65d (sw XHTML
export: fix handling of list labels, 2021-05-13), where we started to
assume that in case the last paragraph of a list is not numbered, then
the entire list is not numbered. This lead to loosing the  for an
 in case the list starts with a numbered paragraph, but ends with a
non-numbered one.

Fix the problem by (if necessary) looking back till the start of the
list to see if any paragraph is numbered: that ensures that the  and
 is always in sync.

This fixes the new problem and keeps the old problem fixed at the same
time.

Change-Id: I7d347b37a40dcc727c2080bf8279e33c3ad147e9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130287
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit 8c2607ae3ce143586e623532b8ae5288277ec3ac)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130310
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index fa40c8d7d04c..7f64c835ce2d 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -1491,6 +1491,48 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testListHeading)
 assertXPathContent(pXmlDoc, 
"/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p", "list header");
 }
 
+CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testPartiallyNumberedList)
+{
+// Given a document with a list, first para is numbered, second is not:
+loadURL("private:factory/swriter", nullptr);
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+pWrtShell->Insert("list header");
+SwDoc* pDoc = pWrtShell->GetDoc();
+sal_uInt16 nPos = pDoc->MakeNumRule(pDoc->GetUniqueNumRuleName());
+SwNumRule* pNumRule = pDoc->GetNumRuleTable()[nPos];
+{
+SwNode& rNode = pWrtShell->GetCursor()->GetPoint()->nNode.GetNode();
+SwTextNode& rTextNode = *rNode.GetTextNode();
+rTextNode.SetAttr(SwNumRuleItem(pNumRule->GetName()));
+}
+pWrtShell->Insert2("numbered");
+pWrtShell->SplitNode();
+pWrtShell->Insert2("not numbered");
+{
+SwNode& rNode = pWrtShell->GetCursor()->GetPoint()->nNode.GetNode();
+SwTextNode& rTextNode = *rNode.GetTextNode();
+rTextNode.SetAttr(SwNumRuleItem(pNumRule->GetName()));
+rTextNode.SetCountedInList(false);
+}
+
+// When exporting to ReqIF:
+ExportToReqif();
+
+// Then make sure the output is well-formed xhtml:
+SvMemoryStream aStream;
+HtmlExportTest::wrapFragment(maTempFile, aStream);
+xmlDocUniquePtr pXmlDoc = parseXmlStream();
+CPPUNIT_ASSERT(pXmlDoc);
+// Without the accompanying fix in place, this test would have failed:
+// - expected: ..
+// - actual  : ..
+// because a  without a matching  is not well-formed, and the 
 was omitted because
+// the second para was not numbered.
+assertXPath(pXmlDoc,
+
"/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ol/reqif-xhtml:li/reqif-xhtml:p",
 2);
+}
+
 CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testBlockQuoteNoMargin)
 {
 // Given a document with some text, para style set to Quotations, no 
bottom margin:
diff --git a/sw/source/filter/html/htmlnumwriter.cxx 
b/sw/source/filter/html/htmlnumwriter.cxx
index 7df3402dda35..df15619cd85e 100644
--- a/sw/source/filter/html/htmlnumwriter.cxx
+++ b/sw/source/filter/html/htmlnumwriter.cxx
@@ -321,25 +321,10 @@ Writer& OutHTML_NumberBulletListEnd( SwHTMLWriter& rWrt,
 bool bSameRule = rNextInfo.GetNumRule() == rInfo.GetNumRule();
 bool bListEnd = !bSameRule || rNextInfo.GetDepth() < rInfo.GetDepth() || 
rNextInfo.IsRestart();
 
-if (rWrt.mbXHTML)
-{
-// XHTML  for the list item content.
-if ((bListEnd && rInfo.IsNumbered()) || (!bListEnd && 
rNextInfo.IsNumbered()))
-{
-HTMLOutFuncs::Out_AsciiTag(rWrt.Strm(),
-   
OStringConcatenation(rWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_li), false);
-}
-}
-
-if (!bListEnd)
-{
-return rWrt;
-}
-
+std::optional oAtLeastOneNumbered;
 if (rWrt.mbXHTML && !rInfo.IsNumbered())
 {
-// If the list only consisted of non-numbered text nodes, then don't 
end the list.
-bool bAtLeastOneNumbered = false;
+ 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-02-17 Thread Caolán McNamara (via logerrit)
 sw/qa/core/data/ooxml/fail/LIBREOFFICE-DBDAZAEC.docx |binary
 sw/source/core/unocore/unodraw.cxx   |2 ++
 2 files changed, 2 insertions(+)

New commits:
commit 780842b6fba24b753f33015bd5c2ad46ced4771c
Author: Caolán McNamara 
AuthorDate: Thu Feb 17 09:57:34 2022 +
Commit: Michael Stahl 
CommitDate: Thu Feb 17 19:07:57 2022 +0100

Refetch in case SwTextNode::InsertItem causes it to be deleted

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

diff --git a/sw/qa/core/data/ooxml/fail/LIBREOFFICE-DBDAZAEC.docx 
b/sw/qa/core/data/ooxml/fail/LIBREOFFICE-DBDAZAEC.docx
new file mode 100755
index ..add554ae9596
Binary files /dev/null and 
b/sw/qa/core/data/ooxml/fail/LIBREOFFICE-DBDAZAEC.docx differ
diff --git a/sw/source/core/unocore/unodraw.cxx 
b/sw/source/core/unocore/unodraw.cxx
index 4d04857e7199..e61a66850001 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -1141,6 +1141,8 @@ void SwXShape::setPropertyValue(const OUString& 
rPropertyName, const uno::Any& a
 SwFormatFlyCnt aFormat( pFormat );
 pNd->InsertItem(aFormat, pInternalPam->GetPoint()
 ->nContent.GetIndex(), 0 );
+//Refetch in case SwTextNode::InsertItem causes it to be 
deleted
+pFormat = GetFrameFormat();
 }
 else
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-02-16 Thread Michael Stahl (via logerrit)
 sw/qa/extras/layout/data/keep-with-next-fly.fodt |  146 +++
 sw/qa/extras/layout/layout.cxx   |   52 
 sw/source/core/layout/flowfrm.cxx|   12 +
 3 files changed, 210 insertions(+)

New commits:
commit 58c28725b2b34941ae4f6afa7689c0d0ebde0be7
Author: Michael Stahl 
AuthorDate: Wed Feb 16 17:32:15 2022 +0100
Commit: Thorsten Behrens 
CommitDate: Wed Feb 16 22:58:06 2022 +0100

sw: layout: allow keep-with-next paragraph with fly to move back

The problem is that a paragraph that has the fo:keep-with-next="always"
and also a fly anchored at-char or at-para with style:flow-with-text="true"
will never move to the previous page, even with space available.

In SwContentFrame::MakeAll() it will first MoveBwd() and then go into
the special case "if ( bKeep && bMoveable )" which calls Calc() on the
next frame.

But this fails to move the next frame because of 
SwFlowFrame::IsPrevObjMove()
finding the fly with a mis-matching mpVertPosOrientFrame - that will not
be fixed until the first SwContentFrame::MakeAll() is done and
SwObjectFormatter::FormatObjsAtFrame() is called.

But SwContentFrame::MakeAll() first detects that the frame is not on
the same page as the next one despite bKeep, so it MoveFwd() again.

This happens already in OOo 3.3.

IsJoinLocked() should be a reasonably good heuristic for "is the
previous frame being formatted".

Change-Id: I86996dcb3d0c46fcb99ec9ad463569abbb8b99f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130033
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 38e7c18188f1c5310898181db87686774be3c040)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130014
Reviewed-by: Thorsten Behrens 

diff --git a/sw/qa/extras/layout/data/keep-with-next-fly.fodt 
b/sw/qa/extras/layout/data/keep-with-next-fly.fodt
new file mode 100644
index ..13d6785f4e1f
--- /dev/null
+++ b/sw/qa/extras/layout/data/keep-with-next-fly.fodt
@@ -0,0 +1,146 @@
+
+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:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 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:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing: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:ooo="http://openoffice.org/2004/office; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d: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:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="ur
 n:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:xforms="http://www.w3.org/2002/xforms; office:version="1.3" 
office:mimetype="application/vnd.oasis.opendocument.text">
+ 
2022-02-16T15:01:24.0881914252022-02-16T15:16:50.103419678PT15M29S1LibreOfficeDev/7.4.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/16748887dd277bd63034e07b5e2a86740235b315
+ 
+  
+  
+  
+ 
+ 
+  
+  
+  
+   
+   
+
+   
+   
+  
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+  
+   
+  
+  
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+   
+
+ 
+
+   
+  
+  
+  
+  
+ 
+ 
+  
+   
+   
+   
+  
+  
+   
+   
+   
+  
+  
+   
+  
+  
+   
+
+   
+   
+   
+  

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-02-15 Thread László Németh (via logerrit)
 sw/qa/uitest/table/tdf146145.py  |   47 +++
 sw/source/uibase/uiview/viewstat.cxx |   20 ++
 2 files changed, 66 insertions(+), 1 deletion(-)

New commits:
commit 4cf2e8f1f42ab4cf91509971d1bb453e62942b8e
Author: László Németh 
AuthorDate: Fri Feb 11 08:58:05 2022 +0100
Commit: László Németh 
CommitDate: Tue Feb 15 20:51:17 2022 +0100

tdf#147435 sw: enable Accept Change for table selection

Accept/Reject Track Change options were only enabled for
table selections, if the first cell of the selected cell range
contains a redline. Now they are enabled, when arbitrary cell
of the table selection contains a redline.

Note: if the selected columns don't contain any redlines and
any tracked row changes, but the adjacent not selected columns
contain a redline, there is a false Enable.

Follow-up to commit 23846867ea32667ccf328c36142394dd6aaee8ba
"tdf#147182 sw: accept/reject all changes of a table selection".

Change-Id: I1d7af04aa3fe5232bb1ff7f9af6116bcdc621ae7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129811
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit c4f6fee3bea0d8618b5815e60304ff9359ccd21c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129934
Tested-by: Jenkins

diff --git a/sw/qa/uitest/table/tdf146145.py b/sw/qa/uitest/table/tdf146145.py
index a082ea780018..357ce82a45f7 100644
--- a/sw/qa/uitest/table/tdf146145.py
+++ b/sw/qa/uitest/table/tdf146145.py
@@ -107,4 +107,51 @@ class tdf146145(UITestCase):
 xToolkit.processEventsToIdle()
 self.assertEqual(len(tables[0].getRows()), 3)
 
+   def test_Related_tdf147182(self):
+with 
self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as 
self.document:
+
+# Check enabling Accept/Reject Track Change icons
+# and Accept Change/Reject Change context menu items
+# on table rows with tracked deletion or insertion
+
+# enable Track Changes toolbar
+
self.xUITest.executeCommand(".uno:AvailableToolbars?Toolbar:string=changes")
+
+xToolkit = 
self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
+xToolkit.processEventsToIdle()
+
+# cursor at changed text: Accept Track Change is enabled
+self.assertTrue(self.is_enabled_Accept_Track_Change())
+
+# cursor in a changed row, but not at changed text: Accept Track 
Change is enabled now
+self.xUITest.executeCommand(".uno:GoRight")
+xToolkit.processEventsToIdle()
+# This was false
+self.assertTrue(self.is_enabled_Accept_Track_Change())
+
+# delete first row
+self.xUITest.executeCommand(".uno:AcceptTrackedChange")
+xToolkit.processEventsToIdle()
+# disabled Accept Track Change
+while self.is_enabled_Accept_Track_Change():
+time.sleep(0.1)
+self.assertFalse(self.is_enabled_Accept_Track_Change())
+
+# delete first row
+self.xUITest.executeCommand(".uno:SelectAll")
+self.xUITest.executeCommand(".uno:SelectAll")
+xToolkit.processEventsToIdle()
+# This was false
+while not self.is_enabled_Accept_Track_Change():
+time.sleep(0.1)
+self.assertTrue(self.is_enabled_Accept_Track_Change())
+
+# delete all changes in the selected table
+self.xUITest.executeCommand(".uno:AcceptTrackedChange")
+xToolkit.processEventsToIdle()
+while self.is_enabled_Accept_Track_Change():
+time.sleep(0.1)
+# disabled Accept Track Change
+self.assertFalse(self.is_enabled_Accept_Track_Change())
+
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/source/uibase/uiview/viewstat.cxx 
b/sw/source/uibase/uiview/viewstat.cxx
index e7ab14f6c3f8..e75cabc3d368 100644
--- a/sw/source/uibase/uiview/viewstat.cxx
+++ b/sw/source/uibase/uiview/viewstat.cxx
@@ -389,10 +389,28 @@ void SwView::GetState(SfxItemSet )
 redline = nullptr;
 if( redline == nullptr )
 {
+// for table selections, GetCursor() gives only PaM of 
the first cell,
+// so extend the redline limit to end of last cell of 
the selection
+// TODO: adjust this for column selections, where the 
selected columns
+// don't contain any redlines and any tracked row 
changes, but the
+// adjacent not selected columns do to avoid false 
Enable
+std::unique_ptr pSelectionEnd;
+if ( m_pWrtShell->IsTableMode() &&
+

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-02-15 Thread Attila Szűcs (via logerrit)
 sw/qa/extras/layout/data/tdf146704_EndnoteInSection.odt |binary
 sw/qa/extras/layout/layout.cxx  |9 +
 sw/source/core/layout/findfrm.cxx   |3 ++-
 3 files changed, 11 insertions(+), 1 deletion(-)

New commits:
commit dbfa2662a6d9a9b53f95198313374f5529978836
Author: Attila Szűcs 
AuthorDate: Mon Feb 14 08:43:08 2022 +0100
Commit: László Németh 
CommitDate: Tue Feb 15 20:49:35 2022 +0100

tdf#146704 sw: fix regression of endnote layout in sections

Endnotes collected at the end of sections moved to a new page.

Regression from commit 4c31b4ef2083087a822c3ae648fd09acc67d2f88
"tdf#139336 sw: fix extra pages of multicolumn sections with footnotes".

Co-authored-by: Tibor Nagy (NISZ)

Change-Id: I36568e33b04ba8024ceef6b3ea84b71fb375e2a4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129896
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 9a457c24ab2731c99f1a5fa1d28f68788e6977f3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129936
Tested-by: Jenkins

diff --git a/sw/qa/extras/layout/data/tdf146704_EndnoteInSection.odt 
b/sw/qa/extras/layout/data/tdf146704_EndnoteInSection.odt
new file mode 100644
index ..660dcb70df0b
Binary files /dev/null and 
b/sw/qa/extras/layout/data/tdf146704_EndnoteInSection.odt differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 3ef61970f5ae..85a685ff2b44 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -3719,6 +3719,15 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf135035)
 CPPUNIT_ASSERT_GREATER(nParentWidth, nFly3Width);
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf146704_EndnoteInSection)
+{
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, 
"tdf146704_EndnoteInSection.odt");
+CPPUNIT_ASSERT(pDoc);
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+// Without the fix, the endnote placed to 2. page
+assertXPath(pXmlDoc, "/root/page", 1);
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 
testTdf139336_ColumnsWithFootnoteDoNotOccupyEntirePage)
 {
 SwDoc* pDoc
diff --git a/sw/source/core/layout/findfrm.cxx 
b/sw/source/core/layout/findfrm.cxx
index 445d3e29dcd6..d100e24526a4 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -458,8 +458,9 @@ SwFootnoteBossFrame* SwFrame::FindFootnoteBossFrame( bool 
bFootnotes )
 // similar case can be reached with a page break + FootnoteAtEnd 
setting
 SwSectionFrame* pSectframe = pRet->FindSctFrame();
 bool bMoveToPageFrame = false;
+// tdf146704: only if it is really a footnote, not an endnote.
 // tdf54465: compatibility flag to make old odt files keep these full page 
sections.
-if (pSectframe
+if (bFootnotes && pSectframe
 && pSectframe->GetFormat()->getIDocumentSettingAccess().get(
 DocumentSettingId::FOOTNOTE_IN_COLUMN_TO_PAGEEND))
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-02-14 Thread Michael Stahl (via logerrit)
 sw/qa/extras/layout/data/table_cell_overlap.fodt |  161 +++
 sw/qa/extras/layout/layout2.cxx  |   58 
 sw/source/core/layout/wsfrm.cxx  |4 
 3 files changed, 223 insertions(+)

New commits:
commit 06bb600ce3445abe095b8011ec7e66b33badb4ef
Author: Michael Stahl 
AuthorDate: Fri Feb 11 18:28:42 2022 +0100
Commit: Thorsten Behrens 
CommitDate: Mon Feb 14 15:24:44 2022 +0100

sw: layout: fix overlapped table rows in --convert-to pdf

If the document is loaded via UI, the first layout action is triggered
from resizing the Window and the table is positioned properly on the
first try.

If the document is loaded via --convert-to, only getRendererCount()
formats the content of the table, and positioning goes wrong.

Somehow the 2 rows of the table in the fly end up on the same Y
position, because when the text frame in the 1st row is formatted
and grows from 0 to 230, the already-valid position of the cell
frame in the 2nd row is not invalidated.

This happens since the earliest version checked, OOo 3.4 beta.

This fix is somewhat similar to commit
068c133ac41c97652909b88c432e3b73010efc3e

Change-Id: I3259c440265cfe40dc7731cb4830bfe2487acf38
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129851
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit e7874c936dd1ff9b3423eb7477cbee2494535176)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129845
Reviewed-by: Thorsten Behrens 

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

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-02-14 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/htmlexport/htmlexport.cxx |   79 +++--
 sw/source/filter/html/htmlatr.cxx  |   18 +--
 sw/source/filter/html/htmltab.cxx  |6 ++
 3 files changed, 74 insertions(+), 29 deletions(-)

New commits:
commit ee8df01413c73597b7bf44637fdce726b3f2085b
Author: Miklos Vajna 
AuthorDate: Fri Feb 11 16:18:26 2022 +0100
Commit: Xisco Fauli 
CommitDate: Mon Feb 14 10:13:52 2022 +0100

sw XHTML / ReqIF filter: avoid adding and removing s for trailing s

The sw/ HTML export writes two s for a  in the doc model at the
end of a paragraph, because the last  would be ignored by browsers.
But then the import ignores all s at the end of paragraphs, so the
import and the export are not a 1:1 mapping; but at least the layout of
the exported HTML is close to the Writer layout.

ReqIF focuses on the preserving the semantics of the doc model instead:
it already doesn't open the document in "web view", and it's not
expected that the number of s change on import or export.

Fix the problem by disabling both the import and the export tweaks in
the ReqIF case.

It would perhaps make sense to do this in general, but for users who
only care about the export layout (and never import the result again),
that would be probably a regression, so don't change this
unconditionally for now.

Change-Id: Iabd4a462185493c1ece0352069077e04c293816b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129820
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit b86679ea6bd2bb053c3822c4642a62a49e381909)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129834
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index 641a1e1560c8..fa40c8d7d04c 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -279,6 +279,8 @@ public:
 void ParseOle1FromRtfUrl(const OUString& rRtfUrl, SvMemoryStream& rOle1);
 /// Export using the C++ HTML export filter, with xhtmlns=reqif-xhtml.
 void ExportToReqif();
+/// Import using the C++ HTML import filter, with xhtmlns=reqif-xhtml.
+void ImportFromReqif(const OUString& rUrl);
 };
 
 OUString SwHtmlDomExportTest::GetOlePath()
@@ -333,6 +335,15 @@ void SwHtmlDomExportTest::ExportToReqif()
 xStorable->storeToURL(maTempFile.GetURL(), aStoreProperties);
 }
 
+void SwHtmlDomExportTest::ImportFromReqif(const OUString& rUrl)
+{
+uno::Sequence aLoadProperties = {
+comphelper::makePropertyValue("FilterName", OUString("HTML 
(StarWriter)")),
+comphelper::makePropertyValue("FilterOptions", 
OUString("xhtmlns=reqif-xhtml")),
+};
+mxComponent = loadFromDesktop(rUrl, "com.sun.star.text.TextDocument", 
aLoadProperties);
+}
+
 constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/extras/htmlexport/data/";
 
 DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testFdo81276, "fdo81276.html")
@@ -757,11 +768,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIfPngImg)
 };
 
 OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + 
"reqif-png-img.xhtml";
-uno::Sequence aLoadProperties = {
-comphelper::makePropertyValue("FilterName", OUString("HTML 
(StarWriter)")),
-comphelper::makePropertyValue("FilterOptions", 
OUString("xhtmlns=reqif-xhtml")),
-};
-mxComponent = loadFromDesktop(aURL, "com.sun.star.text.TextDocument", 
aLoadProperties);
+ImportFromReqif(aURL);
 verify(/*bExported=*/false);
 uno::Reference xStorable(mxComponent, uno::UNO_QUERY);
 uno::Sequence aStoreProperties = {
@@ -771,8 +778,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIfPngImg)
 };
 xStorable->storeToURL(maTempFile.GetURL(), aStoreProperties);
 mxComponent->dispose();
-mxComponent
-= loadFromDesktop(maTempFile.GetURL(), 
"com.sun.star.text.TextDocument", aLoadProperties);
+ImportFromReqif(maTempFile.GetURL());
 verify(/*bExported=*/true);
 }
 
@@ -1088,12 +1094,8 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testRTFOLEMimeType)
 {
 // Import a document with an embedded object.
 OUString aType("test/rtf");
-uno::Sequence aLoadProperties = {
-comphelper::makePropertyValue("FilterName", OUString("HTML 
(StarWriter)")),
-comphelper::makePropertyValue("FilterOptions", 
OUString("xhtmlns=reqif-xhtml")),
-};
 OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + 
"reqif-ole-data.xhtml";
-mxComponent = loadFromDesktop(aURL, "com.sun.star.text.TextDocument", 
aLoadProperties);
+ImportFromReqif(aURL);
 
 // Export it.
 uno::Reference xStorable(mxComponent, uno::UNO_QUERY);
@@ -1234,12 +1236,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testReqifOle1PDF)
 // Now import this back and check the ODT result.
 mxComponent->dispose();
 mxComponent.clear();
-uno::Sequence 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-02-11 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/data/double-page-border.docx |binary
 sw/qa/core/layout/layout.cxx   |   48 +
 sw/source/core/layout/paintfrm.cxx |   23 +--
 3 files changed, 66 insertions(+), 5 deletions(-)

New commits:
commit 69a036043a1b7ba1cff2e17016a73e94055baced
Author: Miklos Vajna 
AuthorDate: Tue Feb 1 15:17:40 2022 +0100
Commit: Mike Kaganski 
CommitDate: Fri Feb 11 09:25:53 2022 +0100

sw: fix swapped inner vs outer border for Word-style right/bottom page 
borders

This is similar to commit cf2690ae76b4250af32be7c8980b8d83b3611591 (sw:
fix swapped inner vs outer border for Word-style bottom table borders,
2022-01-13), but that was for outer table borders, this one is for page
borders.

The explicit mirroring is needed because Writer will automatically
mirror, but Word mirrors in its document model, so we need to "mirror
back" to get the matching rendering.

(cherry picked from commit 60a1f07049a817d4d3d7beb6c9b9da2571e2463b)

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

diff --git a/sw/qa/core/layout/data/double-page-border.docx 
b/sw/qa/core/layout/data/double-page-border.docx
new file mode 100644
index ..a706b327cd05
Binary files /dev/null and b/sw/qa/core/layout/data/double-page-border.docx 
differ
diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx
index a02e17fb8bde..abd77b3e217d 100644
--- a/sw/qa/core/layout/layout.cxx
+++ b/sw/qa/core/layout/layout.cxx
@@ -694,6 +694,54 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, 
testParaBorderInCellClip)
 assertXPath(pXmlDoc, "//clipregion/polygon", 2);
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testDoublePageBorder)
+{
+// Given a page with a top and bottom double border, outer is thick, inner 
is thin:
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "double-page-border.docx");
+SwDocShell* pShell = pDoc->GetDocShell();
+
+// When rendering that document:
+std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile();
+
+// Then make sure the top border is thick+thing and the bottom border is 
thin+thick (from top to
+// bottom):
+MetafileXmlDump dumper;
+xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+// Collect widths of horizontal lines.
+xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, 
"//polyline[@style='solid']/point");
+xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+// Vertical position -> width.
+std::map aBorderWidths;
+for (int i = 0; i < xmlXPathNodeSetGetLength(pXmlNodes); i += 2)
+{
+xmlNodePtr pStart = pXmlNodes->nodeTab[i];
+xmlNodePtr pEnd = pXmlNodes->nodeTab[i + 1];
+xmlChar* pStartY = xmlGetProp(pStart, BAD_CAST("y"));
+xmlChar* pEndY = xmlGetProp(pEnd, BAD_CAST("y"));
+sal_Int32 nStartY = OString(reinterpret_cast(pStartY)).toInt32();
+sal_Int32 nEndY = OString(reinterpret_cast(pEndY)).toInt32();
+if (nStartY != nEndY)
+{
+// Vertical border.
+continue;
+}
+xmlChar* pWidth = xmlGetProp(pStart->parent, BAD_CAST("width"));
+sal_Int32 nWidth = OString(reinterpret_cast(pWidth)).toInt32();
+aBorderWidths[nStartY] = nWidth;
+}
+xmlXPathFreeObject(pXmlObj);
+std::vector aBorderWidthVec;
+std::transform(aBorderWidths.begin(), aBorderWidths.end(), 
std::back_inserter(aBorderWidthVec),
+   [](const std::pair& rPair) { return 
rPair.second; });
+CPPUNIT_ASSERT_EQUAL(static_cast(4), aBorderWidthVec.size());
+CPPUNIT_ASSERT_GREATER(aBorderWidthVec[1], aBorderWidthVec[0]);
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected greater than: 60
+// - Actual  : 15
+// i.e. the bottom border was thick+thin, not thin+thick.
+CPPUNIT_ASSERT_GREATER(aBorderWidthVec[2], aBorderWidthVec[3]);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 1b2a7379b17f..b1b3bef8e42f 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -5358,14 +5358,14 @@ void SwFrame::PaintSwFrameShadowAndBorder(
 pBottomBorder = aAccess.Get()->GetBox().GetBottom();
 }
 
-bool bWordTableCell = false;
+bool bWordBorder = false;
 SwViewShell* pShell = getRootFrame()->GetCurrShell();
 if (pShell)
 {
 const IDocumentSettingAccess& rIDSA = 
pShell->GetDoc()->getIDocumentSettingAccess();
-bWordTableCell = rIDSA.get(DocumentSettingId::TABLE_ROW_KEEP);
+bWordBorder = rIDSA.get(DocumentSettingId::TABLE_ROW_KEEP);
 }
-bool bInWordTableCell = IsContentFrame() && 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-02-11 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/data/para-border-in-cell-clip.docx |binary
 sw/qa/core/layout/layout.cxx |   20 +
 sw/source/core/layout/paintfrm.cxx   |   40 +--
 3 files changed, 57 insertions(+), 3 deletions(-)

New commits:
commit 797aa8d22b8c5cdc7400c1853695a587dd3f03ae
Author: Miklos Vajna 
AuthorDate: Tue Jan 18 17:04:14 2022 +0100
Commit: Mike Kaganski 
CommitDate: Fri Feb 11 09:23:54 2022 +0100

sw: fix unexpected paragraph border inside table cells

The bug document has a table cell, which contains a paragraph with
borders. Its left/right/bottom borders are rendered in Writer, but not
in Word.

The reason for the left/right border is that it's outside the
paragraph's frame area, which is not rendered in Word. Fix this by
clipping the rendered borders so they don't go outside the paragraph's
frame area. (Normally the frame area is the larger rectangle, and then
margins may cause a smaller "print area", but in this case we have a
negative right margin, so clipping the print area to fit into the frame
area actually does something.)

This is quite similar to what commit
1e21902106cbe57658bed03ed24d4d0863685cfd (tdf#117884: intersect border
with paint area of upper frame., 2018-05-26) did for table borders.

The bottom border is a different problem: the cell has a fixed height
and enough content so the paragraph is cut off vertically. This means
that technically the bottom border would be inside the frame area, but
Word cuts it off, because they apply clipping on the not-yet-cut-off
rectangle. Fix this by dropping the bottom margin when the frame is cut
off.

(cherry picked from commit 4a7281fa206c0a82cfc2ba23f25c31ae775d8777)

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

diff --git a/sw/qa/core/layout/data/para-border-in-cell-clip.docx 
b/sw/qa/core/layout/data/para-border-in-cell-clip.docx
new file mode 100644
index ..7c516853648c
Binary files /dev/null and 
b/sw/qa/core/layout/data/para-border-in-cell-clip.docx differ
diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx
index 4ed97597ffcc..a02e17fb8bde 100644
--- a/sw/qa/core/layout/layout.cxx
+++ b/sw/qa/core/layout/layout.cxx
@@ -674,6 +674,26 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, 
testDoubleBorderHorizontal)
 CPPUNIT_ASSERT_GREATER(aBorderWidthVec[3], aBorderWidthVec[2]);
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testParaBorderInCellClip)
+{
+// Given a document which has outside-cell borders defined, which should 
not be visible:
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "para-border-in-cell-clip.docx");
+SwDocShell* pShell = pDoc->GetDocShell();
+
+// When rendering those borders:
+std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile();
+
+// Then make sure that we have clipping setup for both paragraphs inside 
the table cell:
+MetafileXmlDump dumper;
+xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 2
+// - Actual  : 0
+// - XPath '//clipregion/polygon' number of nodes is incorrect
+// i.e. there was no clipping applied, leading to unexpected left/right 
borders.
+assertXPath(pXmlDoc, "//clipregion/polygon", 2);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 656646420dc5..1b2a7379b17f 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -118,6 +118,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::editeng;
 using namespace ::com::sun::star;
@@ -5357,6 +5358,25 @@ void SwFrame::PaintSwFrameShadowAndBorder(
 pBottomBorder = aAccess.Get()->GetBox().GetBottom();
 }
 
+bool bWordTableCell = false;
+SwViewShell* pShell = getRootFrame()->GetCurrShell();
+if (pShell)
+{
+const IDocumentSettingAccess& rIDSA = 
pShell->GetDoc()->getIDocumentSettingAccess();
+bWordTableCell = rIDSA.get(DocumentSettingId::TABLE_ROW_KEEP);
+}
+bool bInWordTableCell = IsContentFrame() && GetUpper()->IsCellFrame() 
&& bWordTableCell;
+if (bInWordTableCell)
+{
+// Compat mode: don't paint bottom border if we know the bottom of 
the content was cut
+// off.
+auto pContentFrame = static_cast(this);
+if (pContentFrame->IsUndersized())
+{
+pBottomBorder = nullptr;
+}
+}
+
 if(nullptr != pLeftBorder || nullptr != pRightBorder || nullptr != 
pTopBorder || nullptr != pBottomBorder)
  

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-02-11 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/data/double-border-horizontal.docx |binary
 sw/qa/core/layout/layout.cxx |   48 +++
 sw/source/core/layout/paintfrm.cxx   |   36 +++---
 3 files changed, 68 insertions(+), 16 deletions(-)

New commits:
commit 13f0bfc17703837bcbe28d8eeb8cc21d223722fc
Author: Miklos Vajna 
AuthorDate: Thu Jan 13 15:57:05 2022 +0100
Commit: Mike Kaganski 
CommitDate: Fri Feb 11 09:22:16 2022 +0100

sw: fix swapped inner vs outer border for Word-style bottom table borders

This is similar to commit fc04a84f297b78a1049182b6d8cf745f863ffe61 (sw:
fix swapped inner vs outer border for Word-style left table borders,
2022-01-11), but that was for vertical borders, this is for horizontal
ones.

The other difference is that Word mirrors vertical lines, but not
horizontal ones. This means that our horizontal line need less
mirroring, while our vertical lines needed more mirroring.

(cherry picked from commit cf2690ae76b4250af32be7c8980b8d83b3611591)

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

diff --git a/sw/qa/core/layout/data/double-border-horizontal.docx 
b/sw/qa/core/layout/data/double-border-horizontal.docx
new file mode 100644
index ..624c7aa1aa74
Binary files /dev/null and 
b/sw/qa/core/layout/data/double-border-horizontal.docx differ
diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx
index 0358b2f0f359..4ed97597ffcc 100644
--- a/sw/qa/core/layout/layout.cxx
+++ b/sw/qa/core/layout/layout.cxx
@@ -626,6 +626,54 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, 
testDoubleBorderVertical)
 CPPUNIT_ASSERT_GREATER(aBorderWidthVec[2], aBorderWidthVec[3]);
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testDoubleBorderHorizontal)
+{
+// Given a table with a top and bottom double border, outer is thin, inner 
is thick:
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "double-border-horizontal.docx");
+SwDocShell* pShell = pDoc->GetDocShell();
+
+// When rendering table borders:
+std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile();
+
+// Then make sure the top border is thin+thick and the bottom border is 
thick+thin (from top to
+// bottom):
+MetafileXmlDump dumper;
+xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+// Collect widths of horizontal lines.
+xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, 
"//polyline[@style='solid']/point");
+xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+// Vertical position -> width.
+std::map aBorderWidths;
+for (int i = 0; i < xmlXPathNodeSetGetLength(pXmlNodes); i += 2)
+{
+xmlNodePtr pStart = pXmlNodes->nodeTab[i];
+xmlNodePtr pEnd = pXmlNodes->nodeTab[i + 1];
+xmlChar* pStartY = xmlGetProp(pStart, BAD_CAST("y"));
+xmlChar* pEndY = xmlGetProp(pEnd, BAD_CAST("y"));
+sal_Int32 nStartY = OString(reinterpret_cast(pStartY)).toInt32();
+sal_Int32 nEndY = OString(reinterpret_cast(pEndY)).toInt32();
+if (nStartY != nEndY)
+{
+// Vertical border.
+continue;
+}
+xmlChar* pWidth = xmlGetProp(pStart->parent, BAD_CAST("width"));
+sal_Int32 nWidth = OString(reinterpret_cast(pWidth)).toInt32();
+aBorderWidths[nStartY] = nWidth;
+}
+xmlXPathFreeObject(pXmlObj);
+std::vector aBorderWidthVec;
+std::transform(aBorderWidths.begin(), aBorderWidths.end(), 
std::back_inserter(aBorderWidthVec),
+   [](const std::pair& rPair) { return 
rPair.second; });
+CPPUNIT_ASSERT_EQUAL(static_cast(4), aBorderWidthVec.size());
+CPPUNIT_ASSERT_GREATER(aBorderWidthVec[0], aBorderWidthVec[1]);
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected greater than: 120
+// - Actual  : 60
+// i.e. the bottom border was thin+thick, not thick+thin.
+CPPUNIT_ASSERT_GREATER(aBorderWidthVec[3], aBorderWidthVec[2]);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 00dc8b81..656646420dc5 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2846,8 +2846,21 @@ void SwTabFramePainter::Insert(const SwFrame& rFrame, 
const SvxBoxItem& rBoxItem
 svx::frame::Style aB(rBoxItem.GetBottom(), 1.0);
 aB.SetWordTableCell(bWordTableCell);
 
+// First cell in a row.
+bool bLeftIsOuter = rFrame.IsCellFrame() && rFrame.GetUpper()->GetLower() 
== 
+// Last cell in a row.
+bool bRightIsOuter = rFrame.IsCellFrame() && rFrame.GetNext() == nullptr;
+// First row in a table.
+bool bTopIsOuter = rFrame.IsCellFrame() && 
rFrame.GetUpper()->GetUpper()->GetLower() == 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-02-11 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/data/double-border-vertical.docx |binary
 sw/qa/core/layout/layout.cxx   |   48 +
 sw/source/core/layout/paintfrm.cxx |7 +++
 3 files changed, 55 insertions(+)

New commits:
commit c9cf688754ffccd785c8628a2e739e234ed4cd3b
Author: Miklos Vajna 
AuthorDate: Tue Jan 11 17:18:11 2022 +0100
Commit: Mike Kaganski 
CommitDate: Fri Feb 11 09:20:32 2022 +0100

sw: fix swapped inner vs outer border for Word-style left table borders

The minimal DOCX bugdoc has a single cell, the left border style is
thinThickMediumGap, the right border style is thickThinMediumGap, which
means the doc model already has the left/right mirroring, don't have to
do it at layout time.

The normal Writer way is to have a single border style and mirror the
right/bottom border line.

But then looking at the Writer vs Word output, inner vs outer is
swapped, so at the end we have to mirror the left border line for
Word-style table borders to get compatible output.

(cherry picked from commit fc04a84f297b78a1049182b6d8cf745f863ffe61)

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

diff --git a/sw/qa/core/layout/data/double-border-vertical.docx 
b/sw/qa/core/layout/data/double-border-vertical.docx
new file mode 100644
index ..a4731ebec612
Binary files /dev/null and b/sw/qa/core/layout/data/double-border-vertical.docx 
differ
diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx
index 2b1dc8be0b3f..0358b2f0f359 100644
--- a/sw/qa/core/layout/layout.cxx
+++ b/sw/qa/core/layout/layout.cxx
@@ -578,6 +578,54 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, 
testInnerCellBorderIntersect)
 CPPUNIT_ASSERT_LESS(aBorderStartEnds[0].second, 
aBorderStartEnds[1].second);
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testDoubleBorderVertical)
+{
+// Given a table with a left and right double border, outer is thick, 
inner is thin:
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "double-border-vertical.docx");
+SwDocShell* pShell = pDoc->GetDocShell();
+
+// When rendering that document:
+std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile();
+
+// Then make sure the left border is thick+thin and the right border is 
thin+thick (from left to
+// right):
+MetafileXmlDump dumper;
+xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+// Collect widths of vertical lines.
+xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, 
"//polyline[@style='solid']/point");
+xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+// Horizontal position -> width.
+std::map aBorderWidths;
+for (int i = 0; i < xmlXPathNodeSetGetLength(pXmlNodes); i += 2)
+{
+xmlNodePtr pStart = pXmlNodes->nodeTab[i];
+xmlNodePtr pEnd = pXmlNodes->nodeTab[i + 1];
+xmlChar* pStartX = xmlGetProp(pStart, BAD_CAST("x"));
+xmlChar* pEndX = xmlGetProp(pEnd, BAD_CAST("x"));
+sal_Int32 nStartX = OString(reinterpret_cast(pStartX)).toInt32();
+sal_Int32 nEndX = OString(reinterpret_cast(pEndX)).toInt32();
+if (nStartX != nEndX)
+{
+// Horizontal border.
+continue;
+}
+xmlChar* pWidth = xmlGetProp(pStart->parent, BAD_CAST("width"));
+sal_Int32 nWidth = OString(reinterpret_cast(pWidth)).toInt32();
+aBorderWidths[nStartX] = nWidth;
+}
+xmlXPathFreeObject(pXmlObj);
+std::vector aBorderWidthVec;
+std::transform(aBorderWidths.begin(), aBorderWidths.end(), 
std::back_inserter(aBorderWidthVec),
+   [](const std::pair& rPair) { return 
rPair.second; });
+CPPUNIT_ASSERT_EQUAL(static_cast(4), aBorderWidthVec.size());
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected greater than: 120
+// - Actual  : 60
+// i.e. the left border was thin+thick, not thick+thin.
+CPPUNIT_ASSERT_GREATER(aBorderWidthVec[1], aBorderWidthVec[0]);
+CPPUNIT_ASSERT_GREATER(aBorderWidthVec[2], aBorderWidthVec[3]);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 41cbb9c47e71..00dc8b81 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2861,6 +2861,13 @@ void SwTabFramePainter::Insert(const SwFrame& rFrame, 
const SvxBoxItem& rBoxItem
 
 // First cell in a row.
 bool bOuter = rFrame.IsCellFrame() && rFrame.GetUpper()->GetLower() == 

+
+if (bWordTableCell && bOuter)
+{
+// First vs secondary and inner vs outer is the other way around in 
Word.
+aL.MirrorSelf();
+}
+
 SwLineEntry aLeft  (nLeft,   nTop,  nBottom, bOuter,
 bVert ? aB  

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-02-11 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/data/inner-border.docx |binary
 sw/qa/core/layout/layout.cxx |   53 +++
 sw/source/core/layout/paintfrm.cxx   |   83 +++
 3 files changed, 116 insertions(+), 20 deletions(-)

New commits:
commit 0dbecd2d2ebe18a262cfab96e105637840b5b7fe
Author: Miklos Vajna 
AuthorDate: Thu Jan 6 15:45:02 2022 +0100
Commit: Mike Kaganski 
CommitDate: Fri Feb 11 09:19:07 2022 +0100

sw: fix too long inner borders intersecting with outer borders for Word 
cells

This is similar to commit 66ac8e60896f6306bed8fbb34606fd14474f19ce (sw:
fix unwanted long vertical border around vertically merged Word cell,
2021-03-04), but this one is about how we handle table border painting
when an inner border intersects with an outer border.

Previously we used to paint the full outer border and the full inner
border, which looks silly in case you have e.g. double border outside
and a single border inside -- the inner line stops at the edge of the
thick outer border in Word.

Do the same by limiting the start of a horizontal line if its start
would match the X coordinate of a vertical line (and the remaining 3
combinations of hori/vert line start/end). We always limit the inner
line, so this needs extending SwLineEntry if the line is an outer one or
not.

(cherry picked from commit 526c8bdb54eff942d5213030d1455f97720a1ba7)

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

diff --git a/sw/qa/core/layout/data/inner-border.docx 
b/sw/qa/core/layout/data/inner-border.docx
new file mode 100644
index ..1d8adc9fe818
Binary files /dev/null and b/sw/qa/core/layout/data/inner-border.docx differ
diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx
index b1cb3136b963..2b1dc8be0b3f 100644
--- a/sw/qa/core/layout/layout.cxx
+++ b/sw/qa/core/layout/layout.cxx
@@ -525,6 +525,59 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testLinkedBullet)
 assertXPath(pXmlDoc, "//bmpexscale", 1);
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testInnerCellBorderIntersect)
+{
+// Given a table with both outer and inner borders:
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "inner-border.docx");
+SwDocShell* pShell = pDoc->GetDocShell();
+
+// When rendering table borders:
+std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile();
+
+// Then make sure that that inner and outer borders don't overlap in Word 
compatibility mode,
+// and inner borders are reduced to prevent an overlap:
+MetafileXmlDump dumper;
+xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+// Collect start/end (vertical) positions of horizontal borders.
+xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, 
"//polyline[@style='solid']/point");
+xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+std::vector> aBorderStartEnds;
+for (int i = 0; i < xmlXPathNodeSetGetLength(pXmlNodes); i += 2)
+{
+xmlNodePtr pStart = pXmlNodes->nodeTab[i];
+xmlNodePtr pEnd = pXmlNodes->nodeTab[i + 1];
+xmlChar* pStartY = xmlGetProp(pStart, BAD_CAST("y"));
+xmlChar* pEndY = xmlGetProp(pEnd, BAD_CAST("y"));
+sal_Int32 nStartY = OString(reinterpret_cast(pStartY)).toInt32();
+sal_Int32 nEndY = OString(reinterpret_cast(pEndY)).toInt32();
+if (nStartY != nEndY)
+{
+// Vertical border.
+continue;
+}
+xmlChar* pStartX = xmlGetProp(pStart, BAD_CAST("x"));
+xmlChar* pEndX = xmlGetProp(pEnd, BAD_CAST("x"));
+sal_Int32 nStartX = OString(reinterpret_cast(pStartX)).toInt32();
+sal_Int32 nEndX = OString(reinterpret_cast(pEndX)).toInt32();
+aBorderStartEnds.emplace_back(nStartX, nEndX);
+}
+xmlXPathFreeObject(pXmlObj);
+// We have 3 lines: top, middle and bottom. The top and the bottom one is 
a full line, since
+// it's an outer border. The middle one has increased start and decreased 
end to avoid an
+// overlap.
+CPPUNIT_ASSERT_EQUAL(static_cast(3), aBorderStartEnds.size());
+CPPUNIT_ASSERT_EQUAL(aBorderStartEnds[0].first, aBorderStartEnds[2].first);
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected greater than: 1724
+// - Actual  : 1724
+// i.e. the middle line's start was the same as the top line start, while 
what we want is a
+// larger X position, so the start of the middle line doesn't overlap with 
the thick vertical
+// outer border on the left of the table.
+CPPUNIT_ASSERT_GREATER(aBorderStartEnds[0].first, 
aBorderStartEnds[1].first);
+CPPUNIT_ASSERT_EQUAL(aBorderStartEnds[0].second, 
aBorderStartEnds[2].second);
+CPPUNIT_ASSERT_LESS(aBorderStartEnds[0].second, 
aBorderStartEnds[1].second);
+}
+
 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-02-10 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter4.cxx |   55 
 sw/source/core/edit/edredln.cxx |   46 --
 sw/source/uibase/uiview/view2.cxx   |   14 -
 3 files changed, 112 insertions(+), 3 deletions(-)

New commits:
commit d4a503a030706bf609e498e25888d400cc5aaefa
Author: László Németh 
AuthorDate: Wed Feb 9 12:15:33 2022 +0100
Commit: László Németh 
CommitDate: Thu Feb 10 09:37:10 2022 +0100

tdf#147182 sw: accept/reject all changes of a table selection

Selecting multiple cells of a text table which contain
tracked text changes, and choosing Accept Track Change/Reject
Track Change, only text changes of the first cell were
accepted/rejected (a problem inherited from OOo).

The fix allows to accept/reject also all tracked row
deletions/insertions in the selected table rows by a single
click.

Note for manual testing: first cell of the selection should
still contain a tracked change, otherwise Accept Track Change/
Reject Track Change menu items/icons aren't active.

Conflicts:
sw/qa/extras/uiwriter/uiwriter4.cxx

Change-Id: I11e71075f4144bba86dda690ec712a24ccf815dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129717
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry-picked from commit 23846867ea32667ccf328c36142394dd6aaee8ba)

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

diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx 
b/sw/qa/extras/uiwriter/uiwriter4.cxx
index f7ff97ca1f02..aa807418e348 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -202,6 +202,7 @@ public:
 void testTableRedlineRedoCrash();
 void testTableRemoveHasTextChangesOnly();
 void testTableRemoveHasTextChangesOnly2();
+void testTdf147182_AcceptAllChangesInTableSelection();
 void testTdf66405();
 void testTdf35021_tabOverMarginDemo();
 void testTdf106701_tabOverMarginAutotab();
@@ -329,6 +330,7 @@ public:
 CPPUNIT_TEST(testTableRedlineRedoCrash);
 CPPUNIT_TEST(testTableRemoveHasTextChangesOnly);
 CPPUNIT_TEST(testTableRemoveHasTextChangesOnly2);
+CPPUNIT_TEST(testTdf147182_AcceptAllChangesInTableSelection);
 CPPUNIT_TEST(testTdf66405);
 CPPUNIT_TEST(testTdf35021_tabOverMarginDemo);
 CPPUNIT_TEST(testTdf106701_tabOverMarginAutotab);
@@ -1657,6 +1659,59 @@ void 
SwUiWriterTest4::testTableRemoveHasTextChangesOnly2()
 CPPUNIT_ASSERT_EQUAL(static_cast(14), 
pEditShell->GetRedlineCount());
 }
 
+void SwUiWriterTest4::testTdf147182_AcceptAllChangesInTableSelection()
+{
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "TC-table-del-add.docx");
+CPPUNIT_ASSERT(pDoc);
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+
+// check redline count
+SwEditShell* const pEditShell(pDoc->GetEditShell());
+CPPUNIT_ASSERT_EQUAL(static_cast(14), 
pEditShell->GetRedlineCount());
+
+// 4 rows in Show Changes mode
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row", 4);
+
+// Select the first table to get a table selection
+dispatchCommand(mxComponent, ".uno:SelectAll", {});
+dispatchCommand(mxComponent, ".uno:SelectAll", {});
+dispatchCommand(mxComponent, ".uno:AcceptTrackedChange", {});
+Scheduler::ProcessEventsToIdle();
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+// Accepting tracked changes in the selected table results 3 rows
+// This was 4 (only text changes of the first selected cell were accepted)
+assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row", 3);
+CPPUNIT_ASSERT_EQUAL(static_cast(8), 
pEditShell->GetRedlineCount());
+
+// Undo: 4 rows again
+pDoc->GetIDocumentUndoRedo().Undo();
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row", 4);
+CPPUNIT_ASSERT_EQUAL(static_cast(14), 
pEditShell->GetRedlineCount());
+
+// To check Undo of HasTextChangesOnly reject the same row results 3 rows
+dispatchCommand(mxComponent, ".uno:Escape", {});
+dispatchCommand(mxComponent, ".uno:SelectAll", {});
+dispatchCommand(mxComponent, ".uno:SelectAll", {});
+dispatchCommand(mxComponent, ".uno:RejectTrackedChange", {});
+Scheduler::ProcessEventsToIdle();
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+// This was 4 (only text changes of the first selected cell were rejected)
+assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row", 3);
+
+// Undo: 4 rows again
+pDoc->GetIDocumentUndoRedo().Undo();
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row", 4);
+

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-02-10 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter4.cxx  |  142 +++
 sw/source/uibase/dochdl/swdtflvr.cxx |  123 ++
 sw/source/uibase/inc/swdtflvr.hxx|7 -
 3 files changed, 255 insertions(+), 17 deletions(-)

New commits:
commit 9493147ad6b046a4685896d594ed257800552f67
Author: László Németh 
AuthorDate: Mon Feb 7 18:03:45 2022 +0100
Commit: László Németh 
CommitDate: Thu Feb 10 09:36:53 2022 +0100

tdf#147181 tdf#147322 sw: fix drag & drop multiple table rows

With change tracking, moving multiple table rows tracked
only the first row as deleted, and in the insertion point,
as inserted.

Without change tracking, only the first row were deleted
from the original position. This is a regression of tdf#84806
from commit 5e8aa259e48d5602b932353bb146ebb523982cf2
"tdf#146967 sw table: fix freezing in Hide Changes mode".

Add unit tests for the change tracking fix and for the original
table moving fix in commit 7fe64353dc9950e19182a59a486a1ecac27cf98e
"tdf#84806 Writer: drag and drop selected tables, don't empty".

Conflicts:
sw/qa/extras/uiwriter/uiwriter4.cxx

Change-Id: I43250fcef4bbf482e67a7414f4f655e75d226b55
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129635
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry-picked from commit 2bb9ad2078e355b71ab25db0c46f3d0bb19cf6d4)

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

diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx 
b/sw/qa/extras/uiwriter/uiwriter4.cxx
index 090938240c63..f7ff97ca1f02 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -103,6 +103,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -260,6 +261,8 @@ public:
 void testTdf115013();
 void testTdf114536();
 void testTdf115065();
+void testTdf84806_MovingMultipleTableRows();
+void testTdf147181_TrackedMovingOfMultipleTableRows();
 void testTdf115132();
 void testXDrawPagesSupplier();
 void testTdf116403();
@@ -382,6 +385,8 @@ public:
 CPPUNIT_TEST(testTdf115013);
 CPPUNIT_TEST(testTdf114536);
 CPPUNIT_TEST(testTdf115065);
+CPPUNIT_TEST(testTdf84806_MovingMultipleTableRows);
+CPPUNIT_TEST(testTdf147181_TrackedMovingOfMultipleTableRows);
 CPPUNIT_TEST(testTdf115132);
 CPPUNIT_TEST(testXDrawPagesSupplier);
 CPPUNIT_TEST(testTdf116403);
@@ -2922,6 +2927,143 @@ void SwUiWriterTest4::testTdf115065()
 pWrtShell->Copy(*pWrtShell, ptFrom, ptTo);
 }
 
+void SwUiWriterTest4::testTdf84806_MovingMultipleTableRows()
+{
+// Moving of multiple table rows.
+// Source table (first one) has two rows;
+// destination (second one) has only one row
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf115065.odt");
+CPPUNIT_ASSERT(pDoc);
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTablesSupplier->getTextTables(),
+uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTables->getCount());
+uno::Reference xTableNames = 
xTablesSupplier->getTextTables();
+CPPUNIT_ASSERT(xTableNames->hasByName("Table1"));
+CPPUNIT_ASSERT(xTableNames->hasByName("Table2"));
+uno::Reference xTable1(xTableNames->getByName("Table1"), 
uno::UNO_QUERY);
+uno::Reference xTable2(xTableNames->getByName("Table2"), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable1->getRows()->getCount());
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable2->getRows()->getCount());
+
+// without redlining
+CPPUNIT_ASSERT_MESSAGE("redlining should be off",
+   !pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+
+sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
+
+pWrtShell->GotoTable("Table2");
+SwRect aRect = pWrtShell->GetCurrFrame()->getFrameArea();
+// Destination point is the middle of the first cell of second table
+Point ptTo(aRect.Left() + aRect.Width() / 2, aRect.Top() + aRect.Height() 
/ 2);
+
+// Move rows of the first table into the second table
+pWrtShell->GotoTable("Table1");
+pWrtShell->SelTable();
+rtl::Reference xTransfer = new SwTransferable(*pWrtShell);
+xTransfer->PrivateDrop(*pWrtShell, ptTo, /*bMove=*/true, 
/*bXSelection=*/true);
+
+// This was 2 tables
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable2->getRows()->getCount());
+
+// Undo results 2 tables
+rUndoManager.Undo();
+uno::Reference 
xTables2(xTablesSupplier->getTextTables(),
+ 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-02-03 Thread Miklos Vajna (via logerrit)
 sw/qa/core/text/data/empty-numbering-page-split.fodt |   62 +++
 sw/qa/core/text/data/image.png   |binary
 sw/qa/core/text/text.cxx |   16 
 sw/source/core/text/frmform.cxx  |   10 ++-
 4 files changed, 87 insertions(+), 1 deletion(-)

New commits:
commit 1a9147b86bb8f06efd1275b2025cd7f464e0331d
Author: Miklos Vajna 
AuthorDate: Wed Feb 2 16:02:19 2022 +0100
Commit: Michael Stahl 
CommitDate: Thu Feb 3 11:29:17 2022 +0100

tdf#137920 sw: avoid layout loop when inserting at-char anchored large image

Regression from commit d250ca91c79f457102daf4da81446b7f130fb0ee (sw:
insert image: set anchor to at-char by default, 2019-11-18), the problem
was that the document has 2 pages, the first page would host the anchor
of an inserted image and looped while creating/deleting a next page
frame when updating the layout on inserting of an image.

This problem was less visible before, as the at-para anchor is a
different codepath, which was the previous default.

The primary problem is that the loop in SwLayAction::Action() assumes
that we make progress, so in case m_bAgain is set, then doing the layout
again won't re-set m_bAgain, but it happened here.

That happens because each iteration calls SwFrame::InsertPage(),
followed by a SwPageFrame::DestroyImpl(). Examining the backtrace of the
SwPageFrame ctor leads to SwTextFrame::FormatAdjust() which tries to
split the text frame only in case it has either a number portion or a
text portion, but the check there was incomplete: a "none" number format
results in no number portion, leading to this loop.

Fix the problem by checking for HasVisibleNumberingOrBullet() before
assuming that we can split an empty text frame into two pieces where at
least one of them is not empty.

(cherry picked from commit 3e9975cf507e24e9c501575c501833164d217acc)

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

diff --git a/sw/qa/core/text/data/empty-numbering-page-split.fodt 
b/sw/qa/core/text/data/empty-numbering-page-split.fodt
new file mode 100644
index ..517ad2e0fb26
--- /dev/null
+++ b/sw/qa/core/text/data/empty-numbering-page-split.fodt
@@ -0,0 +1,62 @@
+
+
+  
+
+  
+
+
+
+  
+  
+
+
+  
+
+
+  
+
+
+  
+
+  
+
+  
+  
+
+  
+
+
+  
+  
+
+  
+  
+
+  
+
+
+  
+  
+
+  
+  
+
+  
+  
+
+  
+
+  
+  
+
+  
+
+
+  
+  
+
+  
+  
+
+  
+
diff --git a/sw/qa/core/text/data/image.png b/sw/qa/core/text/data/image.png
new file mode 100644
index ..49e71b07ae8b
Binary files /dev/null and b/sw/qa/core/text/data/image.png differ
diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index 6832ad2cb436..4358fe03df75 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -216,6 +216,22 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testRuby)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testEmptyNumberingPageSplit)
+{
+// Given a document with 2 pages: the only para on page 1 is a numbering 
without a number
+// portion:
+createSwDoc(DATA_DIRECTORY, "empty-numbering-page-split.fodt");
+
+// When inserting an image that doesn't fit the body frame:
+// Then make sure that the layout update after insertion finishes:
+uno::Sequence aArgs = {
+comphelper::makePropertyValue("FileName",
+  
m_directories.getURLFromSrc(DATA_DIRECTORY) + "image.png"),
+};
+// Without the accompanying fix in place, this never finished.
+dispatchCommand(mxComponent, ".uno:InsertGraphic", aArgs);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 93b6e2b272d8..2eba32cdef55 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -1119,13 +1119,21 @@ void SwTextFrame::FormatAdjust( SwTextFormatter ,
 }
 else
 {
+const SwTextNode* pTextNode = GetTextNodeForParaProps();
+bool bHasVisibleNumRule = nStrLen == TextFrameIndex(0) && 
pTextNode->GetNumRule();
+
+if (!pTextNode->HasVisibleNumberingOrBullet())
+{
+bHasVisibleNumRule = false;
+}
+
 // Only split frame, if the frame contains
 // content or contains no content, but has a numbering.
 // i#84870 - No split, if text frame only contains one
 // as-character anchored object.
 if ( 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-02-03 Thread Michael Stahl (via logerrit)
 sw/qa/extras/uiwriter/data/tdf147006.rtf  |   24 +
 sw/qa/extras/uiwriter/uiwriter2.cxx   |   35 ++
 sw/source/core/doc/DocumentRedlineManager.cxx |3 +-
 3 files changed, 61 insertions(+), 1 deletion(-)

New commits:
commit 4c5013818613d25b01051eafda9aef50b43d7163
Author: Michael Stahl 
AuthorDate: Tue Feb 1 21:35:46 2022 +0100
Commit: Xisco Fauli 
CommitDate: Thu Feb 3 10:13:13 2022 +0100

tdf#147006 sw_fieldmarkhide: fix crash when deleting fly with fieldmark

The problem is similar to commit eef10be20a4c5108c68b19ccdda263c5ca852386,
there is a fieldmark in a fly and this results in
UpdateFramesForRemoveDeleteRedline() re-creating fly frames that have
already been deleted in SwUndoFlyBase::DelFly(), and then the
SwFlyAtContentFrame::SwClientNotify() crashes on a null anchor position
in the SwFormat::ResetFormatAttr(RES_ANCHOR).

This time the passed rPam is empty, after removing the dummy characters
of the fieldmark; there isn't really anything to do in this case so
just return.

Change-Id: I475b8fcb0bcf94be58ff553454c261d75076303b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129308
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit bdf1d9b8151476531f2fbe06f66db260efcbc529)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129266
Tested-by: Xisco Fauli 
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/uiwriter/data/tdf147006.rtf 
b/sw/qa/extras/uiwriter/data/tdf147006.rtf
new file mode 100644
index ..462c8dc4d52d
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf147006.rtf
@@ -0,0 +1,24 @@
+{\rtf1\ansi\deff3\adeflang1025
+{\fonttbl{\f0\froman\fprq2\fcharset0 Times New 
Roman;}{\f1\froman\fprq2\fcharset2 Symbol;}{\f2\fswiss\fprq2\fcharset0 
Arial;}{\f3\froman\fprq2\fcharset0 Liberation Serif{\*\falt Times New 
Roman};}{\f4\fswiss\fprq2\fcharset0 Liberation Sans{\*\falt 
Arial};}{\f5\fnil\fprq2\fcharset0 Source Han Sans CN;}{\f6\fnil\fprq2\fcharset0 
Lohit Devanagari;}{\f7\fnil\fprq0\fcharset128 Lohit Devanagari;}}
+{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}
+{\stylesheet{\s0\snext0\rtlch\af6\afs24\alang1081 
\ltrch\lang1031\langfe2052\hich\af3\loch\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang1031\kerning1\dbch\af8\langfe2052
 Normal;}
+{\s20\sbasedon0\snext20 Frame Contents;}
+}{\*\generator LibreOfficeDev/7.4.0.0.alpha0$Linux_X86_64 
LibreOffice_project/086efd30b2f5857d2b155099ec06c522d57ad81f}{\info{\creatim\yr2022\mo2\dy1\hr21\min9}{\revtim\yr2022\mo2\dy1\hr21\min10}{\printim\yr0\mo0\dy0\hr0\min0}}{\*\userprops}\deftab709
+\hyphauto1\viewscale100
+{\*\pgdsctbl
+{\pgdsc0\pgdscuse451\pgwsxn11906\pghsxn16838\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\pgdscnxt0
 Default Page Style;}}
+\formshade\paperh16838\paperw11906\margl1134\margr1134\margt1134\margb1134\sectd\sbknone\pgndec\sftnnar\saftnnrlc\sectunlocked1\pgwsxn11906\pghsxn16838\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc
+{\*\ftnsep\chftnsep}\pard\plain \s0\rtlch\af6\afs24\alang1081 
\ltrch\lang1031\langfe2052\hich\af3\loch\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang1031\kerning1\dbch\af8\langfe2052\loch\ql\ltrpar\loch
+{\shp{\*\shpinst\shpwr2\shpwrk0\shpbypara\shpbyignore\shptop114\shpbottom1248\shpbxcolumn\shpbxignore\shpleft4252\shpright5386\shpz0{\sp{\sn
 shapeType}{\sv 202}}{\sp{\sn dxWrapDistLeft}{\sv 72390}}{\sp{\sn 
dxWrapDistRight}{\sv 72390}}{\sp{\sn dyWrapDistTop}{\sv 72390}}{\sp{\sn 
dyWrapDistBottom}{\sv 72390}}{\sp{\sn posrelv}{\sv 2}}{\sp{\sn posv}{\sv 
1}}{\sp{\sn posrelh}{\sv 2}}{\sp{\sn posh}{\sv 2}}{\sp{\sn dxTextLeft}{\sv 
53975}}{\sp{\sn dyTextTop}{\sv 53975}}{\sp{\sn dxTextRight}{\sv 53975}}{\sp{\sn 
dyTextBottom}{\sv 53975}}{\sp{\sn lineColor}{\sv 0}}{\sp{\sn lineWidth}{\sv 
635}}{\shptxt\pgndec\s20\loch\ql{
+{\*\shppict{\pict{\*\picprop{\sp{\sn wzDescription}{\sv }}{\sp{\sn wzName}{\sv 
}}}\picscalex100\picscaley100\piccropl0\piccropr0\piccropt0\piccropb0\picw19\pich19\picwgoal380\pichgoal380\pngblip
+89504e470d0a1a0a000d4948445200130013080600725036cc00017352474200aece1ce90006624b474400ff00ff00ffa0bda793
+0009704859730b130b1301009a9c18000774494d4507db0906123403a1d7aeb200654944415438cb63fc3f03b50013318a2497b0
+fca78a6130838831908914171132908954afe13390899c30c225cf446e606353c7448e41b8d433e133e879cc1f467c7c747d3823009b467ce20c0c0c0c2cc428
+22d64026062a8251c38693618cd42c6901c5e32de14bf6d21e49454e44ae426082}}
+}{\loch
+{\field{\*\fldinst { FORMTEXT }{\loch
+}}{\fldrslt 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-02-02 Thread Regina Henschel (via logerrit)
 sw/qa/core/draw/data/tdf107727_FrameBorder.odt |binary
 sw/qa/core/draw/draw.cxx   |   43 
 sw/source/filter/ww8/rtfattributeoutput.cxx|   52 -
 3 files changed, 78 insertions(+), 17 deletions(-)

New commits:
commit b3f426bc7ff75820c2487f1a7f9d0117b5d53831
Author: Regina Henschel 
AuthorDate: Tue Feb 1 20:38:07 2022 +0100
Commit: Xisco Fauli 
CommitDate: Wed Feb 2 13:54:34 2022 +0100

tdf#107727 disable border in RTF export if not drawn

A border of a text frame is not drawn, if it is really disabled or if
its line style is None. The patch considers both cases. Previously the
first case was missing.

LO can disable single border lines and single border lines can have
different styles. The patch uses a border line now, that is really
drawn, to get the color and width. It uses the first one in order
top, bottom, left, right.

In theory RTF can describe disabling single border lines by using the
flags fTopLine, fBottomLine, fLeftLine or fRightLine. But Word has
only the ability to enable all or none of the border lines for an old
kind text box as contained in an rtf-document. The current patch uses
therefore this all-or-none approach too. It enables border if at least
one is actually drawn, because that keeps the style settings for that
border line. Previously all four border lines need to be drawn.

If it is changed to use the flags fTopLine, fBottomLine, fLeftLine
and fRightLine on export, then it would be possible to recover showing
only single border lines on reimport. But that is out of scope here.

Change-Id: Ib78604def154c133d3c93bc75a38731eb6b02294
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129305
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit 9877a0190e43241f4a5102e5d9cc7181f91d5a6f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129328
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/core/draw/data/tdf107727_FrameBorder.odt 
b/sw/qa/core/draw/data/tdf107727_FrameBorder.odt
new file mode 100644
index ..6b7bc3a375fa
Binary files /dev/null and b/sw/qa/core/draw/data/tdf107727_FrameBorder.odt 
differ
diff --git a/sw/qa/core/draw/draw.cxx b/sw/qa/core/draw/draw.cxx
index 97b6a2bb7d79..c2514808f8e4 100644
--- a/sw/qa/core/draw/draw.cxx
+++ b/sw/qa/core/draw/draw.cxx
@@ -10,6 +10,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -18,6 +19,10 @@
 #include 
 #include 
 
+#include 
+#include 
+#include 
+
 constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/core/draw/data/";
 
 /// Covers sw/source/core/draw/ fixes.
@@ -98,6 +103,44 @@ CPPUNIT_TEST_FIXTURE(SwCoreDrawTest, testTextboxUndoOrdNum)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreDrawTest, testTdf107727FrameBorder)
+{
+// Load a document with a textframe without border, one with only left 
border
+OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + 
"tdf107727_FrameBorder.odt";
+mxComponent = loadFromDesktop(aURL, "com.sun.star.text.TextDocument", {});
+
+// Export to RTF and reload
+uno::Reference xStorable(mxComponent, uno::UNO_QUERY);
+utl::TempFile aTempFile;
+aTempFile.EnableKillingFile();
+utl::MediaDescriptor aMediaDescriptor;
+aMediaDescriptor["FilterName"] <<= OUString("Rich Text Format");
+xStorable->storeToURL(aTempFile.GetURL(), 
aMediaDescriptor.getAsConstPropertyValueList());
+mxComponent = loadFromDesktop(aTempFile.GetURL(), 
"com.sun.star.text.TextDocument", {});
+
+// Get frame without border and inspect it.
+uno::Reference xTextFramesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xIndexAccess(xTextFramesSupplier->getTextFrames(),
+ uno::UNO_QUERY);
+uno::Reference xFrame0(xIndexAccess->getByIndex(0), 
uno::UNO_QUERY);
+auto aBorder = getProperty(xFrame0, "LeftBorder");
+// fo:border="none" is not available via API, and aBorder.LineWidth has 
wrong value (why?).
+sal_uInt32 nBorderWidth
+= aBorder.OuterLineWidth + aBorder.InnerLineWidth + 
aBorder.LineDistance;
+// Without patch it failed with Expected 0, Actual 26
+CPPUNIT_ASSERT_EQUAL(static_cast(0), nBorderWidth);
+
+// Get frame with left border and inspect it.
+uno::Reference xFrame1(xIndexAccess->getByIndex(1), 
uno::UNO_QUERY);
+aBorder = getProperty(xFrame1, "LeftBorder");
+// Without patch it failed with Expected 127, Actual 26. Default border 
width was used.
+nBorderWidth = aBorder.OuterLineWidth + aBorder.InnerLineWidth + 
aBorder.LineDistance;
+CPPUNIT_ASSERT_EQUAL(static_cast(127), nBorderWidth);
+// Without patch it failed with Expected Color: R:0 G:0 B:255 A:0, Actual 
Color: R:0 G:0 B:0 A:0.
+// Default border color was used.
+CPPUNIT_ASSERT_EQUAL(Color(0xff), Color(ColorTransparency, 
aBorder.Color));
+}
+
 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-02-02 Thread Michael Stahl (via logerrit)
 sw/qa/extras/uiwriter/uiwriter2.cxx  |8 
 sw/source/core/crsr/bookmark.cxx |   19 ---
 sw/source/core/doc/docbm.cxx |8 +++-
 sw/source/core/txtnode/modeltoviewhelper.cxx |2 +-
 sw/source/core/undo/rolbck.cxx   |8 
 5 files changed, 28 insertions(+), 17 deletions(-)

New commits:
commit e19044a21287b6538ae5962c5fb29b711c09e4f9
Author: Michael Stahl 
AuthorDate: Tue Feb 1 13:39:19 2022 +0100
Commit: Xisco Fauli 
CommitDate: Wed Feb 2 12:06:00 2022 +0100

tdf#147008 sw_fieldmarkhide: fix invalid NonTextFieldmark positions

Commit ab6176e88f78d0b3aa2490fbc7858304c2d4a437 introduced a crash
in ModelToViewHelper when the positions of a NonTextFieldmark are invalid.

The NonTextFieldmark must always contain 1 CH_TXT_ATR_FORMELEMENT
but after SplitNode() the position is
(rr) p *pFieldMark->m_pPos1
$2 = SwPosition (node 10, offset 1)
(rr) p *pFieldMark->m_pPos2
$3 = SwPosition (node 9, offset 0)

This is because in ContentIdxStoreImpl::SaveBkmks() there is an
asymmetry where the m_pPos2 is recorded to be wrongly corrected to node
9, but if the positions were swapped so that m_pPos1 is the start
position, then it will not be recorded and remain in node 10.

So fix this by changing the NonTextFieldmark to insert its
CH_TXT_ATR_FORMELEMENT differently.

There is some very subtle code in SwTextNode::Update() that is again
asymmetric and (non-obviously) prefers to move m_pPos2 and leave m_pPos1
alone (by moving it to aTmpIdxReg) in case the positions are equal.

But then the fieldmark code increments "rEnd" (which is really the
m_pPos1 i.e. the start after InsertString() returns), and then
decrements m_pPos2.

So avoid the problem by removing these 2 pointless adjustments.

Then it turns a bunch of tests fail because other code assumes that
m_pPos1 is the end of the NonTextFieldmark, so fix
MarkManager::changeFormFieldmarkType(), ModelToViewHelper and
SwHistoryNoTextFieldmark to use GetMarkStart().

Change-Id: I7c82f9a67661121662c95727e0f8f15e06d85a3a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129289
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit ea06852ee87531794f07710de496734a647a9062)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129265
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 79aa517c66f4..65142dbd64e1 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -3600,6 +3600,14 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, 
testCheckboxFormFieldInsertion)
 pFieldmark = dynamic_cast<::sw::mark::IFieldmark*>(*aIter);
 CPPUNIT_ASSERT(pFieldmark);
 CPPUNIT_ASSERT_EQUAL(OUString(ODF_FORMCHECKBOX), 
pFieldmark->GetFieldname());
+
+// tdf#147008 this would crash
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+pWrtShell->StartOfSection(false);
+pWrtShell->SplitNode();
+CPPUNIT_ASSERT_EQUAL(pFieldmark->GetMarkPos().nNode, 
pFieldmark->GetOtherMarkPos().nNode);
+
CPPUNIT_ASSERT_EQUAL(sal_Int32(pFieldmark->GetMarkPos().nContent.GetIndex() + 
1),
+ pFieldmark->GetOtherMarkPos().nContent.GetIndex());
 }
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testDropDownFormFieldInsertion)
diff --git a/sw/source/core/crsr/bookmark.cxx b/sw/source/core/crsr/bookmark.cxx
index 2945b018bb8b..417558aad130 100644
--- a/sw/source/core/crsr/bookmark.cxx
+++ b/sw/source/core/crsr/bookmark.cxx
@@ -154,6 +154,10 @@ namespace
 SwPosition const sepPos(sw::mark::FindFieldSep(rField));
 
assert(sepPos.nNode.GetNode().GetTextNode()->GetText()[sepPos.nContent.GetIndex()]
 == CH_TXT_ATR_FIELDSEP); (void) sepPos;
 }
+else
+{   // must be m_pPos1 < m_pPos2 because of asymmetric SplitNode update
+assert(rField.GetMarkPos().nContent.GetIndex() + 1 == 
rField.GetOtherMarkPos().nContent.GetIndex());
+}
 SwPosition const& rEnd(rField.GetMarkEnd());
 
assert(rEnd.nNode.GetNode().GetTextNode()->GetText()[rEnd.nContent.GetIndex() - 
1] == aEndMark); (void) rEnd;
 }
@@ -207,7 +211,14 @@ namespace
 {
 SwPaM aEndPaM(rEnd);
 io_rDoc.getIDocumentContentOperations().InsertString(aEndPaM, 
OUString(aEndMark));
-++rEnd.nContent;
+if (aEndMark != CH_TXT_ATR_FORMELEMENT)
+{
+++rEnd.nContent; // InsertString didn't move non-empty mark
+}
+else
+{   // InsertString moved the mark's end, not its start
+assert(rField.GetMarkPos().nContent.GetIndex() + 1 == 
rField.GetOtherMarkPos().nContent.GetIndex());
+}
 }
 lcl_AssertFieldMarksSet(rField, 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-02-01 Thread László Németh (via logerrit)
 sw/qa/extras/layout/data/tdf54819.fodt |9 +
 sw/qa/extras/layout/layout2.cxx|   32 
 sw/source/core/doc/docredln.cxx|2 +-
 3 files changed, 42 insertions(+), 1 deletion(-)

New commits:
commit 3159108505905cedc088b5ce822680fc9c456d02
Author: László Németh 
AuthorDate: Mon Jan 31 14:37:37 2022 +0100
Commit: Xisco Fauli 
CommitDate: Tue Feb 1 14:12:05 2022 +0100

tdf#146964 sw layout: fix reappearing deletion in Hide Changes

mode at moving text.

Test: in Hide Changes mode, move the selected text by
cutting and pasting it with change tracking. Before the fix,
hidden deletion reappeared again (only clicking on Show
Changes and Hide Changes again fixed the layout).

Regression from commit f51fa7534421a195a58b4a737a2e836d8c25ba81
"tdf#145718 sw, DOCX import: complete tracked text moving"

(cherry picked from commit a2d9b270ce8537ebb59de50ebd07697fe9aa191b)

Conflicts:
sw/qa/extras/layout/layout2.cxx

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

diff --git a/sw/qa/extras/layout/data/tdf54819.fodt 
b/sw/qa/extras/layout/data/tdf54819.fodt
new file mode 100644
index ..f9a8e9d0b698
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf54819.fodt
@@ -0,0 +1,9 @@
+
+http://www.w3.org/1999/xlink; 
xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle: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:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d: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:config="urn:oas
 is:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:officeooo="http://openoffice.org/2009/office; 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:formx="urn:openoffice:names:
 experimental:ooxml-odf-interop:xmlns:form:1.0" 
xmlns:css3t="http://www.w3.org/TR/css3-text/; office:version="1.2" 
office:mimetype="application/vnd.oasis.opendocument.text">
+  
+
+  Lorem ipsum
+  dolor sit amet.
+
+  
+
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index 10d01fa05e33..b9d9a813544f 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -420,6 +421,37 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, 
testTdf145225_RedlineMovingWithBadInsertio
 CPPUNIT_ASSERT_EQUAL(static_cast(3), 
pEditShell->GetRedlineCount());
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, 
testTdf146964_ReappearingMovedTextInHideChangesMode)
+{
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf54819.fodt");
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+
+// enable Record Changes
+dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+
+// set Hide Changes mode
+dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+SwRootFrame* pLayout(pWrtShell->GetLayout());
+CPPUNIT_ASSERT(pLayout->IsHideRedlines());
+
+// delete and paste the deleted word again during Track Changes
+dispatchCommand(mxComponent, ".uno:WordRightSel", {});
+dispatchCommand(mxComponent, ".uno:Cut", {});
+dispatchCommand(mxComponent, ".uno:Paste", {});
+
+SwEditShell* const pEditShell(pDoc->GetEditShell());
+CPPUNIT_ASSERT_EQUAL(static_cast(2), 
pEditShell->GetRedlineCount());
+
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+CPPUNIT_ASSERT(pXmlDoc);
+// 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-01-26 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter2.cxx  |   36 +++
 sw/source/uibase/dochdl/swdtflvr.cxx |7 +-
 2 files changed, 42 insertions(+), 1 deletion(-)

New commits:
commit 29233e10f00af0af132849485648664aadefd456
Author: László Németh 
AuthorDate: Wed Jan 26 13:44:39 2022 +0100
Commit: László Németh 
CommitDate: Thu Jan 27 08:15:41 2022 +0100

tdf#146966 sw: fix inserting empty rows at copying multiple rows

HTML expansion of the clipboard content is used to calculate the
row number of the table on the clipboard. Skip its empty 
elements here, similar to Paste As HTML in Edit->Paste Special->
Paste Special... to avoid inserting empty rows (e.g. selecting and
copying/moving 4 rows inserted 30 extra empty rows).

Note: likely this was a regression, related to the new empty
rows in the clipboard/expansion code.

Change-Id: I58b16c7869c08cda7e2a2c21c3c03bf38446d826
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128986
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 6ad9a3d74ef6eae3e645df12dedbe059acc180c4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128959

diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index fea93243bdc8..79aa517c66f4 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -5156,6 +5156,42 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, 
testPasteTrackedTableRowInHideChangesMode)
 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf146966)
+{
+// load a 4-row table, select more than 1 row and copy them
+// to check insertion of unnecessary empty rows
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf144748.fodt");
+
+// check table row count
+uno::Reference xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTextTablesSupplier->getTextTables(),
+uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+uno::Reference xTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xTable->getRows()->getCount());
+
+// copy table row and paste it by Paste Special->Rows Above
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+pWrtShell->Down(/*bSelect=*/false);
+dispatchCommand(mxComponent, ".uno:SelectTable", {});
+dispatchCommand(mxComponent, ".uno:Copy", {});
+dispatchCommand(mxComponent, ".uno:Escape", {});
+dispatchCommand(mxComponent, ".uno:PasteRowsBefore", {});
+
+// This was 35 (extra empty rows)
+CPPUNIT_ASSERT_EQUAL(sal_Int32(8), xTable->getRows()->getCount());
+
+dispatchCommand(mxComponent, ".uno:Undo", {});
+dispatchCommand(mxComponent, ".uno:Undo", {});
+dispatchCommand(mxComponent, ".uno:Undo", {}); // FIXME Why 3 Undos?
+CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xTable->getRows()->getCount());
+
+dispatchCommand(mxComponent, ".uno:Redo", {});
+dispatchCommand(mxComponent, ".uno:Redo", {});
+CPPUNIT_ASSERT_EQUAL(sal_Int32(8), xTable->getRows()->getCount());
+// dispatchCommand(mxComponent, ".uno:Redo", {}); // FIXME assert
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf145091)
 {
 // load a deleted table, reject them, and delete only its text and export 
to DOCX
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx 
b/sw/source/uibase/dochdl/swdtflvr.cxx
index ea95471b8a59..ddc47cda43e4 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -1576,8 +1576,13 @@ bool SwTransferable::Paste(SwWrtShell& rSh, 
TransferableDataHelper& rData, RndSt
 while((nIdx = aExpand.indexOf(sSearchRowOrCol, nIdx)) > -1)
 {
 // skip rows/columns of nested tables, based on HTML 
indentation
-if (nIdx > 2 && (aExpand[nIdx-1] != '\t' || aExpand[nIdx-2] != 
'\t' || (bShifted && aExpand[nIdx-3] != '\t')))
+if ( nIdx > 3 && (aExpand[nIdx-1] != '\t' || aExpand[nIdx-2] 
!= '\t' ||
+( bShifted && aExpand[nIdx-3] != '\t') ) &&
+// skip also strange hidden empty rows 
+!aExpand.match("", nIdx - 4) )
+{
 ++nSelectedRowsOrCols;
+}
 ++nIdx;
 }
 // are we at the beginning of the cell?


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-01-25 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter2.cxx  |   46 +++
 sw/source/uibase/dochdl/swdtflvr.cxx |   31 +--
 2 files changed, 69 insertions(+), 8 deletions(-)

New commits:
commit e16d7e193313d2e479aed3536f564649313eff5e
Author: László Németh 
AuthorDate: Mon Jan 24 17:37:09 2022 +0100
Commit: László Németh 
CommitDate: Tue Jan 25 16:14:43 2022 +0100

tdf#146967 sw table: fix freezing in Hide Changes mode

During change tracking, drag & drop or Cut & Paste a
table row resulted freezing in Hide Changes mode.

Test: In Hide Changes mode, select a table row by
clicking on their left border, and drag & drop or
Cut & Paste it in a different table row.

Regression from commit 5a1c19624eda0c8b847af0dcee70b82502578ceb.

Follow-up to commit 5a1c19624eda0c8b847af0dcee70b82502578ceb
tdf#146965 sw track changes: fix tracked table row moving

Change-Id: Iab606ce036fedcc70e42638e3ccf804c9dbca064
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128875
Tested-by: László Németh 
Reviewed-by: László Németh 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128922
Tested-by: Jenkins

diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index c0c5c9f103e7..fea93243bdc8 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -5110,6 +5110,52 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, 
testPasteTrackedTableRow)
 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRows()->getCount());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, 
testPasteTrackedTableRowInHideChangesMode)
+{
+// load a 1-row table
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf118311.fodt");
+
+// turn on red-lining and show changes
+pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On);
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+CPPUNIT_ASSERT_MESSAGE("redlines should be invisible",
+   !IDocumentRedlineAccess::IsShowChanges(
+   
pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+// check table count
+uno::Reference xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTextTablesSupplier->getTextTables(),
+uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+
+// check table row count
+uno::Reference xTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRows()->getCount());
+
+// copy table row and paste it by Paste Special->Rows Above
+dispatchCommand(mxComponent, ".uno:SelectTable", {});
+dispatchCommand(mxComponent, ".uno:Copy", {});
+dispatchCommand(mxComponent, ".uno:Escape", {});
+
+// This resulted freezing
+dispatchCommand(mxComponent, ".uno:PasteRowsBefore", {});
+
+// 2-row table
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount());
+
+// This was 2 (inserted as a nested table in the first cell of the new row)
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+
+dispatchCommand(mxComponent, ".uno:Undo", {});
+dispatchCommand(mxComponent, ".uno:Undo", {});
+dispatchCommand(mxComponent, ".uno:Undo", {}); // FIXME Why 3 Undos?
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRows()->getCount());
+
+dispatchCommand(mxComponent, ".uno:Redo", {});
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf145091)
 {
 // load a deleted table, reject them, and delete only its text and export 
to DOCX
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx 
b/sw/source/uibase/dochdl/swdtflvr.cxx
index 90ca0e8902ac..ea95471b8a59 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -1626,8 +1626,8 @@ bool SwTransferable::Paste(SwWrtShell& rSh, 
TransferableDataHelper& rData, RndSt
 bool bResult = SwTransferable::PasteData( rData, rSh, nAction, 
nActionFlags, nFormat,
 nDestination, false, false, nullptr, 
0, false, nAnchorType, bIgnoreComments,  );
 
-// set tracked insertion
-if ( eOld & RedlineFlags::On )
+// set tracked insertion, if it's not in a drag & drop action
+if ( !rSh.ActionPend() && ( eOld & RedlineFlags::On) )
 {
 SvxPrintItem aTracked(RES_PRINT, false);
 rSh.GetDoc()->SetRowNotTracked( *rSh.GetCursor(), aTracked );
@@ -3932,6 +3932,11 @@ bool SwTransferable::PrivateDrop( SwWrtShell& rSh, const 
Point& rDragPt,
 {
 bool bTableCol(SelectionType::TableCol & nSelection);
 
+::sw::mark::IMark* pMarkMoveFrom = 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-01-25 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter2.cxx  |   47 +++
 sw/source/uibase/dochdl/swdtflvr.cxx |   17 
 2 files changed, 64 insertions(+)

New commits:
commit 8aab37daf004ed31c67f21a352fba95ab1229086
Author: László Németh 
AuthorDate: Fri Jan 21 11:13:27 2022 +0100
Commit: László Németh 
CommitDate: Tue Jan 25 16:13:34 2022 +0100

tdf#146965 sw track changes: fix tracked table row moving

During track changes, drag & drop or Cut & Paste
a table row resulted a nested table in the first cell of
the newly inserted empty table row instead of moving
the original table row.

Test: select a table row by clicking on their left border,
and drag & drop or Cut & Paste it in a different
table row.

Note: This fixes crashing at Redo of tracked table row
insertion, too.

Regression from commit dbc82c02eb24ec1c97c6ee32069771d8deb394f9
"tdf#143358 sw: track insertion of empty table rows".

Change-Id: I9a31cae2c0e6e5e05450336a1e5b8d792035df35
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128726
Tested-by: László Németh 
Reviewed-by: László Németh 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128921

diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index abb6d02556f8..c0c5c9f103e7 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -5063,6 +5063,53 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, 
testTdf145089_RedlineTableRowInsertionDOCX
 assertXPath(pXmlDoc, "//page[1]//body/tab/row", 1);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testPasteTrackedTableRow)
+{
+// load a 1-row table
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf118311.fodt");
+
+// turn on red-lining and show changes
+pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | 
RedlineFlags::ShowDelete
+  | 
RedlineFlags::ShowInsert);
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+CPPUNIT_ASSERT_MESSAGE(
+"redlines should be visible",
+
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+// check table count
+uno::Reference xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTextTablesSupplier->getTextTables(),
+uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+
+// check table row count
+uno::Reference xTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRows()->getCount());
+
+// copy table row and paste it by Paste Special->Rows Above
+dispatchCommand(mxComponent, ".uno:SelectTable", {});
+dispatchCommand(mxComponent, ".uno:Copy", {});
+dispatchCommand(mxComponent, ".uno:Escape", {});
+dispatchCommand(mxComponent, ".uno:PasteRowsBefore", {});
+
+// 2-row table
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount());
+
+// This was 2 (inserted as a nested table in the first cell of the new row)
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+
+// Is it a tracked row insertion? Its rejection results the original 1-row 
table
+dispatchCommand(mxComponent, ".uno:RejectAllTrackedChanges", {});
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRows()->getCount());
+
+dispatchCommand(mxComponent, ".uno:Undo", {});
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount());
+
+dispatchCommand(mxComponent, ".uno:Redo", {});
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRows()->getCount());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf145091)
 {
 // load a deleted table, reject them, and delete only its text and export 
to DOCX
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx 
b/sw/source/uibase/dochdl/swdtflvr.cxx
index a7a11bbb99f7..90ca0e8902ac 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -109,6 +109,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1598,6 +1599,12 @@ bool SwTransferable::Paste(SwWrtShell& rSh, 
TransferableDataHelper& rData, RndSt
 
IDocumentMarkAccess::MarkType::UNO_BOOKMARK );
 
 // add a new empty row/column before the actual table row/column 
and go there
+// (without setting the rows to tracked table row insertion here, 
do that at the end
+// to avoid layout problems and unnecessary insertion of dummy 
characters for empty rows)
+RedlineFlags eOld = 
rSh.GetDoc()->getIDocumentRedlineAccess().GetRedlineFlags();
+if ( eOld & RedlineFlags::On )
+

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2022-01-15 Thread Michael Stahl (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx |3 +++
 sw/source/filter/ww8/wrtw8nds.cxx |3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

New commits:
commit eb88b41c15f6451e06b34e2ec0ef5ec4359c200c
Author: Michael Stahl 
AuthorDate: Thu Jan 13 14:14:44 2022 +0100
Commit: Thorsten Behrens 
CommitDate: Sat Jan 15 11:29:00 2022 +0100

tdf#143039 tdf#143106 sw: DOCX export: don't export duplicate flys

The problem is that at the end of the paragraph a second call to
OutFlys() is made in line 2730 and that causes the duplication; for
this call the value FLY_POSTPONED must be returned, not FLY_NONE.

(regression from 3eced2d52415abeac266804ab682bee022322a19)

Also revert commit deb892628a1501527c8c41b85a65282df95b81b1 because its
test fails now as 0 comments are exported; it was apparently another
problem introduced by the above commit, and apparently this fix helps
for duplication of comments too.

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128386
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit f261fae4af72b1328bc3e93fc52a9a24ce0975b3)

Restore tdf#134951 docxexport: stop duplicating stuff in postponed text

Partially revert commit f261fae4af72b1328bc3e93fc52a9a24ce0975b3
to restore deb892628a1501527c8c41b85a65282df95b81b1 because as reported
by jluth the test case testfdo79008 that failed was apparently somewhat
misleading and the test case testTdf134951_duplicates that should test
comments erroneously failed to fail because it is doing a loadAndSave()
instead of a loadAndReload().

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128410
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 
(cherry picked from commit 4c4fb36222f6c624cfdea82ce266bf9d99073558)

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

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 00b58a149ef4..17fe49c8f8aa 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -136,9 +136,12 @@ CPPUNIT_TEST_FIXTURE(Test, testfdo79008)
  */
 parseExport("word/document.xml");
 
+#if 0
+// TODO: jluth says this test case needs more work
 // tdf#134951: there is only one comment
 xmlDocUniquePtr pXmlSettings = parseExport("word/comments.xml");
 assertXPath(pXmlSettings, "/w:comments/w:comment", 1);
+#endif
 
 // Read-only is set, but it is not enforced, so it should be off...
 SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get());
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx 
b/sw/source/filter/ww8/wrtw8nds.cxx
index 4f3ca7f94305..6081ab30af1d 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -717,7 +717,8 @@ FlyProcessingState SwWW8AttrIter::OutFlys(sal_Int32 nSwPos)
 
 if (maFlyIter == maFlyFrames.end())
 {
-return FLY_NONE;
+// tdf#143039 postponed prevents fly duplication at end of paragraph
+return m_rExport.AttrOutput().IsFlyProcessingPostponed() ? 
FLY_POSTPONED : FLY_NONE;
 }
 
 /*


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2021-12-27 Thread Vasily Melenchuk (via logerrit)
 sw/qa/extras/odfimport/data/tdf146257.odt |binary
 sw/qa/extras/odfimport/odfimport.cxx  |   32 ++
 sw/source/core/doc/number.cxx |   27 -
 3 files changed, 58 insertions(+), 1 deletion(-)

New commits:
commit 176266177ab810159a9956fc776b872ecba3355b
Author: Vasily Melenchuk 
AuthorDate: Sun Dec 26 20:38:30 2021 +0300
Commit: Xisco Fauli 
CommitDate: Mon Dec 27 23:43:02 2021 +0100

tdf#146257: sw: better handling for list numbering = NONE

Previously during refactoring were lost some corner cases with
some level having disabled numbering. In this case LO should
strip useless delimiters up to next level.

For example, if second level has disabled numbering, third level
should look like "1.1", but not "1..1".

Change-Id: I259a16b456f51bc76d5c8360974d0acadfc36776
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127517
Tested-by: Jenkins
Reviewed-by: Vasily Melenchuk 
(cherry picked from commit bf2b46aa15665dde63ceff4e7686b99b3990354f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127569
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/odfimport/data/tdf146257.odt 
b/sw/qa/extras/odfimport/data/tdf146257.odt
new file mode 100644
index ..2431fc0a8ff0
Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf146257.odt differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx 
b/sw/qa/extras/odfimport/odfimport.cxx
index 9d020031fb7d..fa79c7197f42 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -1296,5 +1296,37 @@ CPPUNIT_TEST_FIXTURE(Test, 
testPageAnchorZIndexSecondPage)
 sal_Int32(3), getProperty(getShapeByName(u"Shape2"), 
"ZOrder"));
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf146257)
+{
+load(mpTestDocumentPath, "tdf146257.odt");
+
+// First list should contain no labels
+{
+uno::Reference xPara(getParagraph(2), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty(xPara, 
"ListLabelString"));
+}
+{
+uno::Reference xPara(getParagraph(3), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty(xPara, 
"ListLabelString"));
+}
+{
+uno::Reference xPara(getParagraph(4), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty(xPara, 
"ListLabelString"));
+}
+// For second list ensure second level empty and thord level should not 
contain extra dots
+{
+uno::Reference xPara(getParagraph(6), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("1"), getProperty(xPara, 
"ListLabelString"));
+}
+{
+uno::Reference xPara(getParagraph(7), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty(xPara, 
"ListLabelString"));
+}
+{
+uno::Reference xPara(getParagraph(8), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("1.1"), getProperty(xPara, 
"ListLabelString"));
+}
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index acb142b09988..93a5c149f15c 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -670,6 +670,21 @@ OUString SwNumRule::MakeNumString( const 
SwNumberTree::tNumberVector & rNumVecto
 
 const SwNumFormat& rMyNFormat = Get( o3tl::narrowing(nLevel) );
 
+if (rMyNFormat.GetNumberingType() == SVX_NUM_NUMBER_NONE)
+{
+if (!rMyNFormat.HasListFormat())
+return OUString();
+
+// 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);
+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;
+}
+
 css::lang::Locale aLocale( LanguageTag::convertToLocale(nLang));
 
 if (rMyNFormat.HasListFormat())
@@ -681,9 +696,19 @@ OUString SwNumRule::MakeNumString( const 
SwNumberTree::tNumberVector & rNumVecto
 for (SwNumberTree::tNumberVector::size_type i=0; i <= nLevel; ++i)
 {
 OUString sReplacement;
-if (rMyNFormat.GetNumberingType() == SVX_NUM_NUMBER_NONE)
+const SwNumFormat& rNFormat = Get(i);
+if (rNFormat.GetNumberingType() == SVX_NUM_NUMBER_NONE)
 {
 // 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
+

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2021-12-21 Thread Jim Raykowski (via logerrit)
 sw/qa/uitest/data/tdf134960.odt |binary
 sw/qa/uitest/navigator/tdf134960.py |   43 
 sw/source/uibase/utlui/content.cxx  |4 ++-
 3 files changed, 46 insertions(+), 1 deletion(-)

New commits:
commit 5eecd474971419ebf66d0de687095be09bfc7a58
Author: Jim Raykowski 
AuthorDate: Thu Dec 16 21:30:19 2021 -0900
Commit: Xisco Fauli 
CommitDate: Tue Dec 21 13:44:06 2021 +0100

tdf#134960 List hyperlinks in order of apperance in the document

in Writer Navigator Hyperlinks content type member list

Change-Id: I0473c767478b1125acbb7e1b4bda99ac22934884
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126992
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
Reviewed-by: Jim Raykowski 
(cherry picked from commit 64065ade86cac68b9d500f0495ffc5745a944819)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127180

diff --git a/sw/qa/uitest/data/tdf134960.odt b/sw/qa/uitest/data/tdf134960.odt
new file mode 100644
index ..d75337522abe
Binary files /dev/null and b/sw/qa/uitest/data/tdf134960.odt differ
diff --git a/sw/qa/uitest/navigator/tdf134960.py 
b/sw/qa/uitest/navigator/tdf134960.py
new file mode 100644
index ..7d349fa03ed2
--- /dev/null
+++ b/sw/qa/uitest/navigator/tdf134960.py
@@ -0,0 +1,43 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+
+class tdf134960_hyperlinks(UITestCase):
+
+def test_tdf134960_hyperlinks(self):
+
+with self.ui_test.load_file(get_url_for_data_file("tdf134960.odt")) as 
writer_doc:
+
+xMainWindow = self.xUITest.getTopFocusWindow()
+xWriterEdit = xMainWindow.getChild("writer_edit")
+
+self.xUITest.executeCommand(".uno:Sidebar")
+
+xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": 
"SwNavigatorPanel"}))
+
+# wait until the navigator panel is available
+xNavigatorPanel = 
self.ui_test.wait_until_child_is_available('NavigatorPanel')
+
+xContentTree = xNavigatorPanel.getChild("contenttree")
+xHyperlinks = xContentTree.getChild('7')
+self.assertEqual('Hyperlinks', 
get_state_as_dict(xHyperlinks)['Text'])
+
+xHyperlinks.executeAction("EXPAND", tuple())
+
+expectedHyperlinksOrder = [1, 2, 8, 9, 7, 10, 11, 3, 12, 4, 5, 6]
+for i in range(12):
+self.assertEqual('Hyperlink ' + 
str(expectedHyperlinksOrder[i]), 
get_state_as_dict(xHyperlinks.getChild(str(i)))['Text'])
+
+xHyperlinks.executeAction("COLLAPSE", tuple())
+
+self.xUITest.executeCommand(".uno:Sidebar")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 69443e613a82..88fcf00fad85 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -190,6 +190,8 @@ namespace
 for( SwGetINetAttrs::size_type n = 0; n < nCount; ++n )
 {
 SwGetINetAttr* p = [ n ];
+tools::Long nYPos = 
p->rINetAttr.GetTextNode().FindLayoutRect().Top()
++ p->rINetAttr.GetStart();
 std::unique_ptr pCnt(new SwURLFieldContent(
 pCntType,
 p->sText,
@@ -197,7 +199,7 @@ namespace
 p->rINetAttr.GetINetFormat().GetValue(),
 
INetURLObject::DecodeMechanism::Unambiguous ),
 >rINetAttr,
-n ));
+nYPos));
 pMember->insert( std::move(pCnt) );
 }
 return nCount;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2021-12-20 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter4.cxx   |   75 
 sw/source/core/doc/DocumentRedlineManager.cxx |   16 +++-
 sw/source/core/docnode/ndtbl1.cxx |4 -
 sw/source/core/table/swtable.cxx  |   97 +++---
 4 files changed, 163 insertions(+), 29 deletions(-)

New commits:
commit 02b8bcf06c431ea4694d9fe13d6aa59100c79c05
Author: László Németh 
AuthorDate: Wed Dec 15 12:31:27 2021 +0100
Commit: László Németh 
CommitDate: Tue Dec 21 08:51:53 2021 +0100

tdf#146244 sw: update HasTextChangesOnly in modified rows

It's not forbidden to write in rows deleted or
inserted with change tracking, also Accept/Reject
only part of the text changes here. Improve to
handle these in SwTableLine::UpdateTextChangesOnly()
by keeping property HasTextChangesOnly = false
(tracked row change) only if

1) there is an insert redline, which is the oldest redline in
   the row (tracked row insertion) or

2) there is a delete redline, which is the newest redline in
   the row, and no text outside of redlines, and no insert
   redline in the row, i.e. whole text content is deleted
   (tracked row deletion).

Also update HasTextChangesOnly table row property at accepting
SwRangeRedlines in changed table rows.

And follow-up bug fix commits of this:
commit bc206f7fd3b4a9e843c81f39dcd2faeeff9c785a
"cid#1495785 silence Unchecked return value" and
commit 213173edc5e47bb6da11f9a301f4dca71854a48c
"sw: fix crash with commit 8c028b7e41e3d350d0e67005b16faf0159cc5c12".

(cherry-picked from commit 8c028b7e41e3d350d0e67005b16faf0159cc5c12,
commit bc206f7fd3b4a9e843c81f39dcd2faeeff9c785a and
commit 213173edc5e47bb6da11f9a301f4dca71854a48c)

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

diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx 
b/sw/qa/extras/uiwriter/uiwriter4.cxx
index ddeb659f361d..44d48697799f 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -199,6 +199,7 @@ public:
 void testTdf104425();
 void testTdf104814();
 void testTableRedlineRedoCrash();
+void testTableRemoveHasTextChangesOnly();
 void testTdf66405();
 void testTdf35021_tabOverMarginDemo();
 void testTdf106701_tabOverMarginAutotab();
@@ -321,6 +322,7 @@ public:
 CPPUNIT_TEST(testTdf104425);
 CPPUNIT_TEST(testTdf104814);
 CPPUNIT_TEST(testTableRedlineRedoCrash);
+CPPUNIT_TEST(testTableRemoveHasTextChangesOnly);
 CPPUNIT_TEST(testTdf66405);
 CPPUNIT_TEST(testTdf35021_tabOverMarginDemo);
 CPPUNIT_TEST(testTdf106701_tabOverMarginAutotab);
@@ -1515,6 +1517,79 @@ void SwUiWriterTest4::testTableRedlineRedoCrash()
 rIDRA.AcceptAllRedline(true);
 }
 
+void SwUiWriterTest4::testTableRemoveHasTextChangesOnly()
+{
+//createSwDoc(DATA_DIRECTORY, "tdf91292_paraBackground.docx");
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "TC-table-del-add.docx");
+CPPUNIT_ASSERT(pDoc);
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+
+// disable Record Changes
+dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+CPPUNIT_ASSERT_MESSAGE("redlining should be off",
+   !pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+
+// 4 rows in Show Changes mode
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row", 4);
+
+// Accepting tracked deletions results 3 rows
+IDocumentRedlineAccess& rIDRA(pDoc->getIDocumentRedlineAccess());
+rIDRA.AcceptAllRedline(/*bAccept=*/true);
+Scheduler::ProcessEventsToIdle();
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row", 3);
+
+// Undo: 4 rows again
+pDoc->GetIDocumentUndoRedo().Undo();
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row", 4);
+
+// Accepting again: 3 rows (Undo of HasTextChangesOnly is correct)
+rIDRA.AcceptAllRedline(/*bAccept=*/true);
+Scheduler::ProcessEventsToIdle();
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row", 3);
+
+// Undo: 4 rows again
+pDoc->GetIDocumentUndoRedo().Undo();
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row", 4);
+
+// Move the cursor after the redline, and insert some text without change 
tracking
+pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, 
/*bBasicCall=*/false);
+pWrtShell->Insert("X");
+
+// Accepting again: 4 rows (extra text keeps the deleted row)
+rIDRA.AcceptAllRedline(/*bAccept=*/true);
+

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2021-12-19 Thread Justin Luth (via logerrit)
 sw/qa/extras/uiwriter/uiwriter3.cxx |   19 +++
 sw/source/core/swg/SwXMLTextBlocks1.cxx |   16 +---
 2 files changed, 32 insertions(+), 3 deletions(-)

New commits:
commit 97783676a85ea49aee856b5bd7193a4911856946
Author: Justin Luth 
AuthorDate: Fri Dec 17 18:45:42 2021 +0200
Commit: Noel Grandin 
CommitDate: Mon Dec 20 08:32:24 2021 +0100

tdf#144364 sw: Revert "Use FastParser in SwXMLTextBlocks"

This reverts 7.0 commit fd6feb4f538b0c5c9061529ff002be9f62a7239a.
Noel said this was just a performance fix, so just go ahead
and revert it.

It caused the regression documented in bug 144364.

Change-Id: I044c49e42873db120a94d93a00e9b35105778b9c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127012
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit 1addd8c104f6ad390bdd0ca61cd5ce97b55ce218)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126982
Reviewed-by: Noel Grandin 

diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 43ef4250aaba..978c61255354 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -1905,6 +1905,25 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf116315)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf144364)
+{
+SwDoc* const pDoc = createSwDoc();
+SwWrtShell* const pWrtSh = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtSh);
+
+// expands autotext (via F3)
+pWrtSh->Insert("AR");
+
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_F3);
+Scheduler::ProcessEventsToIdle();
+
+// was ...'letter of '
+CPPUNIT_ASSERT_EQUAL(
+OUString("We hereby acknowledge the receipt of your letter of 
."),
+getParagraph(1)->getString());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf141613)
 {
 SwDoc* const pDoc = createSwDoc();
diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx 
b/sw/source/core/swg/SwXMLTextBlocks1.cxx
index 9f0c6cb545af..36ff82236c9e 100644
--- a/sw/source/core/swg/SwXMLTextBlocks1.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -194,6 +195,9 @@ ErrCode SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx,
 uno::Reference< uno::XComponentContext > xContext =
 comphelper::getProcessComponentContext();
 
+// get parser
+uno::Reference< xml::sax::XParser > xParser = 
xml::sax::Parser::create( xContext );
+
 // create descriptor and reference to it. Either
 // both or neither must be kept because of the
 // reference counting!
@@ -205,15 +209,21 @@ ErrCode SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx,
 OUString sFilterComponent = bOasis
 ? 
OUString("com.sun.star.comp.Writer.XMLOasisAutotextEventsImporter")
 : OUString("com.sun.star.comp.Writer.XMLAutotextEventsImporter");
-uno::Reference< xml::sax::XFastParser > xFilter(
+uno::Reference< xml::sax::XDocumentHandler > xFilter(
 
xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
 sFilterComponent, aFilterArguments, xContext),
-UNO_QUERY_THROW );
+UNO_QUERY );
+OSL_ENSURE( xFilter.is(), "can't instantiate autotext-events filter");
+if ( !xFilter.is() )
+return ERR_SWG_READ_ERROR;
+
+// connect parser and filter
+xParser->setDocumentHandler( xFilter );
 
 // parse the stream
 try
 {
-xFilter->parseStream( aParserInput );
+xParser->parseStream( aParserInput );
 }
 catch( xml::sax::SAXParseException& )
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2021-12-17 Thread Michael Stahl (via logerrit)
 sw/qa/extras/uiwriter/uiwriter2.cxx |   68 
 sw/source/core/txtnode/ndtxt.cxx|   20 +-
 2 files changed, 85 insertions(+), 3 deletions(-)

New commits:
commit e700b5c25f094f11bdb92b3fdb67a27420e805a9
Author: Michael Stahl 
AuthorDate: Fri Dec 17 14:10:50 2021 +0100
Commit: Caolán McNamara 
CommitDate: Fri Dec 17 22:38:20 2021 +0100

tdf#137318 sw_redlinehide: fix JoinNext() if deleted node contains redlines

The GetRedlineMergeFlag() of the deleted node is None also if there are
deletions contained completely inside the node, but in this case the
merged node does need a MergedPara, so check if the deleted node had a
frame that has a MergedPara in addition to the flag (which remains as
an "optimization").

(regression from d258fc29560baa5ecae03ebc2740e11420643e27)

Change-Id: I44456f230374ec1de159106678e80fb4670c9f33
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127011
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 31f51598fd08c2b76583a1baad0c0d6d4b336664)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126978
Reviewed-by: Caolán McNamara 

diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 0086bcd2401e..abb6d02556f8 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -332,6 +332,74 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, 
testRedlineSplitContentNode)
 rUndoManager.Undo();
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137318)
+{
+SwDoc* const pDoc = createSwDoc();
+SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+pWrtShell->Insert("A");
+
+// enable redlining
+dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+// hide
+dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+CPPUNIT_ASSERT_MESSAGE(
+"redlines should be visible",
+
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+CPPUNIT_ASSERT(pWrtShell->GetLayout()->IsHideRedlines());
+
+pWrtShell->DelLine();
+pWrtShell->StartOfSection(false);
+pWrtShell->SplitNode(true);
+pWrtShell->SplitNode(true);
+
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+assertXPath(pXmlDoc, "/root/page[1]/body/txt", 3);
+assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text", 0);
+assertXPath(pXmlDoc, "/root/page[1]/body/txt[2]/Text", 0);
+// not sure why there's an empty text portion here, but it's not a problem
+assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/Text", 1);
+assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/Text[1]", "nType", 
"PortionType::Para");
+assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/Text[1][@Portion]", 0);
+
+pWrtShell->Undo();
+
+// the problem was that here the "A" showed up again
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "/root/page[1]/body/txt", 2);
+assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text", 0);
+assertXPath(pXmlDoc, "/root/page[1]/body/txt[2]/Text", 1);
+assertXPath(pXmlDoc, "/root/page[1]/body/txt[2]/Text[1]", "nType", 
"PortionType::Para");
+assertXPath(pXmlDoc, "/root/page[1]/body/txt[2]/Text[1][@Portion]", 0);
+
+pWrtShell->Undo();
+
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "/root/page[1]/body/txt", 1);
+assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text", 1);
+assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nType", 
"PortionType::Para");
+assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1][@Portion]", 0);
+
+pWrtShell->Undo();
+
+// now the "A" is no longer deleted
+discardDumpedLayout();
+pXmlDoc = parseLayoutDump();
+assertXPath(pXmlDoc, "/root/page[1]/body/txt", 1);
+assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text", 1);
+assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nType", 
"PortionType::Para");
+assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1][@Portion]", 1);
+assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nLength", "1");
+
+assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "Portion", "A");
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf136704)
 {
 SwDoc* const pDoc(createSwDoc());
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 2fefd8b42f50..581c7f344a74 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1016,6 +1016,22 @@ SwContentNode *SwTextNode::JoinNext()
 rDoc.CorrAbs( aIdx, SwPosition( *this ), nOldLen, true );
 }
 SwNode::Merge const eOldMergeFlag(pTextNode->GetRedlineMergeFlag());
+auto 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2021-12-17 Thread Samuel Mehrbrodt (via logerrit)
 sw/qa/python/check_table.py  |6 +++---
 sw/source/core/docnode/ndtbl.cxx |3 ++-
 2 files changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 9237cce9ac9d339f179585f722a8ef0e88be64e3
Author: Samuel Mehrbrodt 
AuthorDate: Thu Dec 16 14:00:05 2021 +0100
Commit: Xisco Fauli 
CommitDate: Fri Dec 17 12:32:43 2021 +0100

tdf#99027 Set default table border width to 0.5pt

Change-Id: Ib6c8a6e63271f400d69702c3c090678d6c016af3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126922
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
(cherry picked from commit c84ec0b1debb9b72f05ffc1d669608afc454cec2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126972
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/python/check_table.py b/sw/qa/python/check_table.py
index b06f3caa4d7d..f845be5649ef 100644
--- a/sw/qa/python/check_table.py
+++ b/sw/qa/python/check_table.py
@@ -35,7 +35,7 @@ class CheckTable(unittest.TestCase):
 def setUpClass(cls):
 cls._uno = UnoInProcess()
 cls._uno.setUp()
-cls.OOLineHairline = 2
+cls.OOLineVeryThin = 18
 
 @classmethod
 def tearDownClass(cls):
@@ -44,13 +44,13 @@ class CheckTable(unittest.TestCase):
 def __test_borderAsserts(self, xBorderLine, line_valid):
 self.assertTrue(line_valid)
 self.assertEqual(0, xBorderLine.InnerLineWidth)
-self.assertEqual(self.OOLineHairline, xBorderLine.OuterLineWidth)
+self.assertEqual(self.OOLineVeryThin, xBorderLine.OuterLineWidth)
 self.assertEqual(0, xBorderLine.LineDistance)
 self.assertEqual(0, xBorderLine.Color)
 
 def __test_borderAssertsWithLineStyle(self, xBorderLine, line_valid):
 self.__test_borderAsserts(xBorderLine, line_valid)
-self.assertEqual(self.OOLineHairline, xBorderLine.LineWidth)
+self.assertEqual(self.OOLineVeryThin, xBorderLine.LineWidth)
 self.assertEqual(SOLID, xBorderLine.LineStyle)
 
 def __test_borderDistance(self, border):
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index ca153b598dde..1b0e09f9b0f2 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -117,7 +117,8 @@ static void lcl_SetDfltBoxAttr( SwFrameFormat& rFormat, 
sal_uInt8 nId )
 
 const bool bHTML = 
rFormat.getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE);
 Color aCol( bHTML ? COL_GRAY : COL_BLACK );
-SvxBorderLine aLine( , SvxBorderLineWidth::Hairline );
+// Default border in Writer: 0.5pt (matching Word)
+SvxBorderLine aLine( , SvxBorderLineWidth::VeryThin );
 if ( bHTML )
 {
 aLine.SetBorderLineStyle(SvxBorderLineStyle::DOUBLE);


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2021-12-14 Thread László Németh (via logerrit)
 sw/qa/uitest/data/TC-table-del-add.docx |binary
 sw/qa/uitest/table/tdf146145.py |  110 
 sw/source/uibase/uiview/view2.cxx   |   55 +++-
 sw/source/uibase/uiview/viewstat.cxx|9 ++
 4 files changed, 171 insertions(+), 3 deletions(-)

New commits:
commit c50dbeaac64a24c9afd9825fc91ace9482802557
Author: László Németh 
AuthorDate: Mon Dec 13 12:09:10 2021 +0100
Commit: László Németh 
CommitDate: Tue Dec 14 16:09:11 2021 +0100

tdf#146145 sw: 1-click Accept/Reject of table row changes

Now context menu of a changed table row shows Accept Change/
Reject Change menu items, which accept or reject
the deletion or insertion of the table row.
Also Accept Change/Reject Change icons of the Track Changes
toolbar are enabled, and do the same, if the cursor is not
before or in a tracked change.

Add the following labels to the Undo actions:

"Accept change: Row Inserted"
"Accept change: Row Deleted"
"Reject change: Row Inserted"
"Reject change: Row Deleted"

Change-Id: I12ae0158d059b044e430cc0ab86f0cf8931eadd0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126770
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 95c003d75e0f8b255344715a35358072b5eba99d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126811
Tested-by: Jenkins

diff --git a/sw/qa/uitest/data/TC-table-del-add.docx 
b/sw/qa/uitest/data/TC-table-del-add.docx
new file mode 100644
index ..841e63f0d12b
Binary files /dev/null and b/sw/qa/uitest/data/TC-table-del-add.docx differ
diff --git a/sw/qa/uitest/table/tdf146145.py b/sw/qa/uitest/table/tdf146145.py
new file mode 100644
index ..a082ea780018
--- /dev/null
+++ b/sw/qa/uitest/table/tdf146145.py
@@ -0,0 +1,110 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+import time
+
+from com.sun.star.accessibility.AccessibleStateType import ENABLED
+
+class tdf146145(UITestCase):
+
+   # access to the private:resource changes toolbar via accessibility API
+   def is_enabled_Accept_Track_Change(self):
+   xFrame = self.document.getCurrentController().getFrame()
+
+   for i in xFrame.getPropertyValue("LayoutManager").getElements():
+   if i.getPropertyValue('ResourceURL') == 
'private:resource/toolbar/changes':
+   return ENABLED in 
i.getRealInterface().getAccessibleContext().getAccessibleChild(5).getAccessibleStateSet().getStates()
+
+   return False
+
+   def test_tdf146145(self):
+with 
self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as 
self.document:
+
+# Check enabling Accept/Reject Track Change icons
+# and Accept Change/Reject Change context menu items
+# on table rows with tracked deletion or insertion
+
+# enable Track Changes toolbar
+
self.xUITest.executeCommand(".uno:AvailableToolbars?Toolbar:string=changes")
+
+xToolkit = 
self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
+xToolkit.processEventsToIdle()
+
+# cursor at changed text: Accept Track Change is enabled
+self.assertTrue(self.is_enabled_Accept_Track_Change())
+
+# cursor in a changed row, but not at changed text: Accept Track 
Change is enabled now
+self.xUITest.executeCommand(".uno:GoRight")
+xToolkit.processEventsToIdle()
+# This was false
+self.assertTrue(self.is_enabled_Accept_Track_Change())
+
+# cursor in a not changed row: Accept Track Change is disabled
+self.xUITest.executeCommand(".uno:GoDown")
+xToolkit.processEventsToIdle()
+while self.is_enabled_Accept_Track_Change():
+time.sleep(0.1)
+self.assertFalse(self.is_enabled_Accept_Track_Change())
+
+# check the fix again to avoid of the asynchron state changes
+self.xUITest.executeCommand(".uno:GoUp")
+xToolkit.processEventsToIdle()
+while not self.is_enabled_Accept_Track_Change():
+time.sleep(0.1)
+self.assertTrue(self.is_enabled_Accept_Track_Change())
+
+# check 1-click accept of table row deletion (3 redlines in the 
row)
+
+# not at changed text, but Accept Track Change removes the whole 
row now
+
+tables = self.document.getTextTables()
+self.assertEqual(len(tables[0].getRows()), 4)
+
+

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2021-12-14 Thread Jim Raykowski (via logerrit)
 sw/qa/uitest/navigator/tdf140661.py |5 -
 sw/source/uibase/utlui/content.cxx  |   18 +++---
 2 files changed, 11 insertions(+), 12 deletions(-)

New commits:
commit 2b035eb5ba1f9600ea19937519cbc9068c31263b
Author: Jim Raykowski 
AuthorDate: Thu Dec 9 20:22:07 2021 -0900
Commit: Xisco Fauli 
CommitDate: Tue Dec 14 11:12:36 2021 +0100

tdf#134960 List drawing objects in order of appearance in document

in Writer Navigator drawing objects content type member list

Current code seems like it should work but GetFrameOfModified doesn't
provide layout position for drawing objects like it does for table and
frame objects. This patch gets position of drawing object in document
directly from SdrObject.

Change-Id: I501757900f265370d8e3b606cb4b3a81464e73f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126627
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
Reviewed-by: Jim Raykowski 
(cherry picked from commit 9e046e43fc6d3fecd193da076c0871a458ba71dd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126808

diff --git a/sw/qa/uitest/navigator/tdf140661.py 
b/sw/qa/uitest/navigator/tdf140661.py
index 75b496b027f9..5c1b6ac50385 100644
--- a/sw/qa/uitest/navigator/tdf140661.py
+++ b/sw/qa/uitest/navigator/tdf140661.py
@@ -32,8 +32,11 @@ class tdf140661(UITestCase):
 self.assertEqual('DrawObject1', 
get_state_as_dict(xDrawings.getChild('0'))['Text'])
 else:
 self.assertEqual(12, len(xDrawings.getChildren()))
+
+# tdf#134960
+expectedShapeOrder = [1, 2, 8, 9, 7, 10, 11, 3, 12, 4, 5, 6]
 for i in range(12):
-self.assertEqual('Shape' + str(i + 1), 
get_state_as_dict(xDrawings.getChild(str(i)))['Text'])
+self.assertEqual('Shape' + str(expectedShapeOrder[i]), 
get_state_as_dict(xDrawings.getChild(str(i)))['Text'])
 
 xDrawings.executeAction("COLLAPSE", tuple())
 
diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 380af4aba7a4..93b2af042fe7 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -1035,18 +1035,14 @@ void SwContentType::FillMemberList(bool* 
pbLevelOrVisibilityChanged)
 // #i51726# - all drawing objects can be named now
 if (!pTemp->GetName().isEmpty())
 {
-SwContact* pContact = 
static_cast(pTemp->GetUserCall());
-tools::Long nYPos = 0;
-const Point aNullPt;
-if(pContact && pContact->GetFormat())
-nYPos = 
pContact->GetFormat()->FindLayoutRect(false, ).Top();
-SwContent* pCnt = new SwContent(
-this,
-pTemp->GetName(),
-nYPos);
-if(!rIDDMA.IsVisibleLayerId(pTemp->GetLayer()))
+tools::Long nYPos = LONG_MIN;
+const bool bIsVisible = 
rIDDMA.IsVisibleLayerId(pTemp->GetLayer());
+if (bIsVisible)
+nYPos = pTemp->GetLogicRect().Top();
+auto pCnt(std::make_unique(this, 
pTemp->GetName(), nYPos));
+if (!bIsVisible)
 pCnt->SetInvisible();
-m_pMember->insert(std::unique_ptr(pCnt));
+m_pMember->insert(std::move(pCnt));
 m_nMemberCount++;
 }
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2021-12-13 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/data/TC-table-del-add.docx |binary
 sw/qa/extras/uiwriter/uiwriter4.cxx  |   19 +
 sw/source/core/doc/docredln.cxx  |   25 ---
 3 files changed, 19 insertions(+), 25 deletions(-)

New commits:
commit daf0526ee637a46eec34cc9d086d5c53a1368d51
Author: László Németh 
AuthorDate: Sat Dec 11 14:24:24 2021 +0100
Commit: László Németh 
CommitDate: Mon Dec 13 21:37:50 2021 +0100

tdf#146208 sw DOCX: fix crash at Redo of tracked table changes

Importing DOCX tables with tracked row deletion and insertion,
accepting them, Undo, and accepting them again (or Redo)
crashed LibreOffice, related to the missing Undo support
of deletions in SwExtraRedlineTable.

SwTableRowRedline is not used for DOCX export since
commit dbc2bdffbec9b3f7eba485652cdd43634458b5a6
"tdf#145091 DOCX: don't export obsolete table row change data",
so it's possible to switch off deletion of row changes
in SwExtraRedlineTable to fix crashing, keeping SwTableRowRedline
only to fix the round-trip of the original row change Date
temporarily.

Change-Id: I6ac571656e45c4299a07a63646bb28d6d1fcd081
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126662
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 6a9cf64ea7509aac258f290cc1f204fd1ce1f974)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126748

diff --git a/sw/qa/extras/uiwriter/data/TC-table-del-add.docx 
b/sw/qa/extras/uiwriter/data/TC-table-del-add.docx
new file mode 100644
index ..841e63f0d12b
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/TC-table-del-add.docx 
differ
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx 
b/sw/qa/extras/uiwriter/uiwriter4.cxx
index 29bb1dd6c02f..ddeb659f361d 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -198,6 +198,7 @@ public:
 void testTdf104440();
 void testTdf104425();
 void testTdf104814();
+void testTableRedlineRedoCrash();
 void testTdf66405();
 void testTdf35021_tabOverMarginDemo();
 void testTdf106701_tabOverMarginAutotab();
@@ -319,6 +320,7 @@ public:
 CPPUNIT_TEST(testTdf104440);
 CPPUNIT_TEST(testTdf104425);
 CPPUNIT_TEST(testTdf104814);
+CPPUNIT_TEST(testTableRedlineRedoCrash);
 CPPUNIT_TEST(testTdf66405);
 CPPUNIT_TEST(testTdf35021_tabOverMarginDemo);
 CPPUNIT_TEST(testTdf106701_tabOverMarginAutotab);
@@ -1496,6 +1498,23 @@ void SwUiWriterTest4::testTdf104814()
 pEditShell->AcceptRedline(0);
 }
 
+// crash at redo of accepting table change tracking imported from DOCX
+void SwUiWriterTest4::testTableRedlineRedoCrash()
+{
+SwDoc* const pDoc(createSwDoc(DATA_DIRECTORY, "TC-table-del-add.docx"));
+sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
+
+// accept all redlines, Undo and accept all redlines again
+
+IDocumentRedlineAccess& rIDRA(pDoc->getIDocumentRedlineAccess());
+rIDRA.AcceptAllRedline(/*bAccept=*/true);
+
+rUndoManager.Undo();
+
+// without the fix, it crashes
+rIDRA.AcceptAllRedline(true);
+}
+
 void SwUiWriterTest4::testTdf66405()
 {
 // Imported formula should have zero margins
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 96f3742ce8f1..0d0b7fa621e2 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -172,31 +172,6 @@ bool SwExtraRedlineTable::DeleteAllTableRedlines( SwDoc& 
rDoc, const SwTable& rT
 }
 }
 }
-else
-{
-const SwTableRowRedline* pTableRowRedline = dynamic_cast(pExtraRedline);
-if (pTableRowRedline)
-{
-const SwTableLine *pRedTabLine = 
>GetTableLine();
-const SwTableBoxes  = pRedTabLine->GetTabBoxes();
-const SwTable& rRedTable = 
rRedTabBoxes[0]->GetSttNd()->FindTableNode()->GetTable();
-if (  ==  )
-{
-// Redline for this table
-const SwRedlineData& aRedlineData = 
pTableRowRedline->GetRedlineData();
-const RedlineType nRedlineType = aRedlineData.GetType();
-
-// Check if this redline object type should be deleted
-if (RedlineType::Any == nRedlineTypeToDelete || 
nRedlineTypeToDelete == nRedlineType)
-
-{
-DeleteAndDestroy( nCurRedlinePos );
-bChg = true;
-continue; // don't increment position after delete
-}
-}
-}
-}
 ++nCurRedlinePos;
 }
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source writerfilter/source

2021-12-11 Thread László Németh (via logerrit)
 sw/qa/extras/layout/layout2.cxx   |2 -
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx|   33 --
 sw/source/core/doc/docredln.cxx   |2 -
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |1 
 4 files changed, 32 insertions(+), 6 deletions(-)

New commits:
commit 9f41f860fc084bbfe7aef0691a061c6b9e99e04b
Author: László Németh 
AuthorDate: Fri Dec 10 10:37:33 2021 +0100
Commit: László Németh 
CommitDate: Sat Dec 11 15:04:27 2021 +0100

tdf#146140 sw DOCX import: fix moveFrom regression with broken text content

(Also a small clean-up: increase the character limit for tracked text
moving detection: Only 2 or more (non-whitespace) character deletions
are checked for it, because single characters are often typos or some
control-like characters, e.g. soft hyphen, not real text movings.)

Details of the regression: commit d32d9a2b3c5e3963f4a18f6c7bbf50fab2e9b2be
"tdf#123460 DOCX track changes: moveFrom completely" fixed
the missing redline import of the end of the moved paragraphs,
but paragraph end was imported as w:del, not w:moveFrom explicitly.
From commit f51fa7534421a195a58b4a737a2e836d8c25ba81
"tdf#145718 sw, DOCX import: complete tracked text moving"
this resulted two deletions (a moved one and a plain one) instead of
the previous single one.

Moreover, exporting these double deletions at the same position to
ODT, raised a back-compatibility issue with broken text content, see
tdf#107292 (solved recently, but not in older LibreOffice versions).

Removing the explicit w:del code path in writerfilter, it solved
the regression from commit f51fa7534421a195a58b4a737a2e836d8c25ba81
"tdf#145718 sw, DOCX import: complete tracked text moving".

See also commit 9e1e88ad5cf2dc0e9b188c60930445652a6c7519
"tdf#145720 DOCX export: fix loss of tracked moving".

Change-Id: I15bfc83b87dd42a762ff84edf5bae765fe02a5ae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126631
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 692bc46b25db61176b4ced7b7beffeca7d55068e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126669
Tested-by: László Németh 

diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index 92910435383e..10d01fa05e33 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -337,7 +337,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineMovingDOCX)
 
 SwEditShell* const pEditShell(pDoc->GetEditShell());
 // This was 2 (moveFrom and moveTo joined other redlines)
-CPPUNIT_ASSERT_EQUAL(static_cast(6), 
pEditShell->GetRedlineCount());
+CPPUNIT_ASSERT_EQUAL(static_cast(5), 
pEditShell->GetRedlineCount());
 
 // Dump the rendering of the first page as an XML file.
 std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile();
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index 6600928f37e9..609d3f7f30b6 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -766,10 +766,37 @@ DECLARE_OOXMLEXPORT_TEST(testTdf123460, "tdf123460.docx")
 CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(2), 2), "RedlineType"));
 
CPPUNIT_ASSERT_EQUAL(OUString("Delete"),getProperty(getRun(getParagraph(2),
 2), "RedlineType"));
 CPPUNIT_ASSERT_EQUAL(true, getRun( getParagraph( 2 ), 3 
)->getString().endsWith("tellus."));
+CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(2), 4), "Bookmark"));
 // deleted paragraph mark at the end of the second paragraph
-CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(2), 5), "RedlineType"));
-
CPPUNIT_ASSERT_EQUAL(OUString("Delete"),getProperty(getRun(getParagraph(2),
 5), "RedlineType"));
-CPPUNIT_ASSERT_EQUAL( OUString( "" ), getRun( getParagraph( 2 ), 6 
)->getString());
+if (mbExported)
+{
+// there is no run after the MoveBookmark
+bool bCaught = false;
+try
+{
+getRun( getParagraph( 2 ), 5 );
+}
+catch (container::NoSuchElementException&)
+{
+bCaught = true;
+}
+CPPUNIT_ASSERT_EQUAL(true, bCaught);
+}
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testTdf146140)
+{
+loadAndSave("tdf123460.docx");
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+CPPUNIT_ASSERT(pXmlDoc);
+
+// This was 1 (put end of paragraph of the previous moveFrom into a w:del,
+// resulting double deletions at the same position, which is an
+// ODT back-compatibility issue described in tdf#107292)
+assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:rPr/w:del", 0);
+// This was 0
+assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:rPr/w:moveFrom", 
1);
 }
 
 //tdf#125298: fix charlimit 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source writerfilter/source

2021-12-11 Thread László Németh (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx|   86 --
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx|   25 +-
 sw/source/filter/ww8/docxattributeoutput.cxx  |   79 
 sw/source/filter/ww8/docxattributeoutput.hxx  |9 +-
 sw/source/filter/ww8/docxexport.cxx   |5 -
 sw/source/filter/ww8/docxexport.hxx   |2 
 sw/source/filter/ww8/rtfexport.cxx|3 
 sw/source/filter/ww8/rtfexport.hxx|3 
 sw/source/filter/ww8/wrtw8nds.cxx |   24 +-
 sw/source/filter/ww8/wrtww8.cxx   |2 
 sw/source/filter/ww8/wrtww8.hxx   |6 -
 writerfilter/source/dmapper/DomainMapper.cxx  |2 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   19 
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |3 
 14 files changed, 199 insertions(+), 69 deletions(-)

New commits:
commit 0ad78d7c1148fd7cde305eb34ab3a921a18632a0
Author: László Németh 
AuthorDate: Thu Dec 2 17:45:46 2021 +0100
Commit: László Németh 
CommitDate: Sat Dec 11 10:47:05 2021 +0100

tdf#145720 DOCX export: fix loss of tracked moving

of documents created in MSO to keep interoperability.

Export moved redlines as moveFrom/moveTo instead of
del/ins elements (also for newly created tracked moving).

Export "MoveBookmark" elements moveFromRangeStart,
moveFromRangeEnd, moveToRangeStart, moveToRangeEnd, which
imported from DOCX documents created in MSO. Without them,
moveFrom/moveTo elements were imported as plain deletion
or insertion in MSO.

Note: MoveBookmark elements were imported and exported as
collapsed plain bookmarks. Now keep their ranges, also store
the information of moveFrom/moveTo for correct export.
In the export filter, mandatory author and date of the tracking
information restored from RedlineData of the first redline
within the MoveBookmark, if it's possible.

Follow-up to commit f51fa7534421a195a58b4a737a2e836d8c25ba81
"tdf#145718 sw, DOCX import: complete tracked text moving".

Change-Id: I54242453a7f7d8f73ea074fc74e8e7bc86d07d01
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126258
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 9e1e88ad5cf2dc0e9b188c60930445652a6c7519,
commit bbb09ebda08fec0702de0fb50dbe630acf73af2f and
commit 3efde47ec9ee091479c04129696f99dc934c3f64)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126290
Tested-by: Jenkins

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 8cb43ffe3e2c..5fae2dab136d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -885,9 +885,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf104797, "tdf104797.docx")
 // check moveFrom and moveTo
 CPPUNIT_ASSERT_EQUAL( OUString( "Will this sentence be duplicated?" ), 
getParagraph( 1 )->getString());
 CPPUNIT_ASSERT_EQUAL( OUString( "" ), getRun( getParagraph( 1 ), 1 
)->getString());
-CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(1), 2), "RedlineType"));
-
CPPUNIT_ASSERT_EQUAL(OUString("Delete"),getProperty(getRun(getParagraph(1),
 2), "RedlineType"));
-CPPUNIT_ASSERT_EQUAL(true,getProperty(getRun(getParagraph(1), 2), 
"IsStart"));
+CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(1), 3), "RedlineType"));
+
CPPUNIT_ASSERT_EQUAL(OUString("Delete"),getProperty(getRun(getParagraph(1),
 3), "RedlineType"));
+CPPUNIT_ASSERT_EQUAL(true,getProperty(getRun(getParagraph(1), 3), 
"IsStart"));
 CPPUNIT_ASSERT_EQUAL( OUString( "This is a filler sentence. Will this 
sentence be duplicated ADDED STUFF?" ),
 getParagraph( 2 )->getString());
 CPPUNIT_ASSERT_EQUAL( OUString( "" ), getRun( getParagraph( 2 ), 1 
)->getString());
@@ -897,23 +897,39 @@ DECLARE_OOXMLEXPORT_TEST(testTdf104797, "tdf104797.docx")
 
CPPUNIT_ASSERT_EQUAL(OUString("Insert"),getProperty(getRun(getParagraph(2),
 3), "RedlineType"));
 CPPUNIT_ASSERT_EQUAL(true,getProperty(getRun(getParagraph(2), 3), 
"IsStart"));
 
+CPPUNIT_ASSERT_EQUAL( OUString( " " ), getRun( getParagraph( 2 ), 4 
)->getString());
+CPPUNIT_ASSERT_EQUAL( OUString( "" ), getRun( getParagraph( 2 ), 5 
)->getString());
+CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(2), 6), "RedlineType"));
+
CPPUNIT_ASSERT_EQUAL(OUString("Insert"),getProperty(getRun(getParagraph(2),
 6), "RedlineType"));
+CPPUNIT_ASSERT_EQUAL( OUString( "" ), getRun( getParagraph( 2 ), 7 
)->getString());
+CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(2), 7), "RedlineType"));
+CPPUNIT_ASSERT_EQUAL(true,getProperty(getRun(getParagraph(2), 7), 
"IsStart"));
+CPPUNIT_ASSERT_EQUAL( OUString( "Will this sentence be duplicated" ), 
getRun( getParagraph( 2 ), 8 )->getString());
+CPPUNIT_ASSERT_EQUAL( OUString( " 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2021-12-08 Thread László Németh (via logerrit)
 sw/qa/extras/odfexport/data/tdf107292.odt   |binary
 sw/qa/extras/odfexport/odfexport.cxx|   11 +++
 sw/source/filter/xml/XMLRedlineImportHelper.cxx |   21 +
 3 files changed, 32 insertions(+)

New commits:
commit 19d3ecf9334f9750c06feb7207ecc3c6b98ba086
Author: László Németh 
AuthorDate: Wed Dec 8 10:11:06 2021 +0100
Commit: László Németh 
CommitDate: Wed Dec 8 14:11:07 2021 +0100

tdf#107292: ODT import: fix order of deletions at same position

Tracked deletions at the same position were loaded in reverse
order, resulting broken text content.

Note: FODT format is not applicable for the unit test document,
because it's not affected by the problem.

Change-Id: Id13f8d23ae5964cbf82095a3d1ce2f6c9fdd59e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126529
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 76784f2dbf6d8641cfb6bf5d24e37521d6c806df)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126509

diff --git a/sw/qa/extras/odfexport/data/tdf107292.odt 
b/sw/qa/extras/odfexport/data/tdf107292.odt
new file mode 100644
index ..f35da387f964
Binary files /dev/null and b/sw/qa/extras/odfexport/data/tdf107292.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx 
b/sw/qa/extras/odfexport/odfexport.cxx
index 0d5b2eed0ec8..f06778fc25b4 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -557,6 +557,17 @@ DECLARE_ODFEXPORT_TEST(testredlineTextFrame, 
"redlineTextFrame.odt")
 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
 }
 
+DECLARE_ODFEXPORT_TEST(testTdf107292, "tdf107292.odt")
+{
+// tracked deletions at the same position were loaded in reverse order
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+// Without this fix in place, this test would have failed with
+// - Expected: Lorem ipsum dolor sit...
+// - Actual  :  dolor ipsumLorem sit...
+CPPUNIT_ASSERT_EQUAL(OUString("Lorem ipsum dolor sit..."), 
getParagraph(1)->getString());
+}
+
 DECLARE_ODFEXPORT_TEST(testTdf140437, "tdf140437.odt")
 {
 // Without the fix in place, the document would have failed to load
diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx 
b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
index 5e289bb7648f..2edaf23cf847 100644
--- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx
+++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
@@ -653,6 +653,22 @@ void 
XMLRedlineImportHelper::InsertIntoDocument(RedlineInfo* pRedlineInfo)
 new SwRangeRedline( pRedlineData, *aPaM.GetPoint(),
!pRedlineInfo->bMergeLastParagraph );
 
+// tdf#107292 fix order of delete redlines at the same position by 
removing
+// the already inserted redlines temporarily and inserting them back 
in reverse
+// order after inserting pRedline
+std::vector aSwapRedlines;
+if ( RedlineType::Delete == pRedlineInfo->eType )
+{
+SwRedlineTable::size_type n = 0;
+while ( const SwRangeRedline* pRedline2 =
+pDoc->getIDocumentRedlineAccess().GetRedline( 
*pRedline->Start(),  ) )
+{
+SwRedlineTable& aRedlineTable = 
pDoc->getIDocumentRedlineAccess().GetRedlineTable();
+aSwapRedlines.push_back(pRedline2);
+aRedlineTable.Remove(n);
+}
+}
+
 // set mark
 if( aPaM.HasMark() )
 {
@@ -674,6 +690,11 @@ void 
XMLRedlineImportHelper::InsertIntoDocument(RedlineInfo* pRedlineInfo)
 // set redline mode (without doing the associated book-keeping)
 
pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern(RedlineFlags::On);
 pDoc->getIDocumentRedlineAccess().AppendRedline(pRedline, false);
+
+// restore the correct order of the delete redlines at the same 
position
+for (auto i = aSwapRedlines.rbegin(); i != aSwapRedlines.rend(); ++i)
+
pDoc->getIDocumentRedlineAccess().AppendRedline(const_cast(*i),
 false);
+
 
pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern(RedlineFlags::NONE);
 }
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2021-12-03 Thread Michael Stahl (via logerrit)
 sw/qa/extras/uiwriter/data/tdf136452.fodt |   80 ++
 sw/qa/extras/uiwriter/uiwriter2.cxx   |   46 +
 sw/source/core/layout/frmtool.cxx |5 +
 3 files changed, 130 insertions(+), 1 deletion(-)

New commits:
commit 24d2a5198efd994a7e53d1cd0d9740dab0ea5fb0
Author: Michael Stahl 
AuthorDate: Thu Dec 2 14:17:14 2021 +0100
Commit: Michael Stahl 
CommitDate: Fri Dec 3 20:06:59 2021 +0100

tdf#136452 sw_redlinehide: fix crash in undo of delete across sections

The problem is that on the first SwUndoDelete, the m_nSectDiff branch
MoveNodes() creates a top-level SwTextFrame for the node "Korean", then
the m_nReplaceDummy branch does another MoveNodes() to move the same
node into the section, but its frame remains outside the section.

Generalize fix 55576842ec72a748d0bad123d41fa03c89fc136d for tdf#131684
to check the last SwTextNode inside the section if it has a frame
outside the SwSectionFrame.

(regression from 6c7245e789f973cf6dad03f7008ab3f9d12d350c)

Change-Id: I30495d8f3d8fc0d70cb20df44409174edc2d4a4f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126257
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 2b256c84aa4c063c8161b32a7b424daa28b5741b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126246

diff --git a/sw/qa/extras/uiwriter/data/tdf136452.fodt 
b/sw/qa/extras/uiwriter/data/tdf136452.fodt
new file mode 100644
index ..74c3102aa781
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf136452.fodt
@@ -0,0 +1,80 @@
+
+
+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:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 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:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing: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:ooo="http://openoffice.org/2004/office; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d: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:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="ur
 n:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:xforms="http://www.w3.org/2002/xforms; office:version="1.3" 
office:mimetype="application/vnd.oasis.opendocument.text">
+ 
+  
+  
+  
+ 
+ 
+  
+   
+   
+
+   
+   
+  
+  
+   
+   
+  
+  
+   
+  
+  
+   
+  
+  
+ 
+ 
+  
+   
+
+
+   
+  
+  
+   
+
+
+   
+  
+  
+   
+
+
+   
+  
+  
+   
+
+   
+   
+   
+  
+  
+   
+  
+ 
+ 
+  
+ 
+ 
+  
+   A
+   
+B
+C
+   
+   D
+   
+E
+F
+   
+   G
+   
+H
+   
+  
+ 
+
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 9797de01576f..0086bcd2401e 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -571,6 +571,52 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf134252)
 CPPUNIT_ASSERT_EQUAL(OUString(""), xCursor->getString());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf136452)
+{
+SwDoc* const pDoc(createSwDoc(DATA_DIRECTORY, "tdf136452.fodt"));
+
+SwNodeOffset const nNodes(pDoc->GetNodes().Count());
+
+SwWrtShell* const pWrtShell(pDoc->GetDocShell()->GetWrtShell());
+
+// first deletion spanning 2 sections
+pWrtShell->SttEndDoc(false);
+pWrtShell->SetMark();
+pWrtShell->Up(true, 2);
+pWrtShell->Delete();
+
+// 2 paragraphs deleted, last section is gone
+

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source writerfilter/source

2021-12-03 Thread Vasily Melenchuk (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf137466.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx   |   15 
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx|2 
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx|4 -
 sw/qa/extras/ooxmlexport/ooxmlw14export.cxx  |2 
 sw/source/filter/ww8/docxattributeoutput.cxx |   89 ---
 sw/source/filter/ww8/docxattributeoutput.hxx |6 +
 sw/source/filter/ww8/docxexport.cxx  |3 
 writerfilter/source/dmapper/DomainMapper.cxx |   20 +-
 writerfilter/source/ooxml/model.xml  |   29 +++-
 10 files changed, 152 insertions(+), 18 deletions(-)

New commits:
commit 1733ed0935125814c963e37383f51daec8031e59
Author: Vasily Melenchuk 
AuthorDate: Tue Nov 16 11:50:03 2021 +0300
Commit: Xisco Fauli 
CommitDate: Fri Dec 3 10:02:09 2021 +0100

tdf#137466: docx: support w:placeholder & w15:color in w:sdtPr

Content controls in Word can contain some other elements which
are not supported by Writer. Put them into grabbag and write
back to DOCX on save to avoid losing quite sensitive data.

Test testSimpleSdts is modified: testcase is actully containing
4 sdt elements with ids in input and output.

Change-Id: I1f9addd03ed828bf375ccac5188a004f011e8a0d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125271
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
Reviewed-by: Vasily Melenchuk 
(cherry picked from commit 7db38a496a5e458ec12888ddbf63c603706ae3fc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126000
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf137466.docx 
b/sw/qa/extras/ooxmlexport/data/tdf137466.docx
new file mode 100644
index ..3c5977251bda
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf137466.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index c711a6b2a10b..a7762a057e32 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -64,6 +64,21 @@ CPPUNIT_TEST_FIXTURE(Test, testParaStyleNumLevel)
 assertXPath(pXmlDoc, 
"/w:styles/w:style[@w:styleId='Mystyle']/w:pPr/w:numPr/w:ilvl", "val", "1");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf137466, "tdf137466.docx")
+{
+xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+if (!pXmlDoc)
+   return; // initial import, no futher checks
+
+// Ensure that we have 
+OUString sDocPart = getXPath(pXmlDoc, 
"/w:document/w:body/w:sdt/w:sdtPr/w:placeholder/w:docPart", "val");
+CPPUNIT_ASSERT_EQUAL(OUString("DefaultPlaceholder_-1854013440"), sDocPart);
+
+// Ensure that we have 
+OUString sColor = getXPath(pXmlDoc, 
"/w:document/w:body/w:sdt/w:sdtPr/w15:color", "val");
+CPPUNIT_ASSERT_EQUAL(OUString("FF"), sColor);
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testDontAddNewStyles)
 {
 // Given a document that lacks builtin styles, and addition of them is 
disabled:
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index 5858eec46524..cfb779d13c84 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -1021,7 +1021,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSimpleSdts)
 xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
 
 assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:text", 1);
-assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:id", 3);
+assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:id", 4);
 assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:picture", 1);
 assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:group", 1);
 assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:citation", 1);
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 081ac3252d31..6b6c5c497b65 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -579,10 +579,10 @@ CPPUNIT_TEST_FIXTURE(Test, testFDO79062)
 {
 loadAndSave("fdo79062.docx");
 xmlDocUniquePtr pXmlFootNotes = parseExport("word/footnotes.xml");
-assertXPath(pXmlFootNotes, "/w:footnotes", "Ignorable", "w14 wp14");
+assertXPath(pXmlFootNotes, "/w:footnotes", "Ignorable", "w14 wp14 w15");
 
 xmlDocUniquePtr pXmlEndNotes = parseExport("word/endnotes.xml");
-assertXPath(pXmlEndNotes, "/w:endnotes", "Ignorable", "w14 wp14");
+assertXPath(pXmlEndNotes, "/w:endnotes", "Ignorable", "w14 wp14 w15");
 
 //tdf#93121 don't add fake tabs in front of extra footnote paragraphs
 uno::Reference xFootnoteSupp(mxComponent, 
uno::UNO_QUERY);
diff --git a/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx
index 157939060024..9e3184b566fe 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx
+++