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
This commit is contained in:
@@ -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
|
||||||
|
if (GetDocumentType() != DOCUMENT_DOCX)
|
||||||
|
{
|
||||||
pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND );
|
pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND );
|
||||||
WriteNonVisualDrawingProperties( xShape, IDS( TextShape ) );
|
WriteNonVisualDrawingProperties( xShape, IDS( TextShape ) );
|
||||||
|
}
|
||||||
pFS->singleElementNS( mnXmlNamespace, XML_cNvSpPr, XML_txBox, "1", FSEND );
|
pFS->singleElementNS( mnXmlNamespace, XML_cNvSpPr, XML_txBox, "1", FSEND );
|
||||||
|
if (GetDocumentType() != DOCUMENT_DOCX)
|
||||||
|
{
|
||||||
WriteNonVisualProperties( xShape );
|
WriteNonVisualProperties( xShape );
|
||||||
pFS->endElementNS( mnXmlNamespace, XML_nvSpPr );
|
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 )
|
|||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
BIN
sw/qa/extras/ooxmlexport/data/bezier.odt
Normal file
BIN
sw/qa/extras/ooxmlexport/data/bezier.odt
Normal file
Binary file not shown.
@@ -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");
|
||||||
|
Reference in New Issue
Block a user