1/*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
4 *
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.
9 *
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.
14 *
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.
19 */
20
21#ifndef SVGMarkerElement_h
22#define SVGMarkerElement_h
23
24#if ENABLE(SVG)
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"
35
36namespace WebCore {
37
38class SVGMarkerElement : public SVGStyledElement,
39                         public SVGLangSpace,
40                         public SVGExternalResourcesRequired,
41                         public SVGFitToViewBox {
42public:
43    enum SVGMarkerUnitsType {
44        SVG_MARKERUNITS_UNKNOWN           = 0,
45        SVG_MARKERUNITS_USERSPACEONUSE    = 1,
46        SVG_MARKERUNITS_STROKEWIDTH       = 2
47    };
48
49    enum SVGMarkerOrientType {
50        SVG_MARKER_ORIENT_UNKNOWN    = 0,
51        SVG_MARKER_ORIENT_AUTO       = 1,
52        SVG_MARKER_ORIENT_ANGLE      = 2
53    };
54
55    static PassRefPtr<SVGMarkerElement> create(const QualifiedName&, Document*);
56
57    AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const;
58
59    void setOrientToAuto();
60    void setOrientToAngle(const SVGAngle&);
61
62private:
63    SVGMarkerElement(const QualifiedName&, Document*);
64
65    virtual bool needsPendingResourceHandling() const { return false; }
66
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);
73
74    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
75
76    virtual bool selfHasRelativeLengths() const;
77
78    static const AtomicString& orientTypeIdentifier();
79    static const AtomicString& orientAngleIdentifier();
80
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)
89
90    // SVGExternalResourcesRequired
91    DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired)
92
93    // SVGFitToViewBox
94    DECLARE_ANIMATED_RECT(ViewBox, viewBox)
95    DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio)
96};
97
98}
99
100#endif
101#endif
102