Bump version to 4.1-6
[LibreOffice.git] / slideshow / source / inc / animationfactory.hxx
blob513e6651dd87497bcca004ee6d58b1427a7e59b5
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 .
20 #ifndef INCLUDED_SLIDESHOW_ANIMATIONFACTORY_HXX
21 #define INCLUDED_SLIDESHOW_ANIMATIONFACTORY_HXX
24 #include "numberanimation.hxx"
25 #include "enumanimation.hxx"
26 #include "coloranimation.hxx"
27 #include "stringanimation.hxx"
28 #include "boolanimation.hxx"
29 #include "pairanimation.hxx"
31 #include "shape.hxx"
32 #include "shapeattributelayer.hxx"
33 #include "shapemanager.hxx"
35 #include <boost/noncopyable.hpp>
40 /* Definition of AnimationFactory class */
42 namespace slideshow
44 namespace internal
47 /** Factory for Animation objects
49 Given a SMIL XAnimate node, this factory generates the
50 appropriate Animation object from that, which will modify
51 the attribute as specified.
53 class AnimationFactory : private boost::noncopyable
55 public:
56 /** Classifies the attribute name.
58 This enum maps names to appropriate factory methods.
60 enum AttributeClass
62 /// Unknown, prolly invalid name
63 CLASS_UNKNOWN_PROPERTY,
64 /// Use createNumberPropertyAnimation
65 CLASS_NUMBER_PROPERTY,
66 /// Use createEnumPropertyAnimation
67 CLASS_ENUM_PROPERTY,
68 /// Use createColorPropertyAnimation
69 CLASS_COLOR_PROPERTY,
70 /// Use createStringPropertyAnimation
71 CLASS_STRING_PROPERTY,
72 /// Use createBoolPropertyAnimation
73 CLASS_BOOL_PROPERTY
76 static AttributeClass classifyAttributeName( const OUString& rAttrName );
78 /// Collection of flags common to all factory methods
79 enum FactoryFlags
81 /** Don't call enter/leaveAnimation for the Shape.
83 This is useful for set effects
85 FLAG_NO_SPRITE = 1
88 static NumberAnimationSharedPtr createNumberPropertyAnimation( const OUString& rAttrName,
89 const AnimatableShapeSharedPtr& rShape,
90 const ShapeManagerSharedPtr& rShapeManager,
91 const ::basegfx::B2DVector& rSlideSize,
92 int nFlags=0 );
94 static EnumAnimationSharedPtr createEnumPropertyAnimation( const OUString& rAttrName,
95 const AnimatableShapeSharedPtr& rShape,
96 const ShapeManagerSharedPtr& rShapeManager,
97 const ::basegfx::B2DVector& rSlideSize,
98 int nFlags=0 );
100 static ColorAnimationSharedPtr createColorPropertyAnimation( const OUString& rAttrName,
101 const AnimatableShapeSharedPtr& rShape,
102 const ShapeManagerSharedPtr& rShapeManager,
103 const ::basegfx::B2DVector& rSlideSize,
104 int nFlags=0 );
106 /** Create scale or move animation
108 @param nTransformType
109 Must be one of
110 animations::AnimationTransformType::TRANSLATE or
111 animations::AnimationTransformType::SCALE.
113 static PairAnimationSharedPtr createPairPropertyAnimation( const AnimatableShapeSharedPtr& rShape,
114 const ShapeManagerSharedPtr& rShapeManager,
115 const ::basegfx::B2DVector& rSlideSize,
116 sal_Int16 nTransformType,
117 int nFlags=0 );
119 static StringAnimationSharedPtr createStringPropertyAnimation( const OUString& rAttrName,
120 const AnimatableShapeSharedPtr& rShape,
121 const ShapeManagerSharedPtr& rShapeManager,
122 const ::basegfx::B2DVector& rSlideSize,
123 int nFlags=0 );
125 static BoolAnimationSharedPtr createBoolPropertyAnimation( const OUString& rAttrName,
126 const AnimatableShapeSharedPtr& rShape,
127 const ShapeManagerSharedPtr& rShapeManager,
128 const ::basegfx::B2DVector& rSlideSize,
129 int nFlags=0 );
131 static NumberAnimationSharedPtr createPathMotionAnimation( const OUString& rSVGDPath,
132 sal_Int16 nAdditive,
133 const AnimatableShapeSharedPtr& rShape,
134 const ShapeManagerSharedPtr& rShapeManager,
135 const ::basegfx::B2DVector& rSlideSize,
136 int nFlags=0);
137 private:
138 // default: constructor/destructor disabed
139 AnimationFactory();
140 ~AnimationFactory();
145 #endif /* INCLUDED_SLIDESHOW_ANIMATIONFACTORY_HXX */
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */