diff options
-rw-r--r-- | sw/qa/filter/ww8/data/floattable-in-inlinetable.doc | bin | 0 -> 33792 bytes | |||
-rw-r--r-- | sw/qa/filter/ww8/ww8.cxx | 37 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par2.cxx | 11 |
3 files changed, 44 insertions, 4 deletions
diff --git a/sw/qa/filter/ww8/data/floattable-in-inlinetable.doc b/sw/qa/filter/ww8/data/floattable-in-inlinetable.doc Binary files differnew file mode 100644 index 000000000000..a2f06973a53c --- /dev/null +++ b/sw/qa/filter/ww8/data/floattable-in-inlinetable.doc diff --git a/sw/qa/filter/ww8/ww8.cxx b/sw/qa/filter/ww8/ww8.cxx index 14cde1758588..ebd4e3d38d36 100644 --- a/sw/qa/filter/ww8/ww8.cxx +++ b/sw/qa/filter/ww8/ww8.cxx @@ -29,6 +29,7 @@ #include <sortedobjs.hxx> #include <fmtwrapinfluenceonobjpos.hxx> #include <ftnidx.hxx> +#include <tabfrm.hxx> namespace { @@ -488,6 +489,42 @@ CPPUNIT_TEST_FIXTURE(Test, testFloattableFootnote) // - Actual : 0 CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rFootnotes.size()); } + +CPPUNIT_TEST_FIXTURE(Test, testSplitFlyInInlineTableDOC) +{ + // Outer inline table on pages 1 -> 2 -> 3, inner floating table on pages 2 -> 3: + // When laying out that document: + createSwDoc("floattable-in-inlinetable.doc"); + + SwDoc* pDoc = getSwDoc(); + SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); + auto pPage1 = pLayout->Lower()->DynCastPageFrame(); + CPPUNIT_ASSERT(pPage1); + { + SwFrame* pBody = pPage1->FindBodyCont(); + auto pTab = pBody->GetLower()->DynCastTabFrame(); + CPPUNIT_ASSERT(!pTab->GetPrecede()); + CPPUNIT_ASSERT(pTab->GetFollow()); + } + auto pPage2 = pPage1->GetNext()->DynCastPageFrame(); + CPPUNIT_ASSERT(pPage2); + { + SwFrame* pBody = pPage2->FindBodyCont(); + auto pTab = pBody->GetLower()->DynCastTabFrame(); + CPPUNIT_ASSERT(pTab->GetPrecede()); + // Without the accompanying fix in place, this test would have failed, the outer table was + // missing on page 3. + CPPUNIT_ASSERT(pTab->GetFollow()); + } + auto pPage3 = pPage2->GetNext()->DynCastPageFrame(); + CPPUNIT_ASSERT(pPage3); + { + SwFrame* pBody = pPage3->FindBodyCont(); + auto pTab = pBody->GetLower()->DynCastTabFrame(); + CPPUNIT_ASSERT(pTab->GetPrecede()); + CPPUNIT_ASSERT(!pTab->GetFollow()); + } +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 6c18f5a9ce08..4cc4f8379b58 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -3419,8 +3419,8 @@ bool SwWW8ImplReader::StartTable(WW8_CP nStartCp) m_aSectionManager.GetTextAreaWidth(), m_nIniFlyDx, m_nIniFlyDy); - // #i45301# - anchor nested table Writer fly frame at-character - eAnchor = RndStdIds::FLY_AT_CHAR; + // #i45301# - anchor nested table Writer fly frame + eAnchor = RndStdIds::FLY_AT_PARA; } } } @@ -3438,7 +3438,7 @@ bool SwWW8ImplReader::StartTable(WW8_CP nStartCp) { int nNewInTable = m_nInTable + 1; - if ((eAnchor == RndStdIds::FLY_AT_CHAR) + if ((eAnchor == RndStdIds::FLY_AT_PARA) && !m_aTableStack.empty() && !InEqualApo(nNewInTable) ) { m_xTableDesc->m_pParentPos = new SwPosition(*m_pPaM->GetPoint()); @@ -3463,9 +3463,12 @@ bool SwWW8ImplReader::StartTable(WW8_CP nStartCp) if ( pTableWFlyPara && pTableSFlyPara ) { WW8FlySet aFlySet( *this, pTableWFlyPara.get(), pTableSFlyPara, false ); - SwFormatAnchor aAnchor( RndStdIds::FLY_AT_CHAR ); + // At-para, so it can split in the multi-page case. + SwFormatAnchor aAnchor(RndStdIds::FLY_AT_PARA); aAnchor.SetAnchor( m_xTableDesc->m_pParentPos ); aFlySet.Put( aAnchor ); + // Map a positioned inner table to a split fly. + aFlySet.Put(SwFormatFlySplit(true)); m_xTableDesc->m_pFlyFormat->SetFormatAttr( aFlySet ); } else |