[Libreoffice-commits] core.git: sd/qa sd/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jul 25 13:00:33 UTC 2018


 sd/qa/unit/data/odp/tdf118836.odp        |binary
 sd/qa/unit/export-tests-ooxml2.cxx       |   14 ++++++++++++++
 sd/source/filter/eppt/pptx-epptooxml.cxx |   30 +++++++++++++++++++++++++++++-
 3 files changed, 43 insertions(+), 1 deletion(-)

New commits:
commit 7ff086c9141429e32c733f38d288cf67d6e9e3c9
Author:     Mark Hung <marklh9 at gmail.com>
AuthorDate: Tue Jul 17 18:58:27 2018 +0800
Commit:     Mark Hung <marklh9 at gmail.com>
CommitDate: Wed Jul 25 15:00:10 2018 +0200

    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 at gmail.com>

diff --git a/sd/qa/unit/data/odp/tdf118836.odp b/sd/qa/unit/data/odp/tdf118836.odp
new file mode 100644
index 000000000000..50857b79deb7
Binary files /dev/null and b/sd/qa/unit/data/odp/tdf118836.odp differ
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)
                 {


More information about the Libreoffice-commits mailing list