KHtml

css_svgvalueimpl.h
1 /*
2  Copyright (C) 2004, 2005 Nikolas Zimmermann <[email protected]>
3  2004, 2005, 2006, 2007 Rob Buis <[email protected]>
4  Copyright (C) 2006 Samuel Weinig ([email protected])
5  (C) 2009 Maksim Orlovich ([email protected])
6 
7  This file is part of the KDE project
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Library General Public
11  License as published by the Free Software Foundation; either
12  version 2 of the License, or (at your option) any later version.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Library General Public License for more details.
18 
19  You should have received a copy of the GNU Library General Public License
20  along with this library; see the file COPYING.LIB. If not, write to
21  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  Boston, MA 02110-1301, USA.
23 */
24 
25 #ifndef _CSS_svg_valueimpl_h_
26 #define _CSS_svg_valueimpl_h_
27 
28 #include <QColor>
29 #include "css/css_valueimpl.h"
30 
31 namespace DOM
32 {
33 
34 class SVGCSSValueImpl : public CSSValueImpl
35 {
36 public:
37  virtual bool isSVGColor() const
38  {
39  return false;
40  }
41  virtual bool isSVGPaint() const
42  {
43  return false;
44  }
45 
46  unsigned short cssValueType() const override
47  {
49  }
50 };
51 
52 class SVGColorImpl : public SVGCSSValueImpl
53 {
54 public:
55  SVGColorImpl();
56  SVGColorImpl(const DOMString &rgbColor);
57  SVGColorImpl(const QColor &c);
58  SVGColorImpl(unsigned short colorType);
59  virtual ~SVGColorImpl();
60 
61  enum SVGColorType {
62  SVG_COLORTYPE_UNKNOWN = 0,
63  SVG_COLORTYPE_RGBCOLOR = 1,
64  SVG_COLORTYPE_RGBCOLOR_ICCCOLOR = 2,
65  SVG_COLORTYPE_CURRENTCOLOR = 3
66  };
67 
68  // 'SVGColor' functions
69  unsigned short colorType() const;
70 
71  unsigned rgbColor() const;
72 
73  static QColor colorFromRGBColorString(const DOMString &);
74  void setRGBColor(const DOMString &rgbColor)
75  {
76  int ignored = 0;
77  setRGBColor(rgbColor, ignored);
78  }
79  void setRGBColor(const DOMString &rgbColor, int &);
80  void setRGBColorICCColor(const DOMString &rgbColor, const DOMString &iccColor, int &);
81  void setColor(unsigned short colorType, const DOMString &rgbColor, const DOMString &iccColor, int &);
82 
83  DOMString cssText() const override;
84 
85  // Helpers
86  const QColor &color() const;
87 
88  bool isSVGColor() const override
89  {
90  return true;
91  }
92 
93  unsigned short cssValueType() const override
94  {
96  }
97 private:
98  QColor m_color;
99  unsigned short m_colorType;
100 };
101 
102 class SVGPaintImpl : public SVGColorImpl
103 {
104 public:
105  enum SVGPaintType {
106  SVG_PAINTTYPE_UNKNOWN = 0,
107  SVG_PAINTTYPE_RGBCOLOR = 1,
108  SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR = 2,
109  SVG_PAINTTYPE_NONE = 101,
110  SVG_PAINTTYPE_CURRENTCOLOR = 102,
111  SVG_PAINTTYPE_URI_NONE = 103,
112  SVG_PAINTTYPE_URI_CURRENTCOLOR = 104,
113  SVG_PAINTTYPE_URI_RGBCOLOR = 105,
114  SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR = 106,
115  SVG_PAINTTYPE_URI = 107
116  };
117 
118  SVGPaintImpl();
119  SVGPaintImpl(const DOMString &uri);
120  SVGPaintImpl(SVGPaintType);
121  SVGPaintImpl(SVGPaintType, const DOMString &uri, const DOMString &rgbPaint = DOMString(), const DOMString &iccPaint = DOMString());
122  SVGPaintImpl(const QColor &c);
123  SVGPaintImpl(const DOMString &uri, const QColor &c);
124  virtual ~SVGPaintImpl();
125 
126  // 'SVGPaint' functions
127  SVGPaintType paintType() const
128  {
129  return m_paintType;
130  }
131  DOMString uri() const;
132 
133  void setUri(const DOMString &);
134  void setPaint(SVGPaintType, const DOMString &uri, const DOMString &rgbPaint, const DOMString &iccPaint, int &);
135 
136  DOMString cssText() const override;
137 
138  static SVGPaintImpl *defaultFill();
139  static SVGPaintImpl *defaultStroke();
140 
141  bool isSVGPaint() const override
142  {
143  return true;
144  }
145 private:
146  SVGPaintType m_paintType;
147  DOMString m_uri;
148 };
149 
150 } // namespace DOM
151 
152 #endif
153 
Not part of DOM.
Definition: css_value.h:262
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
This library provides a full-featured HTML parser and widget.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Oct 16 2021 22:47:51 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.