[Libreoffice-commits] core.git: sw/qa sw/source

László Németh (via logerrit) logerrit at kemper.freedesktop.org
Fri Jan 31 06:46:55 UTC 2020


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

New commits:
commit c81d766dd4ff7d8b580b7fdc79db6e68c5f14204
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Thu Jan 30 11:26:58 2020 +0100
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Fri Jan 31 07:46:19 2020 +0100

    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>

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index c5201ff2b017..8ef96faa47dc 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -243,6 +243,7 @@ public:
     void testTdf75137();
     void testTdf83798();
     void testTdf89714();
+    void testTdf130287();
     void testPropertyDefaults();
     void testTableBackgroundColor();
     void testTdf88899();
@@ -450,6 +451,7 @@ public:
     CPPUNIT_TEST(testTdf75137);
     CPPUNIT_TEST(testTdf83798);
     CPPUNIT_TEST(testTdf89714);
+    CPPUNIT_TEST(testTdf130287);
     CPPUNIT_TEST(testPropertyDefaults);
     CPPUNIT_TEST(testTableBackgroundColor);
     CPPUNIT_TEST(testTdf88899);
@@ -3643,6 +3645,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 fb3d2a15c752..60d38a272a55 100644
--- a/sw/source/core/doc/DocumentStylePoolManager.cxx
+++ b/sw/source/core/doc/DocumentStylePoolManager.cxx
@@ -799,6 +799,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