Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_SLIDESHOW_SOURCE_ENGINE_ANIMATIONNODES_BASECONTAINERNODE_HXX
20 : #define INCLUDED_SLIDESHOW_SOURCE_ENGINE_ANIMATIONNODES_BASECONTAINERNODE_HXX
21 :
22 : #include "basenode.hxx"
23 :
24 : namespace slideshow {
25 : namespace internal {
26 :
27 : /** This interface extends BaseNode with child handling methods.
28 : Used for XAnimationNode objects which have children
29 : */
30 0 : class BaseContainerNode : public BaseNode
31 : {
32 : public:
33 : BaseContainerNode(
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 );
38 :
39 : /** Add given child node to this container
40 : */
41 : void appendChildNode( AnimationNodeSharedPtr const& pNode );
42 :
43 : #if OSL_DEBUG_LEVEL >= 2 && defined(DBG_UTIL)
44 : virtual void showState() const;
45 : virtual const char* getDescription() const { return "BaseContainerNode"; }
46 : #endif
47 :
48 : protected:
49 : // overrides from BaseNode
50 : virtual void dispose() SAL_OVERRIDE;
51 :
52 : private:
53 : virtual bool init_st() SAL_OVERRIDE;
54 : bool init_children();
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;
61 :
62 : protected:
63 0 : bool isDurationIndefinite() const { return mbDurationIndefinite; }
64 :
65 : bool isChildNode( AnimationNodeSharedPtr const& pNode ) const;
66 :
67 : /// @return true: if all children have been deactivated
68 : bool notifyDeactivatedChild( AnimationNodeSharedPtr const& pChildNode );
69 :
70 : bool repeat();
71 :
72 : template <typename FuncT>
73 0 : inline void forEachChildNode( FuncT const& func,
74 : int nodeStateMask = -1 ) const
75 : {
76 0 : VectorOfNodes::const_iterator iPos( maChildren.begin() );
77 0 : VectorOfNodes::const_iterator const iEnd( maChildren.end() );
78 0 : for ( ; iPos != iEnd; ++iPos ) {
79 0 : AnimationNodeSharedPtr const& pNode = *iPos;
80 0 : if (nodeStateMask != -1 && (pNode->getState() & nodeStateMask) == 0)
81 0 : continue;
82 0 : func(pNode);
83 : }
84 0 : }
85 :
86 : typedef ::std::vector<AnimationNodeSharedPtr> VectorOfNodes;
87 : VectorOfNodes maChildren;
88 : ::std::size_t mnFinishedChildren;
89 : double mnLeftIterations;
90 :
91 : private:
92 : const bool mbDurationIndefinite;
93 : };
94 :
95 : typedef ::boost::shared_ptr< BaseContainerNode > BaseContainerNodeSharedPtr;
96 :
97 : } // namespace interface
98 : } // namespace presentation
99 :
100 : #endif // INCLUDED_SLIDESHOW_SOURCE_ENGINE_ANIMATIONNODES_BASECONTAINERNODE_HXX
101 :
102 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|