Kaydet (Commit) fa10258d authored tarafından Miklos Vajna's avatar Miklos Vajna

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

Regression from commit 8b73bafb
(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: 's avatarMiklos Vajna <vmiklos@collabora.com>
üst 25d176ad
...@@ -292,6 +292,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf115719, "tdf115719.docx") ...@@ -292,6 +292,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf115719, "tdf115719.docx")
CPPUNIT_ASSERT_EQUAL(2, getPages()); 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") DECLARE_OOXMLEXPORT_TEST(testTdf116410, "tdf116410.docx")
{ {
// Opposite of the above, was 2 pages, should be 1 page. // Opposite of the above, was 2 pages, should be 1 page.
......
...@@ -1273,8 +1273,9 @@ void SectionPropertyMap::HandleIncreasedAnchoredObjectSpacing(DomainMapper_Impl& ...@@ -1273,8 +1273,9 @@ void SectionPropertyMap::HandleIncreasedAnchoredObjectSpacing(DomainMapper_Impl&
std::vector<AnchoredObjectInfo>& rAnchoredObjectAnchors = rDM_Impl.m_aAnchoredObjectAnchors; std::vector<AnchoredObjectInfo>& rAnchoredObjectAnchors = rDM_Impl.m_aAnchoredObjectAnchors;
for (auto& rAnchor : rAnchoredObjectAnchors) for (auto& rAnchor : rAnchoredObjectAnchors)
{ {
// Ignore this paragraph when there is a single shape only. // Ignore this paragraph when there are not enough shapes to trigger the Word bug we
if (rAnchor.m_aAnchoredObjects.size() < 2) // emulate.
if (rAnchor.m_aAnchoredObjects.size() < 4)
continue; continue;
// Analyze the anchored objects of this paragraph, now that we know the // Analyze the anchored objects of this paragraph, now that we know the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment