summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2018-07-15 19:36:00 +0800
committerMark Hung <marklh9@gmail.com>2018-07-18 14:56:19 +0200
commit70674228f3afd1019da7314b368a121a9afaa5d2 (patch)
treecb6437c91121ae443eaf9e064f1ba09512086b08
parent6af1637d0cf85566ca8482cc284669c4968ae977 (diff)
tdf#118768 fix pptx export of put on the brake animation.
1. Convert to, by, from based on attribute name for Animate. 2. Export auto reverse (autoRev) attribute. Change-Id: I11ae9997de29a5b0992889eed2eb58d48d81fbb5 Reviewed-on: https://gerrit.libreoffice.org/57554 Tested-by: Jenkins Reviewed-by: Mark Hung <marklh9@gmail.com>
-rwxr-xr-xsd/qa/unit/data/odp/tdf118768-brake.odpbin0 -> 10742 bytes
-rw-r--r--sd/qa/unit/export-tests-ooxml2.cxx23
-rw-r--r--sd/source/filter/eppt/pptexanimations.cxx1
-rw-r--r--sd/source/filter/eppt/pptx-epptooxml.cxx37
4 files changed, 43 insertions, 18 deletions
diff --git a/sd/qa/unit/data/odp/tdf118768-brake.odp b/sd/qa/unit/data/odp/tdf118768-brake.odp
new file mode 100755
index 000000000000..1f3abbcc0d58
--- /dev/null
+++ b/sd/qa/unit/data/odp/tdf118768-brake.odp
Binary files differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 6ca55d72a4e3..b18810b232db 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -146,6 +146,7 @@ public:
void testTdf104786();
void testTdf104789();
void testOpenDocumentAsReadOnly();
+ void testTdf118768();
CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
@@ -213,6 +214,7 @@ public:
CPPUNIT_TEST(testTdf104786);
CPPUNIT_TEST(testTdf104789);
CPPUNIT_TEST(testOpenDocumentAsReadOnly);
+ CPPUNIT_TEST(testTdf118768);
CPPUNIT_TEST_SUITE_END();
@@ -1694,6 +1696,27 @@ void SdOOXMLExportTest2::testOpenDocumentAsReadOnly()
xDocShRef->DoClose();
}
+void SdOOXMLExportTest2::testTdf118768()
+{
+ sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf118768-brake.odp"), ODP);
+ utl::TempFile tempFile;
+ xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+ xDocShRef->DoClose();
+
+ // check that transition attribute didn't change from 'out' to 'in'
+ xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
+ assertXPath(pXmlDocContent, "//p:anim[1]", "from", "(-#ppt_w/2)");
+ assertXPath(pXmlDocContent, "//p:anim[1]", "to", "(#ppt_x)");
+ assertXPath(pXmlDocContent, "//p:anim[2]", "from", "0");
+
+ assertXPath(pXmlDocContent, "//p:anim[2]", "to", "-1");
+ assertXPath(pXmlDocContent, "//p:anim[2]/p:cBhvr/p:cTn", "autoRev", "1");
+
+ assertXPath(pXmlDocContent, "//p:anim[3]", "by", "(#ppt_h/3+#ppt_w*0.1)");
+ assertXPath(pXmlDocContent, "//p:anim[3]/p:cBhvr/p:cTn", "autoRev", "1");
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sd/source/filter/eppt/pptexanimations.cxx b/sd/source/filter/eppt/pptexanimations.cxx
index 169dc83c202e..70a2286eb031 100644
--- a/sd/source/filter/eppt/pptexanimations.cxx
+++ b/sd/source/filter/eppt/pptexanimations.cxx
@@ -1401,6 +1401,7 @@ Any AnimationExporter::convertAnimateValue( const Any& rSourceValue, const OUStr
else if ( rAttributeName == "Rotate" // "r" or "style.rotation" ?
|| rAttributeName == "Opacity"
|| rAttributeName == "CharHeight"
+ || rAttributeName == "SkewX"
)
{
double fNumber = 0.0;
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 212821d7b56b..c8b530ea35a0 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -1236,28 +1236,26 @@ void PowerPointExport::WriteAnimationNodeAnimate(const FSHelperPtr& pFS, const R
}
else
{
- OUString sTo;
+ OUString sFrom, sTo, sBy;
if (rXAnimate.is() && nXmlNodeType == XML_anim)
{
- rXAnimate->getTo() >>= sTo;
+ OUString sAttributeName = rXAnimate->getAttributeName();
+ Any aFrom = AnimationExporter::convertAnimateValue(rXAnimate->getFrom(), sAttributeName);
+ aFrom >>= sFrom;
+ Any aTo = AnimationExporter::convertAnimateValue(rXAnimate->getTo(), sAttributeName);
+ aTo >>= sTo;
+ Any aBy = AnimationExporter::convertAnimateValue(rXAnimate->getBy(), sAttributeName);
+ aBy >>= sBy;
}
- if (!sTo.isEmpty())
- {
- pFS->startElementNS(XML_p, nXmlNodeType,
- XML_calcmode, pCalcMode,
- XML_valueType, pValueType,
- XML_to, USS(sTo),
- FSEND);
- bTo = false;
- }
- else
- {
- pFS->startElementNS(XML_p, nXmlNodeType,
- XML_calcmode, pCalcMode,
- XML_valueType, pValueType,
- FSEND);
- }
+ pFS->startElementNS(XML_p, nXmlNodeType,
+ XML_calcmode, pCalcMode,
+ XML_valueType, pValueType,
+ XML_from, sFrom.getLength() ? USS(sFrom) : nullptr,
+ XML_to, sTo.getLength() ? USS(sTo) : nullptr,
+ XML_by, sBy.getLength() ? USS(sBy) : nullptr,
+ FSEND);
+ bTo = sTo.isEmpty() && sFrom.isEmpty() && sBy.isEmpty();
}
WriteAnimationNodeAnimateInside(pFS, rXNode, bMainSeqChild, bSimple, bTo);
@@ -1568,9 +1566,12 @@ void PowerPointExport::WriteAnimationNodeCommonPropsStart(const FSHelperPtr& pFS
}
}
+ bool bAutoReverse = rXNode->getAutoReverse();
+
pFS->startElementNS(XML_p, XML_cTn,
XML_id, I64S(mnAnimationNodeIdMax ++),
XML_dur, fDuration != 0 ? I32S(static_cast<sal_Int32>(fDuration * 1000.0)) : pDuration,
+ XML_autoRev, bAutoReverse ? "1" : nullptr,
XML_restart, pRestart,
XML_nodeType, pNodeType,
XML_fill, pFill,