[Libreoffice-commits] core.git: sw/qa sw/source

Justin Luth justin_luth at sil.org
Mon Feb 15 13:35:34 UTC 2016


 sw/qa/extras/ww8export/data/tdf56321_flipImage_both.doc |binary
 sw/qa/extras/ww8export/ww8export.cxx                    |   20 ++++++++++++++++
 sw/source/filter/ww8/ww8graf.cxx                        |   18 ++++++++++++++
 3 files changed, 38 insertions(+)

New commits:
commit aa03fd09c0e18ace241c9fe151f7f52c6773f403
Author: Justin Luth <justin_luth at sil.org>
Date:   Sat Feb 13 16:28:48 2016 +0300

    tdf#56321 - .doc import image flipped status
    
    Although LO was exporting whether an image was flipped
    horizontally or vertically, it wasn't reading it in during
    an import.
    
    Change-Id: Ia85e3459d00f40d852bbcd3fcfe15e7b53d518ba
    Reviewed-on: https://gerrit.libreoffice.org/22344
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/qa/extras/ww8export/data/tdf56321_flipImage_both.doc b/sw/qa/extras/ww8export/data/tdf56321_flipImage_both.doc
new file mode 100644
index 0000000..a5293f2
Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf56321_flipImage_both.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index ec03873..38c0ebf 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -23,7 +23,9 @@
 #include <com/sun/star/view/DocumentZoomType.hpp>
 #include <com/sun/star/rdf/URI.hpp>
 #include <com/sun/star/rdf/Statement.hpp>
+#include <grfatr.hxx>
 #include <pagedesc.hxx>
+#include <ndgrf.hxx>
 
 #include <sfx2/bindings.hxx>
 #include <sfx2/request.hxx>
@@ -567,6 +569,24 @@ DECLARE_WW8EXPORT_TEST(testTextVerticalAdjustment, "tdf36117_verticalAdjustment.
     CPPUNIT_ASSERT_EQUAL( drawing::TextVerticalAdjust_BLOCK, nVA );
 }
 
+DECLARE_WW8EXPORT_TEST(testRES_MIRROR_GRAPH_BOTH, "tdf56321_flipImage_both.doc")
+{
+    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
+    CPPUNIT_ASSERT(pTextDoc);
+    SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
+    CPPUNIT_ASSERT(pDoc);
+
+    for (int n = 0; ; n++)
+    {
+        SwNode* pNode = pDoc->GetNodes()[ n ];
+        if (SwGrfNode *pGrfNode = pNode->GetGrfNode())
+        {
+            CPPUNIT_ASSERT(pGrfNode->GetSwAttrSet().GetMirrorGrf().GetValue() == 3);
+            break;
+        }
+    }
+}
+
 DECLARE_WW8EXPORT_TEST(testCommentExport, "comment-export.odt")
 {
     struct TextPortionInfo {
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 22f7510..7c480d4 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -2094,6 +2094,24 @@ SwWW8ImplReader::SetAttributesAtGrfNode(SvxMSDffImportRec const*const pRecord,
             pGrfNd->SetAttr( aCrop );
         }
 
+        bool bFlipH = pRecord->nFlags & SHAPEFLAG_FLIPH;
+        bool bFlipV = pRecord->nFlags & SHAPEFLAG_FLIPV;
+        if ( bFlipH || bFlipV )
+        {
+            SwMirrorGrf aMirror = pGrfNd->GetSwAttrSet().GetMirrorGrf();
+            if( bFlipH )
+            {
+                if( bFlipV )
+                    aMirror.SetValue(RES_MIRROR_GRAPH_BOTH);
+                else
+                    aMirror.SetValue(RES_MIRROR_GRAPH_VERT);
+            }
+            else
+                aMirror.SetValue(RES_MIRROR_GRAPH_HOR);
+
+            pGrfNd->SetAttr( aMirror );
+        }
+
         if (pRecord->pObj)
         {
             const SfxItemSet& rOldSet = pRecord->pObj->GetMergedItemSet();


More information about the Libreoffice-commits mailing list