summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-10-18 19:54:07 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-10-19 17:34:30 +0200
commit482adfc9dd5c08dae2a51d93ee579efa7df6e862 (patch)
tree5e5e994fc047a5e6a94407c7e948da96a1eff273 /writerfilter
parentd2f1f5005e0df725d9f1830e278b06a151c860b6 (diff)
tdf#144798 DOCX import: handle ZOrder of chart objects
Regression from commit 10efab2b9a3cf7fc49655c90ba29db4512680c38 (tdf#82824 DOCX import: fix at-char embedded object handling, 2016-11-15), the problem was that if we start supporting anchor types other than as-char, then handling ZOrder is no longer optional. (cherry picked from commit 63007619da7e6c4a6d0c466a8fe54324252be14b) Change-Id: I605cee33180490817055978b22f3271b3c08a1c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123794 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Jenkins
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx18
-rw-r--r--writerfilter/qa/cppunittests/dmapper/data/chart-zorder.docxbin0 -> 21206 bytes
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx3
3 files changed, 21 insertions, 0 deletions
diff --git a/writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx b/writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx
index ef4c8ed40fb0..3719a09e3323 100644
--- a/writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx
@@ -18,6 +18,7 @@
#include <com/sun/star/text/WritingMode2.hpp>
#include <com/sun/star/text/XTextTablesSupplier.hpp>
#include <com/sun/star/text/XTextTable.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
#include <vcl/scheduler.hxx>
@@ -212,6 +213,23 @@ CPPUNIT_TEST_FIXTURE(Test, testCreateDatePreserve)
// i.e. the formatting of the create date field was lost.
CPPUNIT_ASSERT_EQUAL(OUString("7/7/2020 10:11:00 AM"), xPortion->getString());
}
+
+CPPUNIT_TEST_FIXTURE(Test, testChartZOrder)
+{
+ // Given a document with a chart and a shape on it:
+ OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "chart-zorder.docx";
+
+ // When loading the document:
+ getComponent() = loadFromDesktop(aURL);
+
+ // Then make sure the shape is on top of the chart:
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(getComponent(), uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xDrawPage = xDrawPageSupplier->getDrawPage();
+ uno::Reference<lang::XServiceInfo> xChart(xDrawPage->getByIndex(0), uno::UNO_QUERY);
+ // Without the accompanying fix in place, this test would have failed, as the chart was on top
+ // of the shape.
+ CPPUNIT_ASSERT(xChart->supportsService("com.sun.star.text.TextEmbeddedObject"));
+}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/qa/cppunittests/dmapper/data/chart-zorder.docx b/writerfilter/qa/cppunittests/dmapper/data/chart-zorder.docx
new file mode 100644
index 000000000000..e022a3bde266
--- /dev/null
+++ b/writerfilter/qa/cppunittests/dmapper/data/chart-zorder.docx
Binary files differ
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 46bf027d293a..3af37fc28f59 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -7308,6 +7308,9 @@ void DomainMapper_Impl::ImportGraphic(const writerfilter::Reference< Properties
xEmbeddedProps->setPropertyValue("VertOrientRelation", xShapeProps->getPropertyValue("VertOrientRelation"));
//tdf123873 fix missing textwrap import
xEmbeddedProps->setPropertyValue("TextWrap", xShapeProps->getPropertyValue("TextWrap"));
+
+ // GraphicZOrderHelper::findZOrder() was called already, so can just copy it over.
+ xEmbeddedProps->setPropertyValue("ZOrder", xShapeProps->getPropertyValue("ZOrder"));
}
}
//insert it into the document at the current cursor position