tdf#100037 vml import: add AS_CHAR images to zOrder calculation
Inline shapes are at the level of body text,
so any heaven-layer floating objects should be above it,
and any hell-layer flys should be below it.
DML images already do this in applyZOrder().
make CppunitTest_sw_ooxmlexport18 \
CPPUNIT_TEST_NAME=testTdf100037_inlineZOrder
Change-Id: I51ab2eb4c1b59ebf048f16dca60a02b327c5e6b4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168511
Reviewed-by: Justin Luth <jluth@mail.com>
Tested-by: Jenkins
diff --git a/sw/qa/extras/ooxmlexport/data/tdf100037_inlineZOrder.docx b/sw/qa/extras/ooxmlexport/data/tdf100037_inlineZOrder.docx
new file mode 100644
index 0000000..5f3e9b3
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf100037_inlineZOrder.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
index de10f43..50a9dc3 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -1058,12 +1058,24 @@ DECLARE_OOXMLEXPORT_TEST(testTdf159158_zOrder_headerBehind2, "tdf159158_zOrder_h
CPPUNIT_ASSERT_EQUAL(OUString("HeaderImage"),
getProperty<OUString>(zOrder0, "LinkDisplayName"));
CPPUNIT_ASSERT_EQUAL(OUString("BodyBlueRectangle"),
getProperty<OUString>(zOrder1,"LinkDisplayName"));
getProperty<OUString>(zOrder1, "LinkDisplayName"));
// The logo should not be opaque since it is in the header.
CPPUNIT_ASSERT(!getProperty<bool>(zOrder0, "Opaque")); // logo should be invisible
CPPUNIT_ASSERT(!getProperty<bool>(zOrder1, "Opaque"));
}
DECLARE_OOXMLEXPORT_TEST(testTdf100037_inlineZOrder, "tdf100037_inlineZOrder.docx")
{
// given a floating textbox followed by an inline image,
// an inline image should always be behind a heaven-layer floating object.
uno::Reference<beans::XPropertySet> zOrder0(getShape(1), uno::UNO_QUERY);
uno::Reference<beans::XPropertySet> zOrder1(getShape(2), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(zOrder0, "ZOrder")); // lower
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<sal_Int32>(zOrder1, "ZOrder")); // higher
CPPUNIT_ASSERT_EQUAL(OUString("Image 2"), getProperty<OUString>(zOrder0, "LinkDisplayName"));
CPPUNIT_ASSERT_EQUAL(OUString("Frame1"), getProperty<OUString>(zOrder1, "LinkDisplayName"));
}
DECLARE_OOXMLEXPORT_TEST(testTdf155903, "tdf155903.odt")
{
// Without the accompanying fix in place, this test would have crashed,
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index fefabe5..6e9fae2 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -1223,8 +1223,7 @@ CPPUNIT_TEST_FIXTURE(Test, testActiveXControlAlign)
CPPUNIT_ASSERT_EQUAL(2, getShapes());
CPPUNIT_ASSERT_EQUAL(1, getPages());
// First check box aligned as a floating object
uno::Reference<drawing::XControlShape> xControlShape(getShape(1), uno::UNO_QUERY);
CPPUNIT_ASSERT(xControlShape.is());
uno::Reference<drawing::XControlShape> xControlShape(getShape(2), uno::UNO_QUERY_THROW);
// Check whether we have the right control
uno::Reference<beans::XPropertySet> xPropertySet(xControlShape->getControl(), uno::UNO_QUERY);
@@ -1245,7 +1244,7 @@ CPPUNIT_TEST_FIXTURE(Test, testActiveXControlAlign)
CPPUNIT_ASSERT_EQUAL(sal_Int32(2341), xShape->getPosition().Y);
// Second check box aligned inline / as character
xControlShape.set(getShape(2), uno::UNO_QUERY);
xControlShape.set(getShape(1), uno::UNO_QUERY_THROW);
// Check whether we have the right control
xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY);
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index 8f20487..25612d082 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -4831,6 +4831,12 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape
if(aPropMargin)
xShapePropertySet->setPropertyValue(getPropertyName(PROP_BOTTOM_MARGIN),
aPropMargin->second);
sal_Int64 zOrder = SAL_MIN_INT64;
xShapePropertySet->setPropertyValue(u"ZOrder"_ustr,
uno::Any(rZOrderHelper.findZOrder(zOrder, /*LastDuplicateWins*/true)));
rZOrderHelper.addItem(xShapePropertySet, zOrder);
checkZOrderStatus = true;
}
else
{