Bump version to 6.0-36
[LibreOffice.git] / slideshow / source / engine / slide / slideanimations.cxx
blobf10f6633a4646cbc32fd64e149cb6d95eb40ba99
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 <tools/diagnose_ex.h>
23 #include <comphelper/anytostring.hxx>
24 #include <cppuhelper/exc_hlp.hxx>
26 #include "slideanimations.hxx"
27 #include <animationnodefactory.hxx>
29 using namespace ::com::sun::star;
31 namespace slideshow
33 namespace internal
35 SlideAnimations::SlideAnimations( const SlideShowContext& rContext,
36 const ::basegfx::B2DVector& rSlideSize ) :
37 maContext( rContext ),
38 maSlideSize( rSlideSize ),
39 mpRootNode()
41 ENSURE_OR_THROW( maContext.mpSubsettableShapeManager,
42 "SlideAnimations::SlideAnimations(): Invalid SlideShowContext" );
45 SlideAnimations::~SlideAnimations()
47 if( mpRootNode )
49 SHOW_NODE_TREE( mpRootNode );
51 try
53 mpRootNode->dispose();
55 catch (uno::Exception &)
57 SAL_WARN( "slideshow", comphelper::anyToString(cppu::getCaughtException() ) );
62 bool SlideAnimations::importAnimations( const uno::Reference< animations::XAnimationNode >& xRootAnimationNode )
64 mpRootNode = AnimationNodeFactory::createAnimationNode(
65 xRootAnimationNode,
66 maSlideSize,
67 maContext );
69 SHOW_NODE_TREE( mpRootNode );
71 return static_cast< bool >(mpRootNode);
74 bool SlideAnimations::isAnimated() const
76 if( !mpRootNode )
77 return false; // no animations there
79 // query root node about pending animations
80 return mpRootNode->hasPendingAnimation();
83 bool SlideAnimations::start()
85 if( !mpRootNode )
86 return false; // no animations there
88 // init all nodes
89 if( !mpRootNode->init() )
90 return false;
92 // resolve root node
93 if( !mpRootNode->resolve() )
94 return false;
96 return true;
99 void SlideAnimations::end()
101 if( !mpRootNode )
102 return; // no animations there
104 // end root node
105 mpRootNode->deactivate();
106 mpRootNode->end();
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */