diff options
author | Mark Hung <marklh9@gmail.com> | 2018-07-17 18:58:27 +0800 |
---|---|---|
committer | Mark Hung <marklh9@gmail.com> | 2018-07-25 15:00:10 +0200 |
commit | 7ff086c9141429e32c733f38d288cf67d6e9e3c9 (patch) | |
tree | 1e0866d4f6b4ac7fdb708c5df190bc9352d6c9dd /sd | |
parent | 981ffeb876e3b3d898b00054ed5072035cf27c1a (diff) |
tdf#118836: fix grow-shrink animation in saved pptx.
Convert AnimeTransform with transform type SCALE to animScale.
Change-Id: I39dfbdb814afa78ca981238bb1876f4af0995791
Reviewed-on: https://gerrit.libreoffice.org/57790
Tested-by: Jenkins
Reviewed-by: Mark Hung <marklh9@gmail.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/data/odp/tdf118836.odp | bin | 0 -> 11655 bytes | |||
-rw-r--r-- | sd/qa/unit/export-tests-ooxml2.cxx | 14 | ||||
-rw-r--r-- | sd/source/filter/eppt/pptx-epptooxml.cxx | 30 |
3 files changed, 43 insertions, 1 deletions
diff --git a/sd/qa/unit/data/odp/tdf118836.odp b/sd/qa/unit/data/odp/tdf118836.odp Binary files differnew file mode 100644 index 000000000000..50857b79deb7 --- /dev/null +++ b/sd/qa/unit/data/odp/tdf118836.odp diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index e33f02f82103..6201053df0ad 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -150,6 +150,7 @@ public: void testOpenDocumentAsReadOnly(); void testTdf118835(); void testTdf118768(); + void testTdf118836(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest2); @@ -221,6 +222,7 @@ public: CPPUNIT_TEST(testOpenDocumentAsReadOnly); CPPUNIT_TEST(testTdf118835); CPPUNIT_TEST(testTdf118768); + CPPUNIT_TEST(testTdf118836); CPPUNIT_TEST_SUITE_END(); @@ -1776,6 +1778,18 @@ void SdOOXMLExportTest2::testTdf118768() xDocShRef->DoClose(); } +void SdOOXMLExportTest2::testTdf118836() +{ + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf118836.odp"), ODP); + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); + + xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + assertXPath(pXmlDocContent, "//p:animScale/p:by", "x", "250000"); + assertXPath(pXmlDocContent, "//p:animScale/p:by", "y", "250000"); + xDocShRef->DoClose(); +} + 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 80e87fa1db0c..e23af1110080 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -918,6 +918,27 @@ void PowerPointExport::WriteAnimationProperty(const FSHelperPtr& pFS, const Any& if (!rAny.hasValue()) return; + ValuePair aPair; + + if (rAny >>= aPair) + { + double x, y; + if ((aPair.First >>= x) && (aPair.Second >>= y)) + { + if (nToken == XML_by) + { + // MS needs ending values but we have offset values. + x += 1.0; + y += 1.0; + } + pFS->singleElementNS(XML_p, nToken, + XML_x, OString::number(x*100000).getStr(), + XML_y, OString::number(y*100000).getStr(), + FSEND); + } + return; + } + sal_uInt32 nRgb; double fDouble; @@ -1345,6 +1366,12 @@ void PowerPointExport::WriteAnimationNodeAnimateInside(const FSHelperPtr& pFS, c WriteAnimateColorColor(pFS, xColor->getFrom(), XML_from); WriteAnimateColorColor(pFS, xColor->getTo(), XML_to); } + else if (xTransform.is() && xTransform->getTransformType() == AnimationTransformType::SCALE) + { + WriteAnimationProperty(pFS, rXAnimate->getBy(), XML_by); + WriteAnimationProperty(pFS, rXAnimate->getFrom(), XML_from); + WriteAnimationProperty(pFS, rXAnimate->getTo(), XML_to); + } else if (bWriteTo) WriteAnimateTo(pFS, rXAnimate->getTo(), rXAnimate->getAttributeName()); } @@ -1781,7 +1808,8 @@ void PowerPointExport::WriteAnimationNode(const FSHelperPtr& pFS, const Referenc { if (xTransform->getTransformType() == AnimationTransformType::SCALE) { - SAL_WARN("sd.eppt", "SCALE transform type not handled"); + xmlNodeType = XML_animScale; + pMethod = &PowerPointExport::WriteAnimationNodeAnimate; } else if (xTransform->getTransformType() == AnimationTransformType::ROTATE) { |