oox/source/export/shapes.cxx       |    7 +++++++
 sd/qa/unit/data/odp/ole_icon.odp   |binary
 sd/qa/unit/export-tests-ooxml3.cxx |   17 +++++++++++++++++
 3 files changed, 24 insertions(+)

New commits:
commit 0b224cc5f3c896d8b0064d5cbadc6fce66c8beb9
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Wed Nov 2 09:30:30 2022 +0100
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Mon Nov 14 12:19:11 2022 +0100

    Revert "Revert "tdf#151622 PPTX: fix export of show as icon option""
    
    This reverts commit b652ebda7fa4e6c8db2f934bf4c8d2927f5c2332.
    
    Adapt unittest to UnoApiTest
    
    Change-Id: I6a1e42d4b445efdb48dab35f0bd5110aa52b0d74
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142156
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-by: László Németh <nem...@numbertext.org>

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 88be4362b228..9d00dff8348c 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -47,6 +47,7 @@
 #include <com/sun/star/drawing/ConnectorType.hpp>
 #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
 #include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
+#include <com/sun/star/embed/Aspects.hpp>
 #include <com/sun/star/embed/EmbedStates.hpp>
 #include <com/sun/star/embed/XEmbeddedObject.hpp>
 #include <com/sun/star/embed/XEmbedPersist.hpp>
@@ -2616,6 +2617,10 @@ ShapeExport& ShapeExport::WriteOLE2Shape( const 
Reference< XShape >& xShape )
         TOOLS_WARN_EXCEPTION("oox.shape", "ShapeExport::WriteOLEObject");
     }
 
+    sal_Int64 nAspect;
+    bool bShowAsIcon = (xPropSet->getPropertyValue("Aspect") >>= nAspect)
+                       && nAspect == embed::Aspects::MSOLE_ICON;
+
     OUString const sRelId = mpFB->addRelation(
         mpFS->getOutputStream(), sRelationType,
         Concat2View(OUString::createFromAscii(GetRelationCompPrefix()) + 
sFileName));
@@ -2642,6 +2647,7 @@ ShapeExport& ShapeExport::WriteOLE2Shape( const 
Reference< XShape >& xShape )
     if (pProgID)
     {
         mpFS->startElementNS( mnXmlNamespace, XML_oleObj,
+                          XML_showAsIcon, sax_fastparser::UseIf("1", 
bShowAsIcon),
                           XML_progId, pProgID,
                           FSNS(XML_r, XML_id), sRelId,
                           XML_spid, "" );
@@ -2650,6 +2656,7 @@ ShapeExport& ShapeExport::WriteOLE2Shape( const 
Reference< XShape >& xShape )
     {
         mpFS->startElementNS( mnXmlNamespace, XML_oleObj,
 //?                                              XML_name, "Document",
+                          XML_showAsIcon, sax_fastparser::UseIf("1", 
bShowAsIcon),
                           FSNS(XML_r, XML_id), sRelId,
                           // The spec says that this is a required attribute, 
but PowerPoint can only handle an empty value.
                           XML_spid, "" );
diff --git a/sd/qa/unit/data/odp/ole_icon.odp b/sd/qa/unit/data/odp/ole_icon.odp
new file mode 100644
index 000000000000..073899c6e564
Binary files /dev/null and b/sd/qa/unit/data/odp/ole_icon.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml3.cxx 
b/sd/qa/unit/export-tests-ooxml3.cxx
index e5e8cee6c390..c32055df3f42 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -129,6 +129,7 @@ public:
     void testTdf94122_autoColor();
     void testTdf124333();
     void testAutofittedTextboxIndent();
+    void testTdf151622_oleIcon();
 
     CPPUNIT_TEST_SUITE(SdOOXMLExportTest3);
 
@@ -218,6 +219,7 @@ public:
     CPPUNIT_TEST(testTdf94122_autoColor);
     CPPUNIT_TEST(testTdf124333);
     CPPUNIT_TEST(testAutofittedTextboxIndent);
+    CPPUNIT_TEST(testTdf151622_oleIcon);
     CPPUNIT_TEST_SUITE_END();
 
     virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override
@@ -2074,6 +2076,21 @@ void SdOOXMLExportTest3::testAutofittedTextboxIndent()
                 "712800");
 }
 
+void SdOOXMLExportTest3::testTdf151622_oleIcon()
+{
+    loadFromURL(u"odp/ole_icon.odp");
+
+    utl::TempFileNamed tmpfile = save("Impress Office Open XML");
+
+    xmlDocUniquePtr pXml = parseExport(tmpfile, "ppt/slides/slide1.xml");
+
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expression: prop
+    // - In ..., XPath '//p:oleObj' no attribute 'showAsIcon' exist
+    // i.e. show as icon option wasn't exported.
+    assertXPath(pXml, "//p:oleObj", "showAsIcon", "1");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest3);
 
 CPPUNIT_PLUGIN_IMPLEMENT();

Reply via email to