summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikhil Walvekar <nikhil.walvekar@synerzip.com>2014-02-24 14:25:09 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-02-26 06:03:36 -0600
commit3c0a7cf4f67720f2cca2c4eb543f838d5b644e7f (patch)
treee533a18e3d6e0dc50bcc9b268dacced96b2ac697
parentb06820d74c701e305f007d4cb91f939e5644d11d (diff)
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@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--sw/source/filter/ww8/docxsdrexport.cxx14
1 files changed, 13 insertions, 1 deletions
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index 170be93f62ac..bb771c8f7df7 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);