25#include <com/sun/star/animations/TransitionType.hpp>
26#include <com/sun/star/animations/TransitionSubType.hpp>
46class ClippingAnimation :
public NumberAnimation
52 const TransitionInfo& rTransitionInfo,
53 bool bDirectionForward,
56 virtual ~ClippingAnimation()
override;
60 virtual void prefetch()
override;
63 virtual void end()
override;
67 virtual bool operator()(
double nValue )
override;
68 virtual double getUnderlyingValue()
const override;
80ClippingAnimation::ClippingAnimation(
83 const TransitionInfo& rTransitionInfo,
84 bool bDirectionForward,
97 "ClippingAnimation::ClippingAnimation(): Invalid ShapeManager" );
100ClippingAnimation::~ClippingAnimation()
106 catch (
const uno::Exception&)
112void ClippingAnimation::prefetch()
120 "ClippingAnimation::start(): Shape already set" );
122 "ClippingAnimation::start(): Attribute layer already set" );
124 "ClippingAnimation::start(): Invalid shape" );
126 "ClippingAnimation::start(): Invalid attribute layer" );
138void ClippingAnimation::end()
143void ClippingAnimation::end_()
150 if(
mpShape->isContentChanged() )
155bool ClippingAnimation::operator()(
double nValue )
159 "ClippingAnimation::operator(): Invalid ShapeAttributeLayer" );
162 auto aBounds =
mpShape->getDomBounds().getRange();
165 if(
mpShape->isContentChanged() )
171double ClippingAnimation::getUnderlyingValue()
const
175 "ClippingAnimation::getUnderlyingValue(): Invalid ShapeAttributeLayer" );
184 const ActivitiesFactory::CommonParameters& rParms,
187 const ::basegfx::B2DVector& rSlideSize,
188 css::uno::Reference< css::animations::XTransitionFilter >
const& xTransition,
194 "createShapeTransitionByType(): Invalid XTransition" );
196 const TransitionInfo* pTransitionInfo(
200 if( pTransitionInfo !=
nullptr )
202 switch( pTransitionInfo->meTransitionClass )
205 case TransitionInfo::TRANSITION_INVALID:
206 OSL_FAIL(
"createShapeTransitionByType(): Invalid transition type. "
207 "Don't ask me for a 0 TransitionType, have no XTransitionFilter node instead!" );
211 case TransitionInfo::TRANSITION_CLIP_POLYPOLYGON:
221 std::make_shared<ClippingAnimation>(
225 xTransition->getDirection(),
226 xTransition->getMode() ),
231 case TransitionInfo::TRANSITION_SPECIAL:
235 case animations::TransitionType::RANDOM:
243 "createShapeTransitionByType(): Got invalid random transition info" );
245 ENSURE_OR_THROW( pRandomTransitionInfo->mnTransitionType != animations::TransitionType::RANDOM,
246 "createShapeTransitionByType(): Got random again for random input!" );
249 pGeneratedActivity = createShapeTransitionByType( rParms,
254 pRandomTransitionInfo->mnTransitionType,
255 pRandomTransitionInfo->mnTransitionSubType );
260 case animations::TransitionType::SLIDEWIPE:
262 sal_Int16 nBarWipeSubType(0);
263 bool bDirectionForward(
true);
268 case animations::TransitionSubType::FROMLEFT:
269 nBarWipeSubType = animations::TransitionSubType::LEFTTORIGHT;
270 bDirectionForward =
true;
273 case animations::TransitionSubType::FROMRIGHT:
274 nBarWipeSubType = animations::TransitionSubType::LEFTTORIGHT;
275 bDirectionForward =
false;
278 case animations::TransitionSubType::FROMTOP:
279 nBarWipeSubType = animations::TransitionSubType::TOPTOBOTTOM;
280 bDirectionForward =
true;
283 case animations::TransitionSubType::FROMBOTTOM:
284 nBarWipeSubType = animations::TransitionSubType::TOPTOBOTTOM;
285 bDirectionForward =
false;
290 "createShapeTransitionByType(): Unexpected subtype for SLIDEWIPE" );
297 animations::TransitionType::BARWIPE,
303 std::make_shared<ClippingAnimation>(
309 xTransition->getMode() ),
329 xTransition->getMode() );
338 if( !pGeneratedActivity )
343 "createShapeTransitionByType(): Unknown type/subtype combination encountered: "
344 << xTransition->getTransition() <<
" " << xTransition->getSubtype() );
347 return pGeneratedActivity;
353 const ActivitiesFactory::CommonParameters& rParms,
356 const ::basegfx::B2DVector& rSlideSize,
357 uno::Reference< animations::XTransitionFilter >
const& xTransition )
359 return createShapeTransitionByType( rParms,
364 xTransition->getTransition(),
365 xTransition->getSubtype() );
#define TOOLS_WARN_EXCEPTION(area, stream)
#define ENSURE_OR_RETURN_FALSE(c, m)
#define ENSURE_OR_THROW(c, m)
#define SAL_WARN(area, stream)
AnimationActivitySharedPtr createSimpleActivity(const CommonParameters &rParms, const NumberAnimationSharedPtr &rAnimator, bool bDirectionForward)
Create a simple activity for the given animator.
NumberAnimationSharedPtr createNumberPropertyAnimation(const OUString &rAttrName, const AnimatableShapeSharedPtr &rShape, const ShapeManagerSharedPtr &rShapeManager, const ::basegfx::B2DVector &rSlideSize, const box2d::utils::Box2DWorldSharedPtr &pBox2DWorld, int nFlags=0)
ParametricPolyPolygonSharedPtr createClipPolyPolygon(sal_Int16 nTransitionType, sal_Int16 nTransitionSubType)
AnimationActivitySharedPtr createShapeTransition(const ActivitiesFactory::CommonParameters &rParms, const AnimatableShapeSharedPtr &rShape, const ShapeManagerSharedPtr &rShapeManager, const ::basegfx::B2DVector &rSlideSize, css::uno::Reference< css::animations::XTransitionFilter > const &xTransition)
Create a transition effect for shapes.
::std::shared_ptr< AnimatableShape > AnimatableShapeSharedPtr
const TransitionInfo * getRandomTransitionInfo()
::std::shared_ptr< AnimationActivity > AnimationActivitySharedPtr
::std::shared_ptr< ShapeAttributeLayer > ShapeAttributeLayerSharedPtr
const TransitionInfo * getTransitionInfo(sal_Int16 nTransitionType, sal_Int16 nTransitionSubType)
std::shared_ptr< ShapeManager > ShapeManagerSharedPtr
::std::shared_ptr< ParametricPolyPolygon > ParametricPolyPolygonSharedPtr
ClippingFunctor maClippingFunctor
ShapeManagerSharedPtr mpShapeManager
AnimatableShapeSharedPtr mpShape
ShapeAttributeLayerSharedPtr mpAttrLayer