[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sd/qa sd/source

Szymon Kłos szymon.klos at collabora.com
Sat Oct 7 10:30:49 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  |   40 ++++++++++++++++++++++++------
 5 files changed, 53 insertions(+), 9 deletions(-)

New commits:
commit 02dd08fa5c3a6c6b2aaf39bdc9be5a0fe14fecd8
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>
    Reviewed-on: https://gerrit.libreoffice.org/43117
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar 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 c1858e5a38a4..f2e36afb68a7 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -118,6 +118,7 @@ public:
     void testTdf112334();
     void testTdf112647();
     void testTdf112086();
+    void testTdf104788();
 
     CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
@@ -157,6 +158,7 @@ public:
     CPPUNIT_TEST(testTdf112334);
     CPPUNIT_TEST(testTdf112647);
     CPPUNIT_TEST(testTdf112086);
+    CPPUNIT_TEST(testTdf104788);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -1019,6 +1021,23 @@ void SdOOXMLExportTest2::testTdf112086()
     CPPUNIT_ASSERT_EQUAL(OUString("ppt_h"), sAttributeName);
 }
 
+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 ebfe5d345813..52241d2d4949 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 7a15904c7c94..0a3ab58f8459 100644
--- a/sd/source/filter/eppt/pptexanimations.cxx
+++ b/sd/source/filter/eppt/pptexanimations.cxx
@@ -1409,7 +1409,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 fa4e9dbc1a22..74c1086d6633 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -981,6 +981,12 @@ void PowerPointExport::WriteAnimationAttributeName( const FSHelperPtr& pFS, cons
         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_INFO("sd.eppt", "unhandled animation attribute name: " << rAttributeName);
@@ -1022,6 +1028,7 @@ void PowerPointExport::WriteAnimationNodeAnimate( const FSHelperPtr& pFS, const
     const char* pCalcMode = nullptr;
     const char* pValueType = nullptr;
     bool bSimple = ( nXmlNodeType != XML_anim );
+    bool bTo = true;
 
     if( !bSimple ) {
     switch( rXAnimate->getCalcMode() ) {
@@ -1104,17 +1111,35 @@ void PowerPointExport::WriteAnimationNodeAnimate( const FSHelperPtr& pFS, const
     }
     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() )
@@ -1150,7 +1175,8 @@ void PowerPointExport::WriteAnimationNodeAnimateInside( const FSHelperPtr& pFS,
     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