summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManfred Blume <manfred.blume@cib.de>2017-12-08 15:01:51 +0100
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2017-12-22 13:41:36 +0100
commit8b4704f84814cecb2e60ab0ab6aa4924968a51e5 (patch)
treedf6f66480470035bb2ce084b7ff3c11151c2be9f
parentbb8fedb5645e2c8103f670f398ee4a3bd5b5bad0 (diff)
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. Reviewed-on: https://gerrit.libreoffice.org/46021 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> (cherry picked from commit 18765b9fa739337d2d891513f6e2fb7c3ce23b50) Change-Id: I5366eb824f0ef7016599c777786cbdf42f65b9b5 Reviewed-on: https://gerrit.libreoffice.org/46942 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Oliver Specht <oliver.specht@cib.de>
-rwxr-xr-xsw/qa/extras/uiwriter/data/fdo114306.odtbin0 -> 17107 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx15
-rw-r--r--sw/source/core/layout/findfrm.cxx8
-rw-r--r--sw/source/core/layout/flowfrm.cxx9
4 files changed, 29 insertions, 3 deletions
diff --git a/sw/qa/extras/uiwriter/data/fdo114306.odt b/sw/qa/extras/uiwriter/data/fdo114306.odt
new file mode 100755
index 000000000000..5a7d2f9ca864
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/fdo114306.odt
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index dd2781a77552..0398e15e6ebe 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -287,6 +287,7 @@ public:
void testTdf99689TableOfFigures();
void testTdf99689TableOfTables();
void testTdf113790();
+ void testTdf114306();
CPPUNIT_TEST_SUITE(SwUiWriterTest);
CPPUNIT_TEST(testReplaceForward);
@@ -455,6 +456,7 @@ public:
CPPUNIT_TEST(testTdf99689TableOfFigures);
CPPUNIT_TEST(testTdf99689TableOfTables);
CPPUNIT_TEST(testTdf113790);
+ CPPUNIT_TEST(testTdf114306);
CPPUNIT_TEST_SUITE_END();
private:
@@ -5240,6 +5242,19 @@ void SwUiWriterTest::testTdf112025()
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()
{
createDoc("tdf108524.odt");
diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx
index 3a3607934481..daccef43edcc 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -1303,8 +1303,14 @@ bool SwFrame::IsMoveable( const SwLayoutFrame* _pLayoutFrame ) const
_pLayoutFrame->IsInDocBody() ||
_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() &&
- ( !IsContentFrame() || !const_cast<SwFrame*>(this)->GetNextCellLeaf() ) )
+ ( !IsContentFrame() || (!const_cast<SwFrame*>(this)->GetNextCellLeaf()
+ && !const_cast<SwFrame*>(this)->GetPrevCellLeaf()) )
+ )
{
bRetVal = false;
}
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index 83043c78278f..78b78e61b8e9 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -2021,14 +2021,19 @@ bool SwFlowFrame::MoveBwd( bool &rbReformat )
const SwLayoutFrame* pUpperFrame = m_rThis.GetUpper();
while ( pUpperFrame )
{
- if ( pUpperFrame->IsTabFrame() )
+ if ( pUpperFrame->IsTabFrame() || pUpperFrame->IsRowFrame() )
{
return false;
}
// If the text frame is a follow-section-in-table, that can move
// backward as well.
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;
}