Bump version to 6.4-15
[LibreOffice.git] / include / animations / animationnodehelper.hxx
blobeee41cd282beda380c073742870247f62ae8e116
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 .
20 #ifndef INCLUDED_ANIMATIONS_ANIMATIONNODEHELPER_HXX
21 #define INCLUDED_ANIMATIONS_ANIMATIONNODEHELPER_HXX
23 #include <com/sun/star/uno/Reference.hxx>
24 #include <com/sun/star/animations/XAnimationNode.hpp>
25 #include <com/sun/star/container/XEnumerationAccess.hpp>
26 #include <com/sun/star/container/XEnumeration.hpp>
28 #include <vector>
30 /* Declaration and definition of AnimationNode helper */
32 namespace anim
34 // TODO(Q1): this could possibly be implemented with a somewhat
35 // more lightweight template, by having the actual worker receive
36 // only a function pointer, and a thin templated wrapper around
37 // that which converts member functions into that.
39 /** pushes the given node to the given vector and recursively calls itself for each child node.
41 inline void create_deep_vector( const css::uno::Reference< css::animations::XAnimationNode >& xNode,
42 std::vector< css::uno::Reference< css::animations::XAnimationNode > >& rVector )
44 rVector.push_back( xNode );
46 try
48 // get an XEnumerationAccess to the children
49 css::uno::Reference< css::container::XEnumerationAccess >
50 xEnumerationAccess( xNode, css::uno::UNO_QUERY );
52 if( xEnumerationAccess.is() )
54 css::uno::Reference< css::container::XEnumeration >
55 xEnumeration = xEnumerationAccess->createEnumeration();
57 if( xEnumeration.is() )
59 while( xEnumeration->hasMoreElements() )
61 css::uno::Reference< css::animations::XAnimationNode >
62 xChildNode( xEnumeration->nextElement(),
63 css::uno::UNO_QUERY_THROW );
65 create_deep_vector( xChildNode, rVector );
70 catch( css::uno::Exception& )
76 #endif /* INCLUDED_ANIMATIONS_ANIMATIONNODEHELPER_HXX */
78 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */