diff options
author | Bakos Attila <bakos.attilakaroly@nisz.hu> | 2020-01-10 10:49:14 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-01-13 12:27:47 +0100 |
commit | 4fcc04d134644a3013df7f331fe36072b96adb9f (patch) | |
tree | 830dd65ac267b239c2e80bb1e63454b3b34c74b4 | |
parent | 6b5ce621ff2a82d4fa77d7781d1dabd4b14a4c90 (diff) |
tdf#128207: DOCX import: fix chart positioning
Embedded graphic objects had got 0 values for vertical and horizontal
positioning before, resulting overlapping, hidden charts,
but now they are positioned according to the values in the document.
Change-Id: Ia5403ac65ff7192d61072e8a9d8a7f80c7178b9b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86521
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: László Németh <nemeth@numbertext.org>
(cherry picked from commit d9c535ead688e9f156dbcf43948df08a69e218be)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86536
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf128207.docx | bin | 0 -> 50324 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 8 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 4 | ||||
-rw-r--r-- | writerfilter/source/dmapper/GraphicImport.cxx | 5 | ||||
-rw-r--r-- | writerfilter/source/dmapper/GraphicImport.hxx | 2 |
5 files changed, 19 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf128207.docx b/sw/qa/extras/ooxmlexport/data/tdf128207.docx Binary files differnew file mode 100644 index 000000000000..c234ec8bc10f --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf128207.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index 062831503404..516d65d9bcb8 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -34,6 +34,14 @@ protected: } }; +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128207, "tdf128207.docx") +{ + //There was the charts on each other, because their horizontal and vertical position was 0! + xmlDocPtr p_XmlDoc = parseExport("word/document.xml"); + CPPUNIT_ASSERT(p_XmlDoc); + assertXPathContent(p_XmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/w:drawing/wp:anchor/wp:positionH/wp:posOffset", "4445"); +} + DECLARE_OOXMLEXPORT_TEST(testTdf87569v, "tdf87569_vml.docx") { //the original tdf87569 sample has vml shapes... diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index f60d188c4c01..0f79bb73334e 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -6101,6 +6101,10 @@ void DomainMapper_Impl::ImportGraphic(const writerfilter::Reference< Properties // Update the shape properties if it is embedded object. if(m_xEmbedded.is()){ + if (m_pGraphicImport->GetXShapeObject()) + m_pGraphicImport->GetXShapeObject()->setPosition( + m_pGraphicImport->GetGraphicObjectPosition()); + uno::Reference<drawing::XShape> xShape = m_pGraphicImport->GetXShapeObject(); UpdateEmbeddedShapeProps(xShape); if (eGraphicImportType == IMPORT_AS_DETECTED_ANCHOR) diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index da2b9ce04ef4..df4ae45f7671 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -424,6 +424,11 @@ GraphicImport::~GraphicImport() { } +com::sun::star::awt::Point GraphicImport::GetGraphicObjectPosition() +{ + return (com::sun::star::awt::Point(m_pImpl->nLeftPosition, m_pImpl->nTopPosition)); +} + void GraphicImport::handleWrapTextValue(sal_uInt32 nVal) { switch (nVal) diff --git a/writerfilter/source/dmapper/GraphicImport.hxx b/writerfilter/source/dmapper/GraphicImport.hxx index d83f41cb161d..7807e48ede00 100644 --- a/writerfilter/source/dmapper/GraphicImport.hxx +++ b/writerfilter/source/dmapper/GraphicImport.hxx @@ -99,6 +99,8 @@ public: bool IsGraphic() const; sal_Int32 GetLeftMarginOrig() const; + com::sun::star::awt::Point GetGraphicObjectPosition(); + private: // Properties virtual void lcl_attribute(Id Name, Value & val) override; |