1 /*
2     Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 
4     This file is part of the KDE project
5 
6     This library is free software; you can redistribute it and/or
7     modify it under the terms of the GNU Library General Public
8     License as published by the Free Software Foundation; either
9     version 2 of the License, or (at your option) any later version.
10 
11     This library is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14     Library General Public License for more details.
15 
16     You should have received a copy of the GNU Library General Public License
17     along with this library; see the file COPYING.LIB.  If not, write to
18     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19     Boston, MA 02110-1301, USA.
20 */
21 
22 #ifndef PatternAttributes_h
23 #define PatternAttributes_h
24 
25 #if ENABLE(SVG)
26 
27 namespace WebCore
28 {
29 struct PatternAttributes {
PatternAttributesPatternAttributes30     PatternAttributes()
31         : m_x()
32         , m_y()
33         , m_width()
34         , m_height()
35         , m_boundingBoxMode(true)
36         , m_boundingBoxModeContent(false)
37         , m_patternContentElement(0)
38         , m_xSet(false)
39         , m_ySet(false)
40         , m_widthSet(false)
41         , m_heightSet(false)
42         , m_boundingBoxModeSet(false)
43         , m_boundingBoxModeContentSet(false)
44         , m_patternTransformSet(false)
45         , m_patternContentElementSet(false)
46     {
47     }
48 
xPatternAttributes49     SVGLength x() const
50     {
51         return m_x;
52     }
yPatternAttributes53     SVGLength y() const
54     {
55         return m_y;
56     }
widthPatternAttributes57     SVGLength width() const
58     {
59         return m_width;
60     }
heightPatternAttributes61     SVGLength height() const
62     {
63         return m_height;
64     }
boundingBoxModePatternAttributes65     bool boundingBoxMode() const
66     {
67         return m_boundingBoxMode;
68     }
boundingBoxModeContentPatternAttributes69     bool boundingBoxModeContent() const
70     {
71         return m_boundingBoxModeContent;
72     }
patternTransformPatternAttributes73     AffineTransform patternTransform() const
74     {
75         return m_patternTransform;
76     }
patternContentElementPatternAttributes77     const SVGPatternElement *patternContentElement() const
78     {
79         return m_patternContentElement;
80     }
81 
setXPatternAttributes82     void setX(const SVGLength &value)
83     {
84         m_x = value;
85         m_xSet = true;
86     }
setYPatternAttributes87     void setY(const SVGLength &value)
88     {
89         m_y = value;
90         m_ySet = true;
91     }
setWidthPatternAttributes92     void setWidth(const SVGLength &value)
93     {
94         m_width = value;
95         m_widthSet = true;
96     }
setHeightPatternAttributes97     void setHeight(const SVGLength &value)
98     {
99         m_height = value;
100         m_heightSet = true;
101     }
setBoundingBoxModePatternAttributes102     void setBoundingBoxMode(bool value)
103     {
104         m_boundingBoxMode = value;
105         m_boundingBoxModeSet = true;
106     }
setBoundingBoxModeContentPatternAttributes107     void setBoundingBoxModeContent(bool value)
108     {
109         m_boundingBoxModeContent = value;
110         m_boundingBoxModeContentSet = true;
111     }
setPatternTransformPatternAttributes112     void setPatternTransform(const AffineTransform &value)
113     {
114         m_patternTransform = value;
115         m_patternTransformSet = true;
116     }
setPatternContentElementPatternAttributes117     void setPatternContentElement(const SVGPatternElement *value)
118     {
119         m_patternContentElement = value;
120         m_patternContentElementSet = true;
121     }
122 
hasXPatternAttributes123     bool hasX() const
124     {
125         return m_xSet;
126     }
hasYPatternAttributes127     bool hasY() const
128     {
129         return m_ySet;
130     }
hasWidthPatternAttributes131     bool hasWidth() const
132     {
133         return m_widthSet;
134     }
hasHeightPatternAttributes135     bool hasHeight() const
136     {
137         return m_heightSet;
138     }
hasBoundingBoxModePatternAttributes139     bool hasBoundingBoxMode() const
140     {
141         return m_boundingBoxModeSet;
142     }
hasBoundingBoxModeContentPatternAttributes143     bool hasBoundingBoxModeContent() const
144     {
145         return m_boundingBoxModeContentSet;
146     }
hasPatternTransformPatternAttributes147     bool hasPatternTransform() const
148     {
149         return m_patternTransformSet;
150     }
hasPatternContentElementPatternAttributes151     bool hasPatternContentElement() const
152     {
153         return m_patternContentElementSet;
154     }
155 
156 private:
157     // Properties
158     SVGLength m_x;
159     SVGLength m_y;
160     SVGLength m_width;
161     SVGLength m_height;
162     bool m_boundingBoxMode;
163     bool m_boundingBoxModeContent;
164     AffineTransform m_patternTransform;
165     const SVGPatternElement *m_patternContentElement;
166 
167     // Property states
168     bool m_xSet : 1;
169     bool m_ySet : 1;
170     bool m_widthSet : 1;
171     bool m_heightSet : 1;
172     bool m_boundingBoxModeSet : 1;
173     bool m_boundingBoxModeContentSet : 1;
174     bool m_patternTransformSet : 1;
175     bool m_patternContentElementSet : 1;
176 };
177 
178 } // namespace WebCore
179 
180 #endif // ENABLE(SVG)
181 #endif
182 
183