Kaydet (Commit) 18765b9f authored tarafından Manfred Blume's avatar Manfred Blume Kaydeden (comit) Thorsten Behrens

tdf#114306 fix unexpected page break in row-spanned table

If a para gets moved off to another page, it never gets
moved back. Make IsMoveable() more symmetric, add condition
to MoveBwd to also claim table content back.

Change-Id: I5366eb824f0ef7016599c777786cbdf42f65b9b5
Reviewed-on: https://gerrit.libreoffice.org/46021Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
Tested-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst baaf6c12
...@@ -289,6 +289,7 @@ public: ...@@ -289,6 +289,7 @@ public:
void testTdf99689TableOfTables(); void testTdf99689TableOfTables();
void testTdf113790(); void testTdf113790();
void testTdf108048(); void testTdf108048();
void testTdf114306();
CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST_SUITE(SwUiWriterTest);
CPPUNIT_TEST(testReplaceForward); CPPUNIT_TEST(testReplaceForward);
...@@ -458,6 +459,7 @@ public: ...@@ -458,6 +459,7 @@ public:
CPPUNIT_TEST(testTdf99689TableOfTables); CPPUNIT_TEST(testTdf99689TableOfTables);
CPPUNIT_TEST(testTdf113790); CPPUNIT_TEST(testTdf113790);
CPPUNIT_TEST(testTdf108048); CPPUNIT_TEST(testTdf108048);
CPPUNIT_TEST(testTdf114306);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
private: private:
...@@ -5243,6 +5245,19 @@ void SwUiWriterTest::testTdf112025() ...@@ -5243,6 +5245,19 @@ void SwUiWriterTest::testTdf112025()
CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xStyle, "IsLandscape")); CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xStyle, "IsLandscape"));
} }
void SwUiWriterTest::testTdf114306()
{
load(DATA_DIRECTORY, "fdo114306.odt");
xmlDocPtr pXmlDoc = parseLayoutDump();
// There are 2 long paragraphs in cell A1.
// A part of paragraph 2 should flow over to the second page but
// *not* the whole paragraph. There should be 2 paragraphs on
// page 1 and 1 paragraph on page 2.
assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row[1]/cell[1]/txt", 2);
assertXPath(pXmlDoc, "/root/page[2]/body/tab[1]/row[1]/cell[1]/txt", 1);
}
void SwUiWriterTest::testTdf108524() void SwUiWriterTest::testTdf108524()
{ {
createDoc("tdf108524.odt"); createDoc("tdf108524.odt");
......
...@@ -1303,8 +1303,14 @@ bool SwFrame::IsMoveable( const SwLayoutFrame* _pLayoutFrame ) const ...@@ -1303,8 +1303,14 @@ bool SwFrame::IsMoveable( const SwLayoutFrame* _pLayoutFrame ) const
_pLayoutFrame->IsInDocBody() || _pLayoutFrame->IsInDocBody() ||
_pLayoutFrame->IsInFootnote() ) _pLayoutFrame->IsInFootnote() )
{ {
// If IsMovable() is called before a MoveFwd() the method
// may return false if there is no NextCellLeaf. If
// IsMovable() is called before a MoveBwd() the method may
// return false if there is no PrevCellLeaf.
if ( _pLayoutFrame->IsInTab() && !IsTabFrame() && if ( _pLayoutFrame->IsInTab() && !IsTabFrame() &&
( !IsContentFrame() || !const_cast<SwFrame*>(this)->GetNextCellLeaf() ) ) ( !IsContentFrame() || (!const_cast<SwFrame*>(this)->GetNextCellLeaf()
&& !const_cast<SwFrame*>(this)->GetPrevCellLeaf()) )
)
{ {
bRetVal = false; bRetVal = false;
} }
......
...@@ -2021,14 +2021,19 @@ bool SwFlowFrame::MoveBwd( bool &rbReformat ) ...@@ -2021,14 +2021,19 @@ bool SwFlowFrame::MoveBwd( bool &rbReformat )
const SwLayoutFrame* pUpperFrame = m_rThis.GetUpper(); const SwLayoutFrame* pUpperFrame = m_rThis.GetUpper();
while ( pUpperFrame ) while ( pUpperFrame )
{ {
if ( pUpperFrame->IsTabFrame() ) if ( pUpperFrame->IsTabFrame() || pUpperFrame->IsRowFrame() )
{ {
return false; return false;
} }
// If the text frame is a follow-section-in-table, that can move // If the text frame is a follow-section-in-table, that can move
// backward as well. // backward as well.
bool bIsFollowSection = pUpperFrame->IsSctFrame() && static_cast<const SwSectionFrame*>(pUpperFrame)->GetPrecede(); bool bIsFollowSection = pUpperFrame->IsSctFrame() && static_cast<const SwSectionFrame*>(pUpperFrame)->GetPrecede();
if ( ( pUpperFrame->IsColumnFrame() && pUpperFrame->IsInSct() ) || bIsFollowSection )
// If the text frame is a follow-in-table, that can move
// backward as well.
bool bIsFollow = const_cast<SwLayoutFrame*>(pUpperFrame)->GetPrevCellLeaf();
if ( ( pUpperFrame->IsColumnFrame() && pUpperFrame->IsInSct() ) || bIsFollowSection || bIsFollow )
{ {
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment