make physics based animation effects importable-exportable
Makes physics based animation effects importable and exportable on content.xml. Uses one new xml token animatePhysics. Also adds a new animation preset called Physics Basic that is available under Emphasis animation effect category. Change-Id: I38b0511f973668655cff78becebe3f1e628d9083 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100247 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
This commit is contained in:
committed by
Thorsten Behrens
parent
a58fe88b5b
commit
e33486189d
@@ -30,6 +30,10 @@
|
||||
<implementation name="animcore::AnimateMotion"
|
||||
constructor="com_sun_star_animations_AnimateMotion_get_implementation">
|
||||
<service name="com.sun.star.animations.AnimateMotion"/>
|
||||
</implementation>
|
||||
<implementation name="animcore::AnimatePhysics"
|
||||
constructor="com_sun_star_animations_AnimatePhysics_get_implementation">
|
||||
<service name="com.sun.star.animations.AnimatePhysics"/>
|
||||
</implementation>
|
||||
<implementation name="animcore::AnimateSet"
|
||||
constructor="com_sun_star_animations_AnimateSet_get_implementation">
|
||||
|
||||
@@ -291,7 +291,7 @@ private:
|
||||
const sal_Int16 mnNodeType;
|
||||
|
||||
// for XTypeProvider
|
||||
static std::array<Sequence< Type >*, 12> mpTypes;
|
||||
static std::array<Sequence< Type >*, 13> mpTypes;
|
||||
|
||||
// attributes for the XAnimationNode interface implementation
|
||||
Any maBegin, maDuration, maEnd, maEndSync, maRepeatCount, maRepeatDuration;
|
||||
@@ -394,7 +394,7 @@ Any SAL_CALL TimeContainerEnumeration::nextElement()
|
||||
}
|
||||
|
||||
|
||||
std::array<Sequence< Type >*, 12> AnimationNode::mpTypes = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr };
|
||||
std::array<Sequence< Type >*, 13> AnimationNode::mpTypes = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr };
|
||||
|
||||
AnimationNode::AnimationNode( sal_Int16 nNodeType )
|
||||
: maChangeListener(maMutex),
|
||||
@@ -565,6 +565,16 @@ static OUString getImplementationName_ANIMATEMOTION()
|
||||
return "animcore::AnimateMotion";
|
||||
}
|
||||
|
||||
static Sequence<OUString> getSupportedServiceNames_ANIMATEPHYSICS()
|
||||
{
|
||||
return { "com.sun.star.animations.AnimatePhysics" };
|
||||
}
|
||||
|
||||
static OUString getImplementationName_ANIMATEPHYSICS()
|
||||
{
|
||||
return "animcore::AnimatePhysics";
|
||||
}
|
||||
|
||||
static Sequence<OUString> getSupportedServiceNames_ANIMATETRANSFORM()
|
||||
{
|
||||
return { "com.sun.star.animations.AnimateTransform" };
|
||||
@@ -658,6 +668,12 @@ Any SAL_CALL AnimationNode::queryInterface( const Type& aType )
|
||||
static_cast< XAnimate * >( static_cast< XAnimateMotion * >(this) ),
|
||||
static_cast< XAnimateMotion * >( this ) );
|
||||
break;
|
||||
case AnimationNodeType::ANIMATEPHYSICS:
|
||||
aRet = ::cppu::queryInterface(
|
||||
aType,
|
||||
static_cast< XAnimate * >( static_cast< XAnimateMotion * >(this) ),
|
||||
static_cast< XAnimateMotion * >( this ) );
|
||||
break;
|
||||
case AnimationNodeType::ANIMATECOLOR:
|
||||
aRet = ::cppu::queryInterface(
|
||||
aType,
|
||||
@@ -717,6 +733,7 @@ void AnimationNode::initTypeProvider( sal_Int16 nNodeType ) throw()
|
||||
8, // TRANSITIONFILTER
|
||||
8, // AUDIO
|
||||
8, // COMMAND
|
||||
8, // ANIMATEPHYSICS
|
||||
};
|
||||
|
||||
// collect types
|
||||
@@ -749,6 +766,9 @@ void AnimationNode::initTypeProvider( sal_Int16 nNodeType ) throw()
|
||||
case AnimationNodeType::ANIMATEMOTION:
|
||||
pTypeAr[nPos++] = cppu::UnoType<XAnimateMotion>::get();
|
||||
break;
|
||||
case AnimationNodeType::ANIMATEPHYSICS:
|
||||
pTypeAr[nPos++] = cppu::UnoType<XAnimateMotion>::get();
|
||||
break;
|
||||
case AnimationNodeType::ANIMATECOLOR:
|
||||
pTypeAr[nPos++] = cppu::UnoType<XAnimateColor>::get();
|
||||
break;
|
||||
@@ -817,6 +837,8 @@ OUString AnimationNode::getImplementationName()
|
||||
return getImplementationName_ANIMATECOLOR();
|
||||
case AnimationNodeType::ANIMATEMOTION:
|
||||
return getImplementationName_ANIMATEMOTION();
|
||||
case AnimationNodeType::ANIMATEPHYSICS:
|
||||
return getImplementationName_ANIMATEPHYSICS();
|
||||
case AnimationNodeType::TRANSITIONFILTER:
|
||||
return getImplementationName_TRANSITIONFILTER();
|
||||
case AnimationNodeType::ANIMATETRANSFORM:
|
||||
@@ -854,6 +876,8 @@ Sequence< OUString > AnimationNode::getSupportedServiceNames()
|
||||
return getSupportedServiceNames_ANIMATECOLOR();
|
||||
case AnimationNodeType::ANIMATEMOTION:
|
||||
return getSupportedServiceNames_ANIMATEMOTION();
|
||||
case AnimationNodeType::ANIMATEPHYSICS:
|
||||
return getSupportedServiceNames_ANIMATEPHYSICS();
|
||||
case AnimationNodeType::TRANSITIONFILTER:
|
||||
return getSupportedServiceNames_TRANSITIONFILTER();
|
||||
case AnimationNodeType::ANIMATETRANSFORM:
|
||||
@@ -2041,6 +2065,13 @@ com_sun_star_animations_AnimateMotion_get_implementation(css::uno::XComponentCon
|
||||
return cppu::acquire(new animcore::AnimationNode(ANIMATEMOTION));
|
||||
}
|
||||
|
||||
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
|
||||
com_sun_star_animations_AnimatePhysics_get_implementation(css::uno::XComponentContext*,
|
||||
css::uno::Sequence<css::uno::Any> const &)
|
||||
{
|
||||
return cppu::acquire(new animcore::AnimationNode(ANIMATEPHYSICS));
|
||||
}
|
||||
|
||||
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
|
||||
com_sun_star_animations_AnimateTransform_get_implementation(css::uno::XComponentContext*,
|
||||
css::uno::Sequence<css::uno::Any> const &)
|
||||
|
||||
@@ -2793,6 +2793,7 @@ namespace xmloff::token {
|
||||
XML_MULTIPLY,
|
||||
XML_ANIMATE,
|
||||
XML_ANIMATEMOTION,
|
||||
XML_ANIMATEPHYSICS,
|
||||
XML_ANIMATETRANSFORM,
|
||||
XML_ANIMATECOLOR,
|
||||
XML_TRANSITIONFILTER,
|
||||
|
||||
@@ -29,6 +29,7 @@ $(eval $(call gb_UnoApi_use_api,offapi,\
|
||||
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/animations,\
|
||||
AnimateColor \
|
||||
AnimateMotion \
|
||||
AnimatePhysics \
|
||||
AnimateSet \
|
||||
Audio \
|
||||
Command \
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
#ifndef __com_sun_star_animations_AnimatePhysics_idl__
|
||||
#define __com_sun_star_animations_AnimatePhysics_idl__
|
||||
|
||||
#include <com/sun/star/animations/XAnimationNode.idl>
|
||||
|
||||
|
||||
module com { module sun { module star { module animations {
|
||||
|
||||
|
||||
service AnimatePhysics : com::sun::star::animations::XAnimationNode;
|
||||
|
||||
|
||||
}; }; }; };
|
||||
|
||||
#endif
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
||||
@@ -1035,6 +1035,11 @@
|
||||
<value xml:lang="en-US">Vertical Figure 8</value>
|
||||
</prop>
|
||||
</node>
|
||||
<node oor:name="libo-physics-fall" oor:op="replace">
|
||||
<prop oor:name="Label" oor:type="xs:string">
|
||||
<value xml:lang="en-US">Fall simulated</value>
|
||||
</prop>
|
||||
</node>
|
||||
<node oor:name="ooo-media-start" oor:op="replace">
|
||||
<prop oor:name="Label" oor:type="xs:string">
|
||||
<value xml:lang="en-US">Start media</value>
|
||||
@@ -2500,7 +2505,7 @@
|
||||
<value xml:lang="en-US">Exciting</value>
|
||||
</prop>
|
||||
<prop oor:name="Effects" oor:type="oor:string-list">
|
||||
<value oor:separator=";">ooo-emphasis-blast;ooo-emphasis-bold-reveal;ooo-emphasis-style-emphasis;ooo-emphasis-wave;ooo-emphasis-blink</value>
|
||||
<value oor:separator=";">ooo-emphasis-blast;ooo-emphasis-bold-reveal;ooo-emphasis-style-emphasis;ooo-emphasis-wave;ooo-emphasis-blink;libo-physics-fall</value>
|
||||
</prop>
|
||||
</node>
|
||||
</node>
|
||||
|
||||
@@ -2420,4 +2420,47 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
|
||||
</rng:element>
|
||||
</rng:define>
|
||||
|
||||
<!-- TODO no proposal -->
|
||||
<rng:define name="animation-element" combine="choice">
|
||||
<rng:choice>
|
||||
<rng:element name="loext:animatePhysics">
|
||||
<rng:ref name="common-anim-target-attlist"/>
|
||||
<rng:ref name="common-timing-attlist"/>
|
||||
<rng:ref name="animate-physics-attlist"/>
|
||||
</rng:element>
|
||||
</rng:choice>
|
||||
</rng:define>
|
||||
|
||||
<rng:define name="animate-physics-attlist">
|
||||
<rng:optional>
|
||||
<!-- default value: 0 -->
|
||||
<rng:attribute name="loext:velocity-x">
|
||||
<rng:ref name="double"/>
|
||||
</rng:attribute>
|
||||
</rng:optional>
|
||||
<rng:optional>
|
||||
<!-- default value: 0 -->
|
||||
<rng:attribute name="loext:velocity-y">
|
||||
<rng:ref name="double"/>
|
||||
</rng:attribute>
|
||||
</rng:optional>
|
||||
<rng:optional>
|
||||
<!-- default value: 0.1 -->
|
||||
<rng:attribute name="loext:bounciness">
|
||||
<rng:data type="double">
|
||||
<rng:param name="minExclusive">0</rng:param>
|
||||
<rng:param name="maxInclusive">1</rng:param>
|
||||
</rng:data>
|
||||
</rng:attribute>
|
||||
</rng:optional>
|
||||
<rng:optional>
|
||||
<!-- default value: 1 -->
|
||||
<rng:attribute name="loext:density">
|
||||
<rng:data type="double">
|
||||
<rng:param name="minInclusive">0</rng:param>
|
||||
</rng:data>
|
||||
</rng:attribute>
|
||||
</rng:optional>
|
||||
</rng:define>
|
||||
|
||||
</rng:grammar>
|
||||
|
||||
@@ -2639,6 +2639,13 @@
|
||||
</anim:par>
|
||||
</anim:par>
|
||||
</anim:par>
|
||||
<anim:par smil:begin="indefinite" smil:fill="hold">
|
||||
<anim:par smil:begin="0" smil:fill="hold">
|
||||
<anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="emphasis" pres:preset-id="libo-physics-fall">
|
||||
<anim:animatePhysics smil:dur="4" smil:fill="hold"/>
|
||||
</anim:par>
|
||||
</anim:par>
|
||||
</anim:par>
|
||||
<anim:par smil:begin="indefinite" smil:fill="hold">
|
||||
<anim:par smil:begin="0" smil:fill="hold">
|
||||
<anim:par smil:begin="0" smil:fill="hold" pres:node-type="on-click" pres:preset-class="media-call" pres:preset-id="ooo-media-start">
|
||||
|
||||
@@ -2794,6 +2794,7 @@ namespace xmloff::token {
|
||||
TOKEN( "multiply", XML_MULTIPLY ),
|
||||
TOKEN( "animate", XML_ANIMATE ),
|
||||
TOKEN( "animateMotion", XML_ANIMATEMOTION ),
|
||||
TOKEN( "animatePhysics", XML_ANIMATEPHYSICS ),
|
||||
TOKEN( "animateTransform", XML_ANIMATETRANSFORM ),
|
||||
TOKEN( "animateColor", XML_ANIMATECOLOR ),
|
||||
TOKEN( "transitionFilter", XML_TRANSITIONFILTER ),
|
||||
|
||||
@@ -699,6 +699,7 @@ void AnimationsExporterImpl::prepareNode( const Reference< XAnimationNode >& xNo
|
||||
case AnimationNodeType::ANIMATE:
|
||||
case AnimationNodeType::SET:
|
||||
case AnimationNodeType::ANIMATEMOTION:
|
||||
case AnimationNodeType::ANIMATEPHYSICS:
|
||||
case AnimationNodeType::ANIMATECOLOR:
|
||||
case AnimationNodeType::ANIMATETRANSFORM:
|
||||
case AnimationNodeType::TRANSITIONFILTER:
|
||||
@@ -949,6 +950,7 @@ void AnimationsExporterImpl::exportNode( const Reference< XAnimationNode >& xNod
|
||||
case AnimationNodeType::ANIMATE:
|
||||
case AnimationNodeType::SET:
|
||||
case AnimationNodeType::ANIMATEMOTION:
|
||||
case AnimationNodeType::ANIMATEPHYSICS:
|
||||
case AnimationNodeType::ANIMATECOLOR:
|
||||
case AnimationNodeType::ANIMATETRANSFORM:
|
||||
case AnimationNodeType::TRANSITIONFILTER:
|
||||
@@ -1091,6 +1093,10 @@ void AnimationsExporterImpl::exportAnimate( const Reference< XAnimate >& xAnimat
|
||||
{
|
||||
eAttributeName = XML_ANIMATEMOTION;
|
||||
}
|
||||
else if( nNodeType == AnimationNodeType::ANIMATEPHYSICS )
|
||||
{
|
||||
eAttributeName = XML_ANIMATEPHYSICS;
|
||||
}
|
||||
else
|
||||
{
|
||||
OUString sTemp( xAnimate->getAttributeName() );
|
||||
@@ -1236,6 +1242,15 @@ void AnimationsExporterImpl::exportAnimate( const Reference< XAnimate >& xAnimat
|
||||
}
|
||||
break;
|
||||
|
||||
case AnimationNodeType::ANIMATEPHYSICS:
|
||||
{
|
||||
eElementToken = XML_ANIMATEPHYSICS;
|
||||
|
||||
Reference< XAnimateMotion > xAnimateMotion( xAnimate, UNO_QUERY_THROW );
|
||||
aTemp = xAnimateMotion->getOrigin();
|
||||
}
|
||||
break;
|
||||
|
||||
case AnimationNodeType::ANIMATECOLOR:
|
||||
{
|
||||
eElementToken = XML_ANIMATECOLOR;
|
||||
@@ -1297,7 +1312,14 @@ void AnimationsExporterImpl::exportAnimate( const Reference< XAnimate >& xAnimat
|
||||
break;
|
||||
}
|
||||
|
||||
SvXMLElementExport aElement( *mxExport, XML_NAMESPACE_ANIMATION, eElementToken, true, true );
|
||||
if( eElementToken == XML_ANIMATEPHYSICS ) // not a standart should use the extension namespace
|
||||
{
|
||||
SvXMLElementExport aElement( *mxExport, XML_NAMESPACE_LO_EXT, eElementToken, true, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
SvXMLElementExport aElement( *mxExport, XML_NAMESPACE_ANIMATION, eElementToken, true, true );
|
||||
}
|
||||
|
||||
}
|
||||
catch (const Exception&)
|
||||
@@ -1445,6 +1467,7 @@ void AnimationsExporterImpl::convertValue( XMLTokenEnum eAttributeName, OUString
|
||||
case XML_HEIGHT:
|
||||
case XML_ANIMATETRANSFORM:
|
||||
case XML_ANIMATEMOTION:
|
||||
case XML_ANIMATEPHYSICS:
|
||||
{
|
||||
if( auto aString = o3tl::tryAccess<OUString>(rValue) )
|
||||
{
|
||||
|
||||
@@ -458,6 +458,8 @@ AnimationNodeContext::AnimationNodeContext(
|
||||
pServiceName = "com.sun.star.animations.AnimateSet"; break;
|
||||
case XML_ANIMATEMOTION:
|
||||
pServiceName = "com.sun.star.animations.AnimateMotion"; break;
|
||||
case XML_ANIMATEPHYSICS:
|
||||
pServiceName = "com.sun.star.animations.AnimatePhysics"; break;
|
||||
case XML_ANIMATECOLOR:
|
||||
pServiceName = "com.sun.star.animations.AnimateColor"; break;
|
||||
case XML_ANIMATETRANSFORM:
|
||||
|
||||
@@ -2622,6 +2622,7 @@ additive
|
||||
multiply
|
||||
animate
|
||||
animateMotion
|
||||
animatePhysics
|
||||
animateTransform
|
||||
animateColor
|
||||
transitionFilter
|
||||
|
||||
Reference in New Issue
Block a user