1 /* 2 Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 2004, 2005, 2006, 2008 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 SVGTextContentElement_h 22 #define SVGTextContentElement_h 23 24 #if ENABLE(SVG) 25 #include "SVGExternalResourcesRequired.h" 26 #include "SVGLangSpace.h" 27 #include "SVGStyledElement.h" 28 #include "SVGTests.h" 29 30 namespace WebCore { 31 32 class SVGLength; 33 34 class SVGTextContentElement : public SVGStyledElement, 35 public SVGTests, 36 public SVGLangSpace, 37 public SVGExternalResourcesRequired { 38 public: 39 enum SVGLengthAdjustType { 40 LENGTHADJUST_UNKNOWN = 0, 41 LENGTHADJUST_SPACING = 1, 42 LENGTHADJUST_SPACINGANDGLYPHS = 2 43 }; 44 45 SVGTextContentElement(const QualifiedName&, Document*); 46 virtual ~SVGTextContentElement(); 47 isValid()48 virtual bool isValid() const { return SVGTests::isValid(); } isTextContent()49 virtual bool isTextContent() const { return true; } 50 51 unsigned getNumberOfChars() const; 52 float getComputedTextLength() const; 53 float getSubStringLength(unsigned charnum, unsigned nchars, ExceptionCode&) const; 54 FloatPoint getStartPositionOfChar(unsigned charnum, ExceptionCode&) const; 55 FloatPoint getEndPositionOfChar(unsigned charnum, ExceptionCode&) const; 56 FloatRect getExtentOfChar(unsigned charnum, ExceptionCode&) const; 57 float getRotationOfChar(unsigned charnum, ExceptionCode&) const; 58 int getCharNumAtPosition(const FloatPoint&) const; 59 void selectSubString(unsigned charnum, unsigned nchars, ExceptionCode&) const; 60 61 virtual void parseMappedAttribute(MappedAttribute*); 62 virtual void synchronizeProperty(const QualifiedName&); 63 64 bool isKnownAttribute(const QualifiedName&); 65 66 private: 67 DECLARE_ANIMATED_PROPERTY(SVGTextContentElement, SVGNames::textLengthAttr, SVGLength, TextLength, textLength) 68 DECLARE_ANIMATED_PROPERTY(SVGTextContentElement, SVGNames::lengthAdjustAttr, int, LengthAdjust, lengthAdjust) 69 70 // SVGExternalResourcesRequired 71 DECLARE_ANIMATED_PROPERTY(SVGTextContentElement, SVGNames::externalResourcesRequiredAttr, bool, ExternalResourcesRequired, externalResourcesRequired) 72 }; 73 74 } // namespace WebCore 75 76 #endif // ENABLE(SVG) 77 #endif 78