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

Miklos Vajna vmiklos at collabora.co.uk
Tue Dec 17 02:54:05 PST 2013


 sw/source/filter/ww8/docxsdrexport.cxx |   33 ++++++++++++++++++++++-----------
 1 file changed, 22 insertions(+), 11 deletions(-)

New commits:
commit 64dc8acbf13eff6d52056a9464bba550651dce95
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Dec 17 11:31:07 2013 +0100

    DocxSdrExport: there is no DML syntax for watermarks
    
    At least what we wrote previously is not accepted by Word and even Word
    2013 writes watermarks as VML-only.
    
    This fixes testWatermark in CppunitTest_sw_ooxmlexport when DML export is
    enabled in non-experimental mode.
    
    Change-Id: I231014dd7ad60b5a4b0d79e76cdc3386641af032

diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index 57affcf..8b6a2bd 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -351,20 +351,31 @@ void DocxSdrExport::Impl::writeDMLDrawing(const SdrObject* pSdrObject, const SwF
 
 void DocxSdrExport::writeDMLAndVMLDrawing(const SdrObject* sdrObj, const SwFrmFmt& rFrmFmt,const Point& rNdTopLeft, int nAnchorId)
 {
-    m_pImpl->m_pSerializer->startElementNS(XML_mc, XML_AlternateContent, FSEND);
+    // Depending on the shape type, we actually don't write the shape as DML.
+    OUString sShapeType;
+    sal_uInt32 nMirrorFlags = 0;
+    uno::Reference<drawing::XShape> xShape(const_cast<SdrObject*>(sdrObj)->getUnoShape(), uno::UNO_QUERY_THROW);
+    MSO_SPT eShapeType = EscherPropertyContainer::GetCustomShapeType(xShape, nMirrorFlags, sShapeType);
 
-    const SdrObjGroup* pObjGroup = PTR_CAST(SdrObjGroup, sdrObj);
-    m_pImpl->m_pSerializer->startElementNS(XML_mc, XML_Choice,
-                                           XML_Requires, (pObjGroup ? "wpg" : "wps"),
-                                           FSEND);
-    m_pImpl->writeDMLDrawing(sdrObj, &rFrmFmt, nAnchorId);
-    m_pImpl->m_pSerializer->endElementNS(XML_mc, XML_Choice);
+    if (eShapeType != ESCHER_ShpInst_TextPlainText)
+    {
+        m_pImpl->m_pSerializer->startElementNS(XML_mc, XML_AlternateContent, FSEND);
+
+        const SdrObjGroup* pObjGroup = PTR_CAST(SdrObjGroup, sdrObj);
+        m_pImpl->m_pSerializer->startElementNS(XML_mc, XML_Choice,
+                                               XML_Requires, (pObjGroup ? "wpg" : "wps"),
+                                               FSEND);
+        m_pImpl->writeDMLDrawing(sdrObj, &rFrmFmt, nAnchorId);
+        m_pImpl->m_pSerializer->endElementNS(XML_mc, XML_Choice);
 
-    m_pImpl->m_pSerializer->startElementNS(XML_mc, XML_Fallback, FSEND);
-    writeVMLDrawing(sdrObj, rFrmFmt, rNdTopLeft);
-    m_pImpl->m_pSerializer->endElementNS(XML_mc, XML_Fallback);
+        m_pImpl->m_pSerializer->startElementNS(XML_mc, XML_Fallback, FSEND);
+        writeVMLDrawing(sdrObj, rFrmFmt, rNdTopLeft);
+        m_pImpl->m_pSerializer->endElementNS(XML_mc, XML_Fallback);
 
-    m_pImpl->m_pSerializer->endElementNS(XML_mc, XML_AlternateContent);
+        m_pImpl->m_pSerializer->endElementNS(XML_mc, XML_AlternateContent);
+    }
+    else
+        writeVMLDrawing(sdrObj, rFrmFmt, rNdTopLeft);
 }
 
 void DocxSdrExport::writeDiagram(const SdrObject* sdrObject, const Size& size)


More information about the Libreoffice-commits mailing list