1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef INCLUDED_SLIDESHOW_ANIMATIONFACTORY_HXX 29*cdf0e10cSrcweir #define INCLUDED_SLIDESHOW_ANIMATIONFACTORY_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir #include "numberanimation.hxx" 33*cdf0e10cSrcweir #include "enumanimation.hxx" 34*cdf0e10cSrcweir #include "coloranimation.hxx" 35*cdf0e10cSrcweir #include "stringanimation.hxx" 36*cdf0e10cSrcweir #include "boolanimation.hxx" 37*cdf0e10cSrcweir #include "pairanimation.hxx" 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir #include "shape.hxx" 40*cdf0e10cSrcweir #include "shapeattributelayer.hxx" 41*cdf0e10cSrcweir #include "shapemanager.hxx" 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir #include <boost/noncopyable.hpp> 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir namespace rtl 47*cdf0e10cSrcweir { 48*cdf0e10cSrcweir class OUString; 49*cdf0e10cSrcweir } 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir /* Definition of AnimationFactory class */ 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir namespace slideshow 55*cdf0e10cSrcweir { 56*cdf0e10cSrcweir namespace internal 57*cdf0e10cSrcweir { 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir /** Factory for Animation objects 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir Given a SMIL XAnimate node, this factory generates the 62*cdf0e10cSrcweir appropriate Animation object from that, which will modify 63*cdf0e10cSrcweir the attribute as specified. 64*cdf0e10cSrcweir */ 65*cdf0e10cSrcweir class AnimationFactory : private boost::noncopyable 66*cdf0e10cSrcweir { 67*cdf0e10cSrcweir public: 68*cdf0e10cSrcweir /** Classifies the attribute name. 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir This enum maps names to appropriate factory methods. 71*cdf0e10cSrcweir */ 72*cdf0e10cSrcweir enum AttributeClass 73*cdf0e10cSrcweir { 74*cdf0e10cSrcweir /// Unknown, prolly invalid name 75*cdf0e10cSrcweir CLASS_UNKNOWN_PROPERTY, 76*cdf0e10cSrcweir /// Use createNumberPropertyAnimation 77*cdf0e10cSrcweir CLASS_NUMBER_PROPERTY, 78*cdf0e10cSrcweir /// Use createEnumPropertyAnimation 79*cdf0e10cSrcweir CLASS_ENUM_PROPERTY, 80*cdf0e10cSrcweir /// Use createColorPropertyAnimation 81*cdf0e10cSrcweir CLASS_COLOR_PROPERTY, 82*cdf0e10cSrcweir /// Use createStringPropertyAnimation 83*cdf0e10cSrcweir CLASS_STRING_PROPERTY, 84*cdf0e10cSrcweir /// Use createBoolPropertyAnimation 85*cdf0e10cSrcweir CLASS_BOOL_PROPERTY 86*cdf0e10cSrcweir }; 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir static AttributeClass classifyAttributeName( const ::rtl::OUString& rAttrName ); 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir /// Collection of flags common to all factory methods 91*cdf0e10cSrcweir enum FactoryFlags 92*cdf0e10cSrcweir { 93*cdf0e10cSrcweir /** Don't call enter/leaveAnimation for the Shape. 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir This is useful for set effects 96*cdf0e10cSrcweir */ 97*cdf0e10cSrcweir FLAG_NO_SPRITE = 1 98*cdf0e10cSrcweir }; 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir static NumberAnimationSharedPtr createNumberPropertyAnimation( const ::rtl::OUString& rAttrName, 101*cdf0e10cSrcweir const AnimatableShapeSharedPtr& rShape, 102*cdf0e10cSrcweir const ShapeManagerSharedPtr& rShapeManager, 103*cdf0e10cSrcweir const ::basegfx::B2DVector& rSlideSize, 104*cdf0e10cSrcweir int nFlags=0 ); 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir static EnumAnimationSharedPtr createEnumPropertyAnimation( const ::rtl::OUString& rAttrName, 107*cdf0e10cSrcweir const AnimatableShapeSharedPtr& rShape, 108*cdf0e10cSrcweir const ShapeManagerSharedPtr& rShapeManager, 109*cdf0e10cSrcweir const ::basegfx::B2DVector& rSlideSize, 110*cdf0e10cSrcweir int nFlags=0 ); 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir static ColorAnimationSharedPtr createColorPropertyAnimation( const ::rtl::OUString& rAttrName, 113*cdf0e10cSrcweir const AnimatableShapeSharedPtr& rShape, 114*cdf0e10cSrcweir const ShapeManagerSharedPtr& rShapeManager, 115*cdf0e10cSrcweir const ::basegfx::B2DVector& rSlideSize, 116*cdf0e10cSrcweir int nFlags=0 ); 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir /** Create scale or move animation 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir @param nTransformType 121*cdf0e10cSrcweir Must be one of 122*cdf0e10cSrcweir animations::AnimationTransformType::TRANSLATE or 123*cdf0e10cSrcweir animations::AnimationTransformType::SCALE. 124*cdf0e10cSrcweir */ 125*cdf0e10cSrcweir static PairAnimationSharedPtr createPairPropertyAnimation( const AnimatableShapeSharedPtr& rShape, 126*cdf0e10cSrcweir const ShapeManagerSharedPtr& rShapeManager, 127*cdf0e10cSrcweir const ::basegfx::B2DVector& rSlideSize, 128*cdf0e10cSrcweir sal_Int16 nTransformType, 129*cdf0e10cSrcweir int nFlags=0 ); 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir static StringAnimationSharedPtr createStringPropertyAnimation( const ::rtl::OUString& rAttrName, 132*cdf0e10cSrcweir const AnimatableShapeSharedPtr& rShape, 133*cdf0e10cSrcweir const ShapeManagerSharedPtr& rShapeManager, 134*cdf0e10cSrcweir const ::basegfx::B2DVector& rSlideSize, 135*cdf0e10cSrcweir int nFlags=0 ); 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir static BoolAnimationSharedPtr createBoolPropertyAnimation( const ::rtl::OUString& rAttrName, 138*cdf0e10cSrcweir const AnimatableShapeSharedPtr& rShape, 139*cdf0e10cSrcweir const ShapeManagerSharedPtr& rShapeManager, 140*cdf0e10cSrcweir const ::basegfx::B2DVector& rSlideSize, 141*cdf0e10cSrcweir int nFlags=0 ); 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir static NumberAnimationSharedPtr createPathMotionAnimation( const ::rtl::OUString& rSVGDPath, 144*cdf0e10cSrcweir sal_Int16 nAdditive, 145*cdf0e10cSrcweir const AnimatableShapeSharedPtr& rShape, 146*cdf0e10cSrcweir const ShapeManagerSharedPtr& rShapeManager, 147*cdf0e10cSrcweir const ::basegfx::B2DVector& rSlideSize, 148*cdf0e10cSrcweir int nFlags=0); 149*cdf0e10cSrcweir private: 150*cdf0e10cSrcweir // default: constructor/destructor disabed 151*cdf0e10cSrcweir AnimationFactory(); 152*cdf0e10cSrcweir ~AnimationFactory(); 153*cdf0e10cSrcweir }; 154*cdf0e10cSrcweir } 155*cdf0e10cSrcweir } 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir #endif /* INCLUDED_SLIDESHOW_ANIMATIONFACTORY_HXX */ 158