1*aaef562fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*aaef562fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*aaef562fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*aaef562fSAndrew Rist * distributed with this work for additional information 6*aaef562fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*aaef562fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*aaef562fSAndrew Rist * "License"); you may not use this file except in compliance 9*aaef562fSAndrew Rist * with the License. You may obtain a copy of the License at 10*aaef562fSAndrew Rist * 11*aaef562fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*aaef562fSAndrew Rist * 13*aaef562fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*aaef562fSAndrew Rist * software distributed under the License is distributed on an 15*aaef562fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*aaef562fSAndrew Rist * KIND, either express or implied. See the License for the 17*aaef562fSAndrew Rist * specific language governing permissions and limitations 18*aaef562fSAndrew Rist * under the License. 19*aaef562fSAndrew Rist * 20*aaef562fSAndrew Rist *************************************************************/ 21*aaef562fSAndrew Rist 22*aaef562fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef INCLUDED_SLIDESHOW_ANIMATIONFACTORY_HXX 25cdf0e10cSrcweir #define INCLUDED_SLIDESHOW_ANIMATIONFACTORY_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include "numberanimation.hxx" 29cdf0e10cSrcweir #include "enumanimation.hxx" 30cdf0e10cSrcweir #include "coloranimation.hxx" 31cdf0e10cSrcweir #include "stringanimation.hxx" 32cdf0e10cSrcweir #include "boolanimation.hxx" 33cdf0e10cSrcweir #include "pairanimation.hxx" 34cdf0e10cSrcweir 35cdf0e10cSrcweir #include "shape.hxx" 36cdf0e10cSrcweir #include "shapeattributelayer.hxx" 37cdf0e10cSrcweir #include "shapemanager.hxx" 38cdf0e10cSrcweir 39cdf0e10cSrcweir #include <boost/noncopyable.hpp> 40cdf0e10cSrcweir 41cdf0e10cSrcweir 42cdf0e10cSrcweir namespace rtl 43cdf0e10cSrcweir { 44cdf0e10cSrcweir class OUString; 45cdf0e10cSrcweir } 46cdf0e10cSrcweir 47cdf0e10cSrcweir 48cdf0e10cSrcweir /* Definition of AnimationFactory class */ 49cdf0e10cSrcweir 50cdf0e10cSrcweir namespace slideshow 51cdf0e10cSrcweir { 52cdf0e10cSrcweir namespace internal 53cdf0e10cSrcweir { 54cdf0e10cSrcweir 55cdf0e10cSrcweir /** Factory for Animation objects 56cdf0e10cSrcweir 57cdf0e10cSrcweir Given a SMIL XAnimate node, this factory generates the 58cdf0e10cSrcweir appropriate Animation object from that, which will modify 59cdf0e10cSrcweir the attribute as specified. 60cdf0e10cSrcweir */ 61cdf0e10cSrcweir class AnimationFactory : private boost::noncopyable 62cdf0e10cSrcweir { 63cdf0e10cSrcweir public: 64cdf0e10cSrcweir /** Classifies the attribute name. 65cdf0e10cSrcweir 66cdf0e10cSrcweir This enum maps names to appropriate factory methods. 67cdf0e10cSrcweir */ 68cdf0e10cSrcweir enum AttributeClass 69cdf0e10cSrcweir { 70cdf0e10cSrcweir /// Unknown, prolly invalid name 71cdf0e10cSrcweir CLASS_UNKNOWN_PROPERTY, 72cdf0e10cSrcweir /// Use createNumberPropertyAnimation 73cdf0e10cSrcweir CLASS_NUMBER_PROPERTY, 74cdf0e10cSrcweir /// Use createEnumPropertyAnimation 75cdf0e10cSrcweir CLASS_ENUM_PROPERTY, 76cdf0e10cSrcweir /// Use createColorPropertyAnimation 77cdf0e10cSrcweir CLASS_COLOR_PROPERTY, 78cdf0e10cSrcweir /// Use createStringPropertyAnimation 79cdf0e10cSrcweir CLASS_STRING_PROPERTY, 80cdf0e10cSrcweir /// Use createBoolPropertyAnimation 81cdf0e10cSrcweir CLASS_BOOL_PROPERTY 82cdf0e10cSrcweir }; 83cdf0e10cSrcweir 84cdf0e10cSrcweir static AttributeClass classifyAttributeName( const ::rtl::OUString& rAttrName ); 85cdf0e10cSrcweir 86cdf0e10cSrcweir /// Collection of flags common to all factory methods 87cdf0e10cSrcweir enum FactoryFlags 88cdf0e10cSrcweir { 89cdf0e10cSrcweir /** Don't call enter/leaveAnimation for the Shape. 90cdf0e10cSrcweir 91cdf0e10cSrcweir This is useful for set effects 92cdf0e10cSrcweir */ 93cdf0e10cSrcweir FLAG_NO_SPRITE = 1 94cdf0e10cSrcweir }; 95cdf0e10cSrcweir 96cdf0e10cSrcweir static NumberAnimationSharedPtr createNumberPropertyAnimation( const ::rtl::OUString& rAttrName, 97cdf0e10cSrcweir const AnimatableShapeSharedPtr& rShape, 98cdf0e10cSrcweir const ShapeManagerSharedPtr& rShapeManager, 99cdf0e10cSrcweir const ::basegfx::B2DVector& rSlideSize, 100cdf0e10cSrcweir int nFlags=0 ); 101cdf0e10cSrcweir 102cdf0e10cSrcweir static EnumAnimationSharedPtr createEnumPropertyAnimation( const ::rtl::OUString& rAttrName, 103cdf0e10cSrcweir const AnimatableShapeSharedPtr& rShape, 104cdf0e10cSrcweir const ShapeManagerSharedPtr& rShapeManager, 105cdf0e10cSrcweir const ::basegfx::B2DVector& rSlideSize, 106cdf0e10cSrcweir int nFlags=0 ); 107cdf0e10cSrcweir 108cdf0e10cSrcweir static ColorAnimationSharedPtr createColorPropertyAnimation( const ::rtl::OUString& rAttrName, 109cdf0e10cSrcweir const AnimatableShapeSharedPtr& rShape, 110cdf0e10cSrcweir const ShapeManagerSharedPtr& rShapeManager, 111cdf0e10cSrcweir const ::basegfx::B2DVector& rSlideSize, 112cdf0e10cSrcweir int nFlags=0 ); 113cdf0e10cSrcweir 114cdf0e10cSrcweir /** Create scale or move animation 115cdf0e10cSrcweir 116cdf0e10cSrcweir @param nTransformType 117cdf0e10cSrcweir Must be one of 118cdf0e10cSrcweir animations::AnimationTransformType::TRANSLATE or 119cdf0e10cSrcweir animations::AnimationTransformType::SCALE. 120cdf0e10cSrcweir */ 121cdf0e10cSrcweir static PairAnimationSharedPtr createPairPropertyAnimation( const AnimatableShapeSharedPtr& rShape, 122cdf0e10cSrcweir const ShapeManagerSharedPtr& rShapeManager, 123cdf0e10cSrcweir const ::basegfx::B2DVector& rSlideSize, 124cdf0e10cSrcweir sal_Int16 nTransformType, 125cdf0e10cSrcweir int nFlags=0 ); 126cdf0e10cSrcweir 127cdf0e10cSrcweir static StringAnimationSharedPtr createStringPropertyAnimation( const ::rtl::OUString& rAttrName, 128cdf0e10cSrcweir const AnimatableShapeSharedPtr& rShape, 129cdf0e10cSrcweir const ShapeManagerSharedPtr& rShapeManager, 130cdf0e10cSrcweir const ::basegfx::B2DVector& rSlideSize, 131cdf0e10cSrcweir int nFlags=0 ); 132cdf0e10cSrcweir 133cdf0e10cSrcweir static BoolAnimationSharedPtr createBoolPropertyAnimation( const ::rtl::OUString& rAttrName, 134cdf0e10cSrcweir const AnimatableShapeSharedPtr& rShape, 135cdf0e10cSrcweir const ShapeManagerSharedPtr& rShapeManager, 136cdf0e10cSrcweir const ::basegfx::B2DVector& rSlideSize, 137cdf0e10cSrcweir int nFlags=0 ); 138cdf0e10cSrcweir 139cdf0e10cSrcweir static NumberAnimationSharedPtr createPathMotionAnimation( const ::rtl::OUString& rSVGDPath, 140cdf0e10cSrcweir sal_Int16 nAdditive, 141cdf0e10cSrcweir const AnimatableShapeSharedPtr& rShape, 142cdf0e10cSrcweir const ShapeManagerSharedPtr& rShapeManager, 143cdf0e10cSrcweir const ::basegfx::B2DVector& rSlideSize, 144cdf0e10cSrcweir int nFlags=0); 145cdf0e10cSrcweir private: 146cdf0e10cSrcweir // default: constructor/destructor disabed 147cdf0e10cSrcweir AnimationFactory(); 148cdf0e10cSrcweir ~AnimationFactory(); 149cdf0e10cSrcweir }; 150cdf0e10cSrcweir } 151cdf0e10cSrcweir } 152cdf0e10cSrcweir 153cdf0e10cSrcweir #endif /* INCLUDED_SLIDESHOW_ANIMATIONFACTORY_HXX */ 154