[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sd/qa sd/source

Szymon Kłos szymon.klos at collabora.com
Tue Mar 20 08:57:51 UTC 2018


 sd/qa/unit/data/odp/tdf90627.odp         |binary
 sd/qa/unit/export-tests-ooxml2.cxx       |   15 +++++++++++++++
 sd/source/filter/eppt/epptooxml.hxx      |    4 ++--
 sd/source/filter/eppt/pptx-epptooxml.cxx |   31 +++++++++++++------------------
 4 files changed, 30 insertions(+), 20 deletions(-)

New commits:
commit 41a4917440a34957f2dc5d1a5bc27f966017cedf
Author: Szymon Kłos <szymon.klos at collabora.com>
Date:   Wed Mar 14 18:59:49 2018 +0100

    tdf#90627 Don't save empty conditions
    
    Change-Id: I5a953c1b0fff7bf41a59360a8f52596264ddf266
    Reviewed-on: https://gerrit.libreoffice.org/51293
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/51405
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sd/qa/unit/data/odp/tdf90627.odp b/sd/qa/unit/data/odp/tdf90627.odp
new file mode 100644
index 000000000000..dfa28c9b09a3
Binary files /dev/null and b/sd/qa/unit/data/odp/tdf90627.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 79dd2f4a64bc..0d5de064527c 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -126,6 +126,7 @@ public:
     void testTdf114848();
     /// SmartArt animated elements
     void testTdf104792();
+    void testTdf90627();
 
     CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
@@ -176,6 +177,7 @@ public:
     CPPUNIT_TEST(testAccentColor);
     CPPUNIT_TEST(testTdf114848);
     CPPUNIT_TEST(testTdf104792);
+    CPPUNIT_TEST(testTdf90627);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -1331,6 +1333,19 @@ void SdOOXMLExportTest2::testTdf104792()
     xDocShRef->DoClose();
 }
 
+void SdOOXMLExportTest2::testTdf90627()
+{
+    ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf90627.odp"), ODP);
+    utl::TempFile tempFile;
+    xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+
+    xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
+    // Don't export empty conditions
+    assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst[1]/p:seq/p:cTn/p:childTnLst[1]/p:par[2]/p:cTn/p:childTnLst[1]/p:par/p:cTn/p:childTnLst[1]/p:par/p:cTn/p:endCondLst", 0);
+
+    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 a43ecb4a6930..d2cbbd9a4052 100644
--- a/sd/source/filter/eppt/epptooxml.hxx
+++ b/sd/source/filter/eppt/epptooxml.hxx
@@ -103,8 +103,8 @@ private:
 
     static void WriteAnimateTo( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Any& rValue, const OUString& rAttributeName );
     static void WriteAnimateValues( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Reference< css::animations::XAnimate >& rXAnimate );
-    static void WriteAnimationCondition( const ::sax_fastparser::FSHelperPtr& pFS, css::uno::Any const & rAny, bool bWriteEvent, bool bMainSeqChild );
-    static void WriteAnimationCondition( const ::sax_fastparser::FSHelperPtr& pFS, const char* pDelay, const char* pEvent, double fDelay, bool bHasFDelay );
+    static void WriteAnimationCondition( const ::sax_fastparser::FSHelperPtr& pFS, css::uno::Any const & rAny, bool bWriteEvent, bool bMainSeqChild, sal_Int32 nToken );
+    static void WriteAnimationCondition( const ::sax_fastparser::FSHelperPtr& pFS, const char* pDelay, const char* pEvent, double fDelay, bool bHasFDelay, sal_Int32 nToken );
     void WriteAnimations( const ::sax_fastparser::FSHelperPtr& pFS );
     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 );
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index c5c3ca580101..839e5f45b705 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -1223,10 +1223,12 @@ void PowerPointExport::WriteAnimationNodeAnimateInside(const FSHelperPtr& pFS, c
         WriteAnimateTo(pFS, rXAnimate->getTo(), rXAnimate->getAttributeName());
 }
 
-void PowerPointExport::WriteAnimationCondition(const FSHelperPtr& pFS, const char* pDelay, const char* pEvent, double fDelay, bool bHasFDelay)
+void PowerPointExport::WriteAnimationCondition(const FSHelperPtr& pFS, const char* pDelay, const char* pEvent, double fDelay, bool bHasFDelay, sal_Int32 nToken)
 {
     if (bHasFDelay || pDelay || pEvent)
     {
+        pFS->startElementNS(XML_p, nToken, FSEND);
+
         if (!pEvent)
             pFS->singleElementNS(XML_p, XML_cond,
                                  XML_delay, bHasFDelay ? I64S((sal_uInt32)(fDelay*1000.0)) : pDelay,
@@ -1244,10 +1246,12 @@ void PowerPointExport::WriteAnimationCondition(const FSHelperPtr& pFS, const cha
 
             pFS->endElementNS(XML_p, XML_cond);
         }
+
+        pFS->endElementNS(XML_p, nToken);
     }
 }
 
-void PowerPointExport::WriteAnimationCondition(const FSHelperPtr& pFS, Any const& rAny, bool bWriteEvent, bool bMainSeqChild)
+void PowerPointExport::WriteAnimationCondition(const FSHelperPtr& pFS, Any const& rAny, bool bWriteEvent, bool bMainSeqChild, sal_Int32 nToken)
 {
     bool bHasFDelay = false;
     double fDelay = 0;
@@ -1335,7 +1339,7 @@ void PowerPointExport::WriteAnimationCondition(const FSHelperPtr& pFS, Any const
         }
     }
 
-    WriteAnimationCondition(pFS, pDelay, pEvent, fDelay, bHasFDelay);
+    WriteAnimationCondition(pFS, pDelay, pEvent, fDelay, bHasFDelay, nToken);
 }
 
 void PowerPointExport::WriteAnimationNodeCommonPropsStart(const FSHelperPtr& pFS, const Reference< XAnimationNode >& rXNode, bool bSingle, bool bMainSeqChild)
@@ -1497,15 +1501,13 @@ void PowerPointExport::WriteAnimationNodeCommonPropsStart(const FSHelperPtr& pFS
     {
         Sequence< Any > aCondSeq;
 
-        pFS->startElementNS(XML_p, XML_stCondLst, FSEND);
         if (aAny >>= aCondSeq)
         {
             for (int i = 0; i < aCondSeq.getLength(); i ++)
-                WriteAnimationCondition(pFS, aCondSeq[ i ], false, bMainSeqChild);
+                WriteAnimationCondition(pFS, aCondSeq[ i ], false, bMainSeqChild, XML_stCondLst);
         }
         else
-            WriteAnimationCondition(pFS, aAny, false, bMainSeqChild);
-        pFS->endElementNS(XML_p, XML_stCondLst);
+            WriteAnimationCondition(pFS, aAny, false, bMainSeqChild, XML_stCondLst);
     }
 
     aAny = rXNode->getEnd();
@@ -1513,15 +1515,13 @@ void PowerPointExport::WriteAnimationNodeCommonPropsStart(const FSHelperPtr& pFS
     {
         Sequence< Any > aCondSeq;
 
-        pFS->startElementNS(XML_p, XML_endCondLst, FSEND);
         if (aAny >>= aCondSeq)
         {
             for (int i = 0; i < aCondSeq.getLength(); i ++)
-                WriteAnimationCondition(pFS, aCondSeq[ i ], false, bMainSeqChild);
+                WriteAnimationCondition(pFS, aCondSeq[ i ], false, bMainSeqChild, XML_endCondLst);
         }
         else
-            WriteAnimationCondition(pFS, aAny, false, bMainSeqChild);
-        pFS->endElementNS(XML_p, XML_endCondLst);
+            WriteAnimationCondition(pFS, aAny, false, bMainSeqChild, XML_endCondLst);
     }
 
     Reference< XEnumerationAccess > xEnumerationAccess(rXNode, UNO_QUERY);
@@ -1562,13 +1562,8 @@ void PowerPointExport::WriteAnimationNodeSeq(const FSHelperPtr& pFS, const Refer
 
     WriteAnimationNodeCommonPropsStart(pFS, rXNode, true, bMainSeqChild);
 
-    pFS->startElementNS(XML_p, XML_prevCondLst, FSEND);
-    WriteAnimationCondition(pFS, nullptr, "onPrev", 0, true);
-    pFS->endElementNS(XML_p, XML_prevCondLst);
-
-    pFS->startElementNS(XML_p, XML_nextCondLst, FSEND);
-    WriteAnimationCondition(pFS, nullptr, "onNext", 0, true);
-    pFS->endElementNS(XML_p, XML_nextCondLst);
+    WriteAnimationCondition(pFS, nullptr, "onPrev", 0, true, XML_prevCondLst);
+    WriteAnimationCondition(pFS, nullptr, "onNext", 0, true, XML_nextCondLst);
 
     pFS->endElementNS(XML_p, XML_seq);
 }


More information about the Libreoffice-commits mailing list