diff options
-rw-r--r-- | sw/qa/extras/uiwriter/data/tdf88453.odt | bin | 0 -> 21235 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/layout/tabfrm.cxx | 23 |
3 files changed, 35 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data/tdf88453.odt b/sw/qa/extras/uiwriter/data/tdf88453.odt Binary files differnew file mode 100644 index 000000000000..de8491bbb4f9 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf88453.odt diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 068322859076..ef694d9ddfd0 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -187,6 +187,7 @@ public: void testTdf96536(); void testTdf96479(); void testTdf96961(); + void testTdf88453(); void testClassificationPaste(); CPPUNIT_TEST_SUITE(SwUiWriterTest); @@ -278,6 +279,7 @@ public: CPPUNIT_TEST(testTdf96536); CPPUNIT_TEST(testTdf96479); CPPUNIT_TEST(testTdf96961); + CPPUNIT_TEST(testTdf88453); CPPUNIT_TEST(testClassificationPaste); CPPUNIT_TEST_SUITE_END(); @@ -3248,6 +3250,16 @@ void SwUiWriterTest::testTdf96961() CPPUNIT_ASSERT(nLast > nOther); } +void SwUiWriterTest::testTdf88453() +{ + createDoc("tdf88453.odt"); + calcLayout(); + xmlDocPtr pXmlDoc = parseLayoutDump(); + // This was 0: the table does not fit the first page, but it wasn't split + // to continue on the second page. + assertXPath(pXmlDoc, "/root/page[2]/body/tab", 1); +} + namespace { diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index de4f7496e9e6..2f16c985ccd1 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -331,6 +331,7 @@ static void lcl_ShrinkCellsAndAllContent( SwRowFrame& rRow ) SwCellFrame* pCurrMasterCell = static_cast<SwCellFrame*>(rRow.Lower()); SWRECTFN( pCurrMasterCell ) + bool bAllCellsCollapsed = true; while ( pCurrMasterCell ) { // NEW TABLES @@ -347,6 +348,7 @@ static void lcl_ShrinkCellsAndAllContent( SwRowFrame& rRow ) // we have to start with the last lower frame, otherwise // the shrink will not shrink the current cell SwFrame* pTmp = rToAdjust.GetLastLower(); + bool bAllLowersCollapsed = true; if ( pTmp && pTmp->IsRowFrame() ) { @@ -373,6 +375,9 @@ static void lcl_ShrinkCellsAndAllContent( SwRowFrame& rRow ) pTmp->Shrink( (pTmp->Frame().*fnRect->fnGetHeight)() ); (pTmp->Prt().*fnRect->fnSetTop)( 0 ); (pTmp->Prt().*fnRect->fnSetHeight)( 0 ); + + if ((pTmp->Frame().*fnRect->fnGetHeight)() > 0) + bAllLowersCollapsed = false; } pTmp = pTmp->GetPrev(); @@ -384,8 +389,26 @@ static void lcl_ShrinkCellsAndAllContent( SwRowFrame& rRow ) false ); } + if (bAllLowersCollapsed) + { + // All lower frame of this cell have 0 height -> set height of the cell itself as well. + (pCurrMasterCell->Frame().*fnRect->fnSetHeight)(0); + (pCurrMasterCell->Prt().*fnRect->fnSetTop)(0); + (pCurrMasterCell->Prt().*fnRect->fnSetHeight)(0); + } + else + bAllCellsCollapsed = false; + pCurrMasterCell = static_cast<SwCellFrame*>(pCurrMasterCell->GetNext()); } + + if (bAllCellsCollapsed) + { + // All cells have 0 height -> set height of row as well. + (rRow.Frame().*fnRect->fnSetHeight)(0); + (rRow.Prt().*fnRect->fnSetTop)(0); + (rRow.Prt().*fnRect->fnSetHeight)(0); + } } // Local helper function to move the content from rSourceLine to rDestLine |