Kaydet (Commit) 3a45a4e8 authored tarafından Miklos Vajna's avatar Miklos Vajna

oox: fix export of TextShapes in DOCX

This was the last shape type that unconditionally wrote XML_sp for the
shape element, which is invalid for DOCX.

Change-Id: I3a6f8e6fd8ebbe663dce9ed4453396c3ec91c38a
üst affcea41
...@@ -905,14 +905,20 @@ ShapeExport& ShapeExport::WriteTextShape( Reference< XShape > xShape ) ...@@ -905,14 +905,20 @@ ShapeExport& ShapeExport::WriteTextShape( Reference< XShape > xShape )
{ {
FSHelperPtr pFS = GetFS(); FSHelperPtr pFS = GetFS();
pFS->startElementNS( mnXmlNamespace, XML_sp, FSEND ); pFS->startElementNS( mnXmlNamespace, (GetDocumentType() != DOCUMENT_DOCX ? XML_sp : XML_wsp), FSEND );
// non visual shape properties // non visual shape properties
pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND ); if (GetDocumentType() != DOCUMENT_DOCX)
WriteNonVisualDrawingProperties( xShape, IDS( TextShape ) ); {
pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND );
WriteNonVisualDrawingProperties( xShape, IDS( TextShape ) );
}
pFS->singleElementNS( mnXmlNamespace, XML_cNvSpPr, XML_txBox, "1", FSEND ); pFS->singleElementNS( mnXmlNamespace, XML_cNvSpPr, XML_txBox, "1", FSEND );
WriteNonVisualProperties( xShape ); if (GetDocumentType() != DOCUMENT_DOCX)
pFS->endElementNS( mnXmlNamespace, XML_nvSpPr ); {
WriteNonVisualProperties( xShape );
pFS->endElementNS( mnXmlNamespace, XML_nvSpPr );
}
// visual shape properties // visual shape properties
pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND ); pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND );
...@@ -923,7 +929,7 @@ ShapeExport& ShapeExport::WriteTextShape( Reference< XShape > xShape ) ...@@ -923,7 +929,7 @@ ShapeExport& ShapeExport::WriteTextShape( Reference< XShape > xShape )
WriteTextBox( xShape, mnXmlNamespace ); WriteTextBox( xShape, mnXmlNamespace );
pFS->endElementNS( mnXmlNamespace, XML_sp ); pFS->endElementNS( mnXmlNamespace, (GetDocumentType() != DOCUMENT_DOCX ? XML_sp : XML_wsp) );
return *this; return *this;
} }
......
...@@ -2175,6 +2175,14 @@ DECLARE_OOXMLEXPORT_TEST(testRelorientation, "relorientation.docx") ...@@ -2175,6 +2175,14 @@ DECLARE_OOXMLEXPORT_TEST(testRelorientation, "relorientation.docx")
CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.GroupShape"), xShapeDescriptor->getShapeType()); CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.GroupShape"), xShapeDescriptor->getShapeType());
} }
DECLARE_OOXMLEXPORT_TEST(testBezier, "bezier.odt")
{
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
// Check that no shape got lost: a bezier, a line and a text shape.
CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xDraws->getCount());
}
DECLARE_OOXMLEXPORT_TEST(testTrackChangesDeletedParagraphMark, "testTrackChangesDeletedParagraphMark.docx") DECLARE_OOXMLEXPORT_TEST(testTrackChangesDeletedParagraphMark, "testTrackChangesDeletedParagraphMark.docx")
{ {
xmlDocPtr pXmlDoc = parseExport("word/document.xml"); xmlDocPtr pXmlDoc = parseExport("word/document.xml");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment