2 Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
5 This file is part of the KDE project
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
23 #ifndef SVGPathElement_h
24 #define SVGPathElement_h
27 #include "SVGAnimatedPathData.h"
28 #include "SVGExternalResourcesRequired.h"
29 #include "SVGLangSpace.h"
30 #include "SVGStyledTransformableElement.h"
36 class SVGPathSegArcAbs
;
37 class SVGPathSegArcRel
;
38 class SVGPathSegClosePath
;
39 class SVGPathSegLinetoAbs
;
40 class SVGPathSegLinetoRel
;
41 class SVGPathSegMovetoAbs
;
42 class SVGPathSegMovetoRel
;
43 class SVGPathSegCurvetoCubicAbs
;
44 class SVGPathSegCurvetoCubicRel
;
45 class SVGPathSegLinetoVerticalAbs
;
46 class SVGPathSegLinetoVerticalRel
;
47 class SVGPathSegLinetoHorizontalAbs
;
48 class SVGPathSegLinetoHorizontalRel
;
49 class SVGPathSegCurvetoQuadraticAbs
;
50 class SVGPathSegCurvetoQuadraticRel
;
51 class SVGPathSegCurvetoCubicSmoothAbs
;
52 class SVGPathSegCurvetoCubicSmoothRel
;
53 class SVGPathSegCurvetoQuadraticSmoothAbs
;
54 class SVGPathSegCurvetoQuadraticSmoothRel
;
55 class SVGPathElement
: public SVGStyledTransformableElement
,
58 public SVGExternalResourcesRequired
,
59 public SVGAnimatedPathData
62 SVGPathElement(const QualifiedName
&, Document
*);
63 virtual ~SVGPathElement();
65 virtual bool isValid() const { return SVGTests::isValid(); }
66 float getTotalLength();
67 FloatPoint
getPointAtLength(float distance
);
68 unsigned long getPathSegAtLength(float distance
);
70 static PassRefPtr
<SVGPathSegClosePath
> createSVGPathSegClosePath();
71 static PassRefPtr
<SVGPathSegMovetoAbs
> createSVGPathSegMovetoAbs(float x
, float y
);
72 static PassRefPtr
<SVGPathSegMovetoRel
> createSVGPathSegMovetoRel(float x
, float y
);
73 static PassRefPtr
<SVGPathSegLinetoAbs
> createSVGPathSegLinetoAbs(float x
, float y
);
74 static PassRefPtr
<SVGPathSegLinetoRel
> createSVGPathSegLinetoRel(float x
, float y
);
75 static PassRefPtr
<SVGPathSegCurvetoCubicAbs
> createSVGPathSegCurvetoCubicAbs(float x
, float y
, float x1
, float y1
, float x2
, float y2
);
76 static PassRefPtr
<SVGPathSegCurvetoCubicRel
> createSVGPathSegCurvetoCubicRel(float x
, float y
, float x1
, float y1
, float x2
, float y2
);
77 static PassRefPtr
<SVGPathSegCurvetoQuadraticAbs
> createSVGPathSegCurvetoQuadraticAbs(float x
, float y
, float x1
, float y1
);
78 static PassRefPtr
<SVGPathSegCurvetoQuadraticRel
> createSVGPathSegCurvetoQuadraticRel(float x
, float y
, float x1
, float y1
);
79 static PassRefPtr
<SVGPathSegArcAbs
> createSVGPathSegArcAbs(float x
, float y
, float r1
, float r2
, float angle
, bool largeArcFlag
, bool sweepFlag
);
80 static PassRefPtr
<SVGPathSegArcRel
> createSVGPathSegArcRel(float x
, float y
, float r1
, float r2
, float angle
, bool largeArcFlag
, bool sweepFlag
);
81 static PassRefPtr
<SVGPathSegLinetoHorizontalAbs
> createSVGPathSegLinetoHorizontalAbs(float x
);
82 static PassRefPtr
<SVGPathSegLinetoHorizontalRel
> createSVGPathSegLinetoHorizontalRel(float x
);
83 static PassRefPtr
<SVGPathSegLinetoVerticalAbs
> createSVGPathSegLinetoVerticalAbs(float y
);
84 static PassRefPtr
<SVGPathSegLinetoVerticalRel
> createSVGPathSegLinetoVerticalRel(float y
);
85 static PassRefPtr
<SVGPathSegCurvetoCubicSmoothAbs
> createSVGPathSegCurvetoCubicSmoothAbs(float x
, float y
, float x2
, float y2
);
86 static PassRefPtr
<SVGPathSegCurvetoCubicSmoothRel
> createSVGPathSegCurvetoCubicSmoothRel(float x
, float y
, float x2
, float y2
);
87 static PassRefPtr
<SVGPathSegCurvetoQuadraticSmoothAbs
> createSVGPathSegCurvetoQuadraticSmoothAbs(float x
, float y
);
88 static PassRefPtr
<SVGPathSegCurvetoQuadraticSmoothRel
> createSVGPathSegCurvetoQuadraticSmoothRel(float x
, float y
);
90 // Derived from: 'SVGAnimatedPathData'
91 virtual SVGPathSegList
* pathSegList() const;
92 virtual SVGPathSegList
* normalizedPathSegList() const;
93 virtual SVGPathSegList
* animatedPathSegList() const;
94 virtual SVGPathSegList
* animatedNormalizedPathSegList() const;
96 virtual void parseMappedAttribute(MappedAttribute
*);
97 virtual void svgAttributeChanged(const QualifiedName
&);
99 virtual Path
toPathData() const;
101 virtual bool supportsMarkers() const { return true; }
103 // KHTML ElementImpl pure virtual method
104 virtual quint32
id() const;
105 virtual DOMString
tagName() const;
108 virtual const SVGElement
* contextElement() const { return this; }
111 mutable RefPtr
<SVGPathSegList
> m_pathSegList
;
113 ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired
, bool, ExternalResourcesRequired
, externalResourcesRequired
)
115 ANIMATED_PROPERTY_DECLARATIONS(SVGPathElement
, float, float, PathLength
, pathLength
)
118 } // namespace WebCore
120 #endif // ENABLE(SVG)