summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-01-29 16:20:46 +0100
committerAndras Timar <andras.timar@collabora.com>2018-02-12 21:40:14 +0100
commit02aaacf21749099a58033ff5993e3644bccf6c97 (patch)
treeca10b2cb2443ec4ee86634c34390ba3115cc205a /sw
parent6c1100a596a1a3e544f25b400943d77f524604e2 (diff)
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) Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport11.cxx Change-Id: If142274a8f81a6875059a2651af6d8470870a36a
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/graphic-object-fliph.docxbin0 -> 14408 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport9.cxx6
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx18
3 files changed, 22 insertions, 2 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/graphic-object-fliph.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 7fef2cd0e199..be729d8ecd33 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -641,6 +641,12 @@ DECLARE_OOXMLEXPORT_TEST(testWatermarkTrim, "tdf114308.docx")
CPPUNIT_ASSERT_MESSAGE(ss.str(), nDifference >= -4);
}
+DECLARE_OOXMLEXPORT_TEST(testGraphicObjectFliph, "graphic-object-fliph.docx")
+{
+ CPPUNIT_ASSERT(getProperty<bool>(getShape(1), "HoriMirroredOnEvenPages"));
+ CPPUNIT_ASSERT(getProperty<bool>(getShape(1), "HoriMirroredOnOddPages"));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 4e819406fb68..2deae355d258 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -119,6 +119,7 @@
#include <IDocumentSettingAccess.hxx>
#include <IDocumentStylePoolAccess.hxx>
#include <IDocumentRedlineAccess.hxx>
+#include <grfatr.hxx>
#include <osl/file.hxx>
#include <vcl/embeddedfontshelper.hxx>
@@ -4380,8 +4381,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<sax_fastparser::FastAttributeList> xFrameAttributes(
+ FastSerializerHelper::createAttrList());
+
+ if (pGrfNode)
+ {
+ sal_uInt16 eMirror = pGrfNode->GetSwAttrSet().GetMirrorGrf().GetValue();
+ if (eMirror == RES_MIRROR_GRAPH_VERT || eMirror == RES_MIRROR_GRAPH_BOTH)
+ // Mirror on the vertical axis is a horizontal flip.
+ xFrameAttributes->add(XML_flipH, "1");
+ }
+
+ m_pSerializer->startElementNS(
+ XML_a, XML_xfrm, uno::Reference<xml::sax::XFastAttributeList>(xFrameAttributes.get()));
+
m_pSerializer->singleElementNS( XML_a, XML_off,
XML_x, "0", XML_y, "0",
FSEND );