KHtml

SVGCursorElement.cpp
1 /*
2  Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <[email protected]>
3  2004, 2005, 2006, 2007 Rob Buis <[email protected]>
4 
5  This file is part of the KDE project
6 
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.
11 
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.
16 
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.
21 */
22 
23 #if ENABLE(SVG)
24 #include "SVGCursorElement.h"
25 
26 #include "Attr.h"
27 #include "SVGNames.h"
28 
29 namespace WebCore
30 {
31 
32 SVGCursorElement::SVGCursorElement(const QualifiedName &tagName, Document *doc)
33  : SVGElement(tagName, doc)
34  , SVGTests()
35  , SVGExternalResourcesRequired()
36  , SVGURIReference()
37  , m_x(0, LengthModeWidth)
38  , m_y(0, LengthModeHeight)
39 {
40 }
41 
42 SVGCursorElement::~SVGCursorElement()
43 {
44 }
45 
46 ANIMATED_PROPERTY_DEFINITIONS(SVGCursorElement, SVGLength, Length, length, X, x, SVGNames::xAttr, m_x)
47 ANIMATED_PROPERTY_DEFINITIONS(SVGCursorElement, SVGLength, Length, length, Y, y, SVGNames::yAttr, m_y)
48 
49 void SVGCursorElement::parseMappedAttribute(MappedAttribute *attr)
50 {
51  if (attr->name() == SVGNames::xAttr) {
52  setXBaseValue(SVGLength(0, LengthModeWidth, attr->value()));
53  } else if (attr->name() == SVGNames::yAttr) {
54  setYBaseValue(SVGLength(0, LengthModeHeight, attr->value()));
55  } else {
56  if (SVGTests::parseMappedAttribute(attr)) {
57  return;
58  }
59  if (SVGExternalResourcesRequired::parseMappedAttribute(attr)) {
60  return;
61  }
62  if (SVGURIReference::parseMappedAttribute(attr)) {
63  return;
64  }
65 
66  SVGElement::parseMappedAttribute(attr);
67  }
68 }
69 
70 void SVGCursorElement::addClient(SVGElement *element)
71 {
72  m_clients.add(element);
73 }
74 
75 void SVGCursorElement::removeClient(SVGElement *element)
76 {
77  m_clients.remove(element);
78 }
79 
80 void SVGCursorElement::svgAttributeChanged(const QualifiedName &attrName)
81 {
82  SVGElement::svgAttributeChanged(attrName);
83 
84  if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr ||
85  SVGTests::isKnownAttribute(attrName) ||
86  SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
87  SVGURIReference::isKnownAttribute(attrName)) {
88  HashSet<SVGElement *>::const_iterator it = m_clients.begin();
89  HashSet<SVGElement *>::const_iterator end = m_clients.end();
90 
91  for (; it != end; ++it) {
92  (*it)->setChanged();
93  }
94  }
95 }
96 
97 void SVGCursorElement::getSubresourceAttributeStrings(Vector<String> &urls) const
98 {
99  urls.append(href());
100 }
101 
102 }
103 
104 #endif // ENABLE(SVG)
const QList< QKeySequence > & end()
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Oct 16 2021 22:48:01 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.