File indexing completed on 2024-04-28 11:39:16

0001 /*
0002     Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
0003                   2004, 2005, 2006 Rob Buis <buis@kde.org>
0004 
0005     This file is part of the KDE project
0006 
0007     This library is free software; you can redistribute it and/or
0008     modify it under the terms of the GNU Library General Public
0009     License as published by the Free Software Foundation; either
0010     version 2 of the License, or (at your option) any later version.
0011 
0012     This library is distributed in the hope that it will be useful,
0013     but WITHOUT ANY WARRANTY; without even the implied warranty of
0014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015     Library General Public License for more details.
0016 
0017     You should have received a copy of the GNU Library General Public License
0018     along with this library; see the file COPYING.LIB.  If not, write to
0019     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0020     Boston, MA 02110-1301, USA.
0021 */
0022 
0023 #ifndef SVGMarkerElement_h
0024 #define SVGMarkerElement_h
0025 
0026 #if ENABLE(SVG)
0027 #include "SVGResourceMarker.h"
0028 #include "SVGExternalResourcesRequired.h"
0029 #include "SVGFitToViewBox.h"
0030 #include "SVGLangSpace.h"
0031 #include "SVGStyledElement.h"
0032 
0033 namespace WebCore
0034 {
0035 
0036 class Document;
0037 class SVGAngle;
0038 
0039 class SVGMarkerElement : public SVGStyledElement,
0040     public SVGLangSpace,
0041     public SVGExternalResourcesRequired,
0042     public SVGFitToViewBox
0043 {
0044 public:
0045     enum SVGMarkerUnitsType {
0046         SVG_MARKERUNITS_UNKNOWN           = 0,
0047         SVG_MARKERUNITS_USERSPACEONUSE    = 1,
0048         SVG_MARKERUNITS_STROKEWIDTH       = 2
0049     };
0050 
0051     enum SVGMarkerOrientType {
0052         SVG_MARKER_ORIENT_UNKNOWN    = 0,
0053         SVG_MARKER_ORIENT_AUTO       = 1,
0054         SVG_MARKER_ORIENT_ANGLE      = 2
0055     };
0056 
0057     SVGMarkerElement(const QualifiedName &, Document *);
0058     virtual ~SVGMarkerElement();
0059 
0060     void setOrientToAuto();
0061     void setOrientToAngle(SVGAngle *);
0062 
0063     virtual void parseMappedAttribute(MappedAttribute *);
0064     virtual void svgAttributeChanged(const QualifiedName &);
0065     virtual void childrenChanged(bool changedByParser = false, Node *beforeChange = 0, Node *afterChange = 0, int childCountDelta = 0);
0066 
0067     virtual RenderObject *createRenderer(RenderArena *, RenderStyle *);
0068     virtual SVGResource *canvasResource();
0069 
0070 protected:
0071     virtual const SVGElement *contextElement() const
0072     {
0073         return this;
0074     }
0075 
0076 private:
0077     ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
0078     ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGFitToViewBox, FloatRect, ViewBox, viewBox)
0079     ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGFitToViewBox, SVGPreserveAspectRatio *, PreserveAspectRatio, preserveAspectRatio)
0080 
0081     ANIMATED_PROPERTY_DECLARATIONS(SVGMarkerElement, SVGLength, SVGLength, RefX, refX)
0082     ANIMATED_PROPERTY_DECLARATIONS(SVGMarkerElement, SVGLength, SVGLength, RefY, refY)
0083     ANIMATED_PROPERTY_DECLARATIONS(SVGMarkerElement, SVGLength, SVGLength, MarkerWidth, markerWidth)
0084     ANIMATED_PROPERTY_DECLARATIONS(SVGMarkerElement, SVGLength, SVGLength, MarkerHeight, markerHeight)
0085     ANIMATED_PROPERTY_DECLARATIONS(SVGMarkerElement, int, int, MarkerUnits, markerUnits)
0086     ANIMATED_PROPERTY_DECLARATIONS(SVGMarkerElement, int, int, OrientType, orientType)
0087     ANIMATED_PROPERTY_DECLARATIONS(SVGMarkerElement, SVGAngle *, RefPtr<SVGAngle>, OrientAngle, orientAngle)
0088 
0089     RefPtr<SVGResourceMarker> m_marker;
0090 };
0091 
0092 } // namespace WebCore
0093 
0094 #endif // ENABLE(SVG)
0095 #endif