summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2017-09-07 19:26:07 +0200
committerJan Holesovsky <kendy@collabora.com>2017-09-07 20:12:44 +0200
commit379990b93958d6c49d716f097d94f5b8894e811e (patch)
tree0f55da9e414da19518eabe302905fcbe9bbd2a31
parent649b14eb85205f6cfa31e01138e3bc6ce393f9a0 (diff)
tdf#112280: Export spin animation in PPTX.cd-5.3-23
Contains also: tdf#112280: Unit test. Change-Id: I9f13bbc2bd3a3de582491ea5b2ad16535589420a Reviewed-on: https://gerrit.libreoffice.org/42077 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r--sd/qa/unit/data/pptx/tdf112280.pptxbin0 -> 30309 bytes
-rw-r--r--sd/qa/unit/export-tests-ooxml2.cxx15
-rw-r--r--sd/source/filter/eppt/pptx-epptooxml.cxx84
3 files changed, 89 insertions, 10 deletions
diff --git a/sd/qa/unit/data/pptx/tdf112280.pptx b/sd/qa/unit/data/pptx/tdf112280.pptx
new file mode 100644
index 000000000000..39c2aa4cb1b8
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf112280.pptx
Binary files differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 5586564a33e5..531f97b153c9 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -106,6 +106,7 @@ public:
void testTdf105739();
void testTdf111518();
void testTdf106867();
+ void testTdf112280();
CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
@@ -135,6 +136,7 @@ public:
CPPUNIT_TEST(testTdf105739);
CPPUNIT_TEST(testTdf111518);
CPPUNIT_TEST(testTdf106867);
+ CPPUNIT_TEST(testTdf112280);
CPPUNIT_TEST_SUITE_END();
@@ -840,6 +842,19 @@ void SdOOXMLExportTest2::testTdf106867()
"spid", "42");
}
+void SdOOXMLExportTest2::testTdf112280()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf112280.pptx"), PPTX);
+ utl::TempFile tempFile;
+ xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+ xDocShRef->DoClose();
+
+ // check the animRot value
+ xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
+ assertXPath(pXmlDocContent, "/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:animRot",
+ "by", "21600000");
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 4c18981fe169..e04b6f950f75 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -41,12 +41,14 @@
#include <com/sun/star/animations/AnimationFill.hpp>
#include <com/sun/star/animations/AnimationNodeType.hpp>
#include <com/sun/star/animations/AnimationRestart.hpp>
+#include <com/sun/star/animations/AnimationTransformType.hpp>
#include <com/sun/star/animations/AnimationValueType.hpp>
#include <com/sun/star/animations/Event.hpp>
#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/XAnimateMotion.hpp>
+#include <com/sun/star/animations/XAnimateTransform.hpp>
#include <com/sun/star/animations/XAnimationNode.hpp>
#include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
#include <com/sun/star/animations/XCommand.hpp>
@@ -908,6 +910,16 @@ void PowerPointExport::WriteAnimationAttributeName( const FSHelperPtr& pFS, cons
pFS->writeEscaped("ppt_y");
pFS->endElementNS(XML_p, XML_attrName);
}
+ else if (rAttributeName == "Rotate")
+ {
+ pFS->startElementNS(XML_p, XML_attrName, FSEND);
+ pFS->writeEscaped("r");
+ pFS->endElementNS(XML_p, XML_attrName);
+ }
+ else
+ {
+ SAL_INFO("sd.eppt", "unhandled animation attribute name: " << rAttributeName);
+ }
pFS->endElementNS( XML_p, XML_attrNameLst );
}
@@ -969,27 +981,62 @@ void PowerPointExport::WriteAnimationNodeAnimate( const FSHelperPtr& pFS, const
}
}
- OUString aPath;
if (nXmlNodeType == XML_animMotion)
{
- Reference<XAnimateMotion> rMotion(rXNode, UNO_QUERY);
- if (rMotion.is())
- rMotion->getPath() >>= aPath;
- }
+ OUString aPath;
+ Reference<XAnimateMotion> xMotion(rXNode, UNO_QUERY);
+ if (xMotion.is())
+ xMotion->getPath() >>= aPath;
- if (aPath.isEmpty())
+ pFS->startElementNS(XML_p, nXmlNodeType,
+ XML_path, OUStringToOString(aPath, RTL_TEXTENCODING_UTF8),
+ FSEND);
+ }
+ else if (nXmlNodeType == XML_animRot)
{
+ // when const char* is nullptr, the attribute is completely omitted in the output
+ const char* pBy = nullptr;
+ const char* pFrom = nullptr;
+ const char* pTo = nullptr;
+ OString aBy, aFrom, aTo;
+
+ Reference<XAnimateTransform> xTransform(rXNode, UNO_QUERY);
+ if (xTransform.is())
+ {
+ double value;
+ if (xTransform->getBy() >>= value)
+ {
+ aBy = OString::number(static_cast<int>(value * PER_DEGREE));
+ pBy = aBy.getStr();
+ }
+
+ if (xTransform->getFrom() >>= value)
+ {
+ aFrom = OString::number(static_cast<int>(value * PER_DEGREE));
+ pFrom = aFrom.getStr();
+ }
+
+ if (xTransform->getTo() >>= value)
+ {
+ aTo = OString::number(static_cast<int>(value * PER_DEGREE));
+ pTo = aTo.getStr();
+ }
+ }
+
pFS->startElementNS(XML_p, nXmlNodeType,
- XML_calcmode, pCalcMode,
- XML_valueType, pValueType,
+ XML_by, pBy,
+ XML_from, pFrom,
+ XML_to, pTo,
FSEND);
}
else
{
pFS->startElementNS(XML_p, nXmlNodeType,
- XML_path, OUStringToOString(aPath, RTL_TEXTENCODING_UTF8),
+ XML_calcmode, pCalcMode,
+ XML_valueType, pValueType,
FSEND);
}
+
WriteAnimationNodeAnimateInside(pFS, rXNode, bMainSeqChild, bSimple);
pFS->endElementNS(XML_p, nXmlNodeType);
}
@@ -1425,6 +1472,23 @@ void PowerPointExport::WriteAnimationNode( const FSHelperPtr& pFS, const Referen
xmlNodeType = XML_animMotion;
pMethod = &PowerPointExport::WriteAnimationNodeAnimate;
break;
+ case AnimationNodeType::ANIMATETRANSFORM:
+ {
+ Reference<XAnimateTransform> xTransform(rXNode, UNO_QUERY);
+ if (xTransform.is())
+ {
+ if (xTransform->getTransformType() == AnimationTransformType::SCALE)
+ {
+ SAL_WARN("sd.eppt", "SCALE transform type not handled");
+ }
+ else if (xTransform->getTransformType() == AnimationTransformType::ROTATE)
+ {
+ xmlNodeType = XML_animRot;
+ pMethod = &PowerPointExport::WriteAnimationNodeAnimate;
+ }
+ }
+ }
+ break;
case AnimationNodeType::SET:
xmlNodeType = XML_set;
pMethod = &PowerPointExport::WriteAnimationNodeAnimate;
@@ -1438,7 +1502,7 @@ void PowerPointExport::WriteAnimationNode( const FSHelperPtr& pFS, const Referen
pMethod = &PowerPointExport::WriteAnimationNodeCommand;
break;
default:
- SAL_WARN("sd.eppt", "unhandled: " << rXNode->getType());
+ SAL_WARN("sd.eppt", "unhandled animation node: " << rXNode->getType());
break;
}