implement PowerPoint 'flash' slide transition (API CHANGE)
It's like 'fade', but using white instead of black. It's a separate type in the pptx file (although I actually cannot find it in the spec OOXML, but PowerPoint 2013 generates it). The API change in XTransitionFactory should be fine, I doubt there's anything external using it. Change-Id: I3479840f265ed8227b3b8301ecff56a63d57f493 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93668 Tested-by: Luboš Luňák <l.lunak@collabora.com> Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
This commit is contained in:
parent
320cba9284
commit
e3d7fdff5c
16 changed files with 88 additions and 21 deletions
|
@ -72,6 +72,7 @@ namespace oox::ppt {
|
|||
double mfTransitionDurationInSeconds;
|
||||
bool mbMode; /**< https://api.libreoffice.org/docs/common/ref/com/sun/star/animations/XTransitionFilter.html Mode property */
|
||||
::sal_Int32 mnAdvanceTime;
|
||||
::sal_Int32 mnTransitionFadeColor;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -52,6 +52,9 @@ interface XTransitionFactory : ::com::sun::star::uno::XInterface
|
|||
@param transitionSubType
|
||||
Subtype for the transition (@see ::com::sun::star::animations::TransitionSubType)
|
||||
|
||||
@param transitionFadeColor
|
||||
Color to use (for some transitions)
|
||||
|
||||
@param view
|
||||
Slide show view to display on
|
||||
|
||||
|
@ -63,6 +66,7 @@ interface XTransitionFactory : ::com::sun::star::uno::XInterface
|
|||
*/
|
||||
XTransition createTransition( [in] short transitionType,
|
||||
[in] short transitionSubType,
|
||||
[in] long transitionFadeColor,
|
||||
[in] XSlideShowView view,
|
||||
[in] com::sun::star::rendering::XBitmap leavingBitmap,
|
||||
[in] com::sun::star::rendering::XBitmap enteringBitmap );
|
||||
|
|
|
@ -1658,6 +1658,11 @@
|
|||
<value xml:lang="en-US">Through Black</value>
|
||||
</prop>
|
||||
</node>
|
||||
<node oor:name="through-white" oor:op="replace">
|
||||
<prop oor:name="Label" oor:type="xs:string">
|
||||
<value xml:lang="en-US">Through White</value>
|
||||
</prop>
|
||||
</node>
|
||||
<node oor:name="left-right" oor:op="replace">
|
||||
<prop oor:name="Label" oor:type="xs:string">
|
||||
<value xml:lang="en-US">Left to Right</value>
|
||||
|
@ -2020,6 +2025,14 @@
|
|||
<value>through-black</value>
|
||||
</prop>
|
||||
</node>
|
||||
<node oor:name="fade-through-white" oor:op="replace">
|
||||
<prop oor:name="Set" oor:type="xs:string">
|
||||
<value>fade</value>
|
||||
</prop>
|
||||
<prop oor:name="Variant" oor:type="xs:string">
|
||||
<value>through-white</value>
|
||||
</prop>
|
||||
</node>
|
||||
<node oor:name="zoom-rotate-in" oor:op="replace">
|
||||
<prop oor:name="Set" oor:type="xs:string">
|
||||
<value>newsflash</value>
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include <osl/diagnose.h>
|
||||
#include <sal/log.hxx>
|
||||
#include <tools/color.hxx>
|
||||
|
||||
#include <oox/helper/propertymap.hxx>
|
||||
#include <oox/token/namespaces.hxx>
|
||||
|
@ -46,6 +47,7 @@ namespace oox::ppt {
|
|||
, mfTransitionDurationInSeconds( -1.0 )
|
||||
, mbMode( true )
|
||||
, mnAdvanceTime( -1 )
|
||||
, mnTransitionFadeColor( 0 )
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -58,6 +60,7 @@ namespace oox::ppt {
|
|||
, mfTransitionDurationInSeconds( -1.0 )
|
||||
, mbMode( true )
|
||||
, mnAdvanceTime( -1 )
|
||||
, mnTransitionFadeColor( 0 )
|
||||
{
|
||||
const transition *p = transition::find( sFilterName );
|
||||
if( p )
|
||||
|
@ -78,7 +81,7 @@ namespace oox::ppt {
|
|||
aProps.setProperty( PROP_Speed, mnAnimationSpeed);
|
||||
if( mfTransitionDurationInSeconds >= 0.0 )
|
||||
aProps.setProperty( PROP_TransitionDuration, mfTransitionDurationInSeconds);
|
||||
aProps.setProperty( PROP_TransitionFadeColor, sal_Int32(0));
|
||||
aProps.setProperty( PROP_TransitionFadeColor, mnTransitionFadeColor);
|
||||
if( mnAdvanceTime != -1 ) {
|
||||
aProps.setProperty( PROP_Duration, mnAdvanceTime/1000);
|
||||
aProps.setProperty( PROP_Change, static_cast<sal_Int32>(1));
|
||||
|
@ -431,6 +434,11 @@ namespace oox::ppt {
|
|||
mnTransitionType = TransitionType::MISCSHAPEWIPE;
|
||||
mnTransitionSubType = TransitionSubType::HEART;
|
||||
break;
|
||||
case P14_TOKEN(flash):
|
||||
mnTransitionType = TransitionType::FADE;
|
||||
mnTransitionSubType = TransitionSubType::FADEOVERCOLOR;
|
||||
mnTransitionFadeColor = static_cast<sal_Int32>(COL_WHITE);
|
||||
break;
|
||||
default:
|
||||
mnTransitionType = 0;
|
||||
break;
|
||||
|
|
|
@ -138,6 +138,7 @@ SlideTransitionContext::~SlideTransitionContext() throw()
|
|||
case P14_TOKEN( ripple ):
|
||||
case P14_TOKEN( glitter ):
|
||||
case P14_TOKEN( honeycomb ):
|
||||
case P14_TOKEN( flash ):
|
||||
// CT_Empty
|
||||
if (!mbHasTransition)
|
||||
{
|
||||
|
|
|
@ -254,7 +254,7 @@ void PPTWriter::ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_
|
|||
sal_Int16 nTST = 0;
|
||||
if ( GetPropertyValue( aAny, mXPagePropSet, "TransitionSubtype" )
|
||||
&& ( aAny >>= nTST ) )
|
||||
nTransitionType = GetTransition( nTT, nTST, eFe, nDirection );
|
||||
nTransitionType = GetTransition( nTT, nTST, eFe, 0, nDirection );
|
||||
|
||||
}
|
||||
if ( !nTransitionType )
|
||||
|
|
|
@ -405,7 +405,8 @@ public:
|
|||
bool CreateSlideMaster( sal_uInt32 nPageNum );
|
||||
bool CreateNotes( sal_uInt32 nPageNum );
|
||||
|
||||
static sal_Int8 GetTransition( sal_Int16 nTransitionType, sal_Int16 nTransitionSubtype, css::presentation::FadeEffect eEffect, sal_uInt8& nDirection );
|
||||
static sal_Int8 GetTransition( sal_Int16 nTransitionType, sal_Int16 nTransitionSubtype, css::presentation::FadeEffect eEffect,
|
||||
sal_Int32 nTransitionFadeColor, sal_uInt8& nDirection );
|
||||
static sal_Int8 GetTransition( css::presentation::FadeEffect eEffect, sal_uInt8& nDirection );
|
||||
};
|
||||
|
||||
|
|
|
@ -711,7 +711,8 @@ bool PPTWriterBase::GetShapeByIndex( sal_uInt32 nIndex, bool bGroup )
|
|||
return false;
|
||||
}
|
||||
|
||||
sal_Int8 PPTWriterBase::GetTransition( sal_Int16 nTransitionType, sal_Int16 nTransitionSubtype, FadeEffect eEffect, sal_uInt8& nDirection )
|
||||
sal_Int8 PPTWriterBase::GetTransition( sal_Int16 nTransitionType, sal_Int16 nTransitionSubtype, FadeEffect eEffect,
|
||||
sal_Int32 nTransitionFadeColor, sal_uInt8& nDirection )
|
||||
{
|
||||
sal_Int8 nPPTTransitionType = 0;
|
||||
nDirection = 0;
|
||||
|
@ -723,7 +724,12 @@ sal_Int8 PPTWriterBase::GetTransition( sal_Int16 nTransitionType, sal_Int16 nTra
|
|||
if ( nTransitionSubtype == TransitionSubType::CROSSFADE )
|
||||
nPPTTransitionType = PPT_TRANSITION_TYPE_SMOOTHFADE;
|
||||
else if ( nTransitionSubtype == TransitionSubType::FADEOVERCOLOR )
|
||||
nPPTTransitionType = PPT_TRANSITION_TYPE_FADE;
|
||||
{
|
||||
if( nTransitionFadeColor == static_cast<sal_Int32>(COL_WHITE) )
|
||||
nPPTTransitionType = PPT_TRANSITION_TYPE_FLASH;
|
||||
else
|
||||
nPPTTransitionType = PPT_TRANSITION_TYPE_FADE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TransitionType::PUSHWIPE :
|
||||
|
|
|
@ -565,7 +565,13 @@ void PowerPointExport::WriteTransition(const FSHelperPtr& pFS)
|
|||
|
||||
if (ImplGetPropertyValue(mXPagePropSet, "TransitionType") && (mAny >>= nTransitionType) &&
|
||||
ImplGetPropertyValue(mXPagePropSet, "TransitionSubtype") && (mAny >>= nTransitionSubtype))
|
||||
nPPTTransitionType = GetTransition(nTransitionType, nTransitionSubtype, eFadeEffect, nDirection);
|
||||
{
|
||||
// FADEOVERCOLOR with black -> fade, with white -> flash
|
||||
sal_Int32 nTransitionFadeColor = 0;
|
||||
if( ImplGetPropertyValue(mXPagePropSet, "TransitionFadeColor"))
|
||||
mAny >>= nTransitionFadeColor;
|
||||
nPPTTransitionType = GetTransition(nTransitionType, nTransitionSubtype, eFadeEffect, nTransitionFadeColor, nDirection);
|
||||
}
|
||||
|
||||
if (!nPPTTransitionType && eFadeEffect != FadeEffect_NONE)
|
||||
nPPTTransitionType = GetTransition(eFadeEffect, nDirection);
|
||||
|
@ -817,6 +823,11 @@ void PowerPointExport::WriteTransition(const FSHelperPtr& pFS)
|
|||
nTransition = XML_zoom;
|
||||
pDirection = (nDirection == 1) ? "in" : "out";
|
||||
break;
|
||||
case PPT_TRANSITION_TYPE_FLASH:
|
||||
nTransition14 = XML_flash;
|
||||
nTransition = XML_fade;
|
||||
bOOXmlSpecificTransition = true;
|
||||
break;
|
||||
// coverity[dead_error_line] - following conditions exist to avoid compiler warning
|
||||
case PPT_TRANSITION_TYPE_NONE:
|
||||
default:
|
||||
|
|
|
@ -56,6 +56,9 @@ namespace ppt
|
|||
#define PPT_TRANSITION_TYPE_WHEEL 26
|
||||
#define PPT_TRANSITION_TYPE_CIRCLE 27
|
||||
|
||||
// undocumented(?)
|
||||
#define PPT_TRANSITION_TYPE_FLASH 30
|
||||
|
||||
// atoms
|
||||
#define DFF_msofbtAnimEvent 0xf125
|
||||
#define DFF_msofbtAnimNode 0xf127
|
||||
|
|
|
@ -134,6 +134,9 @@
|
|||
<anim:par pres:preset-id="fade-through-black">
|
||||
<anim:transitionFilter smil:type="fade" smil:subtype="fadeOverColor" smil:fadeColor="#000000"/>
|
||||
</anim:par>
|
||||
<anim:par pres:preset-id="fade-through-white">
|
||||
<anim:transitionFilter smil:type="fade" smil:subtype="fadeOverColor" smil:fadeColor="#FFFFFF"/>
|
||||
</anim:par>
|
||||
<anim:par pres:preset-id="cut-through-black">
|
||||
<anim:transitionFilter smil:type="barWipe" smil:subtype="fadeOverColor" smil:fadeColor="#000000"/>
|
||||
</anim:par>
|
||||
|
|
|
@ -15,7 +15,11 @@ uniform float time;
|
|||
varying vec2 v_texturePosition;
|
||||
|
||||
void main() {
|
||||
vec4 black = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#ifdef use_white
|
||||
vec4 color = vec4(1.0, 1.0, 1.0, 1.0);
|
||||
#else
|
||||
vec4 color = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
#endif
|
||||
vec4 texel;
|
||||
float amount;
|
||||
if (time < 0.5) {
|
||||
|
@ -25,7 +29,7 @@ void main() {
|
|||
texel = texture2D(enteringSlideTexture, v_texturePosition);
|
||||
amount = (1.0 - time) * 2;
|
||||
}
|
||||
gl_FragColor = mix(texel, black, amount);
|
||||
gl_FragColor = mix(texel, color, amount);
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
|
|
@ -1351,37 +1351,40 @@ std::shared_ptr<OGLTransitionImpl> makeFadeSmoothly()
|
|||
namespace
|
||||
{
|
||||
|
||||
class FadeThroughBlackTransition : public OGLTransitionImpl
|
||||
class FadeThroughColorTransition : public OGLTransitionImpl
|
||||
{
|
||||
public:
|
||||
FadeThroughBlackTransition(const TransitionScene& rScene, const TransitionSettings& rSettings)
|
||||
: OGLTransitionImpl(rScene, rSettings)
|
||||
FadeThroughColorTransition(const TransitionScene& rScene, const TransitionSettings& rSettings, bool white)
|
||||
: OGLTransitionImpl(rScene, rSettings), useWhite( white )
|
||||
{}
|
||||
|
||||
private:
|
||||
virtual GLuint makeShader() const override;
|
||||
bool useWhite;
|
||||
};
|
||||
|
||||
GLuint FadeThroughBlackTransition::makeShader() const
|
||||
GLuint FadeThroughColorTransition::makeShader() const
|
||||
{
|
||||
return OpenGLHelper::LoadShaders( "basicVertexShader", "fadeBlackFragmentShader" );
|
||||
return OpenGLHelper::LoadShaders( "basicVertexShader", "fadeBlackFragmentShader",
|
||||
useWhite ? "#define use_white" : "", "" );
|
||||
}
|
||||
|
||||
std::shared_ptr<OGLTransitionImpl>
|
||||
makeFadeThroughBlackTransition(
|
||||
makeFadeThroughColorTransition(
|
||||
const Primitives_t& rLeavingSlidePrimitives,
|
||||
const Primitives_t& rEnteringSlidePrimitives,
|
||||
const TransitionSettings& rSettings)
|
||||
const TransitionSettings& rSettings,
|
||||
bool white)
|
||||
{
|
||||
return std::make_shared<FadeThroughBlackTransition>(
|
||||
return std::make_shared<FadeThroughColorTransition>(
|
||||
TransitionScene(rLeavingSlidePrimitives, rEnteringSlidePrimitives),
|
||||
rSettings)
|
||||
rSettings, white)
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
std::shared_ptr<OGLTransitionImpl> makeFadeThroughBlack()
|
||||
std::shared_ptr<OGLTransitionImpl> makeFadeThroughColor( bool white )
|
||||
{
|
||||
Primitive Slide;
|
||||
|
||||
|
@ -1395,7 +1398,7 @@ std::shared_ptr<OGLTransitionImpl> makeFadeThroughBlack()
|
|||
TransitionSettings aSettings;
|
||||
aSettings.mbUseMipMapLeaving = aSettings.mbUseMipMapEntering = false;
|
||||
|
||||
return makeFadeThroughBlackTransition(aLeavingSlide, aEnteringSlide, aSettings);
|
||||
return makeFadeThroughColorTransition(aLeavingSlide, aEnteringSlide, aSettings, white);
|
||||
}
|
||||
|
||||
namespace
|
||||
|
|
|
@ -271,7 +271,8 @@ std::shared_ptr<OGLTransitionImpl> makeNewsflash();
|
|||
|
||||
std::shared_ptr<OGLTransitionImpl> makeDiamond();
|
||||
std::shared_ptr<OGLTransitionImpl> makeFadeSmoothly();
|
||||
std::shared_ptr<OGLTransitionImpl> makeFadeThroughBlack();
|
||||
// fade through black or white
|
||||
std::shared_ptr<OGLTransitionImpl> makeFadeThroughColor( bool white = false );
|
||||
|
||||
class SceneObject
|
||||
{
|
||||
|
|
|
@ -1214,6 +1214,7 @@ public:
|
|||
virtual uno::Reference< presentation::XTransition > SAL_CALL createTransition(
|
||||
sal_Int16 transitionType,
|
||||
sal_Int16 transitionSubType,
|
||||
sal_Int32 transitionFadeColor,
|
||||
const uno::Reference< presentation::XSlideShowView >& view,
|
||||
const uno::Reference< rendering::XBitmap >& leavingBitmap,
|
||||
const uno::Reference< rendering::XBitmap >& enteringBitmap ) override
|
||||
|
@ -1288,7 +1289,7 @@ public:
|
|||
} else if( transitionType == animations::TransitionType::FADE && transitionSubType == animations::TransitionSubType::CROSSFADE ) {
|
||||
pTransition = makeFadeSmoothly();
|
||||
} else if( transitionType == animations::TransitionType::FADE && transitionSubType == animations::TransitionSubType::FADEOVERCOLOR ) {
|
||||
pTransition = makeFadeThroughBlack();
|
||||
pTransition = makeFadeThroughColor( transitionFadeColor == 0xffffff );
|
||||
} else if( transitionType == animations::TransitionType::IRISWIPE && transitionSubType == animations::TransitionSubType::DIAMOND ) {
|
||||
pTransition = makeDiamond();
|
||||
} else if( transitionType == animations::TransitionType::ZOOM && transitionSubType == animations::TransitionSubType::ROTATEIN ) {
|
||||
|
|
|
@ -108,6 +108,7 @@ public:
|
|||
*/
|
||||
PluginSlideChange( sal_Int16 nTransitionType,
|
||||
sal_Int16 nTransitionSubType,
|
||||
const RGBColor& rTransitionFadeColor,
|
||||
std::optional<SlideSharedPtr> const& leavingSlide_,
|
||||
const SlideSharedPtr& pEnteringSlide,
|
||||
const UnoViewContainer& rViewContainer,
|
||||
|
@ -126,6 +127,7 @@ public:
|
|||
mbSuccess( false ),
|
||||
mnTransitionType( nTransitionType ),
|
||||
mnTransitionSubType( nTransitionSubType ),
|
||||
mnTransitionFadeColor( rTransitionFadeColor ),
|
||||
mxFactory( xFactory )
|
||||
{
|
||||
// create one transition per view
|
||||
|
@ -150,6 +152,7 @@ public:
|
|||
uno::Reference<presentation::XTransition> rTransition = mxFactory->createTransition(
|
||||
mnTransitionType,
|
||||
mnTransitionSubType,
|
||||
RGBAColor2UnoColor( mnTransitionFadeColor.getIntegerColor()),
|
||||
rView->getUnoView(),
|
||||
getLeavingBitmap(ViewEntry(rView))->getXBitmap(),
|
||||
getEnteringBitmap(ViewEntry(rView))->getXBitmap() );
|
||||
|
@ -247,6 +250,7 @@ private:
|
|||
|
||||
sal_Int16 mnTransitionType;
|
||||
sal_Int16 mnTransitionSubType;
|
||||
RGBColor mnTransitionFadeColor;
|
||||
|
||||
uno::Reference<presentation::XTransitionFactory> mxFactory;
|
||||
};
|
||||
|
@ -844,6 +848,7 @@ NumberAnimationSharedPtr createSlideWipeTransition(
|
|||
NumberAnimationSharedPtr createPluginTransition(
|
||||
sal_Int16 nTransitionType,
|
||||
sal_Int16 nTransitionSubType,
|
||||
const RGBColor& rTransitionFadeColor,
|
||||
std::optional<SlideSharedPtr> const& pLeavingSlide,
|
||||
const SlideSharedPtr& pEnteringSlide,
|
||||
const UnoViewContainer& rViewContainer,
|
||||
|
@ -857,6 +862,7 @@ NumberAnimationSharedPtr createPluginTransition(
|
|||
std::make_shared<PluginSlideChange>(
|
||||
nTransitionType,
|
||||
nTransitionSubType,
|
||||
rTransitionFadeColor,
|
||||
pLeavingSlide,
|
||||
pEnteringSlide,
|
||||
rViewContainer,
|
||||
|
@ -909,6 +915,7 @@ NumberAnimationSharedPtr TransitionFactory::createSlideTransition(
|
|||
createPluginTransition(
|
||||
nTransitionType,
|
||||
nTransitionSubType,
|
||||
rTransitionFadeColor,
|
||||
std::make_optional(pLeavingSlide),
|
||||
pEnteringSlide,
|
||||
rViewContainer,
|
||||
|
|
Loading…
Reference in a new issue