Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : :
20 : :
21 : : // must be first
22 : : #include <canvas/debug.hxx>
23 : : #include <canvas/verbosetrace.hxx>
24 : :
25 : : #include <com/sun/star/animations/Timing.hpp>
26 : :
27 : : #include <tools.hxx>
28 : : #include <nodetools.hxx>
29 : :
30 : :
31 : : using namespace ::com::sun::star;
32 : :
33 : : namespace slideshow
34 : : {
35 : : namespace internal
36 : : {
37 : : #if OSL_DEBUG_LEVEL >= 2 && defined(DBG_UTIL)
38 : : int& debugGetCurrentOffset()
39 : : {
40 : : static int lcl_nOffset = 0; // to make each tree output distinct
41 : :
42 : : return lcl_nOffset;
43 : : }
44 : :
45 : : void debugNodesShowTree( const BaseNode* pNode )
46 : : {
47 : : if( pNode )
48 : : pNode->showState();
49 : :
50 : : ++debugGetCurrentOffset();
51 : : }
52 : : #endif
53 : :
54 : 0 : AttributableShapeSharedPtr lookupAttributableShape( const ShapeManagerSharedPtr& rShapeManager,
55 : : const uno::Reference< drawing::XShape >& xShape )
56 : : {
57 : 0 : ENSURE_OR_THROW( rShapeManager,
58 : : "lookupAttributableShape(): invalid ShapeManager" );
59 : :
60 : 0 : ShapeSharedPtr pShape( rShapeManager->lookupShape( xShape ) );
61 : :
62 : 0 : ENSURE_OR_THROW( pShape,
63 : : "lookupAttributableShape(): no shape found for given XShape" );
64 : :
65 : : AttributableShapeSharedPtr pRes(
66 : 0 : ::boost::dynamic_pointer_cast< AttributableShape >( pShape ) );
67 : :
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 : 0 : ENSURE_OR_THROW( pRes,
72 : : "lookupAttributableShape(): shape found does not implement AttributableShape interface" );
73 : :
74 : 0 : return pRes;
75 : : }
76 : :
77 : 0 : bool isIndefiniteTiming( const uno::Any& rAny )
78 : : {
79 : 0 : if( !rAny.hasValue() )
80 : 0 : return true;
81 : :
82 : : animations::Timing eTiming;
83 : :
84 : 0 : if( !(rAny >>= eTiming) ||
85 : : eTiming != animations::Timing_INDEFINITE )
86 : : {
87 : 0 : return false;
88 : : }
89 : :
90 : 0 : return true;
91 : : }
92 : :
93 : : }
94 : : }
95 : :
96 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|