tdf#47365 PPTX export: support loop attribute

Follow-up to commit ad2809b4b6
"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>
This commit is contained in:
Tibor Nagy
2021-06-01 20:09:07 +02:00
committed by László Németh
parent 92d731d256
commit 312334f848
5 changed files with 52 additions and 0 deletions

View File

@@ -52,6 +52,7 @@ enum class Relationship
OFFICEDOCUMENT,
OLEOBJECT,
PACKAGE,
PRESPROPS,
SETTINGS,
SHAREDSTRINGS,
SLIDE,

View File

@@ -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"},

View File

@@ -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);

View File

@@ -151,6 +151,8 @@ private:
void WriteAuthors();
void WritePresentationProps();
/// If this is PPTM, output the VBA stream.
void WriteVBA();
};

View File

@@ -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);