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

Miklos Vajna vmiklos at collabora.co.uk
Tue Dec 17 07:30:26 PST 2013


 oox/source/export/shapes.cxx           |    7 ++++++-
 sw/source/filter/ww8/docxexport.cxx    |    8 ++++++--
 sw/source/filter/ww8/docxsdrexport.cxx |   11 ++++++++---
 3 files changed, 20 insertions(+), 6 deletions(-)

New commits:
commit 1279f9c835d188be72a21779377cb03841d6bc54
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Dec 17 16:08:29 2013 +0100

    DOCX drawingml export: give drawinglayer pictures the correct namespace
    
    This is triggered by testVMLData in CppunitTest_sw_ooxmlexport when DML export
    is enabled in non-experimental mode.
    
    Change-Id: Id636b1ab701ff49da1b05b720fcb2173360584ba

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 6a793b7..b2b39a4 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -446,7 +446,12 @@ void ShapeExport::WriteGraphicObjectShapePart( Reference< XShape > xShape, const
 
     FSHelperPtr pFS = GetFS();
 
-    pFS->startElementNS( mnXmlNamespace, XML_pic, FSEND );
+    if (GetDocumentType() != DOCUMENT_DOCX)
+        pFS->startElementNS( mnXmlNamespace, XML_pic, FSEND );
+    else
+        pFS->startElementNS( mnXmlNamespace, XML_pic,
+                             FSNS(XML_xmlns, XML_pic), "http://schemas.openxmlformats.org/drawingml/2006/picture",
+                             FSEND );
 
     pFS->startElementNS( mnXmlNamespace, XML_nvPicPr, FSEND );
 
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 7d5f63b..d8463a1 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -334,8 +334,12 @@ OString DocxExport::OutputChart( uno::Reference< frame::XModel >& xModel, sal_In
 void DocxExport::OutputDML(uno::Reference<drawing::XShape>& xShape)
 {
     uno::Reference<lang::XServiceInfo> xServiceInfo(xShape, uno::UNO_QUERY_THROW);
-    bool bGroupShape = xServiceInfo->supportsService("com.sun.star.drawing.GroupShape");
-    oox::drawingml::ShapeExport aExport((bGroupShape ? XML_wpg : XML_wps), m_pAttrOutput->GetSerializer(), 0, m_pFilter, oox::drawingml::DrawingML::DOCUMENT_DOCX, m_pAttrOutput);
+    sal_Int32 nNamespace = XML_wps;
+    if (xServiceInfo->supportsService("com.sun.star.drawing.GroupShape"))
+        nNamespace = XML_wpg;
+    else if (xServiceInfo->supportsService("com.sun.star.drawing.GraphicObjectShape"))
+        nNamespace = XML_pic;
+    oox::drawingml::ShapeExport aExport(nNamespace, m_pAttrOutput->GetSerializer(), 0, m_pFilter, oox::drawingml::DrawingML::DOCUMENT_DOCX, m_pAttrOutput);
     aExport.WriteShape(xShape);
 }
 
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index 8b6a2bd..f04d653 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -332,15 +332,20 @@ void DocxSdrExport::Impl::writeDMLDrawing(const SdrObject* pSdrObject, const SwF
     sax_fastparser::XFastAttributeListRef xDocPrAttrListRef(pDocPrAttrList);
     pFS->singleElementNS(XML_wp, XML_docPr, xDocPrAttrListRef);
 
+    uno::Reference<drawing::XShape> xShape(const_cast<SdrObject*>(pSdrObject)->getUnoShape(), uno::UNO_QUERY_THROW);
+    uno::Reference<lang::XServiceInfo> xServiceInfo(xShape, uno::UNO_QUERY_THROW);
+    const char* pNamespace = "http://schemas.microsoft.com/office/word/2010/wordprocessingShape";
+    if (xServiceInfo->supportsService("com.sun.star.drawing.GroupShape"))
+        pNamespace = "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup";
+    else if (xServiceInfo->supportsService("com.sun.star.drawing.GraphicObjectShape"))
+        pNamespace = "http://schemas.openxmlformats.org/drawingml/2006/picture";
     pFS->startElementNS(XML_a, XML_graphic,
                         FSNS(XML_xmlns, XML_a), "http://schemas.openxmlformats.org/drawingml/2006/main",
                         FSEND);
-    const SdrObjGroup* pObjGroup = PTR_CAST(SdrObjGroup, pSdrObject);
     pFS->startElementNS(XML_a, XML_graphicData,
-                        XML_uri, (pObjGroup ? "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" : "http://schemas.microsoft.com/office/word/2010/wordprocessingShape"),
+                        XML_uri, pNamespace,
                         FSEND);
 
-    uno::Reference<drawing::XShape> xShape(const_cast<SdrObject*>(pSdrObject)->getUnoShape(), uno::UNO_QUERY_THROW);
     m_rExport.OutputDML(xShape);
 
     pFS->endElementNS(XML_a, XML_graphicData);


More information about the Libreoffice-commits mailing list