1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SLIDESHOW_SOURCE_ENGINE_ANIMATIONNODES_BASECONTAINERNODE_HXX
20 #define INCLUDED_SLIDESHOW_SOURCE_ENGINE_ANIMATIONNODES_BASECONTAINERNODE_HXX
22 #include "basenode.hxx"
27 /** This interface extends BaseNode with child handling methods.
28 Used for XAnimationNode objects which have children
30 class BaseContainerNode
: public BaseNode
34 ::com::sun::star::uno::Reference
<
35 ::com::sun::star::animations::XAnimationNode
> const& xNode
,
36 ::boost::shared_ptr
<BaseContainerNode
> const& pParent
,
37 NodeContext
const& rContext
);
39 /** Add given child node to this container
41 void appendChildNode( AnimationNodeSharedPtr
const& pNode
);
43 #if OSL_DEBUG_LEVEL >= 2 && defined(DBG_UTIL)
44 virtual void showState() const;
45 virtual const char* getDescription() const { return "BaseContainerNode"; }
49 // overrides from BaseNode
50 virtual void dispose() SAL_OVERRIDE
;
53 virtual bool init_st() SAL_OVERRIDE
;
55 virtual void deactivate_st( NodeState eDestState
) SAL_OVERRIDE
;
56 virtual bool hasPendingAnimation() const SAL_OVERRIDE
;
57 // force to be implemented by derived class:
58 virtual void activate_st() SAL_OVERRIDE
= 0;
59 virtual void notifyDeactivating(
60 AnimationNodeSharedPtr
const& rNotifier
) SAL_OVERRIDE
= 0;
63 bool isDurationIndefinite() const { return mbDurationIndefinite
; }
65 bool isChildNode( AnimationNodeSharedPtr
const& pNode
) const;
67 /// @return true: if all children have been deactivated
68 bool notifyDeactivatedChild( AnimationNodeSharedPtr
const& pChildNode
);
72 template <typename FuncT
>
73 inline void forEachChildNode( FuncT
const& func
,
74 int nodeStateMask
= -1 ) const
76 VectorOfNodes::const_iterator
iPos( maChildren
.begin() );
77 VectorOfNodes::const_iterator
const iEnd( maChildren
.end() );
78 for ( ; iPos
!= iEnd
; ++iPos
) {
79 AnimationNodeSharedPtr
const& pNode
= *iPos
;
80 if (nodeStateMask
!= -1 && (pNode
->getState() & nodeStateMask
) == 0)
86 typedef ::std::vector
<AnimationNodeSharedPtr
> VectorOfNodes
;
87 VectorOfNodes maChildren
;
88 ::std::size_t mnFinishedChildren
;
89 double mnLeftIterations
;
92 const bool mbDurationIndefinite
;
95 typedef ::boost::shared_ptr
< BaseContainerNode
> BaseContainerNodeSharedPtr
;
97 } // namespace interface
98 } // namespace presentation
100 #endif // INCLUDED_SLIDESHOW_SOURCE_ENGINE_ANIMATIONNODES_BASECONTAINERNODE_HXX
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */