File indexing completed on 2024-04-28 15:24:27

0001 /*
0002     Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
0003                   2004, 2005 Rob Buis <buis@kde.org>
0004     Copyright (C) 2008 Apple Inc. All rights reserved.
0005 
0006     This file is part of the KDE project
0007 
0008     This library is free software; you can redistribute it and/or
0009     modify it under the terms of the GNU Library General Public
0010     License as published by the Free Software Foundation; either
0011     version 2 of the License, or (at your option) any later version.
0012 
0013     This library is distributed in the hope that it will be useful,
0014     but WITHOUT ANY WARRANTY; without even the implied warranty of
0015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016     Library General Public License for more details.
0017 
0018     You should have received a copy of the GNU Library General Public License
0019     along with this library; see the file COPYING.LIB.  If not, write to
0020     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0021     Boston, MA 02110-1301, USA.
0022 */
0023 
0024 #ifndef SVGAnimateElement_h
0025 #define SVGAnimateElement_h
0026 
0027 #if ENABLE(SVG) && ENABLE(SVG_ANIMATION)
0028 
0029 #include "SVGAnimationElement.h"
0030 
0031 namespace WebCore
0032 {
0033 
0034 class SVGAnimateElement : public SVGAnimationElement
0035 {
0036 public:
0037     SVGAnimateElement(const QualifiedName &, Document *);
0038     virtual ~SVGAnimateElement();
0039 
0040 protected:
0041     virtual const SVGElement *contextElement() const
0042     {
0043         return this;
0044     }
0045 
0046     virtual void resetToBaseValue(const String &);
0047     virtual bool calculateFromAndToValues(const String &fromString, const String &toString);
0048     virtual bool calculateFromAndByValues(const String &fromString, const String &byString);
0049     virtual void calculateAnimatedValue(float percentage, unsigned repeat, SVGSMILElement *resultElement);
0050     virtual void applyResultsToTarget();
0051     virtual float calculateDistance(const String &fromString, const String &toString);
0052 
0053 private:
0054     enum PropertyType { NumberProperty, ColorProperty, StringProperty };
0055     PropertyType determinePropertyType(const String &attribute) const;
0056     PropertyType m_propertyType;
0057 
0058     double m_fromNumber;
0059     double m_toNumber;
0060     double m_animatedNumber;
0061     String m_numberUnit;
0062     Color m_fromColor;
0063     Color m_toColor;
0064     Color m_animatedColor;
0065     String m_fromString;
0066     String m_toString;
0067     String m_animatedString;
0068 };
0069 
0070 } // namespace WebCore
0071 
0072 #endif // ENABLE(SVG)
0073 #endif // SVGAnimateElement_h
0074