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

Miklos Vajna vmiklos at collabora.co.uk
Fri Jan 6 09:57:26 UTC 2017


 oox/source/vml/vmlshape.cxx                  |   22 ++++++++++++++++++++++
 sw/qa/extras/ooxmlimport/data/tdf105127.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx     |    7 +++++++
 3 files changed, 29 insertions(+)

New commits:
commit ac03883cd66a2d58c17c8dac555a053586e46625
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Jan 6 09:42:20 2017 +0100

    tdf#105127 VML import: handle <v:shape style="flip:..." path="...">
    
    I don't see an easy way to implement this via UNO, so use the internal
    API. As to the internal API usage,
    SdrEditView::MirrorMarkedObjVertical() (for UI) and
    SvxMSDffManager::ImportShape() (for WW8 import) are example client code.
    
    Change-Id: I9bf27788db32fd35d6b56e0f1a240c4b7abc5604

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index c978c39..0b68675 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -1058,6 +1058,28 @@ Reference< XShape > BezierShape::implConvertAndInsert( const Reference< XShapes
         aPropSet.setProperty( PROP_PolyPolygonBezier, aBezierCoords );
     }
 
+    // Handle horizontal and vertical flip.
+    if (!maTypeModel.maFlip.isEmpty())
+    {
+        if (SdrObject* pShape = GetSdrObjectFromXShape(xShape))
+        {
+            if (maTypeModel.maFlip.startsWith("x"))
+            {
+                Point aCenter(pShape->GetSnapRect().Center());
+                Point aPoint2(aCenter);
+                aPoint2.setY(aPoint2.getY() + 1);
+                pShape->NbcMirror(aCenter, aPoint2);
+            }
+            if (maTypeModel.maFlip.endsWith("y"))
+            {
+                Point aCenter(pShape->GetSnapRect().Center());
+                Point aPoint2(aCenter);
+                aPoint2.setX(aPoint2.getX() + 1);
+                pShape->NbcMirror(aCenter, aPoint2);
+            }
+        }
+    }
+
     // Hacky way of ensuring the shape is correctly sized/positioned
     xShape->setSize( awt::Size( rShapeRect.Width, rShapeRect.Height ) );
     xShape->setPosition( awt::Point( rShapeRect.X, rShapeRect.Y ) );
diff --git a/sw/qa/extras/ooxmlimport/data/tdf105127.docx b/sw/qa/extras/ooxmlimport/data/tdf105127.docx
new file mode 100644
index 0000000..3cdfa7f
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf105127.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index b1ccafc..0acf8f0 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -692,6 +692,13 @@ DECLARE_OOXMLIMPORT_TEST(testBnc779620, "bnc779620.docx")
     lcl_countTextFrames( mxComponent, 1 );
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf105127, "tdf105127.docx")
+{
+    auto aPolyPolygon = getProperty<drawing::PolyPolygonBezierCoords>(getShape(1), "PolyPolygonBezier");
+    // This was 1910, the shape was rendered upside down.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3257), aPolyPolygon.Coordinates[0][0].Y);
+}
+
 DECLARE_OOXMLIMPORT_TEST(testfdo76583, "fdo76583.docx")
 {
     // The problem was that the floating table was imported as a non-floating one.


More information about the Libreoffice-commits mailing list