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

2017-01-06 Thread Miklos Vajna
 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 86847b02c581e908b5aae1cb13be7dba0e40e180
Author: Miklos Vajna 
Date:   Fri Jan 6 09:42:20 2017 +0100

tdf#105127 VML import: handle 

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
(cherry picked from commit ac03883cd66a2d58c17c8dac555a053586e46625)
Reviewed-on: https://gerrit.libreoffice.org/32778
Tested-by: Jenkins 
Reviewed-by: Jan Holesovsky 

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 000..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(getShape(1), "PolyPolygonBezier");
+// This was 1910, the shape was rendered upside down.
+CPPUNIT_ASSERT_EQUAL(static_cast(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.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-11-30 Thread Miklos Vajna
 oox/source/export/drawingml.cxx  |4 +++-
 sw/qa/extras/ooxmlexport/data/tdf104115.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx|   10 ++
 3 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit c3d124254a3097163aae127e2fe3e34980417f20
Author: Miklos Vajna 
Date:   Tue Nov 29 09:20:28 2016 +0100

tdf#104115 DOCX export: ClosedBezierShape should always result in 


Regression from commit 6b084f0001fc15112bf3c40d20a0c7096c83b7fe (asan:
global-buffer-overflow on fdo55736-1.docx, 2015-01-08), the problem as
seen by the user was that our VML->DML conversion in a DOCX file
resulted in output that wasn't accepted by Word anymore.

Now that commit itself is fine, but as a side effect, the somewhat
unusual (bezier with no actual polypolygons) child shape of the group
shape is now written, but not in a way that conforms to the drawingML
schema.

Fix that pre-existing, but now visible problem by always writing
 in the DOCX case.

(cherry picked from commit a5cc8993dceb61c63caf26ae995d9d62905291e5)

Change-Id: Idbcb903dda07b5c2408d2b0ebbf4b5e4a08b20ed
Reviewed-on: https://gerrit.libreoffice.org/31383
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 0951449..8d02565 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2540,7 +2540,9 @@ bool DrawingML::WriteCustomGeometry( const Reference< 
XShape >& rXShape )
 
 void DrawingML::WritePolyPolygon( const tools::PolyPolygon& rPolyPolygon )
 {
-if( rPolyPolygon.Count() < 1 )
+// In case of Writer, the parent element is , and there the
+//  element is not optional.
+if (rPolyPolygon.Count() < 1 && GetDocumentType() != DOCUMENT_DOCX)
 return;
 
 mpFS->startElementNS( XML_a, XML_custGeom, FSEND );
diff --git a/sw/qa/extras/ooxmlexport/data/tdf104115.docx 
b/sw/qa/extras/ooxmlexport/data/tdf104115.docx
new file mode 100644
index 000..9236f0e
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf104115.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 8d117e6..f4bd83e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -141,6 +141,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf103982, "tdf103982.docx")
 CPPUNIT_ASSERT(nDistB >= 0);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf104115, "tdf104115.docx")
+{
+xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+if (!pXmlDoc)
+return;
+// This found 0 nodes: the custom geometry was not written for the Bezier
+// curve -> Word refused to open the document.
+assertXPath(pXmlDoc, "//a:custGeom", 1);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits