KHtml

css_value.h
1 /*
2  * This file is part of the DOM implementation for KDE.
3  *
4  * Copyright 1999 Lars Knoll ([email protected])
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  * This file includes excerpts from the Document Object Model (DOM)
22  * Level 2 Specification (Style)
23  * https://www.w3.org/TR/DOM-Level-2-Style/
24  * Copyright © 2000 W3C® (MIT, INRIA, Keio), All Rights Reserved.
25  *
26  */
27 #ifndef _CSS_css_value_h_
28 #define _CSS_css_value_h_
29 
30 #include <dom/dom_string.h>
31 
32 #include <QColor>
33 
34 namespace DOM
35 {
36 
37 class CSSStyleDeclarationImpl;
38 class CSSRule;
39 class CSSValue;
40 
59 class KHTML_EXPORT CSSStyleDeclaration
60 {
61 public:
64  CSSStyleDeclaration(CSSStyleDeclarationImpl *impl);
65 public:
66 
67  CSSStyleDeclaration &operator = (const CSSStyleDeclaration &other);
68 
70 
78  DOM::DOMString cssText() const;
79 
91  void setCssText(const DOM::DOMString &);
92 
98  unsigned long length() const;
99 
104  CSSRule parentRule() const;
105 
119  DOM::DOMString getPropertyValue(const DOM::DOMString &propertyName) const;
120 
140  CSSValue getPropertyCSSValue(const DOM::DOMString &propertyName) const;
141 
160  DOM::DOMString removeProperty(const DOM::DOMString &propertyName);
161 
176  DOM::DOMString getPropertyPriority(const DOM::DOMString &propertyName) const;
177 
202  void setProperty(const DOM::DOMString &propertyName, const DOM::DOMString &value, const DOM::DOMString &priority);
203 
217  DOM::DOMString item(unsigned long index) const;
218 
223  CSSStyleDeclarationImpl *handle() const;
224  bool isNull() const;
225 
226 protected:
227  CSSStyleDeclarationImpl *impl;
228 };
229 
230 class CSSValueImpl;
231 
237 class KHTML_EXPORT CSSValue
238 {
239 public:
240  CSSValue();
241  CSSValue(const CSSValue &other);
242  CSSValue(CSSValueImpl *impl);
243 public:
244 
245  CSSValue &operator = (const CSSValue &other);
246 
247  ~CSSValue();
255  enum UnitTypes {
256  CSS_INHERIT = 0,
257  CSS_PRIMITIVE_VALUE = 1,
258  CSS_VALUE_LIST = 2,
259  CSS_CUSTOM = 3,
260  CSS_INITIAL = 4,
261 
262  CSS_SVG_VALUE = 1001
263  };
264 
269  DOM::DOMString cssText() const;
270 
282  void setCssText(const DOM::DOMString &);
283 
288  unsigned short cssValueType() const;
289 
294  bool isCSSValueList() const;
295  bool isCSSPrimitiveValue() const;
296  CSSValueImpl *handle() const;
297  bool isNull() const;
298 
299 protected:
300  CSSValueImpl *impl;
301 };
302 
303 class CSSValueListImpl;
304 class CSSValue;
305 
311 class KHTML_EXPORT CSSValueList : public CSSValue
312 {
313 public:
314  CSSValueList();
315  CSSValueList(const CSSValueList &other);
316  CSSValueList(const CSSValue &other);
317  CSSValueList(CSSValueListImpl *impl);
318 public:
319 
320  CSSValueList &operator = (const CSSValueList &other);
321  CSSValueList &operator = (const CSSValue &other);
322 
323  ~CSSValueList();
324 
331  unsigned long length() const;
332 
345  CSSValue item(unsigned long index);
346 
347 protected:
348  CSSValueListImpl *vimpl;
349 };
350 
351 class CSSPrimitiveValueImpl;
352 class Counter;
353 class RGBColor;
354 class Rect;
355 
367 class KHTML_EXPORT CSSPrimitiveValue : public CSSValue
368 {
369 public:
371  CSSPrimitiveValue(const CSSPrimitiveValue &other);
372  CSSPrimitiveValue(const CSSValue &other);
373  CSSPrimitiveValue(CSSPrimitiveValueImpl *impl);
374 public:
375 
376  CSSPrimitiveValue &operator = (const CSSPrimitiveValue &other);
377  CSSPrimitiveValue &operator = (const CSSValue &other);
378 
384  enum UnitTypes {
385  CSS_UNKNOWN = 0,
386  CSS_NUMBER = 1,
387  CSS_PERCENTAGE = 2,
388  CSS_EMS = 3,
389  CSS_EXS = 4,
390  CSS_CHS = 5,
391  CSS_REMS = 6,
392  CSS_PX = 7,
393  CSS_CM = 8,
394  CSS_MM = 9,
395  CSS_IN = 10,
396  CSS_PT = 11,
397  CSS_PC = 12,
398  CSS_DEG = 13,
399  CSS_RAD = 14,
400  CSS_GRAD = 15,
401  CSS_MS = 16,
402  CSS_S = 17,
403  CSS_HZ = 18,
404  CSS_KHZ = 19,
405  CSS_DIMENSION = 20,
406  CSS_STRING = 21,
407  CSS_URI = 22,
408  CSS_IDENT = 23,
409  CSS_ATTR = 24,
410  CSS_COUNTER = 25,
411  CSS_RECT = 26,
412  CSS_RGBCOLOR = 27,
413  CSS_DPI = 28,
414  CSS_DPCM = 29,
415  CSS_PAIR = 100, // We envision this being exposed as a means of getting computed style values for pairs
416  CSS_HTML_RELATIVE = 255
417  };
418 
424  unsigned short primitiveType() const;
425 
454  void setFloatValue(unsigned short unitType, float floatValue);
455 
481  float getFloatValue(unsigned short unitType) const;
482 
508  void setStringValue(unsigned short stringType, const DOM::DOMString &stringValue);
509 
525  DOM::DOMString getStringValue() const;
526 
540  Counter getCounterValue() const;
541 
555  Rect getRectValue() const;
556 
571  RGBColor getRGBColorValue() const;
572 };
573 
582 class KHTML_EXPORT RGBColor
583 {
584 public:
585  RGBColor();
589  RGBColor(const QColor &c)
590  {
591  m_color = c.rgb();
592  }
593  RGBColor(QRgb color);
594 
595  RGBColor(const RGBColor &other);
596  RGBColor &operator = (const RGBColor &other);
597 
598  ~RGBColor();
599 
604  CSSPrimitiveValue red() const;
605 
610  CSSPrimitiveValue green() const;
611 
616  CSSPrimitiveValue blue() const;
617 
621  QRgb color() const
622  {
623  return m_color;
624  }
625 protected:
626  QRgb m_color;
627 };
628 
629 class RectImpl;
630 
639 class KHTML_EXPORT Rect
640 {
641  friend class CSSPrimitiveValue;
642 public:
643  Rect();
644  Rect(const Rect &other);
645 
646  Rect &operator = (const Rect &other);
647 
648  ~Rect();
649 
654  CSSPrimitiveValue top() const;
655 
660  CSSPrimitiveValue right() const;
661 
666  CSSPrimitiveValue bottom() const;
667 
672  CSSPrimitiveValue left() const;
673 
678  RectImpl *handle() const;
679  bool isNull() const;
680 
681 protected:
682  RectImpl *impl;
683  Rect(RectImpl *i);
684 };
685 
686 class CounterImpl;
687 
696 class KHTML_EXPORT Counter
697 {
698  friend class CSSPrimitiveValue;
699 public:
700  Counter();
701  Counter(const Counter &other);
702 public:
703 
704  Counter &operator = (const Counter &other);
705 
706  ~Counter();
707 
712  DOM::DOMString identifier() const;
713 
718  DOM::DOMString listStyle() const;
719 
724  DOM::DOMString separator() const;
725 
730  CounterImpl *handle() const;
731  bool isNull() const;
732 
733 protected:
734  CounterImpl *impl;
735  Counter(CounterImpl *i);
736 };
737 
738 } // namespace
739 
740 #endif
UnitTypes
An integer indicating which type of unit applies to the value.
Definition: css_value.h:255
The CSSStyleDeclaration interface represents a single CSS declaration block .
Definition: css_value.h:59
QRgb color() const
Definition: css_value.h:621
The CSSValueList interface provides the absraction of an ordered collection of CSS values...
Definition: css_value.h:311
QRgb rgb() const const
The CSSPrimitiveValue interface represents a single CSS value .
Definition: css_value.h:367
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
RGBColor(const QColor &c)
Definition: css_value.h:589
The Rect interface is used to represent any rect value.
Definition: css_value.h:639
This library provides a full-featured HTML parser and widget.
The CSSRule interface is the abstract base interface for any type of CSS statement ...
Definition: css_rule.h:53
The RGBColor interface is used to represent any RGB color value.
Definition: css_value.h:582
QCA_EXPORT void setProperty(const QString &name, const QVariant &value)
The CSSValue interface represents a simple or a complexe value.
Definition: css_value.h:237
The Counter interface is used to represent any counter or counters function value.
Definition: css_value.h:696
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat Aug 8 2020 22:44:49 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.