diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2023-04-14 14:10:03 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2023-04-14 16:37:52 +0200 |
commit | 69fe424e426957545a30e1b912c933e1e7693100 (patch) | |
tree | 5e7521182757ba4a0ba61cab3d501d53a4bcdcee /sw | |
parent | 597853903871325876b44fb523d323d2174874e3 (diff) |
sw floattable: unconditionally map DOC table pos props to SwFormatFlySplit
Previously we only mapped DOC floating tables to split fly frames when
the heuristics asked for a fly frame, this goes further.
Also add a testcase that shows that the import now works, but the export
needs more work.
In other words, this disables heuristics when the feature flag is on.
Change-Id: I65018fef7994b283a60b0c38b22c16e2277cb80f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150410
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ww8export/ww8export2.cxx | 36 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par6.cxx | 3 |
2 files changed, 37 insertions, 2 deletions
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx index 6073b2bfc65e..4f1f6d4afd6d 100644 --- a/sw/qa/extras/ww8export/ww8export2.cxx +++ b/sw/qa/extras/ww8export/ww8export2.cxx @@ -26,13 +26,21 @@ #include <com/sun/star/text/XEndnotesSupplier.hpp> #include <svx/svdpage.hxx> +#include <o3tl/string_view.hxx> #include <ftninfo.hxx> #include <drawdoc.hxx> #include <IDocumentDrawModelAccess.hxx> #include <docsh.hxx> #include <unotxdoc.hxx> -#include <o3tl/string_view.hxx> +#include <IDocumentLayoutAccess.hxx> +#include <rootfrm.hxx> +#include <pagefrm.hxx> +#include <sortedobjs.hxx> +#include <cntfrm.hxx> +#include <anchoredobject.hxx> +#include <tabfrm.hxx> +#include <flyfrms.hxx> class Test : public SwModelTestBase { @@ -336,6 +344,32 @@ DECLARE_WW8EXPORT_TEST(testTdf107773, "tdf107773.doc") CPPUNIT_ASSERT_EQUAL_MESSAGE("Horizontal Orientation", text::HoriOrientation::CENTER, getProperty<sal_Int16>(xTable, "HoriOrient")); } +CPPUNIT_TEST_FIXTURE(Test, testTdf107773SplitFly) +{ + SwModelTestBase::FlySplitGuard aGuard; + + createSwDoc("tdf107773.doc"); + + // This failed, multi-page table was imported as a non-split frame. + SwDoc* pDoc = getSwDoc(); + SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); + auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower()); + CPPUNIT_ASSERT(pPage1); + // pPage1 has no sorted (floating) objections. + CPPUNIT_ASSERT(pPage1->GetSortedObjs()); + const SwSortedObjs& rPage1Objs = *pPage1->GetSortedObjs(); + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage1Objs.size()); + auto pPage1Fly = dynamic_cast<SwFlyAtContentFrame*>(rPage1Objs[0]); + CPPUNIT_ASSERT(pPage1Fly); + auto pTab1 = dynamic_cast<SwTabFrame*>(pPage1Fly->GetLower()); + CPPUNIT_ASSERT(pTab1); + CPPUNIT_ASSERT(pTab1->HasFollow()); + + // tdf#80635 - assert the horizontal orientation. + const SwFormatHoriOrient& rFormatHoriOrient = pPage1Fly->GetFormat()->GetHoriOrient(); + CPPUNIT_ASSERT_EQUAL(css::text::HoriOrientation::CENTER, rFormatHoriOrient.GetHoriOrient()); +} + DECLARE_WW8EXPORT_TEST(testTdf112074_RTLtableJustification, "tdf112074_RTLtableJustification.doc") { uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index ba4e3ef6b9b8..8dce1212c929 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -2507,7 +2507,8 @@ bool SwWW8ImplReader::StartApo(const ApoTestResults &rApo, const WW8_TablePos *p WW8FlySet aFlySet(*this, m_xWFlyPara.get(), m_xSFlyPara.get(), false); - if (pTabPos && pTabPos->bNoFly) + // Always map floating tables to split flys when fly split is allowed. + if (pTabPos && pTabPos->bNoFly && !IsFlySplitAllowed()) { m_xSFlyPara->SetFlyFormat(nullptr); } |