Update git submodules
[LibreOffice.git] / slideshow / source / engine / animationnodes / propertyanimationnode.cxx
blob3e7d68b4beb71d0922a96a932811458de02697e9
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 "propertyanimationnode.hxx"
22 #include <animationfactory.hxx>
24 using namespace com::sun::star;
26 namespace slideshow::internal {
28 AnimationActivitySharedPtr PropertyAnimationNode::createActivity() const
30 // Create AnimationActivity from common XAnimate parameters:
31 ActivitiesFactory::CommonParameters aParms( fillCommonParameters() );
32 uno::Reference<animations::XAnimate> const& xAnimateNode =getXAnimateNode();
33 OUString const attrName( xAnimateNode->getAttributeName() );
34 AttributableShapeSharedPtr const pShape( getShape() );
36 switch (AnimationFactory::classifyAttributeName( attrName )) {
37 default:
38 case AnimationFactory::CLASS_UNKNOWN_PROPERTY:
39 ENSURE_OR_THROW(
40 false,
41 "Unexpected attribute class (unknown or empty attribute name)" );
42 break;
44 case AnimationFactory::CLASS_NUMBER_PROPERTY:
45 return ActivitiesFactory::createAnimateActivity(
46 aParms,
47 AnimationFactory::createNumberPropertyAnimation(
48 attrName,
49 pShape,
50 getContext().mpSubsettableShapeManager,
51 getSlideSize(),
52 getContext().mpBox2DWorld ),
53 xAnimateNode );
55 case AnimationFactory::CLASS_ENUM_PROPERTY:
56 return ActivitiesFactory::createAnimateActivity(
57 aParms,
58 AnimationFactory::createEnumPropertyAnimation(
59 attrName,
60 pShape,
61 getContext().mpSubsettableShapeManager,
62 getSlideSize(),
63 getContext().mpBox2DWorld, 0 ),
64 xAnimateNode );
66 case AnimationFactory::CLASS_COLOR_PROPERTY:
67 return ActivitiesFactory::createAnimateActivity(
68 aParms,
69 AnimationFactory::createColorPropertyAnimation(
70 attrName,
71 pShape,
72 getContext().mpSubsettableShapeManager,
73 getSlideSize(),
74 getContext().mpBox2DWorld ),
75 xAnimateNode );
77 case AnimationFactory::CLASS_STRING_PROPERTY:
78 return ActivitiesFactory::createAnimateActivity(
79 aParms,
80 AnimationFactory::createStringPropertyAnimation(
81 attrName,
82 pShape,
83 getContext().mpSubsettableShapeManager,
84 getSlideSize(),
85 getContext().mpBox2DWorld, 0 ),
86 xAnimateNode );
88 case AnimationFactory::CLASS_BOOL_PROPERTY:
89 return ActivitiesFactory::createAnimateActivity(
90 aParms,
91 AnimationFactory::createBoolPropertyAnimation(
92 attrName,
93 pShape,
94 getContext().mpSubsettableShapeManager,
95 getSlideSize(),
96 getContext().mpBox2DWorld, 0 ),
97 xAnimateNode );
100 return AnimationActivitySharedPtr();
103 } // namespace slideshow::internal
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */