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_INC_BASECONTAINERNODE_HXX
20 #define INCLUDED_SLIDESHOW_SOURCE_INC_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 css::uno::Reference
<css::animations::XAnimationNode
> const& xNode
,
35 ::std::shared_ptr
<BaseContainerNode
> const& pParent
,
36 NodeContext
const& rContext
);
38 /** Add given child node to this container
40 void appendChildNode( AnimationNodeSharedPtr
const& pNode
);
43 virtual void showState() const override
;
44 virtual const char* getDescription() const override
{ return "BaseContainerNode"; }
48 // overrides from BaseNode
49 virtual void dispose() override
;
52 virtual bool init_st() override
;
54 virtual void deactivate_st( NodeState eDestState
) override
;
55 virtual bool hasPendingAnimation() const override
;
56 // force to be implemented by derived class:
57 virtual void activate_st() override
= 0;
58 virtual void notifyDeactivating(
59 AnimationNodeSharedPtr
const& rNotifier
) override
= 0;
62 bool isDurationIndefinite() const { return mbDurationIndefinite
; }
64 bool isChildNode( AnimationNodeSharedPtr
const& pNode
) const;
66 /// @return true: if all children have been deactivated
67 bool notifyDeactivatedChild( AnimationNodeSharedPtr
const& pChildNode
);
71 template <typename FuncT
>
72 void forEachChildNode( FuncT func
,
73 int nodeStateMask
) const
75 VectorOfNodes::const_iterator
iPos( maChildren
.begin() );
76 VectorOfNodes::const_iterator
const iEnd( maChildren
.end() );
77 for ( ; iPos
!= iEnd
; ++iPos
) {
78 AnimationNodeSharedPtr
const& pNode
= *iPos
;
79 if (nodeStateMask
!= -1 && (pNode
->getState() & nodeStateMask
) == 0)
85 typedef ::std::vector
<AnimationNodeSharedPtr
> VectorOfNodes
;
86 VectorOfNodes maChildren
;
87 ::std::size_t mnFinishedChildren
;
88 double mnLeftIterations
;
91 const bool mbDurationIndefinite
;
94 typedef ::std::shared_ptr
< BaseContainerNode
> BaseContainerNodeSharedPtr
;
96 } // namespace interface
97 } // namespace presentation
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */