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

Miklos Vajna vmiklos at collabora.co.uk
Tue Dec 10 05:51:25 PST 2013


 oox/source/export/shapes.cxx |   27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

New commits:
commit eebd963d6d5df8b7637093addfe1b4052eed1f8a
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Dec 10 14:46:48 2013 +0100

    drawingml customshape export: handle docx corner cases
    
    Change-Id: I4b2b13c0855180acbfe34b594e12e493d4f04120

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index c1836b2..d63e8e7 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -288,17 +288,22 @@ ShapeExport& ShapeExport::WriteCustomShape( Reference< XShape > xShape )
     }
 
     FSHelperPtr pFS = GetFS();
-    pFS->startElementNS( mnXmlNamespace, XML_sp, FSEND );
+    pFS->startElementNS( mnXmlNamespace, (GetDocumentType() != DOCUMENT_DOCX ? XML_sp : XML_wsp), FSEND );
 
     // non visual shape properties
-    pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND );
-    pFS->singleElementNS( mnXmlNamespace, XML_cNvPr,
-                          XML_id, I32S( GetNewShapeID( xShape ) ),
-                          XML_name, IDS( CustomShape ),
-                          FSEND );
-    pFS->singleElementNS( mnXmlNamespace, XML_cNvSpPr, FSEND );
-    WriteNonVisualProperties( xShape );
-    pFS->endElementNS( mnXmlNamespace, XML_nvSpPr );
+    if (GetDocumentType() != DOCUMENT_DOCX)
+    {
+        pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND );
+        pFS->singleElementNS( mnXmlNamespace, XML_cNvPr,
+                XML_id, I32S( GetNewShapeID( xShape ) ),
+                XML_name, IDS( CustomShape ),
+                FSEND );
+        pFS->singleElementNS( mnXmlNamespace, XML_cNvSpPr, FSEND );
+        WriteNonVisualProperties( xShape );
+        pFS->endElementNS( mnXmlNamespace, XML_nvSpPr );
+    }
+    else
+        pFS->singleElementNS(mnXmlNamespace, XML_cNvSpPr, FSEND);
 
     // visual shape properties
     pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND );
@@ -322,7 +327,7 @@ ShapeExport& ShapeExport::WriteCustomShape( Reference< XShape > xShape )
     // write text
     WriteTextBox( xShape, mnXmlNamespace );
 
-    pFS->endElementNS( mnXmlNamespace, XML_sp );
+    pFS->endElementNS( mnXmlNamespace, (GetDocumentType() != DOCUMENT_DOCX ? XML_sp : XML_wsp) );
 
     return *this;
 }
@@ -732,6 +737,8 @@ ShapeExport& ShapeExport::WriteTextBox( Reference< XInterface > xIface, sal_Int3
         WriteText( xIface );
         pFS->endElementNS( nXmlNamespace, XML_txBody );
     }
+    else if (GetDocumentType() == DOCUMENT_DOCX)
+        mpFS->singleElementNS(nXmlNamespace, XML_bodyPr, FSEND);
 
     return *this;
 }


More information about the Libreoffice-commits mailing list