tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / slideshow / source / engine / slide / slideanimations.cxx
blob224256c43379333070c738b2bdd44e2c2342e96b
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 <comphelper/diagnose_ex.hxx>
23 #include "slideanimations.hxx"
24 #include <animationnodefactory.hxx>
25 #include <utility>
27 using namespace ::com::sun::star;
29 namespace slideshow::internal
31 SlideAnimations::SlideAnimations( SlideShowContext aContext,
32 const ::basegfx::B2DVector& rSlideSize ) :
33 maContext(std::move( aContext )),
34 maSlideSize( rSlideSize ),
35 mpRootNode()
37 ENSURE_OR_THROW( maContext.mpSubsettableShapeManager,
38 "SlideAnimations::SlideAnimations(): Invalid SlideShowContext" );
41 SlideAnimations::~SlideAnimations() COVERITY_NOEXCEPT_FALSE
43 if( !mpRootNode )
44 return;
46 SHOW_NODE_TREE( mpRootNode );
48 try
50 mpRootNode->dispose();
52 catch (uno::Exception &)
54 TOOLS_WARN_EXCEPTION( "slideshow", "" );
58 bool SlideAnimations::importAnimations( const uno::Reference< animations::XAnimationNode >& xRootAnimationNode )
60 mpRootNode = AnimationNodeFactory::createAnimationNode(
61 xRootAnimationNode,
62 maSlideSize,
63 maContext );
65 SHOW_NODE_TREE( mpRootNode );
67 return static_cast< bool >(mpRootNode);
70 bool SlideAnimations::isAnimated() const
72 if( !mpRootNode )
73 return false; // no animations there
75 // query root node about pending animations
76 return mpRootNode->hasPendingAnimation();
79 bool SlideAnimations::start()
81 if( !mpRootNode )
82 return false; // no animations there
84 // init all nodes
85 if( !mpRootNode->init() )
86 return false;
88 // resolve root node
89 if( !mpRootNode->resolve() )
90 return false;
92 return true;
95 void SlideAnimations::end()
97 if( !mpRootNode )
98 return; // no animations there
100 // end root node
101 mpRootNode->deactivate();
102 mpRootNode->end();
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */