sw a11y: clang-format SidebarWinAccessible code
[LibreOffice.git] / slideshow / source / inc / basecontainernode.hxx
blob79dbe3f2f46dc5a01a8411daaa33a6cc6e56249a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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"
24 namespace slideshow::internal {
26 class BaseContainerNode;
27 typedef ::std::shared_ptr< BaseContainerNode > BaseContainerNodeSharedPtr;
30 /** This interface extends BaseNode with child handling methods.
31 Used for XAnimationNode objects which have children
33 class BaseContainerNode : public BaseNode
35 public:
36 BaseContainerNode(
37 css::uno::Reference<css::animations::XAnimationNode> const& xNode,
38 BaseContainerNodeSharedPtr const& pParent,
39 NodeContext const& rContext );
41 /** Add given child node to this container
43 void appendChildNode( AnimationNodeSharedPtr const& pNode );
45 #if defined(DBG_UTIL)
46 virtual void showState() const override;
47 virtual const char* getDescription() const override { return "BaseContainerNode"; }
48 #endif
50 protected:
51 // overrides from BaseNode
52 virtual void dispose() override;
54 private:
55 virtual bool init_st() override;
56 bool init_children();
57 virtual void deactivate_st( NodeState eDestState ) override;
58 virtual bool hasPendingAnimation() const override;
59 // force to be implemented by derived class:
60 virtual void activate_st() override = 0;
61 virtual void notifyDeactivating(
62 AnimationNodeSharedPtr const& rNotifier ) override = 0;
64 protected:
65 bool isDurationIndefinite() const { return mbDurationIndefinite; }
67 bool isChildNode( AnimationNodeSharedPtr const& pNode ) const;
69 /// @return true: if all children have been deactivated
70 bool notifyDeactivatedChild( AnimationNodeSharedPtr const& pChildNode );
72 void repeat();
74 template <typename FuncT>
75 void forEachChildNode( FuncT func,
76 int nodeStateMask ) const
78 for (AnimationNodeSharedPtr const& pNode : maChildren) {
79 if (nodeStateMask != -1 && (pNode->getState() & nodeStateMask) == 0)
80 continue;
81 func(pNode);
85 typedef ::std::vector<AnimationNodeSharedPtr> VectorOfNodes;
86 VectorOfNodes maChildren;
87 ::std::size_t mnFinishedChildren;
88 double mnLeftIterations;
90 private:
91 const bool mbRepeatIndefinite;
92 const bool mbRestart;
93 const bool mbDurationIndefinite;
96 } // namespace presentation::interface
98 #endif
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */