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

Nikhil Walvekar nikhil.walvekar at synerzip.com
Wed Feb 26 04:04:04 PST 2014


 sw/source/filter/ww8/docxsdrexport.cxx |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 3c0a7cf4f67720f2cca2c4eb543f838d5b644e7f
Author: Nikhil Walvekar <nikhil.walvekar at synerzip.com>
Date:   Mon Feb 24 14:25:09 2014 +0530

    fdo#75254 Unsupported shape in DML writing was causing document corruption.
    
    Added a way to avoid DML export for un-supported shapes. We need to fix
    those properly by adding proper support.
    
    Change-Id: I0aeac1cc3b6e807a0427df9a9695446148d2ba38
    Reviewed-on: https://gerrit.libreoffice.org/8202
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index 170be93..bb771c8 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -103,6 +103,7 @@ struct DocxSdrExport::Impl
     /// Writes wp wrapper code around an SdrObject, which itself is written using drawingML syntax.
     void writeDMLDrawing(const SdrObject* pSdrObj, const SwFrmFmt* pFrmFmt, int nAnchorId);
     void textFrameShadow(const SwFrmFmt& rFrmFmt);
+    bool isSupportedDMLShape(com::sun::star::uno::Reference<com::sun::star::drawing::XShape> xShape);
 };
 
 DocxSdrExport::DocxSdrExport(DocxExport& rExport, sax_fastparser::FSHelperPtr pSerializer, oox::drawingml::DrawingML* pDrawingML)
@@ -549,6 +550,17 @@ void DocxSdrExport::Impl::textFrameShadow(const SwFrmFmt& rFrmFmt)
                                    FSEND);
 }
 
+bool DocxSdrExport::Impl::isSupportedDMLShape(uno::Reference<drawing::XShape> xShape)
+{
+    bool supported = true;
+
+    uno::Reference<lang::XServiceInfo> xServiceInfo(xShape, uno::UNO_QUERY_THROW);
+    if (xServiceInfo->supportsService("com.sun.star.drawing.PolyPolygonShape"))
+        supported = false;
+
+    return supported;
+}
+
 void DocxSdrExport::writeDMLAndVMLDrawing(const SdrObject* sdrObj, const SwFrmFmt& rFrmFmt,const Point& rNdTopLeft, int nAnchorId)
 {
     // Depending on the shape type, we actually don't write the shape as DML.
@@ -557,7 +569,7 @@ void DocxSdrExport::writeDMLAndVMLDrawing(const SdrObject* sdrObj, const SwFrmFm
     uno::Reference<drawing::XShape> xShape(const_cast<SdrObject*>(sdrObj)->getUnoShape(), uno::UNO_QUERY_THROW);
     MSO_SPT eShapeType = EscherPropertyContainer::GetCustomShapeType(xShape, nMirrorFlags, sShapeType);
 
-    if (eShapeType != ESCHER_ShpInst_TextPlainText)
+    if (eShapeType != ESCHER_ShpInst_TextPlainText && m_pImpl->isSupportedDMLShape(xShape))
     {
         m_pImpl->m_pSerializer->startElementNS(XML_mc, XML_AlternateContent, FSEND);
 


More information about the Libreoffice-commits mailing list