20#include <com/sun/star/presentation/EffectNodeType.hpp>
21#include <com/sun/star/presentation/ShapeAnimationSubType.hpp>
22#include <com/sun/star/presentation/TextAnimationType.hpp>
23#include <com/sun/star/presentation/ParagraphTarget.hpp>
25#include <com/sun/star/animations/AnimationFill.hpp>
26#include <com/sun/star/animations/XAnimate.hpp>
27#include <com/sun/star/beans/NamedValue.hpp>
46using ::com::sun::star::drawing::XShape;
47using ::com::sun::star::lang::XMultiServiceFactory;
48using ::com::sun::star::drawing::XShape;
49using ::com::sun::star::beans::NamedValue;
53struct deprecated_FadeEffect_conversion_table_entry
55 FadeEffect meFadeEffect;
56 const char* mpPresetId;
64 { FadeEffect_FADE_FROM_LEFT,
"wipe-right" },
65 { FadeEffect_FADE_FROM_TOP,
"wipe-down" },
66 { FadeEffect_FADE_FROM_RIGHT,
"wipe-left" },
67 { FadeEffect_FADE_FROM_BOTTOM,
"wipe-up" },
69 { FadeEffect_CLOCKWISE,
"wheel-clockwise-1-spoke" },
71 { FadeEffect_UNCOVER_TO_LEFT,
"uncover-left" },
72 { FadeEffect_UNCOVER_TO_UPPERLEFT,
"uncover-left-up" },
73 { FadeEffect_UNCOVER_TO_TOP,
"uncover-up" },
74 { FadeEffect_UNCOVER_TO_UPPERRIGHT,
"uncover-right-up" },
75 { FadeEffect_UNCOVER_TO_RIGHT,
"uncover-right" },
76 { FadeEffect_UNCOVER_TO_LOWERRIGHT,
"uncover-right-down" },
77 { FadeEffect_UNCOVER_TO_BOTTOM,
"uncover-down" },
78 { FadeEffect_UNCOVER_TO_LOWERLEFT,
"uncover-left-down" },
80 { FadeEffect_VERTICAL_LINES,
"random-bars-vertical" },
81 { FadeEffect_HORIZONTAL_LINES,
"random-bars-horizontal" },
83 { FadeEffect_VERTICAL_CHECKERBOARD,
"checkerboard-down" },
84 { FadeEffect_HORIZONTAL_CHECKERBOARD,
"checkerboard-across" },
86 { FadeEffect_FADE_TO_CENTER,
"box-in" },
87 { FadeEffect_FADE_FROM_CENTER,
"box-out" },
89 { FadeEffect_VERTICAL_STRIPES,
"venetian-blinds-vertical" },
90 { FadeEffect_HORIZONTAL_STRIPES,
"venetian-blinds-horizontal" },
92 { FadeEffect_MOVE_FROM_LEFT,
"cover-right" },
93 { FadeEffect_MOVE_FROM_TOP,
"cover-down" },
94 { FadeEffect_MOVE_FROM_RIGHT,
"cover-left" },
95 { FadeEffect_MOVE_FROM_BOTTOM,
"cover-up" },
96 { FadeEffect_MOVE_FROM_UPPERLEFT,
"cover-right-down" },
97 { FadeEffect_MOVE_FROM_UPPERRIGHT,
"cover-left-down" },
98 { FadeEffect_MOVE_FROM_LOWERRIGHT,
"cover-left-up" },
99 { FadeEffect_MOVE_FROM_LOWERLEFT,
"cover-right-up" },
101 { FadeEffect_DISSOLVE,
"dissolve" },
103 { FadeEffect_RANDOM,
"random-transition" },
105 { FadeEffect_ROLL_FROM_LEFT,
"push-right" },
106 { FadeEffect_ROLL_FROM_TOP,
"push-down" },
107 { FadeEffect_ROLL_FROM_RIGHT,
"push-left" },
108 { FadeEffect_ROLL_FROM_BOTTOM,
"push-up" },
110 { FadeEffect_CLOSE_VERTICAL,
"split-horizontal-in" },
111 { FadeEffect_CLOSE_HORIZONTAL,
"split-vertical-in" },
112 { FadeEffect_OPEN_VERTICAL,
"split-horizontal-out" },
113 { FadeEffect_OPEN_HORIZONTAL,
"split-vertical-out" },
115 { FadeEffect_FADE_FROM_UPPERLEFT,
"diagonal-squares-right-down" },
116 { FadeEffect_FADE_FROM_UPPERRIGHT,
"diagonal-squares-left-down" },
117 { FadeEffect_FADE_FROM_LOWERLEFT,
"diagonal-squares-right-up" },
118 { FadeEffect_FADE_FROM_LOWERRIGHT,
"diagonal-squares-left-up" },
121 { FadeEffect_CLOCKWISE,
"clock-wipe-twelve" },
122 { FadeEffect_COUNTERCLOCKWISE,
"reverse-clock-wipe-twelve" },
123 { FadeEffect_SPIRALIN_LEFT,
"spiral-wipe-top-left-clockwise" },
124 { FadeEffect_SPIRALIN_RIGHT,
"spiral-wipe-top-right-counter-clockwise" },
125 { FadeEffect_SPIRALOUT_LEFT,
"spiral-wipe-out-to-bottom-right-clockwise" },
126 { FadeEffect_SPIRALOUT_RIGHT,
"spiral-wipe-out-to-bottom-left-counter-clockwise" },
127 { FadeEffect_WAVYLINE_FROM_LEFT,
"snake-wipe-top-left-vertical" },
128 { FadeEffect_WAVYLINE_FROM_TOP,
"snake-wipe-top-left-horizontal" },
129 { FadeEffect_WAVYLINE_FROM_RIGHT,
"snake-wipe-bottom-right-vertical" },
130 { FadeEffect_WAVYLINE_FROM_BOTTOM,
"snake-wipe-bottom-right-horizontal" },
131 { FadeEffect_STRETCH_FROM_LEFT,
"wipe-right" },
132 { FadeEffect_STRETCH_FROM_TOP,
"wipe-down" },
133 { FadeEffect_STRETCH_FROM_RIGHT,
"wipe-left" },
134 { FadeEffect_STRETCH_FROM_BOTTOM,
"wipe-up" },
138 { FadeEffect_CLOCKWISE,
"wheel-clockwise-2-spokes" },
139 { FadeEffect_CLOCKWISE,
"wheel-clockwise-3-spokes" },
140 { FadeEffect_CLOCKWISE,
"wheel-clockwise-4-spokes" },
141 { FadeEffect_CLOCKWISE,
"wheel-clockwise-8-spokes" },
143 { FadeEffect_FADE_FROM_CENTER,
"shape-circle" },
144 { FadeEffect_FADE_FROM_CENTER,
"shape-diamond" },
145 { FadeEffect_FADE_FROM_CENTER,
"shape-plus" },
147 { FadeEffect_CLOCKWISE,
"wedge" },
149 { FadeEffect_DISSOLVE,
"fade-through-black" },
151 { FadeEffect_CLOCKWISE,
"zoom-rotate-in" },
153 { FadeEffect_HORIZONTAL_LINES,
"comb-horizontal" },
154 { FadeEffect_VERTICAL_LINES,
"comb-vertical" },
156 { FadeEffect_DISSOLVE,
"fade-smoothly" },
158 { FadeEffect_NONE,
nullptr }
167void EffectMigration::SetFadeEffect(
SdPage* pPage, css::presentation::FadeEffect eNewEffect)
170 while( (pEntry->meFadeEffect != FadeEffect_NONE) && (pEntry->meFadeEffect != eNewEffect) )
173 if( pEntry->mpPresetId )
175 const OUString aPresetId( OUString::createFromAscii( pEntry->mpPresetId ) );
179 auto aIt = std::find_if(rPresetList.begin(), rPresetList.end(),
180 [&aPresetId](
const TransitionPresetPtr& rxPreset) { return rxPreset->getPresetId() == aPresetId; });
181 if (aIt != rPresetList.end())
198FadeEffect EffectMigration::GetFadeEffect(
const SdPage* pPage )
201 auto aIt = std::find_if(rPresetList.begin(), rPresetList.end(),
203 return (rxPreset->getTransition() == pPage->getTransitionType())
204 && (rxPreset->getSubtype() == pPage->getTransitionSubtype())
205 && (rxPreset->getDirection() == pPage->getTransitionDirection())
206 && (rxPreset->getFadeColor() == pPage->getTransitionFadeColor());
208 if (aIt != rPresetList.end())
210 const OUString& aPresetId = (*aIt)->getPresetId();
213 while( (pEntry->meFadeEffect != FadeEffect_NONE) && (!aPresetId.equalsAscii( pEntry->mpPresetId ) ) )
216 return pEntry->meFadeEffect;
218 return FadeEffect_NONE;
223struct deprecated_AnimationEffect_conversion_table_entry
225 AnimationEffect meEffect;
226 const char* mpPresetId;
227 const char* mpPresetSubType;
235 { AnimationEffect_APPEAR,
"ooo-entrance-appear",
nullptr },
237 { AnimationEffect_FADE_TO_CENTER,
"ooo-entrance-box",
"in" },
238 { AnimationEffect_FADE_FROM_CENTER,
"ooo-entrance-box",
"out" },
240 { AnimationEffect_VERTICAL_CHECKERBOARD,
"ooo-entrance-checkerboard",
"downward" },
241 { AnimationEffect_HORIZONTAL_CHECKERBOARD,
"ooo-entrance-checkerboard",
"across" },
243 { AnimationEffect_FADE_FROM_UPPERLEFT,
"ooo-entrance-diagonal-squares",
"right-to-bottom" },
244 { AnimationEffect_FADE_FROM_UPPERRIGHT,
"ooo-entrance-diagonal-squares",
"left-to-bottom" },
245 { AnimationEffect_FADE_FROM_LOWERLEFT,
"ooo-entrance-diagonal-squares",
"right-to-top" },
246 { AnimationEffect_FADE_FROM_LOWERRIGHT,
"ooo-entrance-diagonal-squares",
"left-to-top" },
248 { AnimationEffect_DISSOLVE,
"ooo-entrance-dissolve-in",
nullptr },
250 { AnimationEffect_MOVE_FROM_LEFT,
"ooo-entrance-fly-in",
"from-left" },
251 { AnimationEffect_MOVE_FROM_TOP,
"ooo-entrance-fly-in",
"from-top" },
252 { AnimationEffect_MOVE_FROM_RIGHT,
"ooo-entrance-fly-in",
"from-right" },
253 { AnimationEffect_MOVE_FROM_BOTTOM,
"ooo-entrance-fly-in",
"from-bottom" },
254 { AnimationEffect_MOVE_FROM_UPPERLEFT,
"ooo-entrance-fly-in",
"from-top-left" },
255 { AnimationEffect_MOVE_FROM_UPPERRIGHT,
"ooo-entrance-fly-in",
"from-top-right" },
256 { AnimationEffect_MOVE_FROM_LOWERRIGHT,
"ooo-entrance-fly-in",
"from-bottom-right" },
257 { AnimationEffect_MOVE_FROM_LOWERLEFT,
"ooo-entrance-fly-in",
"from-bottom-left" },
259 { AnimationEffect_MOVE_FROM_BOTTOM,
"ooo-entrance-fly-in-slow",
"from-bottom" },
260 { AnimationEffect_MOVE_FROM_LEFT,
"ooo-entrance-fly-in-slow",
"from-left" },
261 { AnimationEffect_MOVE_FROM_RIGHT,
"ooo-entrance-fly-in-slow",
"from-right" },
262 { AnimationEffect_MOVE_FROM_TOP,
"ooo-entrance-fly-in-slow",
"from-top" },
264 { AnimationEffect_MOVE_SHORT_FROM_LEFT,
"ooo-entrance-peek-in",
"from-left" },
265 { AnimationEffect_MOVE_SHORT_FROM_TOP,
"ooo-entrance-peek-in",
"from-top" },
266 { AnimationEffect_MOVE_SHORT_FROM_RIGHT,
"ooo-entrance-peek-in",
"from-right" },
267 { AnimationEffect_MOVE_SHORT_FROM_BOTTOM,
"ooo-entrance-peek-in",
"from-bottom" },
269 { AnimationEffect_VERTICAL_LINES,
"ooo-entrance-random-bars",
"horizontal" },
270 { AnimationEffect_HORIZONTAL_LINES,
"ooo-entrance-random-bars",
"vertical" },
272 { AnimationEffect_RANDOM,
"ooo-entrance-random",
nullptr },
274 { AnimationEffect_CLOSE_VERTICAL,
"ooo-entrance-split",
"horizontal-in" },
275 { AnimationEffect_CLOSE_HORIZONTAL,
"ooo-entrance-split",
"vertical-in" },
276 { AnimationEffect_OPEN_VERTICAL,
"ooo-entrance-split",
"horizontal-out" },
277 { AnimationEffect_OPEN_HORIZONTAL,
"ooo-entrance-split",
"vertical-out" },
279 { AnimationEffect_VERTICAL_STRIPES,
"ooo-entrance-venetian-blinds",
"horizontal" },
280 { AnimationEffect_HORIZONTAL_STRIPES,
"ooo-entrance-venetian-blinds",
"vertical" },
282 { AnimationEffect_FADE_FROM_LEFT,
"ooo-entrance-wipe",
"from-left" },
283 { AnimationEffect_FADE_FROM_TOP,
"ooo-entrance-wipe",
"from-bottom" },
284 { AnimationEffect_FADE_FROM_RIGHT,
"ooo-entrance-wipe",
"from-right" },
285 { AnimationEffect_FADE_FROM_BOTTOM,
"ooo-entrance-wipe",
"from-top" },
287 { AnimationEffect_HORIZONTAL_ROTATE,
"ooo-entrance-swivel",
"vertical" },
288 { AnimationEffect_VERTICAL_ROTATE,
"ooo-entrance-swivel",
"horizontal" },
290 { AnimationEffect_STRETCH_FROM_LEFT,
"ooo-entrance-stretchy",
"from-left" },
291 { AnimationEffect_STRETCH_FROM_UPPERLEFT,
"ooo-entrance-stretchy",
"from-top-left" },
292 { AnimationEffect_STRETCH_FROM_TOP,
"ooo-entrance-stretchy",
"from-top" },
293 { AnimationEffect_STRETCH_FROM_UPPERRIGHT,
"ooo-entrance-stretchy",
"from-top-right" },
294 { AnimationEffect_STRETCH_FROM_RIGHT,
"ooo-entrance-stretchy",
"from-right" },
295 { AnimationEffect_STRETCH_FROM_LOWERRIGHT,
"ooo-entrance-stretchy",
"from-bottom-right" },
296 { AnimationEffect_STRETCH_FROM_BOTTOM,
"ooo-entrance-stretchy",
"from-bottom" },
297 { AnimationEffect_STRETCH_FROM_LOWERLEFT,
"ooo-entrance-stretchy",
"from-bottom-left" },
299 { AnimationEffect_HORIZONTAL_STRETCH,
"ooo-entrance-expand",
nullptr },
301 { AnimationEffect_CLOCKWISE,
"ooo-entrance-wheel",
"1" },
302 { AnimationEffect_COUNTERCLOCKWISE,
"ooo-entrance-clock-wipe",
"counter-clockwise" },
304 { AnimationEffect_SPIRALIN_LEFT,
"ooo-entrance-spiral-wipe",
"from-top-left-clockwise" },
305 { AnimationEffect_SPIRALIN_RIGHT,
"ooo-entrance-spiral-wipe",
"from-top-right-counter-clockwise" },
306 { AnimationEffect_SPIRALOUT_LEFT,
"ooo-entrance-spiral-wipe",
"from-center-clockwise" },
307 { AnimationEffect_SPIRALOUT_RIGHT,
"ooo-entrance-spiral-wipe",
"from-center-counter-clockwise" },
309 { AnimationEffect_WAVYLINE_FROM_LEFT,
"ooo-entrance-snake-wipe",
"from-top-left-vertical" },
310 { AnimationEffect_WAVYLINE_FROM_TOP,
"ooo-entrance-snake-wipe",
"from-top-left-horizontal" },
311 { AnimationEffect_WAVYLINE_FROM_RIGHT,
"ooo-entrance-snake-wipe",
"from-bottom-right-vertical" },
312 { AnimationEffect_WAVYLINE_FROM_BOTTOM,
"ooo-entrance-snake-wipe",
"from-bottom-right-horizontal" },
315 { AnimationEffect_HIDE,
"ooo-exit-disappear",
nullptr },
316 { AnimationEffect_MOVE_TO_LEFT,
"ooo-exit-fly-out",
"from-right" },
317 { AnimationEffect_MOVE_TO_TOP,
"ooo-exit-fly-out",
"from-bottom" },
318 { AnimationEffect_MOVE_TO_RIGHT,
"ooo-exit-fly-out",
"from-left" },
319 { AnimationEffect_MOVE_TO_BOTTOM,
"ooo-exit-fly-out",
"from-top" },
320 { AnimationEffect_MOVE_TO_UPPERLEFT,
"ooo-exit-fly-out",
"from-top-right" },
321 { AnimationEffect_MOVE_TO_UPPERRIGHT,
"ooo-exit-fly-out",
"from-top-left" },
322 { AnimationEffect_MOVE_TO_LOWERRIGHT,
"ooo-exit-fly-out",
"from-bottom-left" },
323 { AnimationEffect_MOVE_TO_LOWERLEFT,
"ooo-exit-fly-out",
"from-bottom-right" },
324 { AnimationEffect_MOVE_SHORT_TO_LEFT,
"ooo-exit-peek-out",
"from-right" },
325 { AnimationEffect_MOVE_SHORT_TO_UPPERLEFT,
"ooo-exit-peek-out",
"from-right" },
326 { AnimationEffect_MOVE_SHORT_TO_TOP,
"ooo-exit-peek-out",
"from-bottom" },
327 { AnimationEffect_MOVE_SHORT_TO_UPPERRIGHT,
"ooo-exit-peek-out",
"from-bottom" },
328 { AnimationEffect_MOVE_SHORT_TO_RIGHT,
"ooo-exit-peek-out",
"from-left" },
329 { AnimationEffect_MOVE_SHORT_TO_LOWERRIGHT,
"ooo-exit-peek-out",
"from-left" },
330 { AnimationEffect_MOVE_SHORT_TO_BOTTOM,
"ooo-exit-peek-out",
"from-top" },
331 { AnimationEffect_MOVE_SHORT_TO_LOWERLEFT,
"ooo-exit-peek-out",
"from-top" },
334 { AnimationEffect_MOVE_SHORT_FROM_UPPERLEFT,
"ooo-entrance-peek-in",
"from-left" },
335 { AnimationEffect_MOVE_SHORT_FROM_UPPERRIGHT,
"ooo-entrance-peek-in",
"from-top" },
336 { AnimationEffect_MOVE_SHORT_FROM_LOWERRIGHT,
"ooo-entrance-peek-in",
"from-right" },
337 { AnimationEffect_MOVE_SHORT_FROM_LOWERLEFT,
"ooo-entrance-peek-in",
"from-bottom" },
338 { AnimationEffect_LASER_FROM_LEFT,
"ooo-entrance-fly-in",
"from-left" },
339 { AnimationEffect_LASER_FROM_TOP,
"ooo-entrance-fly-in",
"from-top" },
340 { AnimationEffect_LASER_FROM_RIGHT,
"ooo-entrance-fly-in",
"from-right" },
341 { AnimationEffect_LASER_FROM_BOTTOM,
"ooo-entrance-fly-in",
"from-bottom" },
342 { AnimationEffect_LASER_FROM_UPPERLEFT,
"ooo-entrance-fly-in",
"from-top-left" },
343 { AnimationEffect_LASER_FROM_UPPERRIGHT,
"ooo-entrance-fly-in",
"from-top-right" },
344 { AnimationEffect_LASER_FROM_LOWERLEFT,
"ooo-entrance-fly-in",
"from-bottom-left" },
345 { AnimationEffect_LASER_FROM_LOWERRIGHT,
"ooo-entrance-fly-in",
"from-bottom-right" },
349 { AnimationEffect_FADE_TO_CENTER,
"ooo-entrance-circle",
"in" },
350 { AnimationEffect_FADE_FROM_CENTER,
"ooo-entrance-circle",
"out" },
351 { AnimationEffect_FADE_TO_CENTER,
"ooo-entrance-diamond",
"in" },
352 { AnimationEffect_FADE_FROM_CENTER,
"ooo-entrance-diamond",
"out" },
353 { AnimationEffect_FADE_TO_CENTER,
"ooo-entrance-plus",
"in" },
354 { AnimationEffect_FADE_FROM_CENTER,
"ooo-entrance-plus",
"out" },
355 { AnimationEffect_CLOCKWISE,
"ooo-entrance-wedge",
nullptr },
356 { AnimationEffect_CLOCKWISE,
"ooo-entrance-wheel",
"2" },
357 { AnimationEffect_CLOCKWISE,
"ooo-entrance-wheel",
"3" },
358 { AnimationEffect_CLOCKWISE,
"ooo-entrance-wheel",
"4" },
359 { AnimationEffect_CLOCKWISE,
"ooo-entrance-wheel",
"8" },
361 { AnimationEffect_MOVE_FROM_RIGHT,
"ooo-entrance-boomerang",
nullptr },
362 { AnimationEffect_MOVE_FROM_UPPERRIGHT,
"ooo-entrance-bounce",
nullptr },
363 { AnimationEffect_MOVE_FROM_BOTTOM,
"ooo-entrance-curve-up",
nullptr },
364 { AnimationEffect_MOVE_FROM_TOP,
"ooo-entrance-float",
nullptr },
365 { AnimationEffect_MOVE_FROM_LEFT,
"ooo-entrance-glide",
nullptr },
366 { AnimationEffect_MOVE_FROM_BOTTOM,
"ooo-entrance-magnify",
nullptr },
367 { AnimationEffect_HORIZONTAL_ROTATE,
"ooo-entrance-pinwheel",
nullptr },
368 { AnimationEffect_MOVE_FROM_LEFT,
"ooo-entrance-breaks",
nullptr },
369 { AnimationEffect_MOVE_FROM_LEFT,
"ooo-entrance-sling",
nullptr },
370 { AnimationEffect_MOVE_FROM_LEFT,
"ooo-entrance-spiral-in",
nullptr },
371 { AnimationEffect_MOVE_FROM_LEFT,
"ooo-entrance-thread",
nullptr },
372 { AnimationEffect_MOVE_FROM_BOTTOM,
"ooo-entrance-ascend",
nullptr },
373 { AnimationEffect_MOVE_FROM_BOTTOM,
"ooo-entrance-center-revolve",
nullptr },
374 { AnimationEffect_APPEAR,
"ooo-entrance-compress",
nullptr },
375 { AnimationEffect_MOVE_SHORT_FROM_TOP,
"ooo-entrance-descend",
nullptr },
376 { AnimationEffect_MOVE_SHORT_FROM_LEFT,
"ooo-entrance-ease-in",
nullptr },
377 { AnimationEffect_MOVE_FROM_BOTTOM,
"ooo-entrance-rise-up",
nullptr },
378 { AnimationEffect_HORIZONTAL_ROTATE,
"ooo-entrance-spin-in",
nullptr },
379 { AnimationEffect_STRETCH_FROM_LEFT,
"ooo-entrance-stretchy",
"across" },
380 { AnimationEffect_STRETCH_FROM_TOP,
"ooo-entrance-stretchy",
"downward" },
382 { AnimationEffect_FADE_FROM_CENTER,
"ooo-entrance-zoom",
"in" },
383 { AnimationEffect_FADE_FROM_CENTER,
"ooo-entrance-zoom",
"in-slightly" },
384 { AnimationEffect_FADE_FROM_CENTER,
"ooo-entrance-zoom",
"in-from-screen-center" },
385 { AnimationEffect_FADE_TO_CENTER,
"ooo-entrance-zoom",
"out" },
386 { AnimationEffect_FADE_TO_CENTER,
"ooo-entrance-zoom",
"out-slightly" },
387 { AnimationEffect_FADE_TO_CENTER,
"ooo-entrance-zoom",
"out-from-screen-center" },
389 { AnimationEffect_DISSOLVE,
"ooo-entrance-fade-in",
nullptr },
390 { AnimationEffect_DISSOLVE,
"ooo-entrance-fade-in-and-zoom",
nullptr },
391 { AnimationEffect_DISSOLVE,
"ooo-entrance-fade-in-and-swivel",
nullptr },
396 { AnimationEffect_NONE,
nullptr,
nullptr }
401 return std::find_if(pMainSequence->getBegin(), pMainSequence->getEnd(),
403 return (pEffect->getTargetShape() == rShape)
404 && (pEffect->getTargetSubItem() == nSubItem);
425 if(
nullptr == pSdrObjList)
433void EffectMigration::SetAnimationEffect(
SvxShape* pShape, AnimationEffect eEffect )
436 "sd::EffectMigration::SetAnimationEffect(), invalid argument!" );
445 OUString aPresetSubType;
447 if( !ConvertAnimationEffect( eEffect, aPresetId, aPresetSubType ) )
449 OSL_FAIL(
"sd::EffectMigration::SetAnimationEffect(), no mapping for given AnimationEffect value" );
458 if( !(pPreset && pMainSequence) )
461 const Reference< XShape > xShape( pShape );
463 EffectSequence::iterator aIterOnlyBackground(
ImplFindEffect( pMainSequence, xShape, ShapeAnimationSubType::ONLY_BACKGROUND ) );
464 EffectSequence::iterator aIterAsWhole(
ImplFindEffect( pMainSequence, xShape, ShapeAnimationSubType::AS_WHOLE ) );
465 const EffectSequence::iterator aEnd( pMainSequence->getEnd() );
467 if( (aIterOnlyBackground == aEnd) && (aIterAsWhole == aEnd) )
469 bool bEffectCreated =
false;
472 EffectSequence::iterator aIterOnlyText(
ImplFindEffect( pMainSequence, xShape, ShapeAnimationSubType::ONLY_TEXT ) );
473 if( aIterOnlyText != aEnd )
476 sal_Int32 nGroupId = (*aIterOnlyText)->getGroupId();
483 pMainSequence->setAnimateForm( pGroup,
true );
486 EffectSequence::iterator aIter(
ImplFindEffect( pMainSequence, xShape, ShapeAnimationSubType::ONLY_BACKGROUND ) );
490 if( ((*aIter)->getPresetId() != aPresetId) ||
491 ((*aIter)->getPresetSubType() != aPresetSubType) )
493 (*aIter)->replaceNode( pPreset->create( aPresetSubType ) );
494 pMainSequence->rebuild();
495 bEffectCreated =
true;
502 if( !bEffectCreated )
506 Reference< XAnimationNode > xNode( pPreset->create( aPresetSubType ) );
507 DBG_ASSERT( xNode.is(),
"EffectMigration::SetAnimationEffect(), could not create preset!" );
511 pEffect->setTarget(
Any( xShape ) );
515 pEffect->setNodeType( EffectNodeType::AFTER_PREVIOUS );
517 pMainSequence->append( pEffect );
523 createTextGroup( pEffect, 10, bManual ? -1 : 0.0,
false,
false );
533 if( aIterAsWhole != aEnd )
535 pEffect = *aIterAsWhole;
539 pEffect = *aIterOnlyBackground;
544 if( (pEffect->getPresetId() != aPresetId) ||
545 (pEffect->getPresetSubType() != aPresetSubType) )
547 pMainSequence->replace( pEffect, pPreset, aPresetSubType, -1.0 );
553AnimationEffect EffectMigration::GetAnimationEffect(
SvxShape* pShape )
556 OUString aPresetSubType;
563 const Reference< XShape > xShape( pShape );
565 EffectSequence::iterator aIter = std::find_if(pMainSequence->getBegin(), pMainSequence->getEnd(),
567 return (pEffect->getTargetShape() == xShape)
568 && ((pEffect->getTargetSubItem() == ShapeAnimationSubType::ONLY_BACKGROUND)
569 || (pEffect->getTargetSubItem() == ShapeAnimationSubType::AS_WHOLE))
570 && (pEffect->getDuration() != 0.1);
573 if (aIter != pMainSequence->getEnd())
575 aPresetId = (*aIter)->getPresetId();
576 aPresetSubType = (*aIter)->getPresetSubType();
581 AnimationEffect eEffect = AnimationEffect_NONE;
583 if( !ConvertPreset( aPresetId, &aPresetSubType, eEffect ) )
584 ConvertPreset( aPresetId,
nullptr, eEffect );
589void EffectMigration::SetTextAnimationEffect(
SvxShape* pShape, AnimationEffect eEffect )
592 "sd::EffectMigration::SetAnimationEffect(), invalid argument!" );
602 OUString aPresetSubType;
604 if( !ConvertAnimationEffect( eEffect, aPresetId, aPresetSubType ) )
606 OSL_FAIL(
"sd::EffectMigration::SetAnimationEffect(), no mapping for given AnimationEffect value" );
613 if( (pTextObj ==
nullptr) || (!pTextObj->
HasText()) )
623 if( !(pPreset && pMainSequence) )
626 const Reference< XShape > xShape( pShape );
628 EffectSequence::iterator aIterOnlyText(
ImplFindEffect( pMainSequence, xShape, ShapeAnimationSubType::ONLY_TEXT ) );
629 const EffectSequence::iterator aEnd( pMainSequence->getEnd() );
634 if( aIterOnlyText != aEnd )
636 const sal_Int32 nGroupId = (*aIterOnlyText)->getGroupId();
638 pGroup = pMainSequence->findGroup( nGroupId );
646 EffectSequence::iterator aIterOnlyBackground(
ImplFindEffect( pMainSequence, xShape, ShapeAnimationSubType::ONLY_BACKGROUND ) );
647 if( aIterOnlyBackground != aEnd )
649 pShapeEffect = *aIterOnlyBackground;
653 EffectSequence::iterator aIterAsWhole(
ImplFindEffect( pMainSequence, xShape, ShapeAnimationSubType::AS_WHOLE ) );
654 if( aIterAsWhole != aEnd )
656 pShapeEffect = *aIterAsWhole;
660 Reference< XAnimationNode > xNode( pPreset->create(
"" ) );
661 DBG_ASSERT( xNode.is(),
"EffectMigration::SetTextAnimationEffect(), could not create preset!" );
664 pShapeEffect = std::make_shared<CustomAnimationEffect>( xNode );
665 pShapeEffect->setTarget(
Any( xShape ) );
666 pShapeEffect->setDuration( 0.1 );
667 pMainSequence->append( pShapeEffect );
671 pShapeEffect->setNodeType( EffectNodeType::AFTER_PREVIOUS );
684 createTextGroup( pShapeEffect, 10, bManual ? -1 : 0.0,
true,
false );
690 const bool bLaserEffect = (eEffect >= AnimationEffect_LASER_FROM_LEFT) && (eEffect <= AnimationEffect_LASER_FROM_LOWERRIGHT);
695 for(
auto& rxEffect : rEffects )
700 if( (rxEffect->getPresetId() != aPresetId) ||
701 (rxEffect->getPresetSubType() != aPresetSubType) )
703 rxEffect->replaceNode( pPreset->create( aPresetSubType ) );
708 rxEffect->setIterateType( TextAnimationType::BY_LETTER );
709 rxEffect->setIterateInterval( 0.5 );
721 pMainSequence->rebuild();
724AnimationEffect EffectMigration::GetTextAnimationEffect(
SvxShape* pShape )
727 OUString aPresetSubType;
736 const Reference< XShape > xShape( pShape );
737 EffectSequence::iterator aIter(
ImplFindEffect( pMainSequence, xShape, ShapeAnimationSubType::ONLY_TEXT ) );
738 if( aIter != pMainSequence->getEnd() )
740 aPresetId = (*aIter)->getPresetId();
741 aPresetSubType = (*aIter)->getPresetSubType();
747 AnimationEffect eEffect = AnimationEffect_NONE;
749 if( !ConvertPreset( aPresetId, &aPresetSubType, eEffect ) )
750 ConvertPreset( aPresetId,
nullptr, eEffect );
755bool EffectMigration::ConvertPreset( std::u16string_view rPresetId,
const OUString* pPresetSubType, AnimationEffect& rEffect )
757 rEffect = AnimationEffect_NONE;
758 if( !rPresetId.empty() )
762 while(
p->mpPresetId )
765 ((
p->mpPresetSubType ==
nullptr ) ||
766 ( pPresetSubType ==
nullptr) ||
767 ( pPresetSubType->equalsAscii(
p->mpPresetSubType )) ) )
769 rEffect =
p->meEffect;
783bool EffectMigration::ConvertAnimationEffect(
const AnimationEffect& rEffect, OUString& rPresetId, OUString& rPresetSubType )
786 while(
p->mpPresetId )
788 if(
p->meEffect == rEffect )
790 rPresetId = OUString::createFromAscii(
p->mpPresetId );
791 rPresetSubType = OUString::createFromAscii(
p->mpPresetSubType );
800double EffectMigration::ConvertAnimationSpeed( AnimationSpeed eSpeed )
805 case AnimationSpeed_SLOW: fDuration = 2.0;
break;
806 case AnimationSpeed_FAST: fDuration = 0.5;
break;
808 fDuration = 1.0;
break;
813void EffectMigration::SetAnimationSpeed(
SvxShape* pShape, AnimationSpeed eSpeed )
816 "sd::EffectMigration::SetAnimationEffect(), invalid argument!" );
824 double fDuration = ConvertAnimationSpeed( eSpeed );
828 const Reference< XShape > xShape( pShape );
830 EffectSequence::iterator aIter;
831 bool bNeedRebuild =
false;
833 for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
836 if( pEffect->getTargetShape() == xShape )
838 if( pEffect->getDuration() != 0.1 )
839 pEffect->setDuration( fDuration );
845 pMainSequence->rebuild();
848AnimationSpeed EffectMigration::GetAnimationSpeed(
SvxShape* pShape )
853 const Reference< XShape > xShape( pShape );
855 double fDuration = 1.0;
857 EffectSequence::iterator aIter = std::find_if(pMainSequence->getBegin(), pMainSequence->getEnd(),
859 return (pEffect->getTargetShape() == xShape)
860 && (pEffect->getDuration() != 0.1);
862 if (aIter != pMainSequence->getEnd())
865 fDuration = pEffect->getDuration();
868 return ConvertDuration( fDuration );
871AnimationSpeed EffectMigration::ConvertDuration(
double fDuration )
873 AnimationSpeed eSpeed;
875 if( fDuration < 1.0 )
876 eSpeed = AnimationSpeed_FAST;
877 else if( fDuration > 1.5 )
878 eSpeed = AnimationSpeed_SLOW;
880 eSpeed = AnimationSpeed_MEDIUM;
885void EffectMigration::SetDimColor(
SvxShape* pShape, sal_Int32 nColor )
888 "sd::EffectMigration::SetAnimationEffect(), invalid argument!" );
898 const Reference< XShape > xShape( pShape );
900 EffectSequence::iterator aIter;
901 bool bNeedRebuild =
false;
903 for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
906 if( pEffect->getTargetShape() == xShape )
908 pEffect->setHasAfterEffect(
true );
909 pEffect->setDimColor(
Any( nColor ) );
910 pEffect->setAfterEffectOnNext(
true );
916 pMainSequence->rebuild();
919sal_Int32 EffectMigration::GetDimColor(
SvxShape* pShape )
921 sal_Int32 nColor = 0;
929 const Reference< XShape > xShape( pShape );
930 EffectSequence::iterator aIter = std::find_if(pMainSequence->getBegin(), pMainSequence->getEnd(),
932 return (pEffect->getTargetShape() == xShape)
933 && pEffect->getDimColor().hasValue()
934 && pEffect->hasAfterEffect();
936 if (aIter != pMainSequence->getEnd())
939 pEffect->getDimColor() >>= nColor;
947void EffectMigration::SetDimHide(
SvxShape* pShape,
bool bDimHide )
950 "sd::EffectMigration::SetAnimationEffect(), invalid argument!" );
960 const Reference< XShape > xShape( pShape );
962 EffectSequence::iterator aIter;
963 bool bNeedRebuild =
false;
965 for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
968 if( pEffect->getTargetShape() == xShape )
970 pEffect->setHasAfterEffect( bDimHide );
973 pEffect->setDimColor( aEmpty );
975 pEffect->setAfterEffectOnNext(
false );
981 pMainSequence->rebuild();
984bool EffectMigration::GetDimHide(
SvxShape* pShape )
994 const Reference< XShape > xShape( pShape );
996 EffectSequence::iterator aIter = std::find_if(pMainSequence->getBegin(), pMainSequence->getEnd(),
998 if (aIter != pMainSequence->getEnd())
1001 bRet = pEffect->hasAfterEffect() &&
1002 !pEffect->getDimColor().hasValue() &&
1003 (!pEffect->IsAfterEffectOnNext());
1011void EffectMigration::SetDimPrevious(
SvxShape* pShape,
bool bDimPrevious )
1014 "sd::EffectMigration::SetAnimationEffect(), invalid argument!" );
1029 const Reference< XShape > xShape( pShape );
1031 EffectSequence::iterator aIter;
1032 bool bNeedRebuild =
false;
1034 for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
1037 if( pEffect->getTargetShape() == xShape )
1039 pEffect->setHasAfterEffect( bDimPrevious );
1040 if( !bDimPrevious || !pEffect->getDimColor().hasValue() )
1041 pEffect->setDimColor( aColor );
1042 pEffect->setAfterEffectOnNext(
true );
1043 bNeedRebuild =
true;
1048 pMainSequence->rebuild();
1051bool EffectMigration::GetDimPrevious(
SvxShape* pShape )
1061 const Reference< XShape > xShape( pShape );
1063 EffectSequence::iterator aIter = std::find_if(pMainSequence->getBegin(), pMainSequence->getEnd(),
1065 if (aIter != pMainSequence->getEnd())
1068 bRet = pEffect->hasAfterEffect() &&
1069 pEffect->getDimColor().hasValue() &&
1070 pEffect->IsAfterEffectOnNext();
1078void EffectMigration::SetPresentationOrder(
SvxShape* pShape, sal_Int32 nNewPos )
1088 sal_Int32 nCurrentPos = -1;
1089 std::vector< std::vector< EffectSequence::iterator > > aEffectVector(1);
1091 if( !rSequence.empty() )
1093 Reference< XShape > xThis( pShape );
1094 Reference< XShape > xCurrent;
1096 EffectSequence::iterator aIter( rSequence.begin() );
1097 EffectSequence::iterator aEnd( rSequence.end() );
1098 for(
nPos = 0; aIter != aEnd; ++aIter )
1102 if( !xCurrent.is() )
1104 xCurrent = pEffect->getTargetShape();
1106 else if( pEffect->getTargetShape() != xCurrent )
1109 xCurrent = pEffect->getTargetShape();
1110 aEffectVector.resize(
nPos+1 );
1114 if(( nCurrentPos == -1 ) && ( xCurrent == xThis ) )
1119 aEffectVector[
nPos].push_back( aIter );
1124 if( nCurrentPos == -1 )
1126 OSL_FAIL(
"sd::EffectMigration::SetPresentationOrder() failed cause this shape has no effect" );
1131 if( nCurrentPos == nNewPos )
1134 std::vector< CustomAnimationEffectPtr > aEffects;
1136 for(
const auto& rIter : aEffectVector[nCurrentPos] )
1138 aEffects.push_back( *rIter );
1139 rSequence.erase( rIter );
1142 if( nNewPos > nCurrentPos )
1145 if( nNewPos ==
static_cast<sal_Int32
>(aEffectVector.size()) )
1147 rSequence.insert( rSequence.end(), aEffects.begin(), aEffects.end() );
1151 EffectSequence::iterator aPos( aEffectVector[nNewPos][0] );
1152 for(
const auto& rEffect : aEffects )
1154 rSequence.insert( aPos, rEffect );
1163sal_Int32 EffectMigration::GetPresentationOrder(
SvxShape* pShape )
1165 sal_Int32
nPos = -1, nFound = -1;
1172 Reference< XShape > xThis( pShape );
1173 Reference< XShape > xCurrent;
1177 if( !xCurrent.is() || pEffect->getTargetShape() != xCurrent )
1180 xCurrent = pEffect->getTargetShape();
1183 if( xCurrent == xThis )
1202 const Reference< XShape > xShape( pShape );
1204 EffectSequence::iterator aIter;
1205 bool bNeedRebuild =
false;
1207 OUString aSoundFile;
1211 for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
1214 if( pEffect->getTargetShape() == xShape )
1216 if( !aSoundFile.isEmpty() )
1218 pEffect->createAudio(
Any( aSoundFile ) );
1222 pEffect->removeAudio();
1224 bNeedRebuild =
true;
1229 pMainSequence->rebuild();
1232OUString EffectMigration::GetSoundFile(
SvxShape* pShape )
1234 OUString aSoundFile;
1243 const Reference< XShape > xShape( pShape );
1245 EffectSequence::iterator aIter;
1247 for( aIter = pMainSequence->getBegin();
1248 (aSoundFile.isEmpty()) && (aIter != pMainSequence->getEnd());
1252 if( pEffect->getTargetShape() == xShape )
1254 if( pEffect->getAudio().is() )
1255 pEffect->getAudio()->getSource() >>= aSoundFile;
1265 return !GetSoundFile( pShape ).isEmpty();
1270 if( !(pShape && pPathObj) )
1277 const Reference< XShape > xShape( pShape );
1281 std::shared_ptr< sd::MainSequence > pMainSequence( pPage->
getMainSequence() );
1283 pMainSequence->append( *pPathObj,
Any( xShape ), -1.0,
"" );
1291 Reference< XMultiServiceFactory > xMsf(::comphelper::getProcessServiceFactory());
1294 Reference< XAnimationNode > xOuterSeqTimeContainer(xMsf->createInstance(
"com.sun.star.animations.ParallelTimeContainer"), UNO_QUERY_THROW);
1297 xOuterSeqTimeContainer->setBegin(
Any(0.0));
1300 xOuterSeqTimeContainer->setFill(AnimationFill::HOLD);
1303 Sequence< NamedValue > aUserDataSequence{
1305 Any(bOnClick ? EffectNodeType::ON_CLICK : EffectNodeType::AFTER_PREVIOUS) }
1308 xOuterSeqTimeContainer->setUserData(aUserDataSequence);
1311 Reference< XAnimationNode > xAnimateSetForLast(xMsf->createInstance(
"com.sun.star.animations.AnimateSet"), UNO_QUERY_THROW);
1314 xAnimateSetForLast->setBegin(
Any(0.0));
1317 xAnimateSetForLast->setDuration(
Any(fDuration));
1320 xAnimateSetForLast->setFill(AnimationFill::HOLD);
1323 Reference< XAnimate > xAnimate(xAnimateSetForLast, UNO_QUERY);
1324 Reference< XShape > xTargetShape(rCandidate.
getUnoShape(), UNO_QUERY);
1325 xAnimate->setTarget(
Any(xTargetShape));
1328 xAnimate->setAttributeName(
"Visibility");
1334 Reference< XTimeContainer > xParentContainer(xOuterSeqTimeContainer, UNO_QUERY_THROW);
1335 xParentContainer->appendChild(xAnimateSetForLast);
1338 rxParentContainer->appendChild(xOuterSeqTimeContainer);
1354 std::shared_ptr< sd::MainSequence > pMainSequence(rPage.
getMainSequence());
1359 std::vector< SdrObject* > aObjects;
1360 aObjects.reserve(aIter.
Count());
1368 aObjects.push_back(pCandidate.get());
1372 Reference< XMultiServiceFactory > xMsf(::comphelper::getProcessServiceFactory());
1373 Reference< XAnimationNode > xOuterSeqTimeContainer(xMsf->createInstance(
"com.sun.star.animations.ParallelTimeContainer"), UNO_QUERY_THROW);
1376 xOuterSeqTimeContainer->setBegin(
Any(0.0));
1379 Reference< XTimeContainer > xParentContainer(xOuterSeqTimeContainer, UNO_QUERY_THROW);
1383 const double fDurationShow(0.2);
1384 const double fDurationHide(0.001);
1386 for(
size_t a(0);
a < aObjects.size();
a++)
1389 pNext = aObjects[
a];
1410 pMainSequence->createEffects(xOuterSeqTimeContainer);
1411 pMainSequence->rebuild();
static EffectSequence::iterator ImplFindEffect(MainSequencePtr const &pMainSequence, const Reference< XShape > &rShape, sal_Int16 nSubItem)
static void createVisibilityOnOffNode(Reference< XTimeContainer > const &rxParentContainer, SdrObject &rCandidate, bool bVisible, bool bOnClick, double fDuration)
deprecated_AnimationEffect_conversion_table_entry const deprecated_AnimationEffect_conversion_table[]
deprecated_FadeEffect_conversion_table_entry const deprecated_FadeEffect_conversion_table[]
static bool implIsInsideGroup(SdrObject const *pObj)
OUString maSoundFile
Path to the sound file in MS DOS notation.
bool mbSoundOn
Sound on / off.
sal_uInt16 GetMasterSdPageCount(PageKind ePgKind) const
SdPage * GetSdPage(sal_uInt16 nPgNum, PageKind ePgKind) const
SdPage * GetMasterSdPage(sal_uInt16 nPgNum, PageKind ePgKind)
SAL_DLLPRIVATE DocumentType GetDocumentType() const
sal_uInt16 GetSdPageCount(PageKind ePgKind) const
void setTransitionFadeColor(sal_Int32 nTransitionFadeColor)
PresChange GetPresChange() const
void setTransitionDirection(bool bTransitionbDirection)
std::shared_ptr< sd::MainSequence > const & getMainSequence()
returns a helper class to manipulate effects inside the main sequence
void setTransitionSubtype(sal_Int16 nTransitionSubtype)
bool hasAnimationNode() const
quick check if this slide has an animation node.
virtual void NbcInsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE) override
void setTransitionType(sal_Int16 nTransitionType)
virtual SdrObjList * GetSubList() const override
virtual rtl::Reference< SdrObject > NbcRemoveObject(size_t nObjNum)
virtual SdrObject * getSdrObjectFromSdrObjList() const
virtual SdrInventor GetObjInventor() const
virtual css::uno::Reference< css::drawing::XShape > getUnoShape()
SdrObjList * getParentSdrObjListFromSdrObject() const
virtual SdrObjKind GetObjIdentifier() const
SdrPage * getSdrPageFromSdrObject() const
virtual bool HasText() const override
SdrObject * GetSdrObject() const
css::uno::Type const & get()
CustomAnimationPresetPtr getEffectDescriptor(const OUString &rPresetId) const
constexpr ::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
#define DBG_ASSERT(sCon, aError)
bool equalsAscii(std::u16string_view s1, std::string_view s2)
std::list< CustomAnimationEffectPtr > EffectSequence
std::shared_ptr< MainSequence > MainSequencePtr
std::shared_ptr< CustomAnimationTextGroup > CustomAnimationTextGroupPtr
std::shared_ptr< CustomAnimationPreset > CustomAnimationPresetPtr
std::vector< TransitionPresetPtr > TransitionPresetList
std::shared_ptr< CustomAnimationEffect > CustomAnimationEffectPtr
std::shared_ptr< TransitionPreset > TransitionPresetPtr
SVXCORE_DLLPUBLIC SdrTextObj * DynCastSdrTextObj(SdrObject *)