File indexing completed on 2024-04-28 15:24:27

0001 /*
0002     Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
0003 
0004     This file is part of the KDE project
0005 
0006     This library is free software; you can redistribute it and/or
0007     modify it under the terms of the GNU Library General Public
0008     License as published by the Free Software Foundation; either
0009     version 2 of the License, or (at your option) any later version.
0010 
0011     This library is distributed in the hope that it will be useful,
0012     but WITHOUT ANY WARRANTY; without even the implied warranty of
0013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014     Library General Public License for more details.
0015 
0016     You should have received a copy of the GNU Library General Public License
0017     along with this library; see the file COPYING.LIB.  If not, write to
0018     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0019     Boston, MA 02110-1301, USA.
0020 */
0021 
0022 #ifndef PatternAttributes_h
0023 #define PatternAttributes_h
0024 
0025 #if ENABLE(SVG)
0026 
0027 namespace WebCore
0028 {
0029 struct PatternAttributes {
0030     PatternAttributes()
0031         : m_x()
0032         , m_y()
0033         , m_width()
0034         , m_height()
0035         , m_boundingBoxMode(true)
0036         , m_boundingBoxModeContent(false)
0037         , m_patternContentElement(0)
0038         , m_xSet(false)
0039         , m_ySet(false)
0040         , m_widthSet(false)
0041         , m_heightSet(false)
0042         , m_boundingBoxModeSet(false)
0043         , m_boundingBoxModeContentSet(false)
0044         , m_patternTransformSet(false)
0045         , m_patternContentElementSet(false)
0046     {
0047     }
0048 
0049     SVGLength x() const
0050     {
0051         return m_x;
0052     }
0053     SVGLength y() const
0054     {
0055         return m_y;
0056     }
0057     SVGLength width() const
0058     {
0059         return m_width;
0060     }
0061     SVGLength height() const
0062     {
0063         return m_height;
0064     }
0065     bool boundingBoxMode() const
0066     {
0067         return m_boundingBoxMode;
0068     }
0069     bool boundingBoxModeContent() const
0070     {
0071         return m_boundingBoxModeContent;
0072     }
0073     AffineTransform patternTransform() const
0074     {
0075         return m_patternTransform;
0076     }
0077     const SVGPatternElement *patternContentElement() const
0078     {
0079         return m_patternContentElement;
0080     }
0081 
0082     void setX(const SVGLength &value)
0083     {
0084         m_x = value;
0085         m_xSet = true;
0086     }
0087     void setY(const SVGLength &value)
0088     {
0089         m_y = value;
0090         m_ySet = true;
0091     }
0092     void setWidth(const SVGLength &value)
0093     {
0094         m_width = value;
0095         m_widthSet = true;
0096     }
0097     void setHeight(const SVGLength &value)
0098     {
0099         m_height = value;
0100         m_heightSet = true;
0101     }
0102     void setBoundingBoxMode(bool value)
0103     {
0104         m_boundingBoxMode = value;
0105         m_boundingBoxModeSet = true;
0106     }
0107     void setBoundingBoxModeContent(bool value)
0108     {
0109         m_boundingBoxModeContent = value;
0110         m_boundingBoxModeContentSet = true;
0111     }
0112     void setPatternTransform(const AffineTransform &value)
0113     {
0114         m_patternTransform = value;
0115         m_patternTransformSet = true;
0116     }
0117     void setPatternContentElement(const SVGPatternElement *value)
0118     {
0119         m_patternContentElement = value;
0120         m_patternContentElementSet = true;
0121     }
0122 
0123     bool hasX() const
0124     {
0125         return m_xSet;
0126     }
0127     bool hasY() const
0128     {
0129         return m_ySet;
0130     }
0131     bool hasWidth() const
0132     {
0133         return m_widthSet;
0134     }
0135     bool hasHeight() const
0136     {
0137         return m_heightSet;
0138     }
0139     bool hasBoundingBoxMode() const
0140     {
0141         return m_boundingBoxModeSet;
0142     }
0143     bool hasBoundingBoxModeContent() const
0144     {
0145         return m_boundingBoxModeContentSet;
0146     }
0147     bool hasPatternTransform() const
0148     {
0149         return m_patternTransformSet;
0150     }
0151     bool hasPatternContentElement() const
0152     {
0153         return m_patternContentElementSet;
0154     }
0155 
0156 private:
0157     // Properties
0158     SVGLength m_x;
0159     SVGLength m_y;
0160     SVGLength m_width;
0161     SVGLength m_height;
0162     bool m_boundingBoxMode;
0163     bool m_boundingBoxModeContent;
0164     AffineTransform m_patternTransform;
0165     const SVGPatternElement *m_patternContentElement;
0166 
0167     // Property states
0168     bool m_xSet : 1;
0169     bool m_ySet : 1;
0170     bool m_widthSet : 1;
0171     bool m_heightSet : 1;
0172     bool m_boundingBoxModeSet : 1;
0173     bool m_boundingBoxModeContentSet : 1;
0174     bool m_patternTransformSet : 1;
0175     bool m_patternContentElementSet : 1;
0176 };
0177 
0178 } // namespace WebCore
0179 
0180 #endif // ENABLE(SVG)
0181 #endif
0182