sd/qa/unit/data/pptx/tdf104786.pptx      |binary
 sd/qa/unit/export-tests-ooxml2.cxx       |   15 +++++++++++++++
 sd/source/filter/eppt/epptooxml.hxx      |    2 +-
 sd/source/filter/eppt/pptx-epptooxml.cxx |   22 +++++++++++++++-------
 4 files changed, 31 insertions(+), 8 deletions(-)

New commits:
commit 544cf7f6750715ae25bdb3d0904672f7432f5c2f
Author: Szymon Kłos <szymon.k...@collabora.com>
Date:   Thu Mar 15 17:17:21 2018 +0100

    tdf#104786 Don't export empty 'to'
    
    Change-Id: I16b573fd6455813c6be5c2f5a0f0a820360a239f
    Reviewed-on: https://gerrit.libreoffice.org/51359
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/51406
    Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>

diff --git a/sd/qa/unit/data/pptx/tdf104786.pptx 
b/sd/qa/unit/data/pptx/tdf104786.pptx
new file mode 100644
index 000000000000..165b5676e400
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf104786.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index 0d5de064527c..6015b7de944a 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -127,6 +127,7 @@ public:
     /// SmartArt animated elements
     void testTdf104792();
     void testTdf90627();
+    void testTdf104786();
 
     CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
@@ -178,6 +179,7 @@ public:
     CPPUNIT_TEST(testTdf114848);
     CPPUNIT_TEST(testTdf104792);
     CPPUNIT_TEST(testTdf90627);
+    CPPUNIT_TEST(testTdf104786);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -1346,6 +1348,19 @@ void SdOOXMLExportTest2::testTdf90627()
     xDocShRef->DoClose();
 }
 
+void SdOOXMLExportTest2::testTdf104786()
+{
+    ::sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf104786.pptx"), 
PPTX);
+    utl::TempFile tempFile;
+    xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+
+    xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide2.xml");
+    // Don't export empty 'to'
+    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:childTnLst/p:set[2]/p:to",
 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 d2cbbd9a4052..d9289b2bedcf 100644
--- a/sd/source/filter/eppt/epptooxml.hxx
+++ b/sd/source/filter/eppt/epptooxml.hxx
@@ -114,7 +114,7 @@ private:
     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 );
     void WriteAnimationNodeCommonPropsStart( const 
::sax_fastparser::FSHelperPtr& pFS, const css::uno::Reference< 
css::animations::XAnimationNode >& rXNode, bool bSingle, bool bMainSeqChild );
-    static void WriteAnimationProperty( const ::sax_fastparser::FSHelperPtr& 
pFS, const css::uno::Any& rAny );
+    static void WriteAnimationProperty( const ::sax_fastparser::FSHelperPtr& 
pFS, const css::uno::Any& rAny, sal_Int32 nToken = 0 );
     void WriteAnimationTarget( const ::sax_fastparser::FSHelperPtr& pFS, const 
css::uno::Any& rTarget );
     bool WriteComments( sal_uInt32 nPageNum );
     void ImplWriteBackground( const ::sax_fastparser::FSHelperPtr& pFS, const 
css::uno::Reference< css::beans::XPropertySet >& aXBackgroundPropSet );
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx 
b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 839e5f45b705..67e1d82b543c 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -826,7 +826,7 @@ void PowerPointExport::WriteTransition(const FSHelperPtr& 
pFS)
     }
 }
 
-void PowerPointExport::WriteAnimationProperty(const FSHelperPtr& pFS, const 
Any& rAny)
+void PowerPointExport::WriteAnimationProperty(const FSHelperPtr& pFS, const 
Any& rAny, sal_Int32 nToken)
 {
     if (!rAny.hasValue())
         return;
@@ -834,6 +834,15 @@ void PowerPointExport::WriteAnimationProperty(const 
FSHelperPtr& pFS, const Any&
     sal_uInt32 nRgb;
     double fDouble;
 
+    uno::TypeClass aClass = rAny.getValueType().getTypeClass();
+    bool bWriteToken = nToken &&
+        (  aClass == TypeClass_LONG
+        || aClass == TypeClass_DOUBLE
+        || aClass == TypeClass_STRING );
+
+    if (bWriteToken)
+        pFS->startElementNS(XML_p, XML_to, FSEND);
+
     switch (rAny.getValueType().getTypeClass())
     {
     case TypeClass_LONG:
@@ -856,6 +865,9 @@ void PowerPointExport::WriteAnimationProperty(const 
FSHelperPtr& pFS, const Any&
     default:
         break;
     }
+
+    if (bWriteToken)
+        pFS->endElementNS(XML_p, nToken);
 }
 
 void PowerPointExport::WriteAnimateValues(const FSHelperPtr& pFS, const 
Reference< XAnimate >& rXAnimate)
@@ -905,18 +917,14 @@ void PowerPointExport::WriteAnimateTo(const FSHelperPtr& 
pFS, const Any& rValue,
 
     SAL_INFO("sd.eppt", "to attribute name: " << USS(rAttributeName));
 
-    pFS->startElementNS(XML_p, XML_to, FSEND);
-
     sal_uInt32 nColor;
     if (rValue >>= nColor)
     {
         // RGB color
-        WriteAnimationProperty(pFS, rValue);
+        WriteAnimationProperty(pFS, rValue, XML_to);
     }
     else
-        WriteAnimationProperty(pFS, 
AnimationExporter::convertAnimateValue(rValue, rAttributeName));
-
-    pFS->endElementNS(XML_p, XML_to);
+        WriteAnimationProperty(pFS, 
AnimationExporter::convertAnimateValue(rValue, rAttributeName), XML_to);
 }
 
 void PowerPointExport::WriteAnimationAttributeName(const FSHelperPtr& pFS, 
const OUString& rAttributeName)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to