tdf#131446 DOCX import: restrict IncreasedAnchoredObjectSpacing further

Regression from commit 8b73bafbc1
(tdf#115719 DOCX import: increase paragraph spacing for anchored
objects, 2018-02-14), this is another case where the workaround for the
Word layout bug is not needed.

tdf115719.docx and tdf115719b.docx are tweaked to have <wp:anchor ...
behindDoc="1"> for 1 shape, as the original bugdoc has it. This allows
us to render both the tdf#115719 and tdf#131446 bug documents the same
way as Word does.

Change-Id: I0c3f197c3360882cd64f8dcf286c6051dc11d674
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92599
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
This commit is contained in:
Miklos Vajna
2020-04-20 21:04:30 +02:00
parent fcd1ed79ce
commit 249428202b
4 changed files with 22 additions and 0 deletions

View File

@@ -1253,6 +1253,28 @@ void SectionPropertyMap::HandleIncreasedAnchoredObjectSpacing(DomainMapper_Impl&
if (rAnchor.m_aAnchoredObjects.size() < 4)
continue;
// Ignore this paragraph if none of the objects are wrapped in the background.
sal_Int32 nOpaqueCount = 0;
for (const auto& rAnchored : rAnchor.m_aAnchoredObjects)
{
uno::Reference<beans::XPropertySet> xShape(rAnchored.m_xAnchoredObject, uno::UNO_QUERY);
if (!xShape.is())
{
continue;
}
bool bOpaque = true;
xShape->getPropertyValue("Opaque") >>= bOpaque;
if (!bOpaque)
{
++nOpaqueCount;
}
}
if (nOpaqueCount < 1)
{
continue;
}
// Analyze the anchored objects of this paragraph, now that we know the
// page width.
sal_Int32 nShapesWidth = 0;