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 b51e9f32410d346a9b5cba1bf3e6a485e17f119d
Author:     Regina Henschel <rb.hensc...@t-online.de>
AuthorDate: Fri Apr 15 15:04:16 2022 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Apr 18 13:28:09 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>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133113

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 97d09ca1be2e..5f0f04bf6bda 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 40031977345d..96642cdc73ec 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -11,6 +11,7 @@
 #include "sdmodeltestbase.hxx"
 #include <comphelper/propertysequence.hxx>
 #include <comphelper/sequence.hxx>
+#include <comphelper/sequenceashashmap.hxx>
 #include <editeng/eeitem.hxx>
 #include <editeng/editobj.hxx>
 #include <editeng/outlobj.hxx>
@@ -34,6 +35,7 @@
 #include <com/sun/star/awt/Rectangle.hpp>
 #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
 #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/style/LineSpacing.hpp>
 #include <com/sun/star/style/LineSpacingMode.hpp>
@@ -126,6 +128,8 @@ public:
     void testTdf147121();
     void testTdf140912_PicturePlaceholder();
     void testEnhancedPathViewBox();
+    void testTdf109169_OctagonBevel();
+    void testTdf109169_DiamondBevel();
 
     CPPUNIT_TEST_SUITE(SdOOXMLExportTest3);
 
@@ -202,6 +206,8 @@ public:
     CPPUNIT_TEST(testTdf147121);
     CPPUNIT_TEST(testTdf140912_PicturePlaceholder);
     CPPUNIT_TEST(testEnhancedPathViewBox);
+    CPPUNIT_TEST(testTdf109169_OctagonBevel);
+    CPPUNIT_TEST(testTdf109169_DiamondBevel);
     CPPUNIT_TEST_SUITE_END();
 
     virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override
@@ -1912,6 +1918,46 @@ void SdOOXMLExportTest3::testEnhancedPathViewBox()
     CPPUNIT_ASSERT_EQUAL(sal_Int32(2045), aBoundRectangle.Width);
 }
 
+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();

Reply via email to