oox/source/export/shapes.cxx | 6 +-- sd/qa/unit/data/odp/tdf109169_Diamond.odp |binary sd/qa/unit/data/odp/tdf109169_Octagon.odp |binary sd/qa/unit/export-tests-ooxml3.cxx | 46 ++++++++++++++++++++++++++++++ 4 files changed, 49 insertions(+), 3 deletions(-)
New commits: commit b195cf4db4c21da3cf754689fb22f0b6a904a03e Author: Regina Henschel <rb.hensc...@t-online.de> AuthorDate: Fri Apr 15 15:04:16 2022 +0200 Commit: Regina Henschel <rb.hensc...@t-online.de> CommitDate: Fri Apr 15 22:16:40 2022 +0200 tdf#109169 use custGeom for Octagon Bevel shape The shapes 'Octagon Bevel', type col_60da8460, and 'Diamond Bevel', type col-502ad400, are LO specific preset shapes. They have neither a counterpart in MS binary nor in OOXML. So they need to be exported with custGeom. To force custGeom these shape types are moved from vDenylist to vAllowlist. These shapes were exported as prst='rect' before. Change-Id: I9619345812b6dba8f14ec2cc6a92ae808a56b595 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133069 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.hensc...@t-online.de> diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index e4d378bd6111..3308d5ab4492 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -551,8 +551,6 @@ static bool lcl_IsOnDenylist(OUString const & rShapeType) u"flower", u"bracket-pair", u"brace-pair", - u"col-60da8460", - u"col-502ad400", u"quad-bevel", u"round-rectangular-callout", u"rectangular-callout", @@ -605,7 +603,9 @@ static bool lcl_IsOnAllowlist(OUString const & rShapeType) { static const std::initializer_list<std::u16string_view> vAllowlist = { u"heart", - u"puzzle" + u"puzzle", + u"col-60da8460", + u"col-502ad400" }; return std::find(vAllowlist.begin(), vAllowlist.end(), rShapeType) != vAllowlist.end(); diff --git a/sd/qa/unit/data/odp/tdf109169_Diamond.odp b/sd/qa/unit/data/odp/tdf109169_Diamond.odp new file mode 100644 index 000000000000..cd6a18d1b318 Binary files /dev/null and b/sd/qa/unit/data/odp/tdf109169_Diamond.odp differ diff --git a/sd/qa/unit/data/odp/tdf109169_Octagon.odp b/sd/qa/unit/data/odp/tdf109169_Octagon.odp new file mode 100644 index 000000000000..f35e746f3b28 Binary files /dev/null and b/sd/qa/unit/data/odp/tdf109169_Octagon.odp differ diff --git a/sd/qa/unit/export-tests-ooxml3.cxx b/sd/qa/unit/export-tests-ooxml3.cxx index 3f4bec336ef1..23486c66f254 100644 --- a/sd/qa/unit/export-tests-ooxml3.cxx +++ b/sd/qa/unit/export-tests-ooxml3.cxx @@ -11,6 +11,7 @@ #include <officecfg/Office/Common.hxx> #include "sdmodeltestbase.hxx" #include <comphelper/sequence.hxx> +#include <comphelper/sequenceashashmap.hxx> #include <editeng/eeitem.hxx> #include <editeng/editobj.hxx> #include <editeng/numitem.hxx> @@ -21,6 +22,7 @@ #include <svx/svdoole2.hxx> #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp> +#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> #include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/frame/XLoadable.hpp> #include <com/sun/star/lang/Locale.hpp> @@ -107,6 +109,8 @@ public: void testTdf140912_PicturePlaceholder(); void testEnhancedPathViewBox(); void testTdf74670(); + void testTdf109169_OctagonBevel(); + void testTdf109169_DiamondBevel(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest3); @@ -184,6 +188,8 @@ public: CPPUNIT_TEST(testTdf140912_PicturePlaceholder); CPPUNIT_TEST(testEnhancedPathViewBox); CPPUNIT_TEST(testTdf74670); + CPPUNIT_TEST(testTdf109169_OctagonBevel); + CPPUNIT_TEST(testTdf109169_DiamondBevel); CPPUNIT_TEST_SUITE_END(); virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override @@ -1919,6 +1925,46 @@ void SdOOXMLExportTest3::testTdf74670() CPPUNIT_ASSERT_EQUAL(1, nImageFiles); } +void SdOOXMLExportTest3::testTdf109169_OctagonBevel() +{ + // The document has a shape 'Octagon Bevel'. It consists of an octagon with 8 points and eight + // facets with 4 points each, total 8+8*4=40 points. Without the patch it was exported as + // rectangle and thus had 4 points. + ::sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf109169_Octagon.odp"), ODP); + xDocShRef = saveAndReload(xDocShRef.get(), PPTX); + + auto xPropSet(getShapeFromPage(0, 0, xDocShRef)); + auto aGeomPropSeq = xPropSet->getPropertyValue("CustomShapeGeometry") + .get<uno::Sequence<beans::PropertyValue>>(); + comphelper::SequenceAsHashMap aCustomShapeGeometry(aGeomPropSeq); + auto aPathSeq((aCustomShapeGeometry["Path"]).get<uno::Sequence<beans::PropertyValue>>()); + comphelper::SequenceAsHashMap aPath(aPathSeq); + auto aCoordinates( + (aPath["Coordinates"]).get<uno::Sequence<drawing::EnhancedCustomShapeParameterPair>>()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(40), aCoordinates.getLength()); +} + +void SdOOXMLExportTest3::testTdf109169_DiamondBevel() +{ + // The document has a shape 'Diamond Bevel'. It consists of a diamond with 4 points and four + // facets with 4 points each, total 4+4*4=20 points. Without the patch it was exported as + // rectangle and thus had 4 points. + ::sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf109169_Diamond.odp"), ODP); + xDocShRef = saveAndReload(xDocShRef.get(), PPTX); + + auto xPropSet(getShapeFromPage(0, 0, xDocShRef)); + auto aGeomPropSeq = xPropSet->getPropertyValue("CustomShapeGeometry") + .get<uno::Sequence<beans::PropertyValue>>(); + comphelper::SequenceAsHashMap aCustomShapeGeometry(aGeomPropSeq); + auto aPathSeq((aCustomShapeGeometry["Path"]).get<uno::Sequence<beans::PropertyValue>>()); + comphelper::SequenceAsHashMap aPath(aPathSeq); + auto aCoordinates( + (aPath["Coordinates"]).get<uno::Sequence<drawing::EnhancedCustomShapeParameterPair>>()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(20), aCoordinates.getLength()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest3); CPPUNIT_PLUGIN_IMPLEMENT();