1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* ***** BEGIN LICENSE BLOCK *****
3 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Original Code is the Mozilla SVG project.
16 : *
17 : * The Initial Developer of the Original Code is
18 : * Scooter Morris.
19 : * Portions created by the Initial Developer are Copyright (C) 2005
20 : * the Initial Developer. All Rights Reserved.
21 : *
22 : * Contributor(s):
23 : * Scooter Morris <scootermorris@comcast.net>
24 : *
25 : * Alternatively, the contents of this file may be used under the terms of
26 : * either the GNU General Public License Version 2 or later (the "GPL"), or
27 : * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 : * in which case the provisions of the GPL or the LGPL are applicable instead
29 : * of those above. If you wish to allow use of your version of this file only
30 : * under the terms of either the GPL or the LGPL, and not to allow others to
31 : * use your version of this file under the terms of the MPL, indicate your
32 : * decision by deleting the provisions above and replace them with the notice
33 : * and other provisions required by the GPL or the LGPL. If you do not delete
34 : * the provisions above, a recipient may use your version of this file under
35 : * the terms of any one of the MPL, the GPL or the LGPL.
36 : *
37 : * ***** END LICENSE BLOCK ***** */
38 :
39 : #ifndef __NS_SVGPATTERNELEMENT_H__
40 : #define __NS_SVGPATTERNELEMENT_H__
41 :
42 : #include "DOMSVGTests.h"
43 : #include "nsIDOMSVGFitToViewBox.h"
44 : #include "nsIDOMSVGPatternElement.h"
45 : #include "nsIDOMSVGUnitTypes.h"
46 : #include "nsIDOMSVGURIReference.h"
47 : #include "nsSVGEnum.h"
48 : #include "nsSVGLength2.h"
49 : #include "nsSVGString.h"
50 : #include "nsSVGStylableElement.h"
51 : #include "nsSVGViewBox.h"
52 : #include "SVGAnimatedPreserveAspectRatio.h"
53 : #include "SVGAnimatedTransformList.h"
54 :
55 : //--------------------- Patterns ------------------------
56 :
57 : typedef nsSVGStylableElement nsSVGPatternElementBase;
58 :
59 : class nsSVGPatternElement : public nsSVGPatternElementBase,
60 : public nsIDOMSVGPatternElement,
61 : public DOMSVGTests,
62 : public nsIDOMSVGURIReference,
63 : public nsIDOMSVGFitToViewBox,
64 : public nsIDOMSVGUnitTypes
65 0 : {
66 : friend class nsSVGPatternFrame;
67 :
68 : protected:
69 : friend nsresult NS_NewSVGPatternElement(nsIContent **aResult,
70 : already_AddRefed<nsINodeInfo> aNodeInfo);
71 : nsSVGPatternElement(already_AddRefed<nsINodeInfo> aNodeInfo);
72 :
73 : public:
74 : typedef mozilla::SVGAnimatedPreserveAspectRatio SVGAnimatedPreserveAspectRatio;
75 :
76 : // interfaces:
77 : NS_DECL_ISUPPORTS_INHERITED
78 :
79 : // Pattern Element
80 : NS_DECL_NSIDOMSVGPATTERNELEMENT
81 :
82 : // URI Reference
83 : NS_DECL_NSIDOMSVGURIREFERENCE
84 :
85 : // FitToViewbox
86 : NS_DECL_NSIDOMSVGFITTOVIEWBOX
87 :
88 0 : NS_FORWARD_NSIDOMNODE(nsSVGElement::)
89 0 : NS_FORWARD_NSIDOMELEMENT(nsSVGElement::)
90 0 : NS_FORWARD_NSIDOMSVGELEMENT(nsSVGElement::)
91 :
92 : // nsIContent interface
93 : NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* name) const;
94 :
95 : virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
96 :
97 : virtual nsXPCClassInfo* GetClassInfo();
98 :
99 : // nsSVGSVGElement methods:
100 : virtual bool HasValidDimensions() const;
101 :
102 : virtual mozilla::SVGAnimatedTransformList* GetAnimatedTransformList();
103 0 : virtual nsIAtom* GetTransformListAttrName() const {
104 0 : return nsGkAtoms::patternTransform;
105 : }
106 : protected:
107 :
108 : virtual LengthAttributesInfo GetLengthInfo();
109 : virtual EnumAttributesInfo GetEnumInfo();
110 : virtual nsSVGViewBox *GetViewBox();
111 : virtual SVGAnimatedPreserveAspectRatio *GetPreserveAspectRatio();
112 : virtual StringAttributesInfo GetStringInfo();
113 :
114 : // nsIDOMSVGPatternElement values
115 : enum { X, Y, WIDTH, HEIGHT };
116 : nsSVGLength2 mLengthAttributes[4];
117 : static LengthInfo sLengthInfo[4];
118 :
119 : enum { PATTERNUNITS, PATTERNCONTENTUNITS };
120 : nsSVGEnum mEnumAttributes[2];
121 : static EnumInfo sEnumInfo[2];
122 :
123 : nsAutoPtr<mozilla::SVGAnimatedTransformList> mPatternTransform;
124 :
125 : // nsIDOMSVGURIReference properties
126 : enum { HREF };
127 : nsSVGString mStringAttributes[1];
128 : static StringInfo sStringInfo[1];
129 :
130 : // nsIDOMSVGFitToViewbox properties
131 : nsSVGViewBox mViewBox;
132 : SVGAnimatedPreserveAspectRatio mPreserveAspectRatio;
133 : };
134 :
135 : #endif
|