2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
21 #ifndef SVGMarkerElement_h
22 #define SVGMarkerElement_h
25 #include "SVGAnimatedAngle.h"
26 #include "SVGAnimatedBoolean.h"
27 #include "SVGAnimatedEnumeration.h"
28 #include "SVGAnimatedLength.h"
29 #include "SVGAnimatedPreserveAspectRatio.h"
30 #include "SVGAnimatedRect.h"
31 #include "SVGExternalResourcesRequired.h"
32 #include "SVGFitToViewBox.h"
33 #include "SVGLangSpace.h"
34 #include "SVGStyledElement.h"
38 class SVGMarkerElement : public SVGStyledElement,
40 public SVGExternalResourcesRequired,
41 public SVGFitToViewBox {
43 enum SVGMarkerUnitsType {
44 SVG_MARKERUNITS_UNKNOWN = 0,
45 SVG_MARKERUNITS_USERSPACEONUSE = 1,
46 SVG_MARKERUNITS_STROKEWIDTH = 2
49 enum SVGMarkerOrientType {
50 SVG_MARKER_ORIENT_UNKNOWN = 0,
51 SVG_MARKER_ORIENT_AUTO = 1,
52 SVG_MARKER_ORIENT_ANGLE = 2
55 static PassRefPtr<SVGMarkerElement> create(const QualifiedName&, Document*);
57 AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const;
59 void setOrientToAuto();
60 void setOrientToAngle(const SVGAngle&);
63 SVGMarkerElement(const QualifiedName&, Document*);
65 virtual bool needsPendingResourceHandling() const { return false; }
67 virtual void parseMappedAttribute(Attribute*);
68 virtual void svgAttributeChanged(const QualifiedName&);
69 virtual void synchronizeProperty(const QualifiedName&);
70 virtual void fillAttributeToPropertyTypeMap();
71 virtual AttributeToPropertyTypeMap& attributeToPropertyTypeMap();
72 virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
74 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
76 virtual bool selfHasRelativeLengths() const;
78 static const AtomicString& orientTypeIdentifier();
79 static const AtomicString& orientAngleIdentifier();
81 // Animated property declarations
82 DECLARE_ANIMATED_LENGTH(RefX, refX)
83 DECLARE_ANIMATED_LENGTH(RefY, refY)
84 DECLARE_ANIMATED_LENGTH(MarkerWidth, markerWidth)
85 DECLARE_ANIMATED_LENGTH(MarkerHeight, markerHeight)
86 DECLARE_ANIMATED_ENUMERATION(MarkerUnits, markerUnits)
87 DECLARE_ANIMATED_ENUMERATION(OrientType, orientType)
88 DECLARE_ANIMATED_ANGLE(OrientAngle, orientAngle)
90 // SVGExternalResourcesRequired
91 DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired)
94 DECLARE_ANIMATED_RECT(ViewBox, viewBox)
95 DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio)