diff --git a/src/dom/svgimpl.h b/src/dom/svgimpl.h
--- a/src/dom/svgimpl.h
+++ b/src/dom/svgimpl.h
* Authors:
* Bob Jamison
*
- * Copyright (C) 2005 Bob Jamison
+ * Copyright (C) 2006-2008 Bob Jamison
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
#include "svg.h"
-#include "domimpl.h"
-#include "smilimpl.h"
+#include "dom/domimpl.h"
+#include "dom/smilimpl.h"
#include <math.h>
class SVGSVGElementImpl;
+typedef Ptr<SVGSVGElementImpl> SVGSVGElementImplPtr;
+class SVGElementImpl;
+typedef Ptr<SVGElementImpl> SVGElementImplPtr;
+class SVGDocumentImpl;
+typedef Ptr<SVGDocumentImpl> SVGDocumentImplPtr;
+
+/*#########################################################################
+## Types
+#########################################################################*/
+/**
+ * Bitmasks for has_an interface for SVGElement
+ */
+#define SVG_ANGLE 0x00000001
+#define SVG_ANIMATED_ANGLE 0x00000002
+#define SVG_ANIMATED_BOOLEAN 0x00000004
+#define SVG_ANIMATED_ENUMERATION 0x00000008
+#define SVG_ANIMATED_INTEGER 0x00000010
+#define SVG_ANIMATED_LENGTH 0x00000020
+#define SVG_ANIMATED_LENGTH_LIST 0x00000040
+#define SVG_ANIMATED_NUMBER 0x00000080
+#define SVG_ANIMATED_NUMBER_LIST 0x00000100
+#define SVG_ANIMATED_RECT 0x00000200
+#define SVG_ANIMATED_STRING 0x00000400
+#define SVG_COLOR 0x00000800
+#define SVG_CSS_RULE 0x00001000
+#define SVG_EXTERNAL_RESOURCES_REQUIRED 0x00002000
+#define SVG_FIT_TO_VIEWBOX 0x00004000
+#define SVG_ICCCOLOR 0x00008000
+#define SVG_LANG_SPACE 0x00010000
+#define SVG_LENGTH 0x00020000
+#define SVG_LENGTH_LIST 0x00040000
+#define SVG_LOCATABLE 0x00080000
+#define SVG_NUMBER 0x00100000
+#define SVG_NUMBER_LIST 0x00200000
+#define SVG_RECT 0x00400000
+#define SVG_RENDERING_INTENT 0x00800000
+#define SVG_STRING_LIST 0x01000000
+#define SVG_STYLABLE 0x02000000
+#define SVG_TESTS 0x04000000
+#define SVG_TRANSFORMABLE 0x08000000
+#define SVG_UNIT_TYPES 0x10000000
+#define SVG_URI_REFERENCE 0x20000000
+#define SVG_VIEW_SPEC 0x40000000
+#define SVG_ZOOM_AND_PAN 0x80000000
+
+/**
+ * How many above? Quite handy
+ */
+#define SVG_NR_INTERFACES 32
+
+
+/**
+ * Enumerations for SVGElement types
+ */
+typedef enum
+{
+/**
+ * Defines a hyperlink
+ */
+SVG_A_ELEMENT = 0,
+/**
+ * Allows control over glyphs used to render particular character
+ * data (e.g. for music symbols or Asian text)
+ */
+SVG_ALTGLYPH_ELEMENT,
+/**
+ * Defines a set of glyph substitutions (e.g. for music symbols or Asian text)
+ */
+SVG_ALTGLYPHDEF_ELEMENT,
+/**
+ * Defines a candidate set of glyph substitutions (e.g. for music symbols
+ * or Asian text)
+ */
+SVG_ALTGLYPHITEM_ELEMENT,
+/**
+ * Animates an attribute or property over time
+ */
+SVG_ANIMATE_ELEMENT,
+/**
+ * Specifies a color transformation over time
+ */
+SVG_ANIMATECOLOR_ELEMENT,
+/**
+ * Causes an element to move along a motion path
+ */
+SVG_ANIMATEMOTION_ELEMENT,
+/**
+ * Animates a transformation attribute on an element
+ */
+SVG_ANIMATETRANSFORM_ELEMENT,
+/**
+ * Defines a circle
+ */
+SVG_CIRCLE_ELEMENT,
+/**
+ *
+ */
+SVG_CLIPPATH_ELEMENT,
+/**
+ * Specifies a color profile description
+ */
+SVG_COLOR_PROFILE_ELEMENT,
+/**
+ * Defines a platform-independent cursor
+ */
+SVG_CURSOR_ELEMENT,
+/**
+ * Defines a separate font definition resource
+ */
+SVG_DEFINITION_SRC_ELEMENT,
+/**
+ * A container for referenced elements
+ */
+SVG_DEFS_ELEMENT,
+/**
+ * A text-only description for elements in SVG - not displayed as part
+ * of the graphics. User agents may display the text as a tooltip
+ */
+SVG_DESC_ELEMENT,
+/**
+ * Defines an ellipse
+ */
+SVG_ELLIPSE_ELEMENT,
+/**
+ * SVG filter. Composites two objects together using different blending modes
+ */
+SVG_FEBLEND_ELEMENT,
+/**
+ * SVG filter. Applies a matrix transformation
+ */
+SVG_FECOLORMATRIX_ELEMENT,
+/**
+ * SVG filter. Performs component-wise remapping of data
+ */
+SVG_FECOMPONENTTRANSFER_ELEMENT,
+/**
+ * SVG filter.
+ */
+SVG_FECOMPOSITE_ELEMENT,
+/**
+ * SVG filter.
+ */
+SVG_FECONVOLVEMATRIX_ELEMENT,
+/**
+ * SVG filter.
+ */
+SVG_FEDIFFUSELIGHTING_ELEMENT,
+/**
+ * SVG filter.
+ */
+SVG_FEDISPLACEMENTMAP_ELEMENT,
+/**
+ * SVG filter. Defines a light source
+ */
+SVG_FEDISTANTLIGHT_ELEMENT,
+/**
+ * SVG filter.
+ */
+SVG_FEFLOOD_ELEMENT,
+/**
+ * SVG filter. Sub-element to feComponentTransfer
+ */
+SVG_FEFUNCA_ELEMENT,
+/**
+ * SVG filter. Sub-element to feComponentTransfer
+ */
+SVG_FEFUNCB_ELEMENT,
+/**
+ * SVG filter. Sub-element to feComponentTransfer
+ */
+SVG_FEFUNCG_ELEMENT,
+/**
+ * SVG filter. Sub-element to feComponentTransfer
+ */
+SVG_FEFUNCR_ELEMENT,
+/**
+ * SVG filter. Performs a Gaussian blur on the image
+ */
+SVG_FEGAUSSIANBLUR_ELEMENT,
+/**
+ * SVG filter.
+ */
+SVG_FEIMAGE_ELEMENT,
+/**
+ * SVG filter. Creates image layers on top of each other
+ */
+SVG_FEMERGE_ELEMENT,
+/**
+ * SVG filter. Sub-element to feMerge
+ */
+SVG_FEMERGENODE_ELEMENT,
+/**
+ * SVG filter. Performs a "fattening" or "thinning" on a source graphic
+ */
+SVG_FEMORPHOLOGY_ELEMENT,
+/**
+ * SVG filter. Moves an image relative to its current position
+ */
+SVG_FEOFFSET_ELEMENT,
+/**
+ * SVG filter.
+ */
+SVG_FEPOINTLIGHT_ELEMENT,
+/**
+ * SVG filter.
+ */
+SVG_FESPECULARLIGHTING_ELEMENT,
+/**
+ * SVG filter.
+ */
+SVG_FESPOTLIGHT_ELEMENT,
+/**
+ * SVG filter.
+ */
+SVG_FETILE_ELEMENT,
+/**
+ * SVG filter.
+ */
+SVG_FETURBULENCE_ELEMENT,
+/**
+ * Container for filter effects
+ */
+SVG_FILTER_ELEMENT,
+/**
+ * Defines a font
+ */
+SVG_FONT_ELEMENT,
+/**
+ * Describes the characteristics of a font
+ */
+SVG_FONT_FACE_ELEMENT,
+/**
+ *
+ */
+SVG_FONT_FACE_FORMAT_ELEMENT,
+/**
+ *
+ */
+SVG_FONT_FACE_NAME_ELEMENT,
+/**
+ *
+ */
+SVG_FONT_FACE_SRC_ELEMENT,
+/**
+ *
+ */
+SVG_FONT_FACE_URI_ELEMENT,
+/**
+ *
+ */
+SVG_FOREIGNOBJECT_ELEMENT,
+/**
+ * A container element for grouping together related elements
+ */
+SVG_G_ELEMENT,
+/**
+ * Defines the graphics for a given glyph
+ */
+SVG_GLYPH_ELEMENT,
+/**
+ * Defines a possible glyph to use
+ */
+SVG_GLYPHREF_ELEMENT,
+/**
+ *
+ */
+SVG_HKERN_ELEMENT,
+/**
+ *
+ */
+SVG_IMAGE_ELEMENT,
+/**
+ * Defines a line
+ */
+SVG_LINE_ELEMENT,
+/**
+ * Defines a linear gradient
+ */
+SVG_LINEARGRADIENT_ELEMENT,
+/**
+ *
+ */
+SVG_MARKER_ELEMENT,
+/**
+ *
+ */
+SVG_MASK_ELEMENT,
+/**
+ * Specifies metadata
+ */
+SVG_METADATA_ELEMENT,
+/**
+ *
+ */
+SVG_MISSING_GLYPH_ELEMENT,
+/**
+ *
+ */
+SVG_MPATH_ELEMENT,
+/**
+ * Defines a path
+ */
+SVG_PATH_ELEMENT,
+/**
+ *
+ */
+SVG_PATTERN_ELEMENT,
+/**
+ * Defines a closed shape that consists of a set of connected straight lines
+ */
+SVG_POLYGON_ELEMENT,
+/**
+ * Defines a set of connected straight lines
+ */
+SVG_POLYLINE_ELEMENT,
+/**
+ * Defines a radial gradient
+ */
+SVG_RADIALGRADIENT_ELEMENT,
+/**
+ * Defines a rectangle
+ */
+SVG_RECT_ELEMENT,
+/**
+ * Container for scripts (e.g., ECMAScript)
+ */
+SVG_SCRIPT_ELEMENT,
+/**
+ * Sets the value of an attribute for a specified duration
+ */
+SVG_SET_ELEMENT,
+/**
+ *
+ */
+SVG_STOP_ELEMENT,
+/**
+ * Allows style sheets to be embedded directly within SVG content
+ */
+SVG_STYLE_ELEMENT,
+/**
+ * Defines an SVG document fragment
+ */
+SVG_SVG_ELEMENT,
+/**
+ *
+ */
+SVG_SWITCH_ELEMENT,
+/**
+ *
+ */
+SVG_SYMBOL_ELEMENT,
+/**
+ *
+ */
+SVG_TEXT_ELEMENT,
+/**
+ *
+ */
+SVG_TEXTPATH_ELEMENT,
+/**
+ * A text-only description for elements in SVG - not displayed as part of
+ * the graphics. User agents may display the text as a tooltip
+ */
+SVG_TITLE_ELEMENT,
+/**
+ *
+ */
+SVG_TREF_ELEMENT,
+/**
+ *
+ */
+SVG_TSPAN_ELEMENT,
+/**
+ *
+ */
+SVG_USE_ELEMENT,
+/**
+ *
+ */
+SVG_VIEW_ELEMENT,
+/**
+ *
+ */
+SVG_VKERN_ELEMENT,
+/**
+ *
+ */
+SVG_MAX_ELEMENT
+
+} SVGElementType;
+
+
+
+
+/**
+ * Look up the SVG Element type enum for a given string
+ * Return -1 if not found
+ */
+int svgElementStrToEnum(const char *str);
+
+
+/**
+ * Return the string corresponding to a given SVG element type enum
+ * Return "unknown" if not found
+ */
+const char *svgElementEnumToStr(int type);
+
/*#########################################################################
## SVGDocumentImpl
/**
*
*/
- virtual SVGSVGElement *getRootElement()
+ virtual SVGSVGElementPtr getRootElement()
{ return rootElement; }
/**
*
*/
- virtual Element *createElement(const DOMString& tagName)
+ virtual ElementPtr createElement(const DOMString& tagName)
throw(DOMException);
/**
*
*/
- virtual Element *createElementNS(const DOMString& namespaceURI,
- const DOMString& qualifiedName)
- throw(DOMException);
+ virtual ElementPtr createElementNS(const DOMString& namespaceURI,
+ const DOMString& qualifiedName)
+ throw(DOMException);
//##################
//# Non-API methods
//##################
SVGDocumentImpl(const DOMImplementation *domImpl,
- const DOMString &namespaceURI,
- const DOMString &qualifiedName,
- const DocumentType *doctype)
+ const DOMString &namespaceURI,
+ const DOMString &qualifiedName,
+ const DocumentTypePtr doctype)
: DocumentImpl(domImpl, namespaceURI,
qualifiedName, doctype)
{
*/
virtual ~SVGDocumentImpl()
{
- if (rootElement)
- delete rootElement;
}
protected:
friend class SvgParser;
- void init()
- {
- title = "";
- referrer = "";
- domain = "";
- rootElement = NULL;
- }
+ void init();
DOMString title;
DOMString referrer;
DOMString domain;
DOMString url;
- SVGSVGElement *rootElement;
+ SVGSVGElementImplPtr rootElement;
};
/**
*
*/
- virtual SVGSVGElement *getOwnerSVGElement()
+ virtual SVGSVGElementPtr getOwnerSVGElement()
{ return ownerSvgElement; }
/**
*
*/
- virtual SVGElement *getViewportElement()
+ virtual SVGElementPtr getViewportElement()
{ return viewportElement; }
/**
*
*/
- SVGElementImpl(SVGDocumentImpl *owner, const DOMString &tagName)
+ SVGElementImpl(SVGDocumentImplPtr owner, const DOMString &tagName)
: ElementImpl(owner, tagName)
{ init(); }
/**
*
*/
- SVGElementImpl(SVGDocumentImpl *owner,
+ SVGElementImpl(SVGDocumentImplPtr owner,
const DOMString &namespaceURI,
const DOMString &tagName)
: ElementImpl(owner, namespaceURI, tagName)
viewportElement = NULL;
}
- DOMString id;
- DOMString xmlBase;
- SVGSVGElement *ownerSvgElement;
- SVGElement *viewportElement;
+ DOMString id;
+ DOMString xmlBase;
+ SVGSVGElementPtr ownerSvgElement;
+ SVGElementPtr viewportElement;
};
{
public:
+ /**
+ * Retrieves an attribute value by name.
+ */
+ virtual DOMString getAttribute(const DOMString& name);
+
+ /**
+ * Sets an attribute value
+ */
+ virtual void setAttribute(const DOMString& name,
+ const DOMString& value)
+ throw(DOMException);
+
/**
*
*/
*
*/
virtual NodeList getIntersectionList (const SVGRect &rect,
- const SVGElement *referenceElement );
+ const SVGElementPtr referenceElement );
/**
*
*/
virtual NodeList getEnclosureList (const SVGRect &rect,
- const SVGElement *referenceElement );
+ const SVGElementPtr referenceElement );
/**
*
*/
- virtual bool checkIntersection (const SVGElement *element, const SVGRect &rect );
+ virtual bool checkIntersection (const SVGElementPtr element, const SVGRect &rect );
/**
*
*/
- virtual bool checkEnclosure (const SVGElement *element, const SVGRect &rect );
+ virtual bool checkEnclosure (const SVGElementPtr element, const SVGRect &rect );
/**
*
/**
*
*/
- virtual Element *getElementById (const DOMString& elementId );
+ virtual ElementPtr getElementById (const DOMString& elementId );
/**
*
*/
- virtual SVGDocument *getSVGDocument ( )
+ virtual SVGDocumentPtr getSVGDocument ( )
throw( DOMException );
//##################
/**
*
*/
- virtual long getNumberOfChars ( );
+ virtual long getNumberOfChars( );
/**
*
*/
- virtual double getComputedTextLength ( );
+ virtual double getComputedTextLength( );
/**
*
*/
- virtual double getSubStringLength (unsigned long charnum, unsigned long nchars )
- throw( DOMException );
+ virtual double getSubStringLength(unsigned long charnum,
+ unsigned long nchars )
+ throw( DOMException );
/**
*
*/
- virtual SVGPoint getStartPositionOfChar (unsigned long charnum )
- throw( DOMException );
+ virtual SVGPoint getStartPositionOfChar(unsigned long charnum )
+ throw( DOMException );
/**
*
*/
- virtual SVGPoint getEndPositionOfChar (unsigned long charnum )
- throw( DOMException );
+ virtual SVGPoint getEndPositionOfChar(unsigned long charnum )
+ throw( DOMException );
/**
*
*/
- virtual SVGRect getExtentOfChar (unsigned long charnum )
- throw( DOMException );
+ virtual SVGRect getExtentOfChar(unsigned long charnum )
+ throw( DOMException );
/**
*
*/
- virtual double getRotationOfChar (unsigned long charnum )
+ virtual double getRotationOfChar(unsigned long charnum )
throw( DOMException );
/**
*
*/
- virtual long getCharNumAtPosition (const SVGPoint &point );
+ virtual long getCharNumAtPosition(const SVGPoint &point );
/**
*
*/
- virtual void selectSubString (unsigned long charnum, unsigned long nchars )
- throw( DOMException );
+ virtual void selectSubString(unsigned long charnum, unsigned long nchars )
+ throw( DOMException );
virtual SVGAnimatedNumber getDiffuseConstant()
{ return diffuseConstant; }
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getKernelUnitLengthX()
+ { return kernelUnitLengthX; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getKernelUnitLengthY()
+ { return kernelUnitLengthY; }
+
//##################
SVGAnimatedString in1;
SVGAnimatedNumber surfaceScale;
SVGAnimatedNumber diffuseConstant;
+ SVGAnimatedNumber kernelUnitLengthX;
+ SVGAnimatedNumber kernelUnitLengthY;
};
/**
*
*/
- virtual SVGElement *getTargetElement()
+ virtual SVGElementPtr getTargetElement()
{ return targetElement; }
protected:
- SVGElement *targetElement;
+ SVGElementPtr targetElement;
double startTime, currentTime, simpleDuration;
};