1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: nodetools.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_slideshow.hxx"
35 #include <canvas/debug.hxx>
36 #include <canvas/verbosetrace.hxx>
38 #include <com/sun/star/animations/Timing.hpp>
41 #include <nodetools.hxx>
44 using namespace ::com::sun::star
;
50 #if defined(VERBOSE) && defined(DBG_UTIL)
51 int& debugGetCurrentOffset()
53 static int lcl_nOffset
= 0; // to make each tree output distinct
58 void debugNodesShowTree( const BaseNode
* pNode
)
63 ++debugGetCurrentOffset();
66 void debugNodesShowTreeWithin( const BaseNode
* pNode
)
69 pNode
->showTreeFromWithin();
71 ++debugGetCurrentOffset();
75 AttributableShapeSharedPtr
lookupAttributableShape( const ShapeManagerSharedPtr
& rShapeManager
,
76 const uno::Reference
< drawing::XShape
>& xShape
)
78 ENSURE_OR_THROW( rShapeManager
,
79 "lookupAttributableShape(): invalid ShapeManager" );
81 ShapeSharedPtr
pShape( rShapeManager
->lookupShape( xShape
) );
83 ENSURE_OR_THROW( pShape
,
84 "lookupAttributableShape(): no shape found for given XShape" );
86 AttributableShapeSharedPtr
pRes(
87 ::boost::dynamic_pointer_cast
< AttributableShape
>( pShape
) );
89 // TODO(E3): Cannot throw here, people might set animation info
90 // for non-animatable shapes from the API. AnimationNodes must catch
91 // the exception and handle that differently
92 ENSURE_OR_THROW( pRes
,
93 "lookupAttributableShape(): shape found does not implement AttributableShape interface" );
98 bool isIndefiniteTiming( const uno::Any
& rAny
)
100 if( !rAny
.hasValue() )
103 animations::Timing eTiming
;
105 if( !(rAny
>>= eTiming
) ||
106 eTiming
!= animations::Timing_INDEFINITE
)
114 /// Extract the node type from the user data
115 bool getNodeType( sal_Int16
& o_rNodeType
,
116 const uno::Sequence
< beans::NamedValue
>& rValues
)
118 beans::NamedValue aNamedValue
;
120 if( findNamedValue( &aNamedValue
,
122 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("node-type") ) ) )
124 if( (aNamedValue
.Value
>>= o_rNodeType
) )