1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: basecontainernode.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef INCLUDED_SLIDESHOW_BASECONTAINERNODE_HXX
31 #define INCLUDED_SLIDESHOW_BASECONTAINERNODE_HXX
33 #include "basenode.hxx"
38 /** This interface extends BaseNode with child handling methods.
39 Used for XAnimationNode objects which have children
41 class BaseContainerNode
: public BaseNode
45 ::com::sun::star::uno::Reference
<
46 ::com::sun::star::animations::XAnimationNode
> const& xNode
,
47 ::boost::shared_ptr
<BaseContainerNode
> const& pParent
,
48 NodeContext
const& rContext
);
50 /** Add given child node to this container
52 void appendChildNode( AnimationNodeSharedPtr
const& pNode
);
54 #if defined(VERBOSE) && defined(DBG_UTIL)
55 virtual void showState() const;
56 virtual const char* getDescription() const { return "BaseContainerNode"; }
60 // overrides from BaseNode
61 virtual void dispose();
64 virtual bool init_st();
65 virtual void deactivate_st( NodeState eDestState
);
66 virtual bool hasPendingAnimation() const;
67 // force to be implemented by derived class:
68 virtual void activate_st() = 0;
69 virtual void notifyDeactivating(
70 AnimationNodeSharedPtr
const& rNotifier
) = 0;
73 bool isDurationIndefinite() const { return mbDurationIndefinite
; }
75 bool isChildNode( AnimationNodeSharedPtr
const& pNode
) const;
77 /// @return true: if all children have been deactivated
78 bool notifyDeactivatedChild( AnimationNodeSharedPtr
const& pChildNode
);
80 template <typename FuncT
>
81 inline void forEachChildNode( FuncT
const& func
,
82 int nodeStateMask
= -1 ) const
84 VectorOfNodes::const_iterator
iPos( maChildren
.begin() );
85 VectorOfNodes::const_iterator
const iEnd( maChildren
.end() );
86 for ( ; iPos
!= iEnd
; ++iPos
) {
87 AnimationNodeSharedPtr
const& pNode
= *iPos
;
88 if (nodeStateMask
!= -1 && (pNode
->getState() & nodeStateMask
) == 0)
94 typedef ::std::vector
<AnimationNodeSharedPtr
> VectorOfNodes
;
95 VectorOfNodes maChildren
;
96 ::std::size_t mnFinishedChildren
;
99 const bool mbDurationIndefinite
;
102 typedef ::boost::shared_ptr
< BaseContainerNode
> BaseContainerNodeSharedPtr
;
104 } // namespace interface
105 } // namespace presentation
107 #endif /* INCLUDED_SLIDESHOW_BASECONTAINERNODE_HXX */