diff options
author | Attila Bakos (NISZ) <bakos.attilakaroly@nisz.hu> | 2021-05-14 13:53:32 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2021-06-23 12:57:40 +0200 |
commit | 63cd67e5e18f01aca303131e148c80398a181a41 (patch) | |
tree | f096ec2a12b32517fa031019aa57e7acf2914998 /sw | |
parent | ae31c8503c568171cadc87a0b3de0ca23619afdd (diff) |
tdf#92525 tdf#142398: fix export of simple custom shapes
Most of the custom shapes were exported with DrawingML custom
geometry instead of DOCX preset shapes, losing their preset type,
adjust handles and text position. Add a preset exporter class to
handle all possible preset shapes later, and fix the export of
the following shapes now: "bevel", "blockArc", "bracePair",
"bracketPair", "hexagon", "octagon", "parallelogram", "plus",
"roundRect" and "triangle".
tdf#92525: keep text position in triangles with different
adjustments, too.
tdf#142398: part 1: export simple shapes as preset shapes.
Change-Id: I6aee74f7670bea8c1fe5909cbf307778ea728669
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115606
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/testCustomShapePresetExport.odt | bin | 0 -> 86157 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport16.cxx | 31 |
2 files changed, 31 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/testCustomShapePresetExport.odt b/sw/qa/extras/ooxmlexport/data/testCustomShapePresetExport.odt Binary files differnew file mode 100644 index 000000000000..4f132e760460 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/testCustomShapePresetExport.odt diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx index 5d567543bcec..dcaa4e6e5e54 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx @@ -129,6 +129,37 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testGutterTop, "gutter-top.docx") assertXPath(pXmlSettings, "/w:settings/w:gutterAtTop", 1); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCustomShapePresetExport, "testCustomShapePresetExport.odt") +{ + // Check if the load failed. + CPPUNIT_ASSERT(getPages()); + + // Check all shapes of the file + int nCount = 0; + for (int i = 1; i <= getShapes(); i++) + { + uno::Reference<beans::XPropertySet> xProperties(getShape(i), uno::UNO_QUERY); + if (!xProperties->getPropertySetInfo()->hasPropertyByName("CustomShapeGeometry")) + continue; + // Get the custom shape property + auto aCustomShapeGeometry = xProperties->getPropertyValue("CustomShapeGeometry") + .get<uno::Sequence<beans::PropertyValue>>(); + // Find for shape type + for (const auto& aCustomGeometryIterator : std::as_const(aCustomShapeGeometry)) + { + if (aCustomGeometryIterator.Name == "Type") + CPPUNIT_ASSERT_MESSAGE( + "This is an ooxml preset shape with custom geometry! Shape type lost!", + aCustomGeometryIterator.Value.get<OUString>() != "ooxml-non-primitive"); + // Without the fix, all shapes have ooxml-non-primitive type, and lost their + // real type (like triangle) with the textbox padding. + } + nCount++; + } + // Without the fix the count does not match. + CPPUNIT_ASSERT_EQUAL(17, nCount); +} + DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf69635, "tdf69635.docx") { xmlDocUniquePtr pXmlHeader1 = parseExport("word/header1.xml"); |