[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sw/qa sw/source writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Tue Jan 30 15:11:50 UTC 2018


 sw/qa/extras/ooxmlexport/data/graphic-object-fliph.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx               |    6 +++++
 sw/source/filter/ww8/docxattributeoutput.cxx            |   18 ++++++++++++++--
 writerfilter/source/dmapper/GraphicImport.cxx           |   11 +++++++++
 4 files changed, 33 insertions(+), 2 deletions(-)

New commits:
commit 59de9010a07710c99722208ba8fdbaa7df616984
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Jan 29 16:20:46 2018 +0100

    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
    Reviewed-on: https://gerrit.libreoffice.org/48902
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

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/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index f67a2b37888f..74cb6c7143e8 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -697,6 +697,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf107111, "tdf107111.docx")
     assertXPath(pXmlDoc, "/w:document/w:body/w:p[5]/w:hyperlink/w:r/w:rPr/w:webHidden", 0);
 }
 
+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 a18eeb8fb635..586fc45c7c69 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -122,6 +122,7 @@
 #include <IDocumentSettingAccess.hxx>
 #include <IDocumentStylePoolAccess.hxx>
 #include <IDocumentRedlineAccess.hxx>
+#include <grfatr.hxx>
 
 #include <osl/file.hxx>
 #include <vcl/embeddedfontshelper.hxx>
@@ -4438,8 +4439,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)
+    {
+        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<xml::sax::XFastAttributeList>(xFrameAttributes.get()));
+
     m_pSerializer->singleElementNS( XML_a, XML_off,
             XML_x, "0", XML_y, "0",
             FSEND );
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index 22878b6121f1..e9826192143c 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1361,6 +1361,17 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const b
                 m_pImpl->applyMargins(xGraphicObjectProperties);
                 m_pImpl->applyName(xGraphicObjectProperties);
             }
+
+            // Handle horizontal flip.
+            bool bMirrored = false;
+            xShapeProps->getPropertyValue("IsMirrored") >>= bMirrored;
+            if (bMirrored)
+            {
+                xGraphicObjectProperties->setPropertyValue("HoriMirroredOnEvenPages",
+                                                           uno::makeAny(true));
+                xGraphicObjectProperties->setPropertyValue("HoriMirroredOnOddPages",
+                                                           uno::makeAny(true));
+            }
         }
     }
     catch( const uno::Exception& e )


More information about the Libreoffice-commits mailing list