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 <tools/diagnose_ex.h>
24 : #include <tools/diagnose_ex.h>
25 :
26 : #include <comphelper/anytostring.hxx>
27 : #include <cppuhelper/exc_hlp.hxx>
28 :
29 : #include "slideanimations.hxx"
30 : #include "animationnodefactory.hxx"
31 :
32 : using namespace ::com::sun::star;
33 :
34 : namespace slideshow
35 : {
36 : namespace internal
37 : {
38 0 : SlideAnimations::SlideAnimations( const SlideShowContext& rContext,
39 : const ::basegfx::B2DVector& rSlideSize ) :
40 : maContext( rContext ),
41 : maSlideSize( rSlideSize ),
42 0 : mpRootNode()
43 : {
44 0 : ENSURE_OR_THROW( maContext.mpSubsettableShapeManager,
45 : "SlideAnimations::SlideAnimations(): Invalid SlideShowContext" );
46 0 : }
47 :
48 0 : SlideAnimations::~SlideAnimations()
49 : {
50 0 : if( mpRootNode )
51 : {
52 : SHOW_NODE_TREE( mpRootNode );
53 :
54 : try
55 : {
56 0 : mpRootNode->dispose();
57 : }
58 0 : catch (uno::Exception &)
59 : {
60 : OSL_FAIL( rtl::OUStringToOString(
61 : comphelper::anyToString(
62 : cppu::getCaughtException() ),
63 : RTL_TEXTENCODING_UTF8 ).getStr() );
64 : }
65 : }
66 0 : }
67 :
68 0 : bool SlideAnimations::importAnimations( const uno::Reference< animations::XAnimationNode >& xRootAnimationNode )
69 : {
70 : mpRootNode = AnimationNodeFactory::createAnimationNode(
71 : xRootAnimationNode,
72 : maSlideSize,
73 0 : maContext );
74 :
75 : SHOW_NODE_TREE( mpRootNode );
76 :
77 0 : return mpRootNode;
78 : }
79 :
80 0 : bool SlideAnimations::isAnimated() const
81 : {
82 0 : if( !mpRootNode )
83 0 : return false; // no animations there
84 :
85 : // query root node about pending animations
86 0 : return mpRootNode->hasPendingAnimation();
87 : }
88 :
89 0 : bool SlideAnimations::start()
90 : {
91 0 : if( !mpRootNode )
92 0 : return false; // no animations there
93 :
94 : // init all nodes
95 0 : if( !mpRootNode->init() )
96 0 : return false;
97 :
98 : // resolve root node
99 0 : if( !mpRootNode->resolve() )
100 0 : return false;
101 :
102 0 : return true;
103 : }
104 :
105 0 : void SlideAnimations::end()
106 : {
107 0 : if( !mpRootNode )
108 0 : return; // no animations there
109 :
110 : // end root node
111 0 : mpRootNode->deactivate();
112 0 : mpRootNode->end();
113 : }
114 :
115 0 : void SlideAnimations::dispose()
116 : {
117 0 : mpRootNode.reset();
118 0 : maContext.dispose();
119 0 : }
120 : }
121 : }
122 :
123 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|