LibreOffice Module slideshow (master) 1
nodetools.cxx
Go to the documentation of this file.
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#include <com/sun/star/animations/Timing.hpp>
22
23#include "nodetools.hxx"
24
25
26using namespace ::com::sun::star;
27
28namespace slideshow::internal
29{
30#if defined(DBG_UTIL)
31 static sal_Int32 lcl_nOffset = 0;
32
33 OUString debugGetNodeName( const BaseNode *pNode )
34 {
35 return OUString::number(lcl_nOffset) +
36 " - 0x" +
37 OUString::number(reinterpret_cast<sal_IntPtr>(pNode), 16);
38 }
39
40 void debugNodesShowTree( const BaseNode* pNode )
41 {
42 if( pNode )
43 pNode->showState();
44
46 }
47#endif
48
51 {
52 ENSURE_OR_THROW( rShapeManager,
53 "lookupAttributableShape(): invalid ShapeManager" );
54
55 ShapeSharedPtr pShape( rShapeManager->lookupShape( xShape ) );
56
57 ENSURE_OR_THROW( pShape,
58 "lookupAttributableShape(): no shape found for given XShape" );
59
61 ::std::dynamic_pointer_cast< AttributableShape >( pShape ) );
62
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" );
68
69 return pRes;
70 }
71
72 bool isIndefiniteTiming( const uno::Any& rAny )
73 {
74 if( !rAny.hasValue() )
75 return true;
76
77 animations::Timing eTiming;
78
79 return (rAny >>= eTiming) && eTiming == animations::Timing_INDEFINITE;
80 }
81
82}
83
84/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This interface extends AnimationNode with some file-private accessor methods.
Definition: basenode.hxx:83
virtual void showState() const
Definition: basenode.cxx:688
#define ENSURE_OR_THROW(c, m)
void debugNodesShowTree(const BaseNode *pNode)
Definition: nodetools.cxx:40
AttributableShapeSharedPtr lookupAttributableShape(const ShapeManagerSharedPtr &rShapeManager, const uno::Reference< drawing::XShape > &xShape)
Definition: nodetools.cxx:49
bool isIndefiniteTiming(const uno::Any &rAny)
Definition: nodetools.cxx:72
static sal_Int32 lcl_nOffset
Definition: nodetools.cxx:31
::std::shared_ptr< AttributableShape > AttributableShapeSharedPtr
std::shared_ptr< ShapeManager > ShapeManagerSharedPtr
Definition: box2dtools.hxx:23
::std::shared_ptr< Shape > ShapeSharedPtr
OUString debugGetNodeName(const BaseNode *pNode)
Definition: nodetools.cxx:33
bool hasValue()