[Libreoffice-commits] core.git: 2 commits - sd/qa sd/source
Jan Holesovsky
kendy at collabora.com
Thu Sep 7 20:08:56 UTC 2017
sd/qa/unit/data/pptx/tdf112280.pptx |binary
sd/qa/unit/export-tests-ooxml2.cxx | 15 +++++
sd/source/filter/eppt/pptx-epptooxml.cxx | 84 +++++++++++++++++++++++++++----
3 files changed, 89 insertions(+), 10 deletions(-)
New commits:
commit d921d4fd24b6416e00069678886f9692ffb4a008
Author: Jan Holesovsky <kendy at collabora.com>
Date: Thu Sep 7 19:42:45 2017 +0200
tdf#112280: Unit test.
Change-Id: I70d7f388c1573ed34bb3d93b480fe1ccaa97076f
Reviewed-on: https://gerrit.libreoffice.org/42075
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
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
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf112280.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index ce7c117e27c0..999d0744b562 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -105,6 +105,7 @@ public:
void testTdf100387();
void testRotateFlip();
void testTdf106867();
+ void testTdf112280();
CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
@@ -137,6 +138,7 @@ public:
CPPUNIT_TEST(testTdf100387);
CPPUNIT_TEST(testRotateFlip);
CPPUNIT_TEST(testTdf106867);
+ CPPUNIT_TEST(testTdf112280);
CPPUNIT_TEST_SUITE_END();
@@ -1024,6 +1026,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();
commit f5fa86303f25dd271d9bbfa9fc25c1e21430910f
Author: Jan Holesovsky <kendy at collabora.com>
Date: Thu Sep 7 19:26:07 2017 +0200
tdf#112280: Export spin animation in PPTX.
Change-Id: I9f13bbc2bd3a3de582491ea5b2ad16535589420a
Reviewed-on: https://gerrit.libreoffice.org/42074
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index b00aa125b129..2129b7f6bcaa 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -43,6 +43,7 @@
#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>
@@ -51,6 +52,7 @@
#include <com/sun/star/animations/TransitionSubType.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>
@@ -928,6 +930,16 @@ void PowerPointExport::WriteAnimationAttributeName(const FSHelperPtr& pFS, const
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);
}
@@ -1012,27 +1024,62 @@ void PowerPointExport::WriteAnimationNodeAnimate(const FSHelperPtr& pFS, const R
}
}
- 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);
}
@@ -1505,6 +1552,23 @@ void PowerPointExport::WriteAnimationNode(const FSHelperPtr& pFS, const Referenc
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;
@@ -1518,7 +1582,7 @@ void PowerPointExport::WriteAnimationNode(const FSHelperPtr& pFS, const Referenc
pMethod = &PowerPointExport::WriteAnimationNodeCommand;
break;
default:
- SAL_WARN("sd.eppt", "unhandled: " << rXNode->getType());
+ SAL_WARN("sd.eppt", "unhandled animation node: " << rXNode->getType());
break;
}
More information about the Libreoffice-commits
mailing list