170f497fbSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 370f497fbSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 470f497fbSAndrew Rist * or more contributor license agreements. See the NOTICE file 570f497fbSAndrew Rist * distributed with this work for additional information 670f497fbSAndrew Rist * regarding copyright ownership. The ASF licenses this file 770f497fbSAndrew Rist * to you under the Apache License, Version 2.0 (the 870f497fbSAndrew Rist * "License"); you may not use this file except in compliance 970f497fbSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 1170f497fbSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 1370f497fbSAndrew Rist * Unless required by applicable law or agreed to in writing, 1470f497fbSAndrew Rist * software distributed under the License is distributed on an 1570f497fbSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1670f497fbSAndrew Rist * KIND, either express or implied. See the License for the 1770f497fbSAndrew Rist * specific language governing permissions and limitations 1870f497fbSAndrew Rist * under the License. 19cdf0e10cSrcweir * 2070f497fbSAndrew Rist *************************************************************/ 2170f497fbSAndrew Rist 22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 23cdf0e10cSrcweir #include "precompiled_slideshow.hxx" 24cdf0e10cSrcweir 25cdf0e10cSrcweir // must be first 26cdf0e10cSrcweir #include <canvas/debug.hxx> 27cdf0e10cSrcweir #include <canvas/verbosetrace.hxx> 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include <com/sun/star/animations/Timing.hpp> 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include <tools.hxx> 32cdf0e10cSrcweir #include <nodetools.hxx> 33cdf0e10cSrcweir 34cdf0e10cSrcweir 35cdf0e10cSrcweir using namespace ::com::sun::star; 36cdf0e10cSrcweir 37cdf0e10cSrcweir namespace slideshow 38cdf0e10cSrcweir { 39cdf0e10cSrcweir namespace internal 40cdf0e10cSrcweir { 41cdf0e10cSrcweir #if defined(VERBOSE) && defined(DBG_UTIL) debugGetCurrentOffset()42cdf0e10cSrcweir int& debugGetCurrentOffset() 43cdf0e10cSrcweir { 44cdf0e10cSrcweir static int lcl_nOffset = 0; // to make each tree output distinct 45cdf0e10cSrcweir 46cdf0e10cSrcweir return lcl_nOffset; 47cdf0e10cSrcweir } 48cdf0e10cSrcweir debugNodesShowTree(const BaseNode * pNode)49cdf0e10cSrcweir void debugNodesShowTree( const BaseNode* pNode ) 50cdf0e10cSrcweir { 51cdf0e10cSrcweir if( pNode ) 52cdf0e10cSrcweir pNode->showState(); 53cdf0e10cSrcweir 54cdf0e10cSrcweir ++debugGetCurrentOffset(); 55cdf0e10cSrcweir } 56cdf0e10cSrcweir debugNodesShowTreeWithin(const BaseNode * pNode)57cdf0e10cSrcweir void debugNodesShowTreeWithin( const BaseNode* pNode ) 58cdf0e10cSrcweir { 59cdf0e10cSrcweir if( pNode ) 60cdf0e10cSrcweir pNode->showTreeFromWithin(); 61cdf0e10cSrcweir 62cdf0e10cSrcweir ++debugGetCurrentOffset(); 63cdf0e10cSrcweir } 64cdf0e10cSrcweir #endif 65cdf0e10cSrcweir lookupAttributableShape(const ShapeManagerSharedPtr & rShapeManager,const uno::Reference<drawing::XShape> & xShape)66cdf0e10cSrcweir AttributableShapeSharedPtr lookupAttributableShape( const ShapeManagerSharedPtr& rShapeManager, 67cdf0e10cSrcweir const uno::Reference< drawing::XShape >& xShape ) 68cdf0e10cSrcweir { 69cdf0e10cSrcweir ENSURE_OR_THROW( rShapeManager, 70cdf0e10cSrcweir "lookupAttributableShape(): invalid ShapeManager" ); 71cdf0e10cSrcweir 72cdf0e10cSrcweir ShapeSharedPtr pShape( rShapeManager->lookupShape( xShape ) ); 73cdf0e10cSrcweir 74cdf0e10cSrcweir ENSURE_OR_THROW( pShape, 75cdf0e10cSrcweir "lookupAttributableShape(): no shape found for given XShape" ); 76cdf0e10cSrcweir 77cdf0e10cSrcweir AttributableShapeSharedPtr pRes( 78cdf0e10cSrcweir ::boost::dynamic_pointer_cast< AttributableShape >( pShape ) ); 79cdf0e10cSrcweir 80cdf0e10cSrcweir // TODO(E3): Cannot throw here, people might set animation info 81cdf0e10cSrcweir // for non-animatable shapes from the API. AnimationNodes must catch 82cdf0e10cSrcweir // the exception and handle that differently 83cdf0e10cSrcweir ENSURE_OR_THROW( pRes, 84cdf0e10cSrcweir "lookupAttributableShape(): shape found does not implement AttributableShape interface" ); 85cdf0e10cSrcweir 86cdf0e10cSrcweir return pRes; 87cdf0e10cSrcweir } 88cdf0e10cSrcweir isIndefiniteTiming(const uno::Any & rAny)89cdf0e10cSrcweir bool isIndefiniteTiming( const uno::Any& rAny ) 90cdf0e10cSrcweir { 91cdf0e10cSrcweir if( !rAny.hasValue() ) 92cdf0e10cSrcweir return true; 93cdf0e10cSrcweir 94cdf0e10cSrcweir animations::Timing eTiming; 95cdf0e10cSrcweir 96cdf0e10cSrcweir if( !(rAny >>= eTiming) || 97cdf0e10cSrcweir eTiming != animations::Timing_INDEFINITE ) 98cdf0e10cSrcweir { 99cdf0e10cSrcweir return false; 100cdf0e10cSrcweir } 101cdf0e10cSrcweir 102cdf0e10cSrcweir return true; 103cdf0e10cSrcweir } 104cdf0e10cSrcweir 105*578c6824Smseidel // Extract the node type from the user data getNodeType(sal_Int16 & o_rNodeType,const uno::Sequence<beans::NamedValue> & rValues)106cdf0e10cSrcweir bool getNodeType( sal_Int16& o_rNodeType, 107cdf0e10cSrcweir const uno::Sequence< beans::NamedValue >& rValues ) 108cdf0e10cSrcweir { 109cdf0e10cSrcweir beans::NamedValue aNamedValue; 110cdf0e10cSrcweir 111cdf0e10cSrcweir if( findNamedValue( &aNamedValue, 112cdf0e10cSrcweir rValues, 113cdf0e10cSrcweir ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("node-type") ) ) ) 114cdf0e10cSrcweir { 115cdf0e10cSrcweir if( (aNamedValue.Value >>= o_rNodeType) ) 116cdf0e10cSrcweir return true; 117cdf0e10cSrcweir } 118cdf0e10cSrcweir 119cdf0e10cSrcweir return false; 120cdf0e10cSrcweir } 121cdf0e10cSrcweir } 122cdf0e10cSrcweir } 123*578c6824Smseidel 124*578c6824Smseidel /* vim: set noet sw=4 ts=4: */ 125