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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jul 18 12:56:44 UTC 2018


 sd/qa/unit/data/odp/tdf118768-brake.odp   |binary
 sd/qa/unit/export-tests-ooxml2.cxx        |   23 ++++++++++++++++++
 sd/source/filter/eppt/pptexanimations.cxx |    1 
 sd/source/filter/eppt/pptx-epptooxml.cxx  |   37 +++++++++++++++---------------
 4 files changed, 43 insertions(+), 18 deletions(-)

New commits:
commit 70674228f3afd1019da7314b368a121a9afaa5d2
Author:     Mark Hung <marklh9 at gmail.com>
AuthorDate: Sun Jul 15 19:36:00 2018 +0800
Commit:     Mark Hung <marklh9 at gmail.com>
CommitDate: Wed Jul 18 14:56:19 2018 +0200

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

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
Binary files /dev/null and b/sd/qa/unit/data/odp/tdf118768-brake.odp 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,


More information about the Libreoffice-commits mailing list