bump product version to 5.0.4.1
[LibreOffice.git] / slideshow / source / engine / animationnodes / nodetools.cxx
blobc1dc398fcd2ccf0ec89f1223b0efa728b31c00b0
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 .
21 // must be first
22 #include <canvas/debug.hxx>
23 #include <canvas/verbosetrace.hxx>
25 #include <com/sun/star/animations/Timing.hpp>
27 #include <tools.hxx>
28 #include <nodetools.hxx>
31 using namespace ::com::sun::star;
33 namespace slideshow
35 namespace internal
37 #if OSL_DEBUG_LEVEL >= 2 && defined(DBG_UTIL)
38 int& debugGetCurrentOffset()
40 static int lcl_nOffset = 0; // to make each tree output distinct
42 return lcl_nOffset;
45 void debugNodesShowTree( const BaseNode* pNode )
47 if( pNode )
48 pNode->showState();
50 ++debugGetCurrentOffset();
52 #endif
54 AttributableShapeSharedPtr lookupAttributableShape( const ShapeManagerSharedPtr& rShapeManager,
55 const uno::Reference< drawing::XShape >& xShape )
57 ENSURE_OR_THROW( rShapeManager,
58 "lookupAttributableShape(): invalid ShapeManager" );
60 ShapeSharedPtr pShape( rShapeManager->lookupShape( xShape ) );
62 ENSURE_OR_THROW( pShape,
63 "lookupAttributableShape(): no shape found for given XShape" );
65 AttributableShapeSharedPtr pRes(
66 ::boost::dynamic_pointer_cast< AttributableShape >( pShape ) );
68 // TODO(E3): Cannot throw here, people might set animation info
69 // for non-animatable shapes from the API. AnimationNodes must catch
70 // the exception and handle that differently
71 ENSURE_OR_THROW( pRes,
72 "lookupAttributableShape(): shape found does not implement AttributableShape interface" );
74 return pRes;
77 bool isIndefiniteTiming( const uno::Any& rAny )
79 if( !rAny.hasValue() )
80 return true;
82 animations::Timing eTiming;
84 if( !(rAny >>= eTiming) ||
85 eTiming != animations::Timing_INDEFINITE )
87 return false;
90 return true;
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */