summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTibor Nagy <nagy.tibor2@nisz.hu>2021-06-01 20:09:07 +0200
committerLászló Németh <nemeth@numbertext.org>2021-06-08 16:37:40 +0200
commit312334f8488a668e9b5302959b60292ce151e4fc (patch)
treeaf759cd962e511fc4665ee88d3cd3d363631300c
parent92d731d256d8a030ee1a150b04f0a7597171fb52 (diff)
tdf#47365 PPTX export: support loop attribute
Follow-up to commit ad2809b4b6dc4837b0c1cadd89a14a234d995fb2 "tdf#47365: import support for PPTX presentation's loop attribute". Change-Id: I7f75acc2bbd6301384883691d5ef4069b1757a05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116560 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
-rw-r--r--include/oox/token/relationship.hxx1
-rw-r--r--oox/source/token/relationship.inc1
-rw-r--r--sd/qa/unit/export-tests-ooxml1.cxx16
-rw-r--r--sd/source/filter/eppt/epptooxml.hxx2
-rw-r--r--sd/source/filter/eppt/pptx-epptooxml.cxx32
5 files changed, 52 insertions, 0 deletions
diff --git a/include/oox/token/relationship.hxx b/include/oox/token/relationship.hxx
index 3f798b1b2529..3c3a4336fe25 100644
--- a/include/oox/token/relationship.hxx
+++ b/include/oox/token/relationship.hxx
@@ -52,6 +52,7 @@ enum class Relationship
OFFICEDOCUMENT,
OLEOBJECT,
PACKAGE,
+ PRESPROPS,
SETTINGS,
SHAREDSTRINGS,
SLIDE,
diff --git a/oox/source/token/relationship.inc b/oox/source/token/relationship.inc
index f54962715fab..4a772671a96f 100644
--- a/oox/source/token/relationship.inc
+++ b/oox/source/token/relationship.inc
@@ -32,6 +32,7 @@
{Relationship::OFFICEDOCUMENT, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"},
{Relationship::OLEOBJECT, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"},
{Relationship::PACKAGE, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"},
+{Relationship::PRESPROPS, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/presProps"},
{Relationship::SETTINGS, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings"},
{Relationship::SHAREDSTRINGS, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings"},
{Relationship::SLIDE, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide"},
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx
index d5c2d8d41a31..a450e6d890eb 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -61,6 +61,7 @@ using namespace css;
class SdOOXMLExportTest1 : public SdModelTestBaseXML
{
public:
+ void testTdf47365();
void testTdf125071();
void testTdf54037();
void testFdo90607();
@@ -119,6 +120,7 @@ public:
CPPUNIT_TEST_SUITE(SdOOXMLExportTest1);
+ CPPUNIT_TEST(testTdf47365);
CPPUNIT_TEST(testTdf125071);
CPPUNIT_TEST(testTdf54037);
CPPUNIT_TEST(testFdo90607);
@@ -204,6 +206,20 @@ void checkFontAttributes( const SdrTextObj* pObj, ItemValue nVal, sal_uInt32 nId
}
+void SdOOXMLExportTest1::testTdf47365()
+{
+ sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/loopNoPause.pptx"), PPTX );
+ utl::TempFile tempFile;
+ xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+ xDocShRef->DoClose();
+
+ xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/presProps.xml");
+
+ assertXPath(pXmlDoc, "/p:presentationPr/p:showPr", "loop", "1");
+
+ assertXPath(pXmlDoc, "/p:presentationPr/p:showPr", "showNarration", "1");
+}
+
void SdOOXMLExportTest1::testTdf125071()
{
sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf125071.pptx"), PPTX);
diff --git a/sd/source/filter/eppt/epptooxml.hxx b/sd/source/filter/eppt/epptooxml.hxx
index 43beea7ca032..93029f073487 100644
--- a/sd/source/filter/eppt/epptooxml.hxx
+++ b/sd/source/filter/eppt/epptooxml.hxx
@@ -151,6 +151,8 @@ private:
void WriteAuthors();
+ void WritePresentationProps();
+
/// If this is PPTM, output the VBA stream.
void WriteVBA();
};
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index a1a6dd6cad5d..6a8502361061 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -50,6 +50,7 @@
#include <com/sun/star/presentation/XCustomPresentationSupplier.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/presentation/XPresentationSupplier.hpp>
#include <oox/export/utils.hxx>
@@ -71,6 +72,10 @@
FSNS(XML_xmlns, XML_p15), OUStringToOString(this->getNamespaceURL(OOX_NS(p15)), RTL_TEXTENCODING_UTF8).getStr(), \
FSNS(XML_xmlns, XML_mc), OUStringToOString(this->getNamespaceURL(OOX_NS(mce)), RTL_TEXTENCODING_UTF8).getStr()
+// presentationPr namespace
+#define PPRNMSS FSNS(XML_xmlns, XML_a), OUStringToOString(this->getNamespaceURL(OOX_NS(dml)), RTL_TEXTENCODING_UTF8).getStr(), \
+ FSNS(XML_xmlns, XML_r), OUStringToOString(this->getNamespaceURL(OOX_NS(officeRel)), RTL_TEXTENCODING_UTF8).getStr(), \
+ FSNS(XML_xmlns, XML_p), OUStringToOString(this->getNamespaceURL(OOX_NS(ppt)), RTL_TEXTENCODING_UTF8).getStr()
using namespace ::com::sun::star;
using namespace ::com::sun::star::animations;
@@ -441,6 +446,8 @@ bool PowerPointExport::exportDocument()
WriteCustomSlideShow();
+ WritePresentationProps();
+
WriteAuthors();
WriteVBA();
@@ -1052,6 +1059,31 @@ sal_Int32 PowerPointExport::GetAuthorIdAndLastIndex(const OUString& sAuthor, sal
return maAuthors[ sAuthor ].nId;
}
+void PowerPointExport::WritePresentationProps()
+{
+ Reference<XPresentationSupplier> xPresentationSupplier(mXModel, uno::UNO_QUERY);
+ if (xPresentationSupplier.is())
+ {
+ Reference<beans::XPropertySet> xPresentationProps(xPresentationSupplier->getPresentation(),
+ uno::UNO_QUERY);
+ bool bEndlessVal = xPresentationProps->getPropertyValue("IsEndless").get<bool>();
+
+ FSHelperPtr pFS = openFragmentStreamWithSerializer(
+ "ppt/presProps.xml",
+ "application/vnd.openxmlformats-officedocument.presentationml.presProps+xml");
+
+ addRelation(mPresentationFS->getOutputStream(),
+ oox::getRelationship(Relationship::PRESPROPS), u"presProps.xml");
+
+ pFS->startElementNS(XML_p, XML_presentationPr, PPRNMSS);
+
+ pFS->singleElementNS(XML_p, XML_showPr, XML_loop, sax_fastparser::UseIf("1", bEndlessVal),
+ XML_showNarration, sax_fastparser::UseIf("1", bEndlessVal));
+
+ pFS->endElementNS(XML_p, XML_presentationPr);
+ }
+}
+
bool PowerPointExport::WriteComments(sal_uInt32 nPageNum)
{
Reference< XAnnotationAccess > xAnnotationAccess(mXDrawPage, uno::UNO_QUERY);