Use o3tl::convert in Math
[LibreOffice.git] / slideshow / source / engine / animationnodes / nodetools.cxx
blobf509e680c04b2f57c97406ef31d27735415b11a9
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 #include <com/sun/star/animations/Timing.hpp>
23 #include "nodetools.hxx"
26 using namespace ::com::sun::star;
28 namespace slideshow::internal
30 #if defined(DBG_UTIL)
31 static sal_Int32 lcl_nOffset = 0;
33 OUString debugGetNodeName( const BaseNode *pNode )
35 return OUString::number(lcl_nOffset) +
36 " - 0x" +
37 OUString::number(reinterpret_cast<sal_Int64>(pNode), 16);
40 void debugNodesShowTree( const BaseNode* pNode )
42 if( pNode )
43 pNode->showState();
45 ++lcl_nOffset;
47 #endif
49 AttributableShapeSharedPtr lookupAttributableShape( const ShapeManagerSharedPtr& rShapeManager,
50 const uno::Reference< drawing::XShape >& xShape )
52 ENSURE_OR_THROW( rShapeManager,
53 "lookupAttributableShape(): invalid ShapeManager" );
55 ShapeSharedPtr pShape( rShapeManager->lookupShape( xShape ) );
57 ENSURE_OR_THROW( pShape,
58 "lookupAttributableShape(): no shape found for given XShape" );
60 AttributableShapeSharedPtr pRes(
61 ::std::dynamic_pointer_cast< AttributableShape >( pShape ) );
63 // TODO(E3): Cannot throw here, people might set animation info
64 // for non-animatable shapes from the API. AnimationNodes must catch
65 // the exception and handle that differently
66 ENSURE_OR_THROW( pRes,
67 "lookupAttributableShape(): shape found does not implement AttributableShape interface" );
69 return pRes;
72 bool isIndefiniteTiming( const uno::Any& rAny )
74 if( !rAny.hasValue() )
75 return true;
77 animations::Timing eTiming;
79 return (rAny >>= eTiming) && eTiming == animations::Timing_INDEFINITE;
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */