[Libreoffice-commits] core.git: oox/source sw/qa
Regina Henschel (via logerrit)
logerrit at kemper.freedesktop.org
Sun Aug 15 19:40:43 UTC 2021
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 24a8e3209b1d7c2f4f13d5cc3f69726253af9eff
Author: Regina Henschel <rb.henschel at t-online.de>
AuthorDate: Sun Aug 15 18:48:32 2021 +0200
Commit: Regina Henschel <rb.henschel at t-online.de>
CommitDate: Sun Aug 15 21:40:07 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.henschel at t-online.de>
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 325387f4991d..9b6bb4f8ed4f 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 17d6204f97fd..51b713dc0d68 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -73,6 +73,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_EXPORTONLY_TEST(testWrapPolygonCurve, "tdf136386_WrapPolygonCurve.odt")
{
// Document has a curve with contour wrap and 'outside only'. Error was, that type 'square' was
More information about the Libreoffice-commits
mailing list