File bnc1039203.patch of Package libreoffice.8149

From 377af664602f5df27df5fcfad5e50a0f59dca38c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Szymon=20K=C5=82os?= <szymon.klos@collabora.com>
Date: Fri, 2 Feb 2018 10:21:50 +0100
Subject: [PATCH 1/4] tdf#115394 import custom slide transition time in PPTX
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* custom values are imported correctly
* standard (fast, slow, medium) values are changed
  to match values in the MSO

Change-Id: I004242afbbf641fe414abc8df248a2844c104502
Reviewed-on: https://gerrit.libreoffice.org/49139
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
---
 include/oox/ppt/slidetransition.hxx           |   4 +++
 offapi/com/sun/star/presentation/DrawPage.idl |   9 +++++--
 oox/source/ppt/slidetransition.cxx            |  22 ++++++++++++++---
 oox/source/ppt/slidetransitioncontext.cxx     |   6 +++++
 oox/source/token/properties.txt               |   1 +
 sd/qa/unit/data/pptx/tdf115394.pptx           | Bin 0 -> 31282 bytes
 sd/qa/unit/import-tests.cxx                   |  34 ++++++++++++++++++++++++++
 sd/source/ui/inc/unoprnms.hxx                 |   1 +
 sd/source/ui/unoidl/unopage.cxx               |   2 +-
 9 files changed, 72 insertions(+), 7 deletions(-)
 create mode 100644 sd/qa/unit/data/pptx/tdf115394.pptx

diff --git a/include/oox/ppt/slidetransition.hxx b/include/oox/ppt/slidetransition.hxx
index 8986016f30aa..5a31b158334b 100644
--- a/include/oox/ppt/slidetransition.hxx
+++ b/include/oox/ppt/slidetransition.hxx
@@ -43,7 +43,10 @@ namespace oox { namespace ppt {
         void setSlideProperties( PropertyMap& props );
         void setTransitionFilterProperties( const css::uno::Reference< css::animations::XTransitionFilter > & xFilter );

+        /// Set one of standard values for slide transition duration
         void setOoxTransitionSpeed( sal_Int32 nToken );
+        /// Set slide transition time directly
+        void setOoxTransitionSpeed( double fDuration );
         void setMode( bool bMode )
             { mbMode = bMode; }
         void setOoxAdvanceTime( sal_Int32 nAdvanceTime )
@@ -66,6 +69,7 @@ namespace oox { namespace ppt {
         ::sal_Int16 mnTransitionSubType;
         bool  mbTransitionDirectionNormal;
         css::presentation::AnimationSpeed mnAnimationSpeed;
+        double mfTransitionDurationInSeconds;
         bool  mbMode; /**< http://api.libreoffice.org/docs/common/ref/com/sun/star/animations/XTransitionFilter.html Mode property */
         ::sal_Int32 mnAdvanceTime;
     };
diff --git a/offapi/com/sun/star/presentation/DrawPage.idl b/offapi/com/sun/star/presentation/DrawPage.idl
index 18e499e81420..0e070470ad25 100644
--- a/offapi/com/sun/star/presentation/DrawPage.idl
+++ b/offapi/com/sun/star/presentation/DrawPage.idl
@@ -79,11 +79,11 @@ published service DrawPage
     [property] short Layout;


-    /** defines the speed of the fade-in effect of this page.
+    /** Defines the speed of the fade-in effect of this page.
+        @see TransitionSpeed
      */
     [property] com::sun::star::presentation::AnimationSpeed Speed;

-
     /** defines if a header presentation shape from the master page is visible
         on this page.
     */
@@ -142,6 +142,11 @@ published service DrawPage
     */
     [optional, property] long DateTimeFormat;

+    /** Specifies slide transition time in seconds.
+        @since LibreOffice 6.1
+        @see Speed
+     */
+    [property, optional] double TransitionDuration;
 };


diff --git a/oox/source/ppt/slidetransition.cxx b/oox/source/ppt/slidetransition.cxx
index e609e6709c2f..7c1555b7dc80 100644
--- a/oox/source/ppt/slidetransition.cxx
+++ b/oox/source/ppt/slidetransition.cxx
@@ -45,6 +45,7 @@ namespace oox { namespace ppt {
         , mnTransitionSubType( 0 )
         , mbTransitionDirectionNormal( true )
         , mnAnimationSpeed( AnimationSpeed_FAST )
+        , mfTransitionDurationInSeconds( -1.0 )
         , mbMode( true )
         , mnAdvanceTime( -1 )
     {
@@ -56,6 +57,7 @@ namespace oox { namespace ppt {
         , mnTransitionSubType( 0 )
         , mbTransitionDirectionNormal( true )
         , mnAnimationSpeed( AnimationSpeed_FAST )
+        , mfTransitionDurationInSeconds( -1.0 )
         , mbMode( true )
         , mnAdvanceTime( -1 )
     {
@@ -76,6 +78,8 @@ namespace oox { namespace ppt {
             aProps.setProperty( PROP_TransitionSubtype, mnTransitionSubType);
             aProps.setProperty( PROP_TransitionDirection, mbTransitionDirectionNormal);
             aProps.setProperty( PROP_Speed, mnAnimationSpeed);
+            if( mfTransitionDurationInSeconds >= 0.0 )
+                aProps.setProperty( PROP_TransitionDuration, mfTransitionDurationInSeconds);
             aProps.setProperty( PROP_TransitionFadeColor, sal_Int32(0));
             if( mnAdvanceTime != -1 ) {
                 aProps.setProperty( PROP_Duration, mnAdvanceTime/1000);
@@ -110,19 +114,21 @@ namespace oox { namespace ppt {
     {
         switch( nToken  )
         {
-            /* In case you want to use time values in second,
-             * the speed values are located in the PPT97 importer
-             * sd/source/filter/ppt/ppt97animations.cxx:664
-             * (void Ppt97Animation::UpdateCacheData() const)
+            /* the speed values are located in the PPT97 importer
+             * sd/source/filter/ppt/pptin.cxx:1783
+             * (void ImplSdPPTImport::ImportPageEffect)
              */
         case XML_fast:
             mnAnimationSpeed = AnimationSpeed_FAST;
+            mfTransitionDurationInSeconds = 0.5;
             break;
         case XML_med:
             mnAnimationSpeed = AnimationSpeed_MEDIUM;
+            mfTransitionDurationInSeconds = 0.75;
             break;
         case XML_slow:
             mnAnimationSpeed = AnimationSpeed_SLOW;
+            mfTransitionDurationInSeconds = 1.0;
             break;
         default:
             // should not happen. just ignore
@@ -130,6 +136,14 @@ namespace oox { namespace ppt {
         }
     }

+    void SlideTransition::setOoxTransitionSpeed( double fDurationInSeconds )
+    {
+        // for compatibility
+        mnAnimationSpeed = ( fDurationInSeconds <= 0.5 ) ? AnimationSpeed_FAST
+                                : ( fDurationInSeconds >= 1.0 ) ? AnimationSpeed_SLOW : AnimationSpeed_MEDIUM;
+        mfTransitionDurationInSeconds = fDurationInSeconds;
+    }
+
     sal_Int16 SlideTransition::ooxToOdpEightDirections( ::sal_Int32 nOoxType )
     {
     sal_Int16 nOdpDirection;
diff --git a/oox/source/ppt/slidetransitioncontext.cxx b/oox/source/ppt/slidetransitioncontext.cxx
index 64d6d5942ba3..7639df7c023b 100644
--- a/oox/source/ppt/slidetransitioncontext.cxx
+++ b/oox/source/ppt/slidetransitioncontext.cxx
@@ -32,6 +32,7 @@
 #include <oox/helper/attributelist.hxx>
 #include <oox/token/namespaces.hxx>
 #include <oox/token/tokens.hxx>
+#include <oox/token/properties.hxx>

 using namespace ::com::sun::star;
 using namespace ::oox::core;
@@ -50,6 +51,11 @@ SlideTransitionContext::SlideTransitionContext( FragmentHandler2 const & rParent
     // ST_TransitionSpeed
     maTransition.setOoxTransitionSpeed( rAttribs.getToken( XML_spd, XML_fast ) );

+    // p14:dur
+    sal_Int32 nDurationInMs = rAttribs.getInteger( P14_TOKEN( dur ), -1 );
+    if( nDurationInMs > -1 )
+        maTransition.setOoxTransitionSpeed( nDurationInMs / 1000.0 );
+
     // TODO
     rAttribs.getBool( XML_advClick, true );

diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index e6bc79ff3d08..d5e945cc4342 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -527,6 +527,7 @@ TopMargin
 TotalsRow
 Transformation
 TransitionDirection
+TransitionDuration
 TransitionFadeColor
 TransitionSubtype
 TransitionType
diff --git a/sd/source/ui/inc/unoprnms.hxx b/sd/source/ui/inc/unoprnms.hxx
index 3dd438f0ec28..1e5e3b910f3e 100644
--- a/sd/source/ui/inc/unoprnms.hxx
+++ b/sd/source/ui/inc/unoprnms.hxx
@@ -33,6 +33,7 @@
 #define UNO_NAME_PAGE_NUMBER            "Number"
 #define UNO_NAME_PAGE_ORIENTATION       "Orientation"
 #define UNO_NAME_PAGE_SPEED             "Speed"
+#define UNO_NAME_PAGE_TRANSITION_DURATION  "TransitionDuration"
 #define UNO_NAME_PAGE_WIDTH             "Width"
 #define UNO_NAME_PAGE_PREVIEW           "Preview"
 #define UNO_NAME_PAGE_PREVIEWBITMAP     "PreviewBitmap"
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 10f25204c810..532d10dbb569 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -142,7 +142,7 @@ const SvxItemPropertySet* ImplGetDrawPagePropertySet( bool bImpress, PageKind eP
         { OUString("TransitionSubtype"),            WID_TRANSITION_SUBTYPE, ::cppu::UnoType<sal_Int16>::get(),            0,  0},
         { OUString("TransitionDirection"),          WID_TRANSITION_DIRECTION, ::cppu::UnoType<sal_Bool>::get(),           0,  0},
         { OUString("TransitionFadeColor"),          WID_TRANSITION_FADE_COLOR, ::cppu::UnoType<sal_Int32>::get(),         0,  0},
-        { OUString("TransitionDuration"),           WID_TRANSITION_DURATION, ::cppu::UnoType<double>::get(),          0,  0},
+        { OUString(UNO_NAME_PAGE_TRANSITION_DURATION), WID_TRANSITION_DURATION, ::cppu::UnoType<double>::get(),          0,  0},
         { OUString("LoopSound"),                    WID_LOOP_SOUND, cppu::UnoType<bool>::get(),                    0, 0},
         { OUString("NavigationOrder"),              WID_NAVORDER, cppu::UnoType<css::container::XIndexAccess>::get(),0,  0},
         { OUString(), 0, css::uno::Type(), 0, 0 }
--
2.13.6


From 9719741507be6daa92e4af9ddfb3177fa51404ca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Szymon=20K=C5=82os?= <szymon.klos@collabora.com>
Date: Mon, 5 Feb 2018 12:41:58 +0100
Subject: [PATCH 2/4] tdf#115394 export custom transition time in PPTX
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Change-Id: Ib8f4cef713895029dc18f68a07baa4b65e4260c0
Reviewed-on: https://gerrit.libreoffice.org/49245
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
---
 sd/qa/unit/export-tests-ooxml2.cxx       |  36 ++++++++
 sd/source/filter/eppt/pptx-epptooxml.cxx | 150 ++++++++++++++++++++++---------
 2 files changed, 145 insertions(+), 41 deletions(-)

diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index c5c3ca580101..9ba23b0ac016 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -650,7 +650,42 @@ void PowerPointExport::WriteTransition(const FSHelperPtr& pFS)
     sal_Int32 advanceTiming = -1;
     sal_Int32 changeType = 0;

-    if (GETA(Speed))
+    sal_Int32 nTransitionDuration = -1;
+    bool isTransitionDurationSet = false;
+
+    // try to use TransitionDuration instead of old Speed property
+    if (GETA(TransitionDuration))
+    {
+        double fTransitionDuration = -1.0;
+        mAny >>= fTransitionDuration;
+        if (fTransitionDuration >= 0)
+        {
+            nTransitionDuration = fTransitionDuration * 1000.0;
+
+            // override values because in MS formats meaning of fast/medium/slow is different
+            if (nTransitionDuration <= 500)
+            {
+                // fast is default
+                speed = nullptr;
+            }
+            else if (nTransitionDuration >= 1000)
+            {
+                speed = "slow";
+            }
+            else
+            {
+                speed = "med";
+            }
+
+            bool isStandardValue = nTransitionDuration == 500
+                || nTransitionDuration == 750
+                || nTransitionDuration == 1000;
+
+            if(!isStandardValue)
+                isTransitionDurationSet = true;
+        }
+    }
+    else if (GETA(Speed))
     {
         mAny >>= animationSpeed;

@@ -670,50 +705,12 @@ void PowerPointExport::WriteTransition(const FSHelperPtr& pFS)

     if (GETA(Change))
         mAny >>= changeType;
+    bool isAdvanceTimingSet = advanceTiming != -1;

     // 1 means automatic, 2 half automatic - not sure what it means - at least I don't see it in UI
     if (changeType == 1 && GETA(Duration))
         mAny >>= advanceTiming;

-    if (nTransition14 || pPresetTransition)
-    {
-        const char* pRequiresNS = nTransition14 ? "p14" : "p15";
-
-        pFS->startElement(FSNS(XML_mc, XML_AlternateContent), FSEND);
-        pFS->startElement(FSNS(XML_mc, XML_Choice), XML_Requires, pRequiresNS, FSEND);
-
-
-        pFS->startElementNS(XML_p, XML_transition,
-                            XML_spd, speed,
-                            XML_advTm, advanceTiming != -1 ? I32S(advanceTiming*1000) : nullptr,
-                            FSEND);
-
-        if (nTransition14)
-        {
-            pFS->singleElementNS(XML_p14, nTransition14,
-                                 XML_isInverted, pInverted,
-                                 XML_dir, pDirection14,
-                                 XML_pattern, pPattern,
-                                 FSEND);
-        }
-        else if (pPresetTransition)
-        {
-            pFS->singleElementNS(XML_p15, XML_prstTrans,
-                                 XML_prst, pPresetTransition,
-                                 FSEND);
-        }
-
-        pFS->endElement(FSNS(XML_p, XML_transition));
-
-        pFS->endElement(FSNS(XML_mc, XML_Choice));
-        pFS->startElement(FSNS(XML_mc, XML_Fallback), FSEND);
-    }
-
-    pFS->startElementNS(XML_p, XML_transition,
-                        XML_spd, speed,
-                        XML_advTm, advanceTiming != -1 ? I32S(advanceTiming*1000) : nullptr,
-                        FSEND);
-
     if (!bOOXmlSpecificTransition)
     {
         switch (nPPTTransitionType)
@@ -807,6 +804,77 @@ void PowerPointExport::WriteTransition(const FSHelperPtr& pFS)
         }
     }

+    if (nTransition14 || pPresetTransition || isTransitionDurationSet)
+    {
+        const char* pRequiresNS = (nTransition14 || isTransitionDurationSet) ? "p14" : "p15";
+
+        pFS->startElement(FSNS(XML_mc, XML_AlternateContent), FSEND);
+        pFS->startElement(FSNS(XML_mc, XML_Choice), XML_Requires, pRequiresNS, FSEND);
+
+        if(isTransitionDurationSet && isAdvanceTimingSet)
+        {
+            pFS->startElementNS(XML_p, XML_transition,
+                XML_spd, speed,
+                XML_advTm, I32S(advanceTiming * 1000),
+                FSNS(XML_p14, XML_dur), I32S(nTransitionDuration),
+                FSEND);
+        }
+        else if(isTransitionDurationSet)
+        {
+            pFS->startElementNS(XML_p, XML_transition,
+                XML_spd, speed,
+                FSNS(XML_p14, XML_dur), I32S(nTransitionDuration),
+                FSEND);
+        }
+        else if(isAdvanceTimingSet)
+        {
+            pFS->startElementNS(XML_p, XML_transition,
+                XML_spd, speed,
+                XML_advTm, I32S(advanceTiming * 1000),
+                FSEND);
+        }
+        else
+        {
+            pFS->startElementNS(XML_p, XML_transition,
+                XML_spd, speed,
+                FSEND);
+        }
+
+        if (nTransition14)
+        {
+            pFS->singleElementNS(XML_p14, nTransition14,
+                XML_isInverted, pInverted,
+                XML_dir, pDirection14,
+                XML_pattern, pPattern,
+                FSEND);
+        }
+        else if (pPresetTransition)
+        {
+            pFS->singleElementNS(XML_p15, XML_prstTrans,
+                XML_prst, pPresetTransition,
+                FSEND);
+        }
+        else if (isTransitionDurationSet && nTransition)
+        {
+            pFS->singleElementNS(XML_p, nTransition,
+                XML_dir, pDirection,
+                XML_orient, pOrientation,
+                XML_spokes, pSpokes,
+                XML_thruBlk, pThruBlk,
+                FSEND);
+        }
+
+        pFS->endElement(FSNS(XML_p, XML_transition));
+
+        pFS->endElement(FSNS(XML_mc, XML_Choice));
+        pFS->startElement(FSNS(XML_mc, XML_Fallback), FSEND);
+    }
+
+    pFS->startElementNS(XML_p, XML_transition,
+        XML_spd, speed,
+        XML_advTm, isAdvanceTimingSet ? I32S(advanceTiming * 1000) : nullptr,
+        FSEND);
+
     if (nTransition)
     {
         pFS->singleElementNS(XML_p, nTransition,
@@ -819,7 +887,7 @@ void PowerPointExport::WriteTransition(const FSHelperPtr& pFS)

     pFS->endElementNS(XML_p, XML_transition);

-    if (nTransition14 || pPresetTransition)
+    if (nTransition14 || pPresetTransition || isTransitionDurationSet)
     {
         pFS->endElement(FSNS(XML_mc, XML_Fallback));
         pFS->endElement(FSNS(XML_mc, XML_AlternateContent));
--
2.13.6


From 41fe895bf25d6a0895cfd1ce78f3cbd1d3eb02b3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Szymon=20K=C5=82os?= <szymon.klos@collabora.com>
Date: Wed, 7 Feb 2018 12:22:52 +0100
Subject: [PATCH 3/4] tdf#115394 export correct slide transition time in PPT
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Change-Id: Ie293dd4cc128c256e39d54fdcd83bb5e13484662
Reviewed-on: https://gerrit.libreoffice.org/49345
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
---
 sd/qa/unit/data/ppt/tdf115394.ppt | Bin 0 -> 90112 bytes
 sd/qa/unit/export-tests.cxx       |  39 ++++++++++++++++++++++++++++++++++++++
 sd/qa/unit/import-tests.cxx       |  25 ++++++++++++++++++++++++
 sd/source/filter/eppt/eppt.cxx    |  26 ++++++++++++++++++++++---
 sd/source/filter/ppt/pptin.cxx    |   6 +++---
 5 files changed, 90 insertions(+), 6 deletions(-)
 create mode 100644 sd/qa/unit/data/ppt/tdf115394.ppt

diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx
index 2b3f76a41ebf..a506a376c20f 100644
--- a/sd/source/filter/eppt/eppt.cxx
+++ b/sd/source/filter/eppt/eppt.cxx
@@ -241,11 +241,31 @@ void PPTWriter::ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_
         sal_Int32   nSlideTime = 0;         // still has to !!!
         sal_uInt8   nSpeed = 1;

-        if ( GetPropertyValue( aAny, mXPagePropSet, "Speed" ) )
+        if ( GetPropertyValue( aAny, mXPagePropSet, "TransitionDuration" ) )
         {
             css::presentation::AnimationSpeed aAs;
-            aAny >>= aAs;
-            nSpeed = (sal_uInt8)aAs;
+            double fTransitionDuration = -1.0;
+            aAny >>= fTransitionDuration;
+
+            if (fTransitionDuration >= 0)
+            {
+                if (fTransitionDuration <= 0.5)
+                {
+                    aAs = css::presentation::AnimationSpeed::AnimationSpeed_FAST;
+                }
+                else if (fTransitionDuration >= 1.0)
+                {
+                    aAs = css::presentation::AnimationSpeed::AnimationSpeed_SLOW;
+                }
+                else
+                {
+                    aAs = css::presentation::AnimationSpeed::AnimationSpeed_MEDIUM;
+                }
+            }
+            else
+                aAs = css::presentation::AnimationSpeed::AnimationSpeed_MEDIUM;
+
+            nSpeed = static_cast<sal_uInt8>(aAs);
         }
         sal_Int16 nTT = 0;
         if ( GetPropertyValue( aAny, mXPagePropSet, "TransitionType" )
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 4215cd7b60a8..91a541135204 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -1786,11 +1786,11 @@ void ImplSdPPTImport::ImportPageEffect( SdPage* pPage, const bool bNewAnimations
                                 }

                                 if ( nSpeed == 0 )
-                                    pPage->setTransitionDuration( 3.0 );    // slow
+                                    pPage->setTransitionDuration( 1.0 );    // slow
                                 else if ( nSpeed == 1 )
-                                    pPage->setTransitionDuration( 2.0 );    // medium
+                                    pPage->setTransitionDuration( 0.75 );    // medium
                                 else if ( nSpeed == 2 )
-                                    pPage->setTransitionDuration( 1.0 );    // fast
+                                    pPage->setTransitionDuration( 0.5 );    // fast

                                 if ( nBuildFlags & 0x400 )                      // slidechange by time
                                 {   // time to show (in Ticks)
--
2.13.6


From b49d7f142bf33a961b8a5ba1ba92e6dc85134940 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Szymon=20K=C5=82os?= <szymon.klos@collabora.com>
Date: Thu, 8 Feb 2018 23:21:38 +0100
Subject: [PATCH 4/4] tdf#115394 correct transition in case of 0s
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Change-Id: I23d18acef0bd5db4a4ad6fc67d409e7ed5c93949
Reviewed-on: https://gerrit.libreoffice.org/49462
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
---
 include/oox/ppt/slidetransitioncontext.hxx |   1 +
 oox/source/ppt/slidetransitioncontext.cxx  |   9 ++++++++-
 sd/qa/unit/data/pptx/tdf115394-zero.pptx   | Bin 0 -> 34352 bytes
 sd/qa/unit/export-tests-ooxml2.cxx         |  16 ++++++++++++++++
 sd/source/filter/eppt/pptx-epptooxml.cxx   |   8 ++++----
 5 files changed, 29 insertions(+), 5 deletions(-)
 create mode 100644 sd/qa/unit/data/pptx/tdf115394-zero.pptx

diff --git a/include/oox/ppt/slidetransitioncontext.hxx b/include/oox/ppt/slidetransitioncontext.hxx
index 3361fd07a5a5..f6b2e7a91d56 100644
--- a/include/oox/ppt/slidetransitioncontext.hxx
+++ b/include/oox/ppt/slidetransitioncontext.hxx
@@ -47,6 +47,7 @@ namespace oox { namespace ppt {
     private:
         PropertyMap&                    maSlideProperties;
         bool                            mbHasTransition;
+        bool                            mbHasTransitionDuration;
         SlideTransition                 maTransition;
     };

diff --git a/oox/source/ppt/slidetransitioncontext.cxx b/oox/source/ppt/slidetransitioncontext.cxx
index 7639df7c023b..94fc1c3862ae 100644
--- a/oox/source/ppt/slidetransitioncontext.cxx
+++ b/oox/source/ppt/slidetransitioncontext.cxx
@@ -47,6 +47,7 @@ SlideTransitionContext::SlideTransitionContext( FragmentHandler2 const & rParent
 : FragmentHandler2( rParent )
 , maSlideProperties( aProperties )
 , mbHasTransition( false )
+, mbHasTransitionDuration( false )
 {
     // ST_TransitionSpeed
     maTransition.setOoxTransitionSpeed( rAttribs.getToken( XML_spd, XML_fast ) );
@@ -54,7 +55,13 @@ SlideTransitionContext::SlideTransitionContext( FragmentHandler2 const & rParent
     // p14:dur
     sal_Int32 nDurationInMs = rAttribs.getInteger( P14_TOKEN( dur ), -1 );
     if( nDurationInMs > -1 )
+    {
+        // In MSO 0 is visible as 0.01s
+        if( nDurationInMs == 0.0 )
+            nDurationInMs = 10;
         maTransition.setOoxTransitionSpeed( nDurationInMs / 1000.0 );
+        mbHasTransitionDuration = true;
+    }

     // TODO
     rAttribs.getBool( XML_advClick, true );
@@ -182,7 +189,7 @@ void SlideTransitionContext::onEndElement()
 {
     if( isCurrentElement(PPT_TOKEN( transition )) )
     {
-        if( mbHasTransition )
+        if( mbHasTransition || mbHasTransitionDuration )
         {
             maTransition.setSlideProperties( maSlideProperties );
             mbHasTransition = false;
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 9ba23b0ac016..1ab1a7dc68ff 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -641,10 +641,6 @@ void PowerPointExport::WriteTransition(const FSHelperPtr& pFS)
         }
     }

-    // check if we resolved what transition to export
-    if (!nPPTTransitionType && !bOOXmlSpecificTransition)
-        return;
-
     AnimationSpeed animationSpeed = AnimationSpeed_MEDIUM;
     const char* speed = nullptr;
     sal_Int32 advanceTiming = -1;
@@ -703,6 +699,10 @@ void PowerPointExport::WriteTransition(const FSHelperPtr& pFS)
         }
     }

+    // check if we resolved what transition to export or time is set
+    if (!nPPTTransitionType && !bOOXmlSpecificTransition && !isTransitionDurationSet)
+        return;
+
     if (GETA(Change))
         mAny >>= changeType;
     bool isAdvanceTimingSet = advanceTiming != -1;
--
2.13.6

openSUSE Build Service is sponsored by