slideshow: add "glitter" slide transition

Change-Id: Ie89b64c4399cd0092eee579660c9fe85f8ca8e73
This commit is contained in:
Tomaž Vajngerl 2015-11-13 10:10:17 +01:00
parent 1c482cb54b
commit f6ef7e33b0
10 changed files with 105 additions and 9 deletions

View File

@ -1605,6 +1605,14 @@
<value xml:lang="en-US">Ripple</value>
</prop>
</node>
<node oor:name="glitter" oor:op="replace">
<prop oor:name="Group" oor:type="xs:string">
<value>exciting</value>
</prop>
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Glitter</value>
</prop>
</node>
</node>
<node oor:name="TransitionVariants">
<node oor:name="plain" oor:op="replace">
@ -2348,6 +2356,11 @@
<value>ripple</value>
</prop>
</node>
<node oor:name="glitter" oor:op="replace">
<prop oor:name="Set" oor:type="xs:string">
<value>glitter</value>
</prop>
</node>
</node>
</node>
<node oor:name="Presets">

View File

@ -413,6 +413,10 @@ namespace oox { namespace ppt {
mnTransitionType = TransitionType::MISCSHAPEWIPE;
mnTransitionSubType = TransitionSubType::HORIZONTAL;
break;
case P14_TOKEN(glitter):
mnTransitionType = TransitionType::MISCSHAPEWIPE;
mnTransitionSubType = TransitionSubType::DIAMOND;
break;
default:
mnTransitionType = 0;
break;

View File

@ -131,6 +131,7 @@ SlideTransitionContext::~SlideTransitionContext() throw()
case PPT_TOKEN( wedge ):
case P14_TOKEN( vortex ):
case P14_TOKEN( ripple ):
case P14_TOKEN( glitter ):
// CT_Empty
if (!mbHasTransition)
{

Binary file not shown.

View File

@ -1424,8 +1424,11 @@ void SdExportTest::testExportTransitionsPPTX()
// RIPPLE
CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 71, TransitionType::MISCSHAPEWIPE, TransitionSubType::HORIZONTAL));
// GLITTER
CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 72, TransitionType::MISCSHAPEWIPE, TransitionSubType::DIAMOND));
// NEWSFLASH
CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 72, TransitionType::ZOOM, TransitionSubType::ROTATEIN));
CPPUNIT_ASSERT(checkTransitionOnPage(xDoc, 73, TransitionType::ZOOM, TransitionSubType::ROTATEIN));
}
CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest);

View File

@ -523,15 +523,17 @@ void PowerPointExport::WriteTransition( FSHelperPtr pFS )
sal_Int32 nTransition = 0;
const char* pDirection = nullptr;
const char* pDirection14 = nullptr;
const char* pOrientation = nullptr;
const char* pThruBlk = nullptr;
const char* pSpokes = nullptr;
char pSpokesTmp[2] = "0";
// p14
sal_Int32 nTransition14 = 0;
const char* pDirection14 = nullptr;
const char* pInverted = nullptr;
const char* pPattern = nullptr; // diamond or hexagon
//p15
const char* pPresetTransition = nullptr;
@ -581,13 +583,20 @@ void PowerPointExport::WriteTransition( FSHelperPtr pFS )
pPresetTransition = "fallOver";
bOOXmlSpecificTransition = true;
break;
case animations::TransitionSubType::CORNERSIN:
case animations::TransitionSubType::CORNERSIN: // Inside turning cube
pInverted = "true";
case animations::TransitionSubType::CORNERSOUT:
case animations::TransitionSubType::CORNERSOUT: // Outside turning cube
nTransition = XML_fade;
nTransition14 = XML_prism;
bOOXmlSpecificTransition = true;
break;
case animations::TransitionSubType::DIAMOND: // Glitter
nTransition = XML_fade;
nTransition14 = XML_glitter;
pDirection14 = "l";
pPattern = "hexagon";
bOOXmlSpecificTransition = true;
break;
}
break;
}
@ -644,6 +653,7 @@ void PowerPointExport::WriteTransition( FSHelperPtr pFS )
pFS->singleElementNS(XML_p14, nTransition14,
XML_isInverted, pInverted,
XML_dir, pDirection14,
XML_pattern, pPattern,
FSEND );
}
else if (pPresetTransition)

View File

@ -64,6 +64,9 @@
</anim:par>
<anim:par pres:preset-id="ripple">
<anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="horizontal"/>
</anim:par>
<anim:par pres:preset-id="glitter">
<anim:transitionFilter smil:type="miscShapeWipe" smil:subtype="diamond"/>
</anim:par>
<anim:par pres:preset-id="zoom-rotate-in">
<anim:transitionFilter smil:type="zoom" smil:subtype="rotateIn"/>

View File

@ -836,6 +836,20 @@ std::shared_ptr<OGLTransitionImpl> makeHelix( sal_uInt16 nRows )
return makeSimpleTransition(aLeavingSlide, aEnteringSlide);
}
float fdiv(int a, int b)
{
return static_cast<float>(a)/b;
}
glm::vec2 vec(float x, float y, float nx, float ny)
{
x = x < 0.0 ? 0.0 : x;
x = x > nx ? nx : x;
y = y < 0.0 ? 0.0 : y;
y = y > ny ? ny : y;
return glm::vec2(fdiv(x, nx), fdiv(y, ny));
}
std::shared_ptr<OGLTransitionImpl> makeNByMTileFlip( sal_uInt16 n, sal_uInt16 m )
{
double invN(1.0/static_cast<double>(n));
@ -1649,11 +1663,6 @@ std::shared_ptr<OGLTransitionImpl> makeDissolve()
namespace
{
float fdiv(int a, int b)
{
return static_cast<float>(a)/b;
}
class VortexTransition : public ShaderTransition
{
public:
@ -1863,6 +1872,54 @@ std::shared_ptr<OGLTransitionImpl> makeRipple()
return makeRippleTransition(aLeavingSlide, aEnteringSlide, aSettings);
}
std::shared_ptr<OGLTransitionImpl> makeGlitter()
{
const int NX = 30, NY = 30;
Primitives_t aLeavingSlide;
Primitives_t aEnteringSlide;
for (int y = 0; y < NY+2; y+=2)
{
for (int x = 0; x < NX+2; x+=2)
{
Primitive Slide;
if (y % 4 == 0)
{
Slide.pushTriangle(vec(x-1, y-1, NX, NY), vec(x, y-2, NX, NY), vec(x, y+0.5, NX, NY));
Slide.pushTriangle(vec(x, y-2, NX, NY), vec(x+1, y-1, NX, NY), vec(x, y+0.5, NX, NY));
Slide.pushTriangle(vec(x+1, y-1, NX, NY), vec(x+1, y, NX, NY), vec(x, y+0.5, NX, NY));
Slide.pushTriangle(vec(x+1, y, NX, NY), vec(x, y+1, NX, NY), vec(x, y+0.5, NX, NY));
Slide.pushTriangle(vec(x, y+1, NX, NY), vec(x-1, y, NX, NY), vec(x, y+0.5, NX, NY));
Slide.pushTriangle(vec(x-1, y, NX, NY), vec(x-1, y-1, NX, NY), vec(x, y+0.5, NX, NY));
}
else
{
Slide.pushTriangle(vec(x-2, y-1, NX, NY), vec(x-1, y-2, NX, NY), vec(x, y+0.5, NX, NY));
Slide.pushTriangle(vec(x-1, y-2, NX, NY), vec(x, y-1, NX, NY), vec(x, y+0.5, NX, NY));
Slide.pushTriangle(vec(x, y-1, NX, NY), vec(x, y, NX, NY), vec(x, y+0.5, NX, NY));
Slide.pushTriangle(vec(x, y, NX, NY), vec(x-1, y+1, NX, NY), vec(x, y+0.5, NX, NY));
Slide.pushTriangle(vec(x-1, y+1, NX, NY), vec(x-2, y, NX, NY), vec(x, y+0.5, NX, NY));
Slide.pushTriangle(vec(x-2, y, NX, NY), vec(x-2, y-1, NX, NY), vec(x, y+0.5, NX, NY));
}
glm::vec3 center = Slide.getVertices()[2];
float random = comphelper::rng::uniform_real_distribution(-0.2, std::nextafter(0.2, DBL_MAX));
Slide.Operations.push_back(makeSRotate(glm::vec3(0, 1, 0), center, 180 , true, fdiv(x, NX) + random , 1.0));
aLeavingSlide.push_back (Slide);
Slide.Operations.push_back(makeSRotate(glm::vec3(0, 1, 0), center, 180 , false, fdiv(x, NX) + random, 1.0));
aEnteringSlide.push_back (Slide);
}
}
return makeSimpleTransition(aLeavingSlide, aEnteringSlide);
}
std::shared_ptr<OGLTransitionImpl> makeNewsflash()
{
Primitive Slide;

View File

@ -236,6 +236,7 @@ std::shared_ptr<OGLTransitionImpl> makeStatic();
std::shared_ptr<OGLTransitionImpl> makeDissolve();
std::shared_ptr<OGLTransitionImpl> makeVortex();
std::shared_ptr<OGLTransitionImpl> makeRipple();
std::shared_ptr<OGLTransitionImpl> makeGlitter();
std::shared_ptr<OGLTransitionImpl> makeNewsflash();
/** 2D replacements

View File

@ -1432,6 +1432,7 @@ public:
case animations::TransitionSubType::CORNERSOUT: // 12
case animations::TransitionSubType::VERTICAL: // 13
case animations::TransitionSubType::HORIZONTAL: // 14
case animations::TransitionSubType::DIAMOND: // 26
case animations::TransitionSubType::CIRCLE: // 27
case animations::TransitionSubType::FANOUTHORIZONTAL: // 55
case animations::TransitionSubType::ACROSS: // 108
@ -1520,6 +1521,9 @@ public:
case animations::TransitionSubType::ACROSS:
pTransition = makeNByMTileFlip(8,6);
break;
case animations::TransitionSubType::DIAMOND:
pTransition = makeGlitter();
break;
}
} else if( transitionType == animations::TransitionType::FADE && transitionSubType == animations::TransitionSubType::CROSSFADE ) {
pTransition = makeFadeSmoothly();