tdf#123243 DOCX import: make increased anchored obj spacing cond more strict

Regression from commit 8b73bafbc1
(tdf#115719 DOCX import: increase paragraph spacing for anchored
objects, 2018-02-14), which is an import-time workaround for a Word
layout bug.

Re-checking the original document from that bug, this only happens with
more anchored shapes (to the same paragraph), so make the workaround
condition more strict, fixing the layout of this bugdoc.

(Which means tdf115719.docx and tdf115719b.docx are modified to be more
close to the original bugdoc.)

Just checked, sadly Word's layout bug is still there in MSO 2019, so
can't revert our emulation of it (not yet).

Change-Id: I26f74a497b7718f8f3a2eadac481c8722e85e680
Reviewed-on: https://gerrit.libreoffice.org/68708
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
This commit is contained in:
Miklos Vajna
2019-03-05 08:35:02 +01:00
parent 25d176ada6
commit fa10258d72
5 changed files with 10 additions and 2 deletions
Binary file not shown.
Binary file not shown.
@@ -292,6 +292,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf115719, "tdf115719.docx")
CPPUNIT_ASSERT_EQUAL(2, getPages());
}
DECLARE_OOXMLEXPORT_TEST(testTdf123243, "tdf123243.docx")
{
// Without the accompanying fix in place, this test would have failed with 'Expected: 1; Actual:
// 2'; i.e. unexpected paragraph margin created 2 pages.
CPPUNIT_ASSERT_EQUAL(1, getPages());
}
DECLARE_OOXMLEXPORT_TEST(testTdf116410, "tdf116410.docx")
{
// Opposite of the above, was 2 pages, should be 1 page.
Binary file not shown.
+3 -2
View File
@@ -1273,8 +1273,9 @@ void SectionPropertyMap::HandleIncreasedAnchoredObjectSpacing(DomainMapper_Impl&
std::vector<AnchoredObjectInfo>& rAnchoredObjectAnchors = rDM_Impl.m_aAnchoredObjectAnchors;
for (auto& rAnchor : rAnchoredObjectAnchors)
{
// Ignore this paragraph when there is a single shape only.
if (rAnchor.m_aAnchoredObjects.size() < 2)
// Ignore this paragraph when there are not enough shapes to trigger the Word bug we
// emulate.
if (rAnchor.m_aAnchoredObjects.size() < 4)
continue;
// Analyze the anchored objects of this paragraph, now that we know the