From 91a176b864ac0492f5c0d2386292118dd3095df4 Mon Sep 17 00:00:00 2001 From: Dimitri Bouron Date: Thu, 22 Dec 2016 11:19:05 +0100 Subject: tdf#104492: Fix bad docx opening and bad layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The problem seems to be the table's repeated rows value which is setted to max table rows in some docx file. Decreasing repeated rows value by one avoids loops but renders a bad layout. Table continuity is lost and lots of rows are hidden. So I set repeated rows value directly to one in order to avoid bad layout. Change-Id: If4adc33febe088a866b704e87e49339710e5aaf5 Reviewed-on: https://gerrit.libreoffice.org/32349 Tested-by: Jenkins Reviewed-by: Björn Michaelsen --- sw/qa/extras/uiwriter/data/tdf104492.docx | Bin 0 -> 61554 bytes sw/qa/extras/uiwriter/uiwriter.cxx | 9 +++++++++ sw/source/core/layout/tabfrm.cxx | 2 ++ 3 files changed, 11 insertions(+) create mode 100644 sw/qa/extras/uiwriter/data/tdf104492.docx (limited to 'sw') diff --git a/sw/qa/extras/uiwriter/data/tdf104492.docx b/sw/qa/extras/uiwriter/data/tdf104492.docx new file mode 100644 index 000000000000..a5a7af367854 Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf104492.docx differ diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 5ac5648a6a9d..229cc3e78d8c 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -221,6 +221,7 @@ public: void testTdf104425(); void testTdf104814(); void testTdf66405(); + void testTdf104492(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); @@ -338,6 +339,7 @@ public: CPPUNIT_TEST(testTdf104425); CPPUNIT_TEST(testTdf104814); CPPUNIT_TEST(testTdf66405); + CPPUNIT_TEST(testTdf104492); CPPUNIT_TEST_SUITE_END(); private: @@ -4201,6 +4203,13 @@ void SwUiWriterTest::testTdf66405() CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nTopMargin); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nBottomMargin); } +void SwUiWriterTest::testTdf104492() +{ + createDoc("tdf104492.docx"); + xmlDocPtr pXmlDoc = parseLayoutDump(); + // The document should split table over 3 pages. + assertXPath(pXmlDoc, "//page", 3); +} CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index d353645f8f00..4583a5db0219 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -2540,6 +2540,8 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) lcl_RecalcTable( *this, nullptr, aNotify ); m_bLowersFormatted = true; m_bCalcLowers = false; + if (!mbValidPrtArea) + m_pTable->SetRowsToRepeat(1); } #if OSL_DEBUG_LEVEL > 0 else -- cgit