sd/qa/unit/data/ppt/tdf115394.ppt |binary sd/qa/unit/export-tests.cxx | 39 ++++++++++++++++++++++++++++++++++++++ sd/qa/unit/import-tests.cxx | 25 ++++++++++++++++++++++++ sd/source/filter/eppt/eppt.cxx | 24 +++++++++++++++++++++-- sd/source/filter/ppt/pptin.cxx | 6 ++--- 5 files changed, 89 insertions(+), 5 deletions(-)
New commits: commit ba9a42009a6e712aea8646956bd711afb058db24 Author: Szymon Kłos <szymon.k...@collabora.com> Date: Wed Feb 7 12:22:52 2018 +0100 tdf#115394 export correct slide transition time in PPT Change-Id: Ie293dd4cc128c256e39d54fdcd83bb5e13484662 Reviewed-on: https://gerrit.libreoffice.org/49345 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> diff --git a/sd/qa/unit/data/ppt/tdf115394.ppt b/sd/qa/unit/data/ppt/tdf115394.ppt new file mode 100644 index 000000000000..1fd299a5e4be Binary files /dev/null and b/sd/qa/unit/data/ppt/tdf115394.ppt differ diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index b27c55b55ba8..73d8bb5c49c6 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -93,6 +93,7 @@ public: void testTdf100926(); void testPageWithTransparentBackground(); void testTextRotation(); + void testTdf115394PPT(); CPPUNIT_TEST_SUITE(SdExportTest); @@ -113,6 +114,7 @@ public: CPPUNIT_TEST(testTdf100926); CPPUNIT_TEST(testPageWithTransparentBackground); CPPUNIT_TEST(testTextRotation); + CPPUNIT_TEST(testTdf115394PPT); CPPUNIT_TEST_SUITE_END(); @@ -843,6 +845,43 @@ void SdExportTest::testTextRotation() xDocShRef->DoClose(); } +void SdExportTest::testTdf115394PPT() +{ + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/ppt/tdf115394.ppt"), PPT); + + // Export the document and import again for a check + uno::Reference< lang::XComponent > xComponent(xDocShRef->GetModel(), uno::UNO_QUERY); + uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY); + utl::MediaDescriptor aMediaDescriptor; + aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[PPT].pFilterName), RTL_TEXTENCODING_UTF8); + + utl::TempFile aTempFile; + aTempFile.EnableKillingFile(); + xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); + xComponent.set(xStorable, uno::UNO_QUERY); + xComponent->dispose(); + xDocShRef = loadURL(aTempFile.GetURL(), PPT); + + double fTransitionDuration; + + // Fast + SdPage* pPage1 = xDocShRef->GetDoc()->GetSdPage(0, PageKind::Standard); + fTransitionDuration = pPage1->getTransitionDuration(); + CPPUNIT_ASSERT_EQUAL(0.5, fTransitionDuration); + + // Medium + SdPage* pPage2 = xDocShRef->GetDoc()->GetSdPage(1, PageKind::Standard); + fTransitionDuration = pPage2->getTransitionDuration(); + CPPUNIT_ASSERT_EQUAL(0.75, fTransitionDuration); + + // Slow + SdPage* pPage3 = xDocShRef->GetDoc()->GetSdPage(2, PageKind::Standard); + fTransitionDuration = pPage3->getTransitionDuration(); + CPPUNIT_ASSERT_EQUAL(1.0, fTransitionDuration); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 652b6ace8626..101131de259b 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -175,6 +175,7 @@ public: void testTdf114913(); void testTdf114821(); void testTdf115394(); + void testTdf115394PPT(); bool checkPattern(sd::DrawDocShellRef const & rDocRef, int nShapeNumber, std::vector<sal_uInt8>& rExpected); void testPatternImport(); @@ -253,6 +254,7 @@ public: CPPUNIT_TEST(testTdf114913); CPPUNIT_TEST(testTdf114821); CPPUNIT_TEST(testTdf115394); + CPPUNIT_TEST(testTdf115394PPT); CPPUNIT_TEST_SUITE_END(); }; @@ -2414,6 +2416,29 @@ void SdImportTest::testTdf115394() xDocShRef->DoClose(); } +void SdImportTest::testTdf115394PPT() +{ + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/ppt/tdf115394.ppt"), PPT); + double fTransitionDuration; + + // Fast + SdPage* pPage1 = xDocShRef->GetDoc()->GetSdPage(0, PageKind::Standard); + fTransitionDuration = pPage1->getTransitionDuration(); + CPPUNIT_ASSERT_EQUAL(0.5, fTransitionDuration); + + // Medium + SdPage* pPage2 = xDocShRef->GetDoc()->GetSdPage(1, PageKind::Standard); + fTransitionDuration = pPage2->getTransitionDuration(); + CPPUNIT_ASSERT_EQUAL(0.75, fTransitionDuration); + + // Slow + SdPage* pPage3 = xDocShRef->GetDoc()->GetSdPage(2, PageKind::Standard); + fTransitionDuration = pPage3->getTransitionDuration(); + CPPUNIT_ASSERT_EQUAL(1.0, fTransitionDuration); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx index 81938bc66ecf..217bb4221317 100644 --- a/sd/source/filter/eppt/eppt.cxx +++ b/sd/source/filter/eppt/eppt.cxx @@ -241,10 +241,30 @@ 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; + 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; diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index e3cc6508a771..62e6e636c792 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -1781,11 +1781,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) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits