diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2015-11-05 21:40:09 +0100 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2015-11-08 19:39:12 +0100 |
commit | 7cacc3326e1409fc245bc7d8d9804966de28e549 (patch) | |
tree | 1ba401a9fe136719257dbcada729f97e1cf89307 | |
parent | 241833e46f7878ed05945ed019f3e48fe515092a (diff) |
pptx: export/import newsflash and comb slide transitions + test
Change-Id: I8ec2e1bc6d6f46f741252085f68edc6c284124b6
-rw-r--r-- | sd/qa/unit/data/AllTransitions.odp | bin | 0 -> 13577 bytes | |||
-rw-r--r-- | sd/qa/unit/export-tests.cxx | 45 | ||||
-rw-r--r-- | sd/source/filter/eppt/pptx-epptbase.cxx | 41 |
3 files changed, 73 insertions, 13 deletions
diff --git a/sd/qa/unit/data/AllTransitions.odp b/sd/qa/unit/data/AllTransitions.odp Binary files differnew file mode 100644 index 000000000000..fa2eced2cc3f --- /dev/null +++ b/sd/qa/unit/data/AllTransitions.odp diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index 2fcec9351420..c74ac8f3dd4d 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -46,6 +46,8 @@ #include <com/sun/star/animations/XAnimationNodeSupplier.hpp> #include <com/sun/star/animations/XAnimationNode.hpp> #include <com/sun/star/animations/XAnimate.hpp> +#include <com/sun/star/animations/TransitionType.hpp> +#include <com/sun/star/animations/TransitionSubType.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/chart/XChartDocument.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> @@ -67,6 +69,7 @@ #include <com/sun/star/table/XTable.hpp> #include <com/sun/star/table/XMergeableCell.hpp> + #include <svx/svdotable.hxx> #include <config_features.h> @@ -127,6 +130,7 @@ public: void testBulletMarginAndIndentation(); void testParaMarginAndindentation(); void testTransparentBackground(); + void testExportTransitionsPPTX(); void testFdo90607(); void testTdf91378(); @@ -168,6 +172,7 @@ public: CPPUNIT_TEST(testBulletMarginAndIndentation); CPPUNIT_TEST(testParaMarginAndindentation); CPPUNIT_TEST(testTransparentBackground); + CPPUNIT_TEST(testExportTransitionsPPTX); CPPUNIT_TEST(testTdf91378); #if !defined WNT @@ -1342,6 +1347,46 @@ void SdExportTest::testTdf80224() xDocShRef->DoClose(); } +bool checkTransitionOnPage(uno::Reference<drawing::XDrawPagesSupplier> xDoc, sal_Int32 nSlideNumber, + sal_Int16 nExpectedTransitionType, sal_Int16 nExpectedTransitionSubType) +{ + sal_Int32 nSlideIndex = nSlideNumber - 1; + + CPPUNIT_ASSERT_MESSAGE("Slide/Page index out of range", nSlideIndex < xDoc->getDrawPages()->getCount()); + + uno::Reference<drawing::XDrawPage> xPage(xDoc->getDrawPages()->getByIndex(nSlideIndex), uno::UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> xPropSet(xPage, uno::UNO_QUERY); + uno::Any aAny; + + aAny = xPropSet->getPropertyValue(OUString("TransitionType")); + sal_Int16 nTransitionType = 0; + if ((aAny >>= nTransitionType) == false) + return false; + + aAny = xPropSet->getPropertyValue(OUString("TransitionSubtype")); + sal_Int16 nTransitionSubtype = 0; + if ((aAny >>= nTransitionSubtype) == false) + return false; + + if (nExpectedTransitionType != nTransitionType) + return false; + if (nExpectedTransitionSubType != nTransitionSubtype) + return false; + + return true; +} + +void SdExportTest::testExportTransitionsPPTX() +{ + sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/AllTransitions.odp"), ODP); + xDocShRef = saveAndReload(xDocShRef, PPTX); + uno::Reference<drawing::XDrawPagesSupplier> xDoc(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW); + + checkTransitionOnPage(xDoc, 71, css::animations::TransitionType::ZOOM, css::animations::TransitionSubType::ROTATEIN); + checkTransitionOnPage(xDoc, 41, css::animations::TransitionType::PUSHWIPE, css::animations::TransitionSubType::COMBHORIZONTAL); + checkTransitionOnPage(xDoc, 42, css::animations::TransitionType::PUSHWIPE, css::animations::TransitionSubType::COMBVERTICAL); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sd/source/filter/eppt/pptx-epptbase.cxx b/sd/source/filter/eppt/pptx-epptbase.cxx index fbcf25c404de..75931b2e068b 100644 --- a/sd/source/filter/eppt/pptx-epptbase.cxx +++ b/sd/source/filter/eppt/pptx-epptbase.cxx @@ -771,22 +771,25 @@ sal_Int8 PPTWriterBase::GetTransition( sal_Int16 nTransitionType, sal_Int16 nTra nPPTTransitionType = PPT_TRANSITION_TYPE_FADE; } break; - case PPT_TRANSITION_TYPE_COMB : - { - nPPTTransitionType = PPT_TRANSITION_TYPE_COMB; - if ( nTransitionSubtype == TransitionSubType::COMBVERTICAL ) - nDirection++; - } - break; case TransitionType::PUSHWIPE : { - nPPTTransitionType = PPT_TRANSITION_TYPE_PUSH; - switch( nTransitionSubtype ) + if (nTransitionSubtype == TransitionSubType::COMBVERTICAL || + nTransitionSubtype == TransitionSubType::COMBHORIZONTAL) + { + nPPTTransitionType = PPT_TRANSITION_TYPE_COMB; + } + else + { + nPPTTransitionType = PPT_TRANSITION_TYPE_PUSH; + } + switch (nTransitionSubtype) { - case TransitionSubType::FROMRIGHT: nDirection = 0; break; - case TransitionSubType::FROMBOTTOM: nDirection = 1; break; - case TransitionSubType::FROMLEFT: nDirection = 2; break; - case TransitionSubType::FROMTOP: nDirection = 3; break; + case TransitionSubType::FROMRIGHT: nDirection = 0; break; + case TransitionSubType::FROMBOTTOM: nDirection = 1; break; + case TransitionSubType::FROMLEFT: nDirection = 2; break; + case TransitionSubType::FROMTOP: nDirection = 3; break; + case TransitionSubType::COMBHORIZONTAL: nDirection = 0; break; + case TransitionSubType::COMBVERTICAL: nDirection = 1; break; } } break; @@ -831,6 +834,18 @@ sal_Int8 PPTWriterBase::GetTransition( sal_Int16 nTransitionType, sal_Int16 nTra } } break; + case TransitionType::ZOOM: + { + switch(nTransitionSubtype) + { + case TransitionSubType::ROTATEIN: + nPPTTransitionType = PPT_TRANSITION_TYPE_NEWSFLASH; + break; + default: + break; + } + } + break; } return nPPTTransitionType; |