From c776937723113937def7410268dcd1208fbaf12d Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 29 Jan 2018 16:20:46 +0100 Subject: DOCX import: handle horizontal flip of bitmaps Horizontal mirror on the UNO API level, mirror on the vertical axis internally. (cherry picked from commit 4bdbb5502f5995727017e22bb8a74b9f45552067) Change-Id: If142274a8f81a6875059a2651af6d8470870a36a Reviewed-on: https://gerrit.libreoffice.org/48893 Tested-by: Jenkins Reviewed-by: Michael Stahl --- .../extras/ooxmlexport/data/graphic-object-fliph.docx | Bin 0 -> 14408 bytes sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 6 ++++++ sw/source/filter/ww8/docxattributeoutput.cxx | 18 ++++++++++++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 sw/qa/extras/ooxmlexport/data/graphic-object-fliph.docx (limited to 'sw') diff --git a/sw/qa/extras/ooxmlexport/data/graphic-object-fliph.docx b/sw/qa/extras/ooxmlexport/data/graphic-object-fliph.docx new file mode 100644 index 000000000000..2f95a2b8583b Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/graphic-object-fliph.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index 700c69b225c3..58e654159494 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -109,6 +109,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf113183, "tdf113183.docx") "HoriOrientPosition")); } +DECLARE_OOXMLEXPORT_TEST(testGraphicObjectFliph, "graphic-object-fliph.docx") +{ + CPPUNIT_ASSERT(getProperty(getShape(1), "HoriMirroredOnEvenPages")); + CPPUNIT_ASSERT(getProperty(getShape(1), "HoriMirroredOnOddPages")); +} + DECLARE_OOXMLEXPORT_TEST(testTdf113547, "tdf113547.docx") { uno::Reference xPropertySet( diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index d46c2d205119..b569bc25b5c3 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -125,6 +125,7 @@ #include #include #include +#include #include #include @@ -4708,8 +4709,21 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size m_pSerializer->startElementNS( XML_pic, XML_spPr, XML_bwMode, "auto", FSEND ); - m_pSerializer->startElementNS( XML_a, XML_xfrm, - FSEND ); + + rtl::Reference xFrameAttributes( + FastSerializerHelper::createAttrList()); + + if (pGrfNode) + { + MirrorGraph eMirror = pGrfNode->GetSwAttrSet().GetMirrorGrf().GetValue(); + if (eMirror == MirrorGraph::Vertical || eMirror == MirrorGraph::Both) + // Mirror on the vertical axis is a horizontal flip. + xFrameAttributes->add(XML_flipH, "1"); + } + + m_pSerializer->startElementNS( + XML_a, XML_xfrm, uno::Reference(xFrameAttributes.get())); + m_pSerializer->singleElementNS( XML_a, XML_off, XML_x, "0", XML_y, "0", FSEND ); -- cgit v1.2.3