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

Miklos Vajna vmiklos at collabora.co.uk
Tue Nov 29 10:52:55 UTC 2016


 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 a5cc8993dceb61c63caf26ae995d9d62905291e5
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Nov 29 09:20:28 2016 +0100

    tdf#104115 DOCX export: ClosedBezierShape should always result in <a:custGeom>
    
    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
    <a:custGeom> in the DOCX case.
    
    Change-Id: Idbcb903dda07b5c2408d2b0ebbf4b5e4a08b20ed
    Reviewed-on: https://gerrit.libreoffice.org/31347
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

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 <wps:spPr>, and there the
+    // <a:custGeom> 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 0000000..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: */


More information about the Libreoffice-commits mailing list