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

Szymon Kłos szymon.klos at collabora.com
Tue Oct 3 18:17:05 UTC 2017


 sd/qa/unit/data/pptx/tdf104788.pptx       |binary
 sd/qa/unit/export-tests-ooxml2.cxx        |   19 +++++++++++++
 sd/source/filter/eppt/epptooxml.hxx       |    2 -
 sd/source/filter/eppt/pptexanimations.cxx |    1 
 sd/source/filter/eppt/pptx-epptooxml.cxx  |   42 +++++++++++++++++++++++++-----
 5 files changed, 55 insertions(+), 9 deletions(-)

New commits:
commit 42c9be63a309fa0d7506ada9cf759dbe023c4a0f
Author: Szymon Kłos <szymon.klos at collabora.com>
Date:   Fri Sep 29 18:22:49 2017 +0200

    tdf#104788 write xshear & to attribute
    
    Change-Id: I2cdaf18424b7f2e5b5e1fe81a9f504f36773eff3
    Reviewed-on: https://gerrit.libreoffice.org/42948
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/sd/qa/unit/data/pptx/tdf104788.pptx b/sd/qa/unit/data/pptx/tdf104788.pptx
new file mode 100755
index 000000000000..c46fb3da50a9
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf104788.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index fa28714b4f27..1ba4f1362d23 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -118,6 +118,7 @@ public:
     void testTdf112086();
     void testTdf112647();
     void testGroupRotation();
+    void testTdf104788();
 
     CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
@@ -161,6 +162,7 @@ public:
     CPPUNIT_TEST(testTdf112086);
     CPPUNIT_TEST(testTdf112647);
     CPPUNIT_TEST(testGroupRotation);
+    CPPUNIT_TEST(testTdf104788);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -1219,6 +1221,23 @@ void SdOOXMLExportTest2::testGroupRotation()
     assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[2]/p:spPr/a:xfrm", "rot", "20400000");
 }
 
+void SdOOXMLExportTest2::testTdf104788()
+{
+    ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf104788.pptx"), PPTX);
+    utl::TempFile tempFile;
+    xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+    xDocShRef->DoClose();
+
+    xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide6.xml");
+
+    OUString sVal = getXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[2]/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:anim[2]", "to");
+    CPPUNIT_ASSERT_EQUAL(OUString("-1.0"), sVal);
+
+    OUString sAttributeName = getXPathContent(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[2]/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:anim[2]/p:cBhvr/p:attrNameLst/p:attrName");
+    CPPUNIT_ASSERT_EQUAL(OUString("xshear"), sAttributeName);
+    xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sd/source/filter/eppt/epptooxml.hxx b/sd/source/filter/eppt/epptooxml.hxx
index 2780767230d6..1d98b541a688 100644
--- a/sd/source/filter/eppt/epptooxml.hxx
+++ b/sd/source/filter/eppt/epptooxml.hxx
@@ -105,7 +105,7 @@ protected:
     static void WriteAnimationAttributeName( const ::sax_fastparser::FSHelperPtr& pFS, const OUString& rAttributeName );
     void WriteAnimationNode( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Reference< css::animations::XAnimationNode >& rXNode, bool bMainSeqChild );
     void WriteAnimationNodeAnimate( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Reference< css::animations::XAnimationNode >& rXNode, sal_Int32 nXmlNodeType, bool bMainSeqChild );
-    void WriteAnimationNodeAnimateInside( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Reference< css::animations::XAnimationNode >& rXNode, bool bMainSeqChild, bool bSimple );
+    void WriteAnimationNodeAnimateInside( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Reference< css::animations::XAnimationNode >& rXNode, bool bMainSeqChild, bool bSimple, bool bWriteTo = true );
     void WriteAnimationNodeSeq( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Reference< css::animations::XAnimationNode >& rXNode, sal_Int32 nXmlNodeType, bool bMainSeqChild );
     void WriteAnimationNodeEffect( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Reference< css::animations::XAnimationNode >& rXNode, sal_Int32 nXmlNodeType, bool bMainSeqChild );
     void WriteAnimationNodeCommand(const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Reference< css::animations::XAnimationNode >& rXNode, sal_Int32 nXmlNodeType, bool bMainSeqChild );
diff --git a/sd/source/filter/eppt/pptexanimations.cxx b/sd/source/filter/eppt/pptexanimations.cxx
index 30653a9a02f9..620e6eecc4d9 100644
--- a/sd/source/filter/eppt/pptexanimations.cxx
+++ b/sd/source/filter/eppt/pptexanimations.cxx
@@ -1399,7 +1399,6 @@ Any AnimationExporter::convertAnimateValue( const Any& rSourceValue, const OUStr
         }
     }
     else if ( rAttributeName == "Rotate"         // "r" or "style.rotation" ?
-            || rAttributeName == "SkewX"
             || rAttributeName == "Opacity"
             || rAttributeName == "CharHeight"
         )
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 0a2a57a4360b..a1bd8619fd88 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -997,6 +997,12 @@ void PowerPointExport::WriteAnimationAttributeName(const FSHelperPtr& pFS, const
         pFS->writeEscaped("style.color");
         pFS->endElementNS(XML_p, XML_attrName);
     }
+    if (rAttributeName == "SkewX")
+    {
+        pFS->startElementNS(XML_p, XML_attrName, FSEND);
+        pFS->writeEscaped("xshear");
+        pFS->endElementNS(XML_p, XML_attrName);
+    }
     else
     {
         SAL_WARN("sd.eppt", "unhandled animation attribute name: " << rAttributeName);
@@ -1058,6 +1064,7 @@ void PowerPointExport::WriteAnimationNodeAnimate(const FSHelperPtr& pFS, const R
     const char* pCalcMode = nullptr;
     const char* pValueType = nullptr;
     bool bSimple = (nXmlNodeType != XML_anim);
+    bool bTo = true;
 
     if (!bSimple)
     {
@@ -1083,6 +1090,8 @@ void PowerPointExport::WriteAnimationNodeAnimate(const FSHelperPtr& pFS, const R
             pValueType = "clr";
             break;
         }
+
+
     }
 
     if (nXmlNodeType == XML_animMotion)
@@ -1143,17 +1152,35 @@ void PowerPointExport::WriteAnimationNodeAnimate(const FSHelperPtr& pFS, const R
     }
     else
     {
-        pFS->startElementNS(XML_p, nXmlNodeType,
-                            XML_calcmode, pCalcMode,
-                            XML_valueType, pValueType,
-                            FSEND);
+        OUString sTo;
+        if (rXAnimate.is() && nXmlNodeType == XML_anim)
+        {
+            rXAnimate->getTo() >>= sTo;
+        }
+        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);
+        }
     }
 
-    WriteAnimationNodeAnimateInside(pFS, rXNode, bMainSeqChild, bSimple);
+    WriteAnimationNodeAnimateInside(pFS, rXNode, bMainSeqChild, bSimple, bTo);
     pFS->endElementNS(XML_p, nXmlNodeType);
 }
 
-void PowerPointExport::WriteAnimationNodeAnimateInside(const FSHelperPtr& pFS, const Reference< XAnimationNode >& rXNode, bool bMainSeqChild, bool bSimple)
+void PowerPointExport::WriteAnimationNodeAnimateInside(const FSHelperPtr& pFS, const Reference< XAnimationNode >& rXNode, bool bMainSeqChild, bool bSimple, bool bWriteTo)
 {
     Reference< XAnimate > rXAnimate(rXNode, UNO_QUERY);
     if (!rXAnimate.is())
@@ -1191,7 +1218,8 @@ void PowerPointExport::WriteAnimationNodeAnimateInside(const FSHelperPtr& pFS, c
     WriteAnimationAttributeName(pFS, rXAnimate->getAttributeName());
     pFS->endElementNS(XML_p, XML_cBhvr);
     WriteAnimateValues(pFS, rXAnimate);
-    WriteAnimateTo(pFS, rXAnimate->getTo(), rXAnimate->getAttributeName());
+    if (bWriteTo)
+        WriteAnimateTo(pFS, rXAnimate->getTo(), rXAnimate->getAttributeName());
 }
 
 void PowerPointExport::WriteAnimationCondition(const FSHelperPtr& pFS, const char* pDelay, const char* pEvent, double fDelay, bool bHasFDelay)


More information about the Libreoffice-commits mailing list