KHTML
SVGTextPositioningElement.cpp
Go to the documentation of this file.
00001 /* 00002 Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 00003 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org> 00004 00005 This file is part of the KDE project 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Library General Public 00009 License as published by the Free Software Foundation; either 00010 version 2 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Library General Public License for more details. 00016 00017 You should have received a copy of the GNU Library General Public License 00018 along with this library; see the file COPYING.LIB. If not, write to 00019 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00020 Boston, MA 02110-1301, USA. 00021 */ 00022 00023 #include "config.h" 00024 #include "wtf/Platform.h" 00025 00026 #if ENABLE(SVG) 00027 #include "SVGTextPositioningElement.h" 00028 00029 #include "SVGLengthList.h" 00030 #include "SVGNames.h" 00031 #include "SVGNumberList.h" 00032 00033 namespace WebCore { 00034 00035 SVGTextPositioningElement::SVGTextPositioningElement(const QualifiedName& tagName, Document* doc) 00036 : SVGTextContentElement(tagName, doc) 00037 , m_x(SVGLengthList::create(SVGNames::xAttr)) 00038 , m_y(SVGLengthList::create(SVGNames::yAttr)) 00039 , m_dx(SVGLengthList::create(SVGNames::dxAttr)) 00040 , m_dy(SVGLengthList::create(SVGNames::dyAttr)) 00041 , m_rotate(SVGNumberList::create(SVGNames::rotateAttr)) 00042 { 00043 } 00044 00045 SVGTextPositioningElement::~SVGTextPositioningElement() 00046 { 00047 } 00048 00049 ANIMATED_PROPERTY_DEFINITIONS(SVGTextPositioningElement, SVGLengthList*, LengthList, lengthList, X, x, SVGNames::xAttr, m_x.get()) 00050 ANIMATED_PROPERTY_DEFINITIONS(SVGTextPositioningElement, SVGLengthList*, LengthList, lengthList, Y, y, SVGNames::yAttr, m_y.get()) 00051 ANIMATED_PROPERTY_DEFINITIONS(SVGTextPositioningElement, SVGLengthList*, LengthList, lengthList, Dx, dx, SVGNames::dxAttr, m_dx.get()) 00052 ANIMATED_PROPERTY_DEFINITIONS(SVGTextPositioningElement, SVGLengthList*, LengthList, lengthList, Dy, dy, SVGNames::dyAttr, m_dy.get()) 00053 ANIMATED_PROPERTY_DEFINITIONS(SVGTextPositioningElement, SVGNumberList*, NumberList, numberList, Rotate, rotate, SVGNames::rotateAttr, m_rotate.get()) 00054 00055 void SVGTextPositioningElement::parseMappedAttribute(MappedAttribute* attr) 00056 { 00057 kDebug() << "parse:" << attr->localName() << attr->value() << endl; 00058 if (attr->name() == SVGNames::xAttr) 00059 xBaseValue()->parse(attr->value(), this, LengthModeWidth); 00060 else if (attr->name() == SVGNames::yAttr) 00061 yBaseValue()->parse(attr->value(), this, LengthModeHeight); 00062 else if (attr->name() == SVGNames::dxAttr) 00063 dxBaseValue()->parse(attr->value(), this, LengthModeWidth); 00064 else if (attr->name() == SVGNames::dyAttr) 00065 dyBaseValue()->parse(attr->value(), this, LengthModeHeight); 00066 else if (attr->name() == SVGNames::rotateAttr) 00067 rotateBaseValue()->parse(attr->value()); 00068 else 00069 SVGTextContentElement::parseMappedAttribute(attr); 00070 } 00071 00072 bool SVGTextPositioningElement::isKnownAttribute(const QualifiedName& attrName) 00073 { 00074 return (attrName.matches(SVGNames::xAttr) || 00075 attrName.matches(SVGNames::yAttr) || 00076 attrName.matches(SVGNames::dxAttr) || 00077 attrName.matches(SVGNames::dyAttr) || 00078 attrName.matches(SVGNames::rotateAttr) || 00079 SVGTextContentElement::isKnownAttribute(attrName)); 00080 } 00081 00082 } 00083 00084 #endif // ENABLE(SVG)
KDE 4.6 API Reference