summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2020-05-07 17:46:01 +0200
committerLuboš Luňák <l.lunak@collabora.com>2020-05-08 17:37:26 +0200
commite3d7fdff5ce3089b24b755063da95a3462b0fc30 (patch)
treee15fc59e9af4439a6f22acea1401cc687c4b3237
parent320cba92847242cfaf34966c3fc32c4e76d45f03 (diff)
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>
-rw-r--r--include/oox/ppt/slidetransition.hxx1
-rw-r--r--offapi/com/sun/star/presentation/XTransitionFactory.idl4
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu13
-rw-r--r--oox/source/ppt/slidetransition.cxx10
-rw-r--r--oox/source/ppt/slidetransitioncontext.cxx1
-rw-r--r--sd/source/filter/eppt/eppt.cxx2
-rw-r--r--sd/source/filter/eppt/epptbase.hxx3
-rw-r--r--sd/source/filter/eppt/pptx-epptbase.cxx10
-rw-r--r--sd/source/filter/eppt/pptx-epptooxml.cxx13
-rw-r--r--sd/source/filter/ppt/pptanimations.hxx3
-rw-r--r--sd/xml/transitions.xml3
-rw-r--r--slideshow/opengl/fadeBlackFragmentShader.glsl8
-rw-r--r--slideshow/source/engine/opengl/TransitionImpl.cxx25
-rw-r--r--slideshow/source/engine/opengl/TransitionImpl.hxx3
-rw-r--r--slideshow/source/engine/opengl/TransitionerImpl.cxx3
-rw-r--r--slideshow/source/engine/transitions/slidetransitionfactory.cxx7
16 files changed, 88 insertions, 21 deletions
diff --git a/include/oox/ppt/slidetransition.hxx b/include/oox/ppt/slidetransition.hxx
index 662b9032dacd..40b664231d9f 100644
--- a/include/oox/ppt/slidetransition.hxx
+++ b/include/oox/ppt/slidetransition.hxx
@@ -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;
};
}
diff --git a/offapi/com/sun/star/presentation/XTransitionFactory.idl b/offapi/com/sun/star/presentation/XTransitionFactory.idl
index 008fdfd7b553..1445565260ad 100644
--- a/offapi/com/sun/star/presentation/XTransitionFactory.idl
+++ b/offapi/com/sun/star/presentation/XTransitionFactory.idl
@@ -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 );
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu
index 1f385b61c540..1f9267d958e1 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu
@@ -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>
diff --git a/oox/source/ppt/slidetransition.cxx b/oox/source/ppt/slidetransition.cxx
index 5f3e5c8edb96..63d746fa6747 100644
--- a/oox/source/ppt/slidetransition.cxx
+++ b/oox/source/ppt/slidetransition.cxx
@@ -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;
diff --git a/oox/source/ppt/slidetransitioncontext.cxx b/oox/source/ppt/slidetransitioncontext.cxx
index 4241d202eb9e..7a5f11b0cca2 100644
--- a/oox/source/ppt/slidetransitioncontext.cxx
+++ b/oox/source/ppt/slidetransitioncontext.cxx
@@ -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)
{
diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx
index a6259824f49c..26f0dae9f234 100644
--- a/sd/source/filter/eppt/eppt.cxx
+++ b/sd/source/filter/eppt/eppt.cxx
@@ -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 )
diff --git a/sd/source/filter/eppt/epptbase.hxx b/sd/source/filter/eppt/epptbase.hxx
index 3a469e7b0611..a5c1a4842f5b 100644
--- a/sd/source/filter/eppt/epptbase.hxx
+++ b/sd/source/filter/eppt/epptbase.hxx
@@ -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 );
};
diff --git a/sd/source/filter/eppt/pptx-epptbase.cxx b/sd/source/filter/eppt/pptx-epptbase.cxx
index acd5df022a4f..13651f0e8f8b 100644
--- a/sd/source/filter/eppt/pptx-epptbase.cxx
+++ b/sd/source/filter/eppt/pptx-epptbase.cxx
@@ -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 :
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 272c5fc31d97..d2fca1e919c7 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -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:
diff --git a/sd/source/filter/ppt/pptanimations.hxx b/sd/source/filter/ppt/pptanimations.hxx
index 84d168bfaf43..a35f742f53ca 100644
--- a/sd/source/filter/ppt/pptanimations.hxx
+++ b/sd/source/filter/ppt/pptanimations.hxx
@@ -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
diff --git a/sd/xml/transitions.xml b/sd/xml/transitions.xml
index cefcab31cf36..78a4d213a029 100644
--- a/sd/xml/transitions.xml
+++ b/sd/xml/transitions.xml
@@ -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>
diff --git a/slideshow/opengl/fadeBlackFragmentShader.glsl b/slideshow/opengl/fadeBlackFragmentShader.glsl
index d45a736c8065..3d618a3b4b91 100644
--- a/slideshow/opengl/fadeBlackFragmentShader.glsl
+++ b/slideshow/opengl/fadeBlackFragmentShader.glsl
@@ -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: */
diff --git a/slideshow/source/engine/opengl/TransitionImpl.cxx b/slideshow/source/engine/opengl/TransitionImpl.cxx
index d1926ab854f9..98d6778fd197 100644
--- a/slideshow/source/engine/opengl/TransitionImpl.cxx
+++ b/slideshow/source/engine/opengl/TransitionImpl.cxx
@@ -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
diff --git a/slideshow/source/engine/opengl/TransitionImpl.hxx b/slideshow/source/engine/opengl/TransitionImpl.hxx
index 2831685cd3a7..ca1d36366a6c 100644
--- a/slideshow/source/engine/opengl/TransitionImpl.hxx
+++ b/slideshow/source/engine/opengl/TransitionImpl.hxx
@@ -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
{
diff --git a/slideshow/source/engine/opengl/TransitionerImpl.cxx b/slideshow/source/engine/opengl/TransitionerImpl.cxx
index 7403cad87425..c60be299752a 100644
--- a/slideshow/source/engine/opengl/TransitionerImpl.cxx
+++ b/slideshow/source/engine/opengl/TransitionerImpl.cxx
@@ -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 ) {
diff --git a/slideshow/source/engine/transitions/slidetransitionfactory.cxx b/slideshow/source/engine/transitions/slidetransitionfactory.cxx
index ec67e434cb7c..66faf10e09b3 100644
--- a/slideshow/source/engine/transitions/slidetransitionfactory.cxx
+++ b/slideshow/source/engine/transitions/slidetransitionfactory.cxx
@@ -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,