diff options
-rw-r--r-- | sw/qa/core/layout/flycnt.cxx | 13 | ||||
-rw-r--r-- | sw/source/core/layout/tabfrm.cxx | 16 |
2 files changed, 29 insertions, 0 deletions
diff --git a/sw/qa/core/layout/flycnt.cxx b/sw/qa/core/layout/flycnt.cxx index 079030d80054..5df8d7fc5c73 100644 --- a/sw/qa/core/layout/flycnt.cxx +++ b/sw/qa/core/layout/flycnt.cxx @@ -510,6 +510,19 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitFlyCompat14) // Without the accompanying fix in place, this test would have failed, the first row was split, // but not in Word. CPPUNIT_ASSERT(!pCell1->GetFollowCell()); + // Also make sure that the second row is entirely on page 2: + auto pPage2 = dynamic_cast<SwPageFrame*>(pPage1->GetNext()); + CPPUNIT_ASSERT(pPage2); + const SwSortedObjs& rPage2Objs = *pPage2->GetSortedObjs(); + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage2Objs.size()); + auto pPage2Fly = dynamic_cast<SwFlyAtContentFrame*>(rPage2Objs[0]); + CPPUNIT_ASSERT(pPage2Fly); + SwFrame* pTab2 = pPage2Fly->GetLower(); + SwFrame* pRow2 = pTab2->GetLower(); + auto pCell2 = dynamic_cast<SwCellFrame*>(pRow2->GetLower()); + // Without the accompanying fix in place, this test would have failed, the second row was split, + // but not in Word. + CPPUNIT_ASSERT(!pCell2->GetPreviousCell()); } } diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 8bba0deab8e1..71d736499d8e 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -1087,6 +1087,22 @@ bool SwTabFrame::Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowK bTryToSplit = false; } + SwFlyFrame* pFly = FindFlyFrame(); + if (bSplitRowAllowed && pFly && pFly->IsFlySplitAllowed()) + { + // The remaining size is less than the minimum row height, then don't even try to split the + // row, just move it forward. + const SwFormatFrameSize& rRowSize = pRow->GetFormat()->GetFrameSize(); + if (rRowSize.GetHeightSizeType() == SwFrameSize::Minimum) + { + SwTwips nMinHeight = rRowSize.GetHeight(); + if (nMinHeight > nRemainingSpaceForLastRow) + { + bSplitRowAllowed = false; + } + } + } + // #i29771# // To avoid loops, we do some checks before actually trying to split // the row. Maybe we should keep the next row in this table. |