21#include <com/sun/star/drawing/XShape.hpp>
22#include <com/sun/star/animations/AnimationNodeType.hpp>
23#include <com/sun/star/presentation/TextAnimationType.hpp>
24#include <com/sun/star/animations/XIterateContainer.hpp>
25#include <com/sun/star/presentation/ShapeAnimationSubType.hpp>
26#include <com/sun/star/presentation/ParagraphTarget.hpp>
55 const uno::Reference< animations::XAnimationNode >& xNode,
57 const NodeContext& rContext );
63 const NodeContext& rContext )
67 const uno::Reference< animations::XAnimationNode >& xChildNode )
const
74 const uno::Reference< animations::XAnimationNode >& xChildNode,
75 const NodeContext& rContext )
const
82 "NodeCreator::operator(): child creation failed" );
99class CloningNodeCreator :
private NodeCreator
103 const NodeContext& rContext )
104 : NodeCreator( rParent, rContext ) {}
107 const uno::Reference< animations::XAnimationNode >& xChildNode )
const
136 aContext.mpMasterShapeSubset =
137 std::make_shared<ShapeSubset>( *aContext.mpMasterShapeSubset );
139 createChild( xChildNode, aContext );
148bool implCreateIteratedNodes(
149 const uno::Reference< animations::XIterateContainer >& xIterNode,
151 const NodeContext& rContext )
154 "implCreateIteratedNodes(): Invalid node" );
156 const double nIntervalTimeout( xIterNode->getIterateInterval() );
161 if( nIntervalTimeout < 0.0 ||
162 nIntervalTimeout > 1000.0 )
167 if( ::basegfx::fTools::equalZero( nIntervalTimeout ) )
168 SAL_INFO(
"slideshow",
"implCreateIteratedNodes(): "
169 "iterate interval close to zero, there's "
170 "no point in defining such an effect "
171 "(visually equivalent to whole-shape effect)" );
178 xIterNode->getTarget().hasValue(),
179 "implCreateIteratedNodes(): no target on ITERATE node" );
181 uno::Reference< drawing::XShape > xTargetShape( xIterNode->getTarget(),
184 presentation::ParagraphTarget aTarget;
185 sal_Int16 nSubItem( xIterNode->getSubItem() );
186 bool bParagraphTarget(
false );
188 if( !xTargetShape.is() )
191 if( !(xIterNode->getTarget() >>= aTarget) )
194 "implCreateIteratedNodes(): could not extract any "
195 "target information" );
197 xTargetShape = aTarget.Shape;
201 "implCreateIteratedNodes(): invalid shape in ParagraphTarget" );
206 nSubItem = presentation::ShapeAnimationSubType::ONLY_TEXT;
208 bParagraphTarget =
true;
218 const DocTreeNodeSupplier& rTreeNodeSupplier(
219 pTargetShape->getTreeNodeSupplier() );
223 NodeContext aContext( rContext );
228 if( bParagraphTarget )
231 aTarget.Paragraph >= 0 &&
232 rTreeNodeSupplier.getNumberOfTreeNodes(
234 "implCreateIteratedNodes(): paragraph index out of range" );
237 std::make_shared<ShapeSubset>(
241 rTreeNodeSupplier.getTreeNode(
244 rContext.maContext.mpSubsettableShapeManager );
250 aContext.mbIsIndependentSubset =
true;
262 pTargetSubset->enableSubsetShape();
267 std::make_shared<ShapeSubset>( pTargetShape,
268 rContext.maContext.mpSubsettableShapeManager );
271 aContext.mpMasterShapeSubset = pTargetSubset;
272 uno::Reference< animations::XAnimationNode > xNode( xIterNode,
273 uno::UNO_QUERY_THROW );
278 if( bParagraphTarget ||
279 nSubItem != presentation::ShapeAnimationSubType::ONLY_TEXT )
297 NodeCreator aCreator( rParent, aContext );
302 "implCreateIteratedNodes(): iterated child node creation failed" );
314 if( nSubItem != presentation::ShapeAnimationSubType::ONLY_BACKGROUND )
321 switch( xIterNode->getIterateType() )
323 case presentation::TextAnimationType::BY_PARAGRAPH:
327 case presentation::TextAnimationType::BY_WORD:
331 case presentation::TextAnimationType::BY_LETTER:
337 false,
"implCreateIteratedNodes(): "
338 "Unexpected IterateType on XIterateContainer");
342 if( bParagraphTarget &&
348 OSL_FAIL(
"implCreateIteratedNodes(): Ignoring paragraph iteration for paragraph master" );
363 aContext.mbIsIndependentSubset =
false;
367 sal_Int32 nTreeNodes( 0 );
368 if( bParagraphTarget )
374 nTreeNodes = rTreeNodeSupplier.getNumberOfSubsetTreeNodes(
375 pTargetSubset->getSubset(),
381 nTreeNodes = rTreeNodeSupplier.getNumberOfTreeNodes(
392 aContext.mnStartDelay = nIntervalTimeout;
394 for( sal_Int32 i=0;
i<nTreeNodes; ++
i )
397 if( bParagraphTarget )
400 aContext.mpMasterShapeSubset =
401 std::make_shared<ShapeSubset>(
403 rTreeNodeSupplier.getSubsetTreeNode(
404 pTargetSubset->getSubset(),
406 eIterateNodeType ) );
411 aContext.mpMasterShapeSubset =
412 std::make_shared<ShapeSubset>( pTargetSubset,
413 rTreeNodeSupplier.getTreeNode(
415 eIterateNodeType ) );
418 CloningNodeCreator aCreator( rParent, aContext );
422 false,
"implCreateIteratedNodes(): "
423 "iterated child node creation failed" );
426 aContext.mnStartDelay += nIntervalTimeout;
436 const uno::Reference< animations::XAnimationNode >& xNode,
438 const NodeContext& rContext )
441 "implCreateAnimationNode(): invalid XAnimationNode" );
447 switch( xNode->getType() )
449 case animations::AnimationNodeType::CUSTOM:
450 OSL_FAIL(
"implCreateAnimationNode(): "
451 "CUSTOM not yet implemented" );
454 case animations::AnimationNodeType::PAR:
455 pCreatedNode = pCreatedContainer =
456 std::make_shared<ParallelTimeContainer>( xNode, rParent, rContext );
459 case animations::AnimationNodeType::ITERATE:
463 pCreatedNode = pCreatedContainer =
464 std::make_shared<ParallelTimeContainer>( xNode, rParent, rContext );
467 case animations::AnimationNodeType::SEQ:
468 pCreatedNode = pCreatedContainer =
469 std::make_shared<SequentialTimeContainer>( xNode, rParent, rContext );
472 case animations::AnimationNodeType::ANIMATE:
473 pCreatedNode = std::make_shared<PropertyAnimationNode>(
474 xNode, rParent, rContext );
477 case animations::AnimationNodeType::SET:
478 pCreatedNode = std::make_shared<AnimationSetNode>(
479 xNode, rParent, rContext );
482 case animations::AnimationNodeType::ANIMATEMOTION:
483 pCreatedNode = std::make_shared<AnimationPathMotionNode>(
484 xNode, rParent, rContext );
487 case animations::AnimationNodeType::ANIMATECOLOR:
488 pCreatedNode = std::make_shared<AnimationColorNode>(
489 xNode, rParent, rContext );
492 case animations::AnimationNodeType::ANIMATETRANSFORM:
493 pCreatedNode = std::make_shared<AnimationTransformNode>(
494 xNode, rParent, rContext );
497 case animations::AnimationNodeType::ANIMATEPHYSICS:
498 pCreatedNode = std::make_shared<AnimationPhysicsNode>(
499 xNode, rParent, rContext );
502 case animations::AnimationNodeType::TRANSITIONFILTER:
503 pCreatedNode = std::make_shared<AnimationTransitionFilterNode>(
504 xNode, rParent, rContext );
507 case animations::AnimationNodeType::AUDIO:
508 pCreatedNode = std::make_shared<AnimationAudioNode>(
509 xNode, rParent, rContext );
512 case animations::AnimationNodeType::COMMAND:
513 pCreatedNode = std::make_shared<AnimationCommandNode>(
514 xNode, rParent, rContext );
518 OSL_FAIL(
"implCreateAnimationNode(): "
519 "invalid AnimationNodeType" );
528 pCreatedNode->setSelf( pCreatedNode );
532 if( pCreatedContainer )
534 uno::Reference< animations::XIterateContainer > xIterNode(
535 xNode, uno::UNO_QUERY );
549 implCreateIteratedNodes( xIterNode,
556 NodeCreator aCreator( pCreatedContainer, rContext );
559 OSL_FAIL(
"implCreateAnimationNode(): "
560 "child node creation failed" );
572 const uno::Reference< animations::XAnimationNode >& xNode,
573 const ::basegfx::B2DVector& rSlideSize,
574 const SlideShowContext& rContext )
578 "AnimationNodeFactory::createAnimationNode(): invalid XAnimationNode" );
580 return implCreateAnimationNode(
583 NodeContext( rContext,
BaseContainerNodeSharedPtr & mrParent
const NodeContext & mrContext
NodeType
Type of shape entity represented by this node.
@ LogicalCharacterCell
This node represents a character.
@ LogicalWord
This node represents a word.
@ LogicalParagraph
This node represents a paragraph.
#define ENSURE_OR_RETURN_FALSE(c, m)
#define ENSURE_OR_THROW(c, m)
#define SAL_INFO(area, stream)
void showTree(AnimationNodeSharedPtr const &pRootNode)
AnimationNodeSharedPtr createAnimationNode(const css::uno::Reference< css::animations::XAnimationNode > &xNode, const ::basegfx::B2DVector &rSlideSize, const SlideShowContext &rContext)
Create an AnimationNode for the given XAnimationNode.
AttributableShapeSharedPtr lookupAttributableShape(const ShapeManagerSharedPtr &rShapeManager, const uno::Reference< drawing::XShape > &xShape)
::std::shared_ptr< ShapeSubset > ShapeSubsetSharedPtr
::std::shared_ptr< BaseContainerNode > BaseContainerNodeSharedPtr
::std::shared_ptr< AnimationNode > AnimationNodeSharedPtr
::std::shared_ptr< AttributableShape > AttributableShapeSharedPtr
::std::shared_ptr< BaseNode > BaseNodeSharedPtr
bool for_each_childNode(const css::uno::Reference< css::animations::XAnimationNode > &xNode, Functor &rFunctor)
Apply given functor to every animation node child.
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)