diff options
-rw-r--r-- | animations/source/animcore/animcore.component | 4 | ||||
-rw-r--r-- | animations/source/animcore/animcore.cxx | 35 | ||||
-rw-r--r-- | include/xmloff/xmltoken.hxx | 1 | ||||
-rw-r--r-- | offapi/UnoApi_offapi.mk | 1 | ||||
-rw-r--r-- | offapi/com/sun/star/animations/AnimatePhysics.idl | 25 | ||||
-rw-r--r-- | officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu | 7 | ||||
-rw-r--r-- | schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng | 43 | ||||
-rw-r--r-- | sd/xml/effects.xml | 7 | ||||
-rw-r--r-- | xmloff/source/core/xmltoken.cxx | 1 | ||||
-rw-r--r-- | xmloff/source/draw/animationexport.cxx | 25 | ||||
-rw-r--r-- | xmloff/source/draw/animationimport.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/token/tokens.txt | 1 |
12 files changed, 148 insertions, 4 deletions
diff --git a/animations/source/animcore/animcore.component b/animations/source/animcore/animcore.component index 2f490aa0ae06..cd691f05e0ba 100644 --- a/animations/source/animcore/animcore.component +++ b/animations/source/animcore/animcore.component @@ -31,6 +31,10 @@ 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"> <service name="com.sun.star.animations.AnimateSet"/> diff --git a/animations/source/animcore/animcore.cxx b/animations/source/animcore/animcore.cxx index f3ffe8c4190a..88e42772936a 100644 --- a/animations/source/animcore/animcore.cxx +++ b/animations/source/animcore/animcore.cxx @@ -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: @@ -2042,6 +2066,13 @@ com_sun_star_animations_AnimateMotion_get_implementation(css::uno::XComponentCon } 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 &) { diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx index 3f3a4f62d8ed..842da16ad084 100644 --- a/include/xmloff/xmltoken.hxx +++ b/include/xmloff/xmltoken.hxx @@ -2793,6 +2793,7 @@ namespace xmloff::token { XML_MULTIPLY, XML_ANIMATE, XML_ANIMATEMOTION, + XML_ANIMATEPHYSICS, XML_ANIMATETRANSFORM, XML_ANIMATECOLOR, XML_TRANSITIONFILTER, diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index ad073f8b8f9f..8a4631dfa52a 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -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 \ diff --git a/offapi/com/sun/star/animations/AnimatePhysics.idl b/offapi/com/sun/star/animations/AnimatePhysics.idl new file mode 100644 index 000000000000..87fe960e611c --- /dev/null +++ b/offapi/com/sun/star/animations/AnimatePhysics.idl @@ -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: */ diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu index 1f9267d958e1..5e6d1088be95 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu @@ -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> diff --git a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng index 920cc0348111..b65dd74407a6 100644 --- a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng +++ b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng @@ -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> diff --git a/sd/xml/effects.xml b/sd/xml/effects.xml index 393ad5d50263..df76e4e7c341 100644 --- a/sd/xml/effects.xml +++ b/sd/xml/effects.xml @@ -2641,6 +2641,13 @@ </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"> <anim:command smil:begin="0" smil:dur="0.001" smil:fill="hold" anim:command="play"/> </anim:par> diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 5f02d4a94b07..ce008e0cc370 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -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 ), diff --git a/xmloff/source/draw/animationexport.cxx b/xmloff/source/draw/animationexport.cxx index 02b58c6e3d7d..2aa02c588ea3 100644 --- a/xmloff/source/draw/animationexport.cxx +++ b/xmloff/source/draw/animationexport.cxx @@ -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) ) { diff --git a/xmloff/source/draw/animationimport.cxx b/xmloff/source/draw/animationimport.cxx index 4ea1131d9868..f8c9e743aa84 100644 --- a/xmloff/source/draw/animationimport.cxx +++ b/xmloff/source/draw/animationimport.cxx @@ -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: diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt index d51a77608dc4..5e0f50bc53d2 100644 --- a/xmloff/source/token/tokens.txt +++ b/xmloff/source/token/tokens.txt @@ -2622,6 +2622,7 @@ additive multiply animate animateMotion +animatePhysics animateTransform animateColor transitionFilter |