[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - sw/qa writerfilter/source

László Németh (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 11 14:29:07 UTC 2020


 sw/qa/extras/layout/data/tdf128959.docx           |binary
 sw/qa/extras/layout/layout.cxx                    |   21 +++++++++++++++++++++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   10 ++++++++--
 3 files changed, 29 insertions(+), 2 deletions(-)

New commits:
commit feb2aed404d102475a9d46ff9588bde7fcbabf4b
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Tue Jan 28 14:32:54 2020 +0100
Commit:     Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Thu Jun 11 16:28:35 2020 +0200

    tdf#128959 DOCX import: fix missing text lines in tables
    
    Orphan/widow line break settings aren't always ignored
    by Writer table layout code, in this case, in vertically
    merged cells, resulting missing paragraph lines.
    
    As a workaround for interoperability, disable orphan/widow
    control in cell paragraphs during the DOCX import to get
    correct layout in Writer, too.
    
    Change-Id: I48fdb0a3bb421fd4df2c729e307a7ef483e3e772
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87637
    Reviewed-by: László Németh <nemeth at numbertext.org>
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96107
    Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
    Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>

diff --git a/sw/qa/extras/layout/data/tdf128959.docx b/sw/qa/extras/layout/data/tdf128959.docx
new file mode 100644
index 000000000000..f22f66504478
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf128959.docx differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index e33eaf66e108..790d3485a337 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -3749,6 +3749,27 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf117982)
     //the source document.
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf128959)
+{
+    // no orphan/widow control in table cells
+    SwDoc* pDocument = createDoc("tdf128959.docx");
+    CPPUNIT_ASSERT(pDocument);
+    discardDumpedLayout();
+    xmlDocPtr pXmlDoc = parseLayoutDump();
+
+    // first two lines of the paragraph in the split table cell on the first page
+    // (these lines were completely lost)
+    assertXPath(
+        pXmlDoc, "/root/page[1]/body/tab[1]/row[1]/cell[1]/txt[1]/LineBreak[1]", "Line",
+        "a)Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue ");
+    assertXPath(
+        pXmlDoc, "/root/page[1]/body/tab[1]/row[1]/cell[1]/txt[1]/LineBreak[2]", "Line",
+        "massa. Fusce posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit ");
+    // last line of the paragraph in the split table cell on the second page
+    assertXPath(pXmlDoc, "/root/page[2]/body/tab[1]/row[1]/cell[1]/txt[1]/LineBreak[1]", "Line",
+                "amet commodo magna eros quis urna.");
+}
+
 static SwRect lcl_getVisibleFlyObjRect(SwWrtShell* pWrtShell)
 {
     SwRootFrame* pRoot = pWrtShell->GetLayout();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 666bd9b46ffb..87322694cbd4 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1786,17 +1786,23 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
                     }
                 }
 
-                // tdf#90069 in tables, apply paragraph level character style also on
-                // paragraph level to support its copy during insertion of new table rows
+                // fix table paragraph properties
                 if ( xParaProps && m_nTableDepth > 0 )
                 {
                     uno::Sequence< beans::PropertyValue > aValues = pParaContext->GetPropertyValues(false);
 
+                    // tdf#90069 in tables, apply paragraph level character style also on
+                    // paragraph level to support its copy during insertion of new table rows
                     for( const auto& rProp : std::as_const(aValues) )
                     {
                         if ( rProp.Name.startsWith("Char") && rProp.Name != "CharStyleName" && rProp.Name != "CharInteropGrabBag" )
                             xParaProps->setPropertyValue( rProp.Name, rProp.Value );
                     }
+
+                    // tdf#128959 table paragraphs haven't got window and orphan controls
+                    uno::Any aAny = uno::makeAny(static_cast<sal_Int8>(0));
+                    xParaProps->setPropertyValue("ParaOrphans", aAny);
+                    xParaProps->setPropertyValue("ParaWidows", aAny);
                 }
             }
             if( !bKeepLastParagraphProperties )


More information about the Libreoffice-commits mailing list