[Libreoffice-commits] core.git: sd/qa sd/source
Tibor Nagy (via logerrit)
logerrit at kemper.freedesktop.org
Mon May 10 09:40:57 UTC 2021
sd/qa/unit/data/pptx/tdf124457.pptx |binary
sd/qa/unit/export-tests-ooxml1.cxx | 22 ++++++++++++++++++++++
sd/source/filter/eppt/pptx-animations.cxx | 22 +++++++++++++++++++++-
3 files changed, 43 insertions(+), 1 deletion(-)
New commits:
commit c89a7e2d900da5a6bded573f6dcff04c7be98339
Author: Tibor Nagy <nagy.tibor2 at nisz.hu>
AuthorDate: Wed May 5 12:38:51 2021 +0200
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Mon May 10 11:40:18 2021 +0200
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 at numbertext.org>
Reviewed-by: László Németh <nemeth at numbertext.org>
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
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf124457.pptx 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);
More information about the Libreoffice-commits
mailing list