oox/source/export/shapes.cxx | 3 +- sw/qa/extras/ooxmlexport/data/tdf143860_NonPrimitiveCustomShape.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport16.cxx | 11 ++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-)
New commits: commit 58ba1b975d75225222a27ff404281b9bff133143 Author: Regina Henschel <rb.hensc...@t-online.de> AuthorDate: Sun Aug 15 18:48:32 2021 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue Aug 17 09:38:44 2021 +0200 tdf#143860 non-primitive needs custGeom not prstGeom Error was, that for a custom shape with type 'non-primitive' method DMLPresetShapeExporter::WriteShape() was called. For such shapes the method GetOOXMLPresetGeometry() returns preset type 'rect' and in case the shape had no handles, that preset geometry was written. In my solution I exclude shapes of type 'non-primitive' from using DMLPresetShapeExporter, because such shapes never belong to a OOXML preset shape. Change-Id: I714f69c98fe15c2b7e70dc0a474a7f85ad757034 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120511 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.hensc...@t-online.de> Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120547 diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 23ea202db76b..1bcabf38eb49 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -843,7 +843,8 @@ ShapeExport& ShapeExport::WriteCustomShape( const Reference< XShape >& xShape ) bool bPresetWriteSuccessful = false; // Let the custom shapes what has name and preset information in OOXML, to be written // as preset ones with parameters. Try that with this converter class. - if (!sShapeType.startsWith("ooxml") && GetDocumentType() == DOCUMENT_DOCX + if (!sShapeType.startsWith("ooxml") && sShapeType != "non-primitive" + && GetDocumentType() == DOCUMENT_DOCX && xShape->getShapeType() == "com.sun.star.drawing.CustomShape") { DMLPresetShapeExporter aCustomShapeConverter(this, xShape); diff --git a/sw/qa/extras/ooxmlexport/data/tdf143860_NonPrimitiveCustomShape.odt b/sw/qa/extras/ooxmlexport/data/tdf143860_NonPrimitiveCustomShape.odt new file mode 100644 index 000000000000..6a1222877031 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf143860_NonPrimitiveCustomShape.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx index 2b3d92b55701..bd8338315381 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx @@ -70,6 +70,17 @@ protected: } }; +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf143860NonPrimitiveCustomShape, + "tdf143860_NonPrimitiveCustomShape.odt") +{ + // The document has a custom shape of type non-primitive without handles. Make sure that the shape + // is not exported with preset but with custom geometry. + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); + CPPUNIT_ASSERT(pXmlDocument); + assertXPath(pXmlDocument, "//a:prstGeom", 0); + assertXPath(pXmlDocument, "//a:custGeom", 1); +} + DECLARE_OOXMLEXPORT_TEST(testTdf136059, "tdf136059.odt") { CPPUNIT_ASSERT_EQUAL_MESSAGE("Contour has not been exported!", true,