Home | History | Annotate | Download | only in svg
      1 /*
      2     Copyright (C) 2007 Nikolas Zimmermann <zimmermann (at) kde.org>
      3 
      4     This library is free software; you can redistribute it and/or
      5     modify it under the terms of the GNU Library General Public
      6     License as published by the Free Software Foundation; either
      7     version 2 of the License, or (at your option) any later version.
      8 
      9     This library is distributed in the hope that it will be useful,
     10     but WITHOUT ANY WARRANTY; without even the implied warranty of
     11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     12     Library General Public License for more details.
     13 
     14     You should have received a copy of the GNU Library General Public License
     15     along with this library; see the file COPYING.LIB.  If not, write to
     16     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     17     Boston, MA 02110-1301, USA.
     18 */
     19 
     20 #ifndef SVGTextPathElement_h
     21 #define SVGTextPathElement_h
     22 
     23 #if ENABLE(SVG)
     24 #include "SVGTextContentElement.h"
     25 
     26 #include "SVGURIReference.h"
     27 
     28 namespace WebCore {
     29     enum SVGTextPathMethodType {
     30         SVG_TEXTPATH_METHODTYPE_UNKNOWN = 0,
     31         SVG_TEXTPATH_METHODTYPE_ALIGN = 1,
     32         SVG_TEXTPATH_METHODTYPE_STRETCH = 2
     33     };
     34 
     35     enum SVGTextPathSpacingType {
     36         SVG_TEXTPATH_SPACINGTYPE_UNKNOWN = 0,
     37         SVG_TEXTPATH_SPACINGTYPE_AUTO = 1,
     38         SVG_TEXTPATH_SPACINGTYPE_EXACT = 2
     39     };
     40 
     41     class SVGTextPathElement : public SVGTextContentElement,
     42                                public SVGURIReference {
     43     public:
     44         // Forward declare these enums in the w3c naming scheme, for IDL generation
     45         enum {
     46             TEXTPATH_METHODTYPE_UNKNOWN = SVG_TEXTPATH_METHODTYPE_UNKNOWN,
     47             TEXTPATH_METHODTYPE_ALIGN = SVG_TEXTPATH_METHODTYPE_ALIGN,
     48             TEXTPATH_METHODTYPE_STRETCH = SVG_TEXTPATH_METHODTYPE_STRETCH,
     49             TEXTPATH_SPACINGTYPE_UNKNOWN = SVG_TEXTPATH_SPACINGTYPE_UNKNOWN,
     50             TEXTPATH_SPACINGTYPE_AUTO = SVG_TEXTPATH_SPACINGTYPE_AUTO,
     51             TEXTPATH_SPACINGTYPE_EXACT = SVG_TEXTPATH_SPACINGTYPE_EXACT
     52         };
     53 
     54         SVGTextPathElement(const QualifiedName&, Document*);
     55         virtual ~SVGTextPathElement();
     56 
     57         virtual void insertedIntoDocument();
     58 
     59         virtual void parseMappedAttribute(MappedAttribute*);
     60         virtual void synchronizeProperty(const QualifiedName&);
     61         virtual bool rendererIsNeeded(RenderStyle* style) { return StyledElement::rendererIsNeeded(style); }
     62         virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
     63 
     64         bool childShouldCreateRenderer(Node*) const;
     65 
     66     private:
     67         DECLARE_ANIMATED_PROPERTY(SVGTextPathElement, SVGNames::startOffsetAttr, SVGLength, StartOffset, startOffset)
     68         DECLARE_ANIMATED_PROPERTY(SVGTextPathElement, SVGNames::methodAttr, int, Method, method)
     69         DECLARE_ANIMATED_PROPERTY(SVGTextPathElement, SVGNames::spacingAttr, int, Spacing, spacing)
     70 
     71         // SVGURIReference
     72         DECLARE_ANIMATED_PROPERTY(SVGTextPathElement, XLinkNames::hrefAttr, String, Href, href)
     73     };
     74 
     75 } // namespace WebCore
     76 
     77 #endif // ENABLE(SVG)
     78 #endif
     79