summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/filter/ww8/data/floattable-vertical-fly-offset.docbin0 -> 41472 bytes
-rw-r--r--sw/qa/filter/ww8/ww8.cxx29
-rw-r--r--sw/source/filter/ww8/ww8par.cxx4
3 files changed, 33 insertions, 0 deletions
diff --git a/sw/qa/filter/ww8/data/floattable-vertical-fly-offset.doc b/sw/qa/filter/ww8/data/floattable-vertical-fly-offset.doc
new file mode 100644
index 000000000000..d17bb5e886d3
--- /dev/null
+++ b/sw/qa/filter/ww8/data/floattable-vertical-fly-offset.doc
Binary files differ
diff --git a/sw/qa/filter/ww8/ww8.cxx b/sw/qa/filter/ww8/ww8.cxx
index 20c1b993caa8..d7af2b675f24 100644
--- a/sw/qa/filter/ww8/ww8.cxx
+++ b/sw/qa/filter/ww8/ww8.cxx
@@ -26,6 +26,7 @@
#include <pagefrm.hxx>
#include <ftnfrm.hxx>
#include <IDocumentSettingAccess.hxx>
+#include <sortedobjs.hxx>
namespace
{
@@ -358,6 +359,34 @@ CPPUNIT_TEST_FIXTURE(Test, testDOCFloatingTableHiddenAnchor)
// i.e. the floating table was lost.
assertXPath(pLayout, "//tab", 2);
}
+
+CPPUNIT_TEST_FIXTURE(Test, testDOCVerticalFlyOffset)
+{
+ // Given a document with 2 pages, a floating table on the first page and an inline table on the
+ // second page:
+ createSwDoc("floattable-vertical-fly-offset.doc");
+
+ // When laying out that document:
+ calcLayout();
+
+ // Then make sure that the tables don't overlap:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ CPPUNIT_ASSERT(pPage1->GetSortedObjs());
+ const SwSortedObjs& rPage1Objs = *pPage1->GetSortedObjs();
+ // Page 1 has a floating table:
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage1Objs.size());
+ auto pPage2 = dynamic_cast<SwPageFrame*>(pPage1->GetNext());
+ // Without the accompanying fix in place, this test would have failed, there was no second page.
+ CPPUNIT_ASSERT(pPage2);
+ SwFrame* pBody2 = pPage2->GetLower();
+ SwFrame* pTable2 = pBody2->GetLower();
+ CPPUNIT_ASSERT(pTable2);
+ // Page 2 starts with an inline table:
+ CPPUNIT_ASSERT(pTable2->IsTabFrame());
+}
}
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 1a328ebf8e54..abd7cf4c0345 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1902,6 +1902,10 @@ void SwWW8ImplReader::ImportDop()
m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::USE_VIRTUAL_DEVICE, !m_xWDop->fUsePrinterMetrics);
m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::USE_HIRES_VIRTUAL_DEVICE, true);
m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::ADD_FLY_OFFSETS, true );
+
+ // No vertical offsets would lead to e.g. overlap of table and fly frames.
+ m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS, true );
+
m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::ADD_EXT_LEADING, !m_xWDop->fNoLeading);
m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::OLD_NUMBERING, false);
m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING, false); // #i47448#