diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2018-02-08 23:21:38 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-03-25 18:28:43 +0200 |
commit | a860ec6b4e567366c731e9aadbbd1ec85f0a072a (patch) | |
tree | b1b71ce35ab9ebcf414bee80b72e33eb48658888 | |
parent | 32e187572335e6490b356d2535c0c6792094a023 (diff) |
tdf#115394 correct transition in case of 0s
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>
(cherry picked from commit df835773fa8d66a1bd534c5b374ac27552751941)
-rw-r--r-- | include/oox/ppt/slidetransitioncontext.hxx | 1 | ||||
-rw-r--r-- | oox/source/ppt/slidetransitioncontext.cxx | 9 | ||||
-rw-r--r-- | sd/qa/unit/data/pptx/tdf115394-zero.pptx | bin | 0 -> 34352 bytes | |||
-rw-r--r-- | sd/qa/unit/export-tests-ooxml2.cxx | 16 | ||||
-rw-r--r-- | sd/source/filter/eppt/pptx-epptooxml.cxx | 8 |
5 files changed, 29 insertions, 5 deletions
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/qa/unit/data/pptx/tdf115394-zero.pptx b/sd/qa/unit/data/pptx/tdf115394-zero.pptx Binary files differnew file mode 100644 index 000000000000..e8fb0cfa240c --- /dev/null +++ b/sd/qa/unit/data/pptx/tdf115394-zero.pptx diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index 1386966717f5..411eb5f1a09c 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -127,6 +127,7 @@ public: void testTdf107608(); void testTdf111786(); void testTdf115394(); + void testTdf115394Zero(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest2); @@ -179,6 +180,7 @@ public: CPPUNIT_TEST(testTdf107608); CPPUNIT_TEST(testTdf111786); CPPUNIT_TEST(testTdf115394); + CPPUNIT_TEST(testTdf115394Zero); CPPUNIT_TEST_SUITE_END(); @@ -1400,6 +1402,20 @@ void SdOOXMLExportTest2::testTdf115394() xDocShRef->DoClose(); } +void SdOOXMLExportTest2::testTdf115394Zero() +{ + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf115394-zero.pptx"), PPTX); + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); + double fTransitionDuration; + + SdPage* pPage = xDocShRef->GetDoc()->GetSdPage(0, PageKind::Standard); + fTransitionDuration = pPage->getTransitionDuration(); + CPPUNIT_ASSERT_EQUAL(0.01, fTransitionDuration); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2); CPPUNIT_PLUGIN_IMPLEMENT(); 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; |