[Libreoffice-commits] core.git: Branch 'distro/collabora/cd-5.3' - sd/qa sd/source
Jan Holesovsky
kendy at collabora.com
Thu Aug 10 14:54:55 UTC 2017
sd/qa/unit/data/pptx/tdf111518.pptx |binary
sd/qa/unit/export-tests-ooxml2.cxx | 16 ++++++
sd/source/filter/eppt/pptx-epptooxml.cxx | 71 +++++++++++++++++++++++--------
3 files changed, 70 insertions(+), 17 deletions(-)
New commits:
commit 9d473dd43a1280c8a921dc25c36ee395f3da8633
Author: Jan Holesovsky <kendy at collabora.com>
Date: Wed Aug 9 14:52:17 2017 +0200
tdf#111518 pptx: Add support for export of p:animMotion.
Contains also the following patches:
tdf#111518 pptx: Unit test.
related tdf#111518 pptx: These attributes are not supposed to be here.
Change-Id: Idd5692c803b1e8d434abc0154419a341934d0753
Reviewed-on: https://gerrit.libreoffice.org/40973
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/sd/qa/unit/data/pptx/tdf111518.pptx b/sd/qa/unit/data/pptx/tdf111518.pptx
new file mode 100644
index 000000000000..a0d77617f67a
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf111518.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index e2130861e515..817cad398a13 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -104,6 +104,7 @@ public:
void testTdf92076();
void testTdf59046();
void testTdf105739();
+ void testTdf111518();
CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
@@ -131,6 +132,7 @@ public:
CPPUNIT_TEST(testTdf92076);
CPPUNIT_TEST(testTdf59046);
CPPUNIT_TEST(testTdf105739);
+ CPPUNIT_TEST(testTdf111518);
CPPUNIT_TEST_SUITE_END();
@@ -790,6 +792,20 @@ void SdOOXMLExportTest2::testTdf105739()
xShell->DoClose();
}
+void SdOOXMLExportTest2::testTdf111518()
+{
+ sd::DrawDocShellRef xShell = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf111518.pptx"), PPTX);
+ utl::TempFile tempFile;
+ tempFile.EnableKillingFile(false);
+ xShell = saveAndReload(xShell.get(), PPTX, &tempFile);
+ xShell->DoClose();
+
+ xmlDocPtr pXmlDocRels = parseExport(tempFile, "ppt/slides/slide1.xml");
+ assertXPath(pXmlDocRels,
+ "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:animMotion",
+ "path",
+ "M -3.54167E-6 -4.81481E-6 L 0.39037 -0.00069");
+}
CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 68b8372f2777..1f63910e6722 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -46,7 +46,7 @@
#include <com/sun/star/animations/EventTrigger.hpp>
#include <com/sun/star/animations/Timing.hpp>
#include <com/sun/star/animations/ValuePair.hpp>
-#include <com/sun/star/animations/XAnimateSet.hpp>
+#include <com/sun/star/animations/XAnimateMotion.hpp>
#include <com/sun/star/animations/XAnimationNode.hpp>
#include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
#include <com/sun/star/animations/XTransitionFilter.hpp>
@@ -883,18 +883,34 @@ void PowerPointExport::WriteAnimationAttributeName( const FSHelperPtr& pFS, cons
SAL_INFO("sd.eppt", "write attribute name: " << USS(rAttributeName));
- const char* sAttributeName = nullptr;
- if ( rAttributeName == "Visibility" ) {
- sAttributeName = "style.visibility";
- } else if ( rAttributeName == "X" ) {
- sAttributeName = "ppt_x";
- } else if ( rAttributeName == "Y" ) {
- sAttributeName = "ppt_y";
+ if (rAttributeName == "Visibility")
+ {
+ pFS->startElementNS(XML_p, XML_attrName, FSEND);
+ pFS->writeEscaped("style.visibility");
+ pFS->endElementNS(XML_p, XML_attrName);
+ }
+ else if (rAttributeName == "X")
+ {
+ pFS->startElementNS(XML_p, XML_attrName, FSEND);
+ pFS->writeEscaped("ppt_x");
+ pFS->endElementNS(XML_p, XML_attrName);
+ }
+ else if (rAttributeName == "Y")
+ {
+ pFS->startElementNS(XML_p, XML_attrName, FSEND);
+ pFS->writeEscaped("ppt_y");
+ pFS->endElementNS(XML_p, XML_attrName);
}
+ else if (rAttributeName == "X;Y")
+ {
+ pFS->startElementNS(XML_p, XML_attrName, FSEND);
+ pFS->writeEscaped("ppt_x");
+ pFS->endElementNS(XML_p, XML_attrName);
- pFS->startElementNS( XML_p, XML_attrName, FSEND );
- pFS->writeEscaped( sAttributeName );
- pFS->endElementNS( XML_p, XML_attrName );
+ pFS->startElementNS(XML_p, XML_attrName, FSEND);
+ pFS->writeEscaped("ppt_y");
+ pFS->endElementNS(XML_p, XML_attrName);
+ }
pFS->endElementNS( XML_p, XML_attrNameLst );
}
@@ -956,12 +972,29 @@ void PowerPointExport::WriteAnimationNodeAnimate( const FSHelperPtr& pFS, const
}
}
- pFS->startElementNS( XML_p, nXmlNodeType,
- XML_calcmode, pCalcMode,
- XML_valueType, pValueType,
- FSEND );
- WriteAnimationNodeAnimateInside( pFS, rXNode, bMainSeqChild, bSimple );
- pFS->endElementNS( XML_p, nXmlNodeType );
+ OUString aPath;
+ if (nXmlNodeType == XML_animMotion)
+ {
+ Reference<XAnimateMotion> rMotion(rXNode, UNO_QUERY);
+ if (rMotion.is())
+ rMotion->getPath() >>= aPath;
+ }
+
+ if (aPath.isEmpty())
+ {
+ pFS->startElementNS(XML_p, nXmlNodeType,
+ XML_calcmode, pCalcMode,
+ XML_valueType, pValueType,
+ FSEND);
+ }
+ else
+ {
+ pFS->startElementNS(XML_p, nXmlNodeType,
+ XML_path, OUStringToOString(aPath, RTL_TEXTENCODING_UTF8),
+ FSEND);
+ }
+ WriteAnimationNodeAnimateInside(pFS, rXNode, bMainSeqChild, bSimple);
+ pFS->endElementNS(XML_p, nXmlNodeType);
}
void PowerPointExport::WriteAnimationNodeAnimateInside( const FSHelperPtr& pFS, const Reference< XAnimationNode >& rXNode, bool bMainSeqChild, bool bSimple )
@@ -1346,6 +1379,10 @@ void PowerPointExport::WriteAnimationNode( const FSHelperPtr& pFS, const Referen
xmlNodeType = XML_anim;
pMethod = &PowerPointExport::WriteAnimationNodeAnimate;
break;
+ case AnimationNodeType::ANIMATEMOTION:
+ xmlNodeType = XML_animMotion;
+ pMethod = &PowerPointExport::WriteAnimationNodeAnimate;
+ break;
case AnimationNodeType::SET:
xmlNodeType = XML_set;
pMethod = &PowerPointExport::WriteAnimationNodeAnimate;
More information about the Libreoffice-commits
mailing list