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

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


 sw/qa/extras/uiwriter/uiwriter.cxx              |   22 ++++++++++++++++++++++
 sw/source/core/doc/DocumentStylePoolManager.cxx |    5 +++++
 2 files changed, 27 insertions(+)

New commits:
commit 0bd1b767e906c74ba7957ec40cf299daa596c0d1
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Thu Jan 30 11:26:58 2020 +0100
Commit:     Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Thu Jun 11 17:06:57 2020 +0200

    tdf#130287 disable orphan/widow control in Table Contents
    
    paragraph style to avoid missing text lines later
    in vertically merged table cells at page break.
    
    From commit 49f453755b72654ba454acc321210e8b040df714
    ("tdf#89714 - enable Widow/Orphan in default style"),
    Table Contents got unnecessary orphan/window
    control. Unfortunately, recent table layout code
    cannot ignore these settings completely, causing known
    problems, see for example tdf#128959 (FILEOPEN DOCX
    Table row content disappears when broken between pages).
    
    Change-Id: Idd570f17b0a11af85072a65f3422535b993db306
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87730
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>
    Tested-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit c81d766dd4ff7d8b580b7fdc79db6e68c5f14204)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96108
    Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
    Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index eacde2daf67d..19ab8f78792b 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -244,6 +244,7 @@ public:
     void testTdf75137();
     void testTdf83798();
     void testTdf89714();
+    void testTdf130287();
     void testPropertyDefaults();
     void testTableBackgroundColor();
     void testTdf88899();
@@ -451,6 +452,7 @@ public:
     CPPUNIT_TEST(testTdf75137);
     CPPUNIT_TEST(testTdf83798);
     CPPUNIT_TEST(testTdf89714);
+    CPPUNIT_TEST(testTdf130287);
     CPPUNIT_TEST(testPropertyDefaults);
     CPPUNIT_TEST(testTableBackgroundColor);
     CPPUNIT_TEST(testTdf88899);
@@ -3613,6 +3615,26 @@ void SwUiWriterTest::testTdf89714()
     CPPUNIT_ASSERT_EQUAL( uno::makeAny(sal_Int8(2)), xPropState->getPropertyDefault("ParaWidows")  );
 }
 
+void SwUiWriterTest::testTdf130287()
+{
+    //create a new writer document
+    SwDoc* pDoc = createDoc();
+    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    //insert a 1-cell table in the newly created document
+    SwInsertTableOptions TableOpt(SwInsertTableFlags::DefaultBorder, 0);
+    pWrtShell->InsertTable(TableOpt, 1, 1);
+    //checking for the row and column
+    uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRows()->getCount());
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getColumns()->getCount());
+    uno::Reference<table::XCell> xCell = xTable->getCellByName("A1");
+    uno::Reference<text::XText> xCellText(xCell, uno::UNO_QUERY);
+    uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, xCellText);
+    // they were 2 (orphan/widow control enabled unnecessarily in Table Contents paragraph style)
+    CPPUNIT_ASSERT_EQUAL( sal_Int8(0), getProperty<sal_Int8>(xParagraph, "ParaOrphans"));
+    CPPUNIT_ASSERT_EQUAL( sal_Int8(0), getProperty<sal_Int8>(xParagraph, "ParaWidows"));
+}
+
 void SwUiWriterTest::testPropertyDefaults()
 {
     createDoc();
diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx
index 767af3a22010..b1fb4debf892 100644
--- a/sw/source/core/doc/DocumentStylePoolManager.cxx
+++ b/sw/source/core/doc/DocumentStylePoolManager.cxx
@@ -798,6 +798,11 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId,
                 SwFormatLineNumber aLN;
                 aLN.SetCountLines( false );
                 aSet.Put( aLN );
+                if (nId == RES_POOLCOLL_TABLE)
+                {
+                    aSet.Put( SvxWidowsItem( 0, RES_PARATR_WIDOWS ) );
+                    aSet.Put( SvxOrphansItem( 0, RES_PARATR_ORPHANS ) );
+                }
             }
             break;
 


More information about the Libreoffice-commits mailing list