summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorTibor Nagy <nagy.tibor2@nisz.hu>2021-05-05 12:38:51 +0200
committerLászló Németh <nemeth@numbertext.org>2021-05-10 11:40:18 +0200
commitc89a7e2d900da5a6bded573f6dcff04c7be98339 (patch)
tree8c935490734032dd109d3e6175c383d30b2ae238 /sd
parent7ef207a79e13cbb3a98b03d7370e741f5796186c (diff)
tdf#124457 PPTX animation: export repeatCount
Aanimation timing property "repeatCount" wasn't exported. Note: PPTX uses a 1000 multiplication in repeatCount to support fractional movement of animated objects, e.g. 1500 means one and a half steps. Change-Id: Iac0dd10007c3e48f06c131d61671e1f78cad45a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115138 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/data/pptx/tdf124457.pptxbin0 -> 35132 bytes
-rw-r--r--sd/qa/unit/export-tests-ooxml1.cxx22
-rw-r--r--sd/source/filter/eppt/pptx-animations.cxx22
3 files changed, 43 insertions, 1 deletions
diff --git a/sd/qa/unit/data/pptx/tdf124457.pptx b/sd/qa/unit/data/pptx/tdf124457.pptx
new file mode 100644
index 000000000000..5ea5173a10d5
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf124457.pptx
Binary files differ
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx
index ad8bb624c614..c2d07f5ca092 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -113,6 +113,7 @@ public:
void testArcTo();
void testNarrationMimeType();
void testTdf140865Wordart3D();
+ void testTdf124457();
CPPUNIT_TEST_SUITE(SdOOXMLExportTest1);
@@ -168,6 +169,7 @@ public:
CPPUNIT_TEST(testArcTo);
CPPUNIT_TEST(testNarrationMimeType);
CPPUNIT_TEST(testTdf140865Wordart3D);
+ CPPUNIT_TEST(testTdf124457);
CPPUNIT_TEST_SUITE_END();
@@ -1472,6 +1474,26 @@ void SdOOXMLExportTest1::testTdf140865Wordart3D()
xDocShRef->DoClose();
}
+void SdOOXMLExportTest1::testTdf124457()
+{
+ sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf124457.pptx"), PPTX );
+ utl::TempFile tempFile;
+ xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+ xDocShRef->DoClose();
+
+ xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml");
+
+ assertXPath(pXmlDoc,
+ "/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[1]/p:cTn",
+ "repeatCount", "3000");
+
+ assertXPath(pXmlDoc,
+ "/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[2]/p:cTn",
+ "repeatCount", "indefinite");
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest1);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sd/source/filter/eppt/pptx-animations.cxx b/sd/source/filter/eppt/pptx-animations.cxx
index 63423c8489c0..43ef7ce4d55d 100644
--- a/sd/source/filter/eppt/pptx-animations.cxx
+++ b/sd/source/filter/eppt/pptx-animations.cxx
@@ -994,11 +994,13 @@ void PPTXAnimationExport::WriteAnimationNodeCommonPropsStart()
{
const Reference<XAnimationNode>& rXNode = getCurrentNode();
std::optional<OString> sDuration;
+ std::optional<OString> sRepeatCount;
const char* pRestart = nullptr;
const char* pNodeType = nullptr;
const char* pPresetClass = nullptr;
const char* pFill = nullptr;
double fDuration = 0;
+ double fRepeatCount = 0;
Any aAny;
assert(mpContext);
@@ -1070,12 +1072,30 @@ void PPTXAnimationExport::WriteAnimationNodeCommonPropsStart()
bool bAutoReverse = rXNode->getAutoReverse();
+ aAny = rXNode->getRepeatCount();
+ if (aAny.hasValue())
+ {
+ Timing eTiming;
+
+ if (aAny >>= eTiming)
+ {
+ if (eTiming == Timing_INDEFINITE)
+ sRepeatCount = "indefinite";
+ }
+ else
+ aAny >>= fRepeatCount;
+ }
+
+ if (fRepeatCount != 0)
+ sRepeatCount = OString::number(static_cast<sal_Int32>(fRepeatCount * 1000.0));
+
mpFS->startElementNS(
XML_p, XML_cTn, XML_id, OString::number(GetNextAnimationNodeId(rXNode)), XML_dur, sDuration,
XML_autoRev, sax_fastparser::UseIf("1", bAutoReverse), XML_restart, pRestart, XML_nodeType,
pNodeType, XML_fill, pFill, XML_presetClass, pPresetClass, XML_presetID,
sax_fastparser::UseIf(OString::number(nPresetId), bPresetId), XML_presetSubtype,
- sax_fastparser::UseIf(OString::number(nPresetSubType), bPresetSubType));
+ sax_fastparser::UseIf(OString::number(nPresetSubType), bPresetSubType), XML_repeatCount,
+ sRepeatCount);
WriteAnimationCondList(mpContext->getCondition(true), XML_stCondLst);
WriteAnimationCondList(mpContext->getCondition(false), XML_endCondLst);