summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2020-01-30 11:26:58 +0100
committerLászló Németh <nemeth@numbertext.org>2020-01-31 07:46:19 +0100
commitc81d766dd4ff7d8b580b7fdc79db6e68c5f14204 (patch)
treea0fb991e4b180a9ec489595186ea265c7c34f180
parente8ac78d3afdeb0302eaea34a50f1ca912d5fe897 (diff)
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@numbertext.org> Tested-by: László Németh <nemeth@numbertext.org>
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx22
-rw-r--r--sw/source/core/doc/DocumentStylePoolManager.cxx5
2 files changed, 27 insertions, 0 deletions
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;