• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KHTML

  • sources
  • kde-4.14
  • kdelibs
  • khtml
  • dom
css_value.h
Go to the documentation of this file.
1 /*
2  * This file is part of the DOM implementation for KDE.
3  *
4  * Copyright 1999 Lars Knoll (knoll@kde.org)
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  * http://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 <QtGui/QColor>
33 
34 #include <kdemacros.h>
35 
36 namespace DOM {
37 
38 class CSSStyleDeclarationImpl;
39 class CSSRule;
40 class CSSValue;
41 
60 class KHTML_EXPORT CSSStyleDeclaration
61 {
62 public:
63  CSSStyleDeclaration();
64  CSSStyleDeclaration(const CSSStyleDeclaration &other);
65  CSSStyleDeclaration(CSSStyleDeclarationImpl *impl);
66 public:
67 
68  CSSStyleDeclaration & operator = (const CSSStyleDeclaration &other);
69 
70  ~CSSStyleDeclaration();
71 
79  DOM::DOMString cssText() const;
80 
92  void setCssText( const DOM::DOMString & );
93 
99  unsigned long length() const;
100 
105  CSSRule parentRule() const;
106 
120  DOM::DOMString getPropertyValue ( const DOM::DOMString &propertyName ) const;
121 
141  CSSValue getPropertyCSSValue ( const DOM::DOMString &propertyName ) const;
142 
161  DOM::DOMString removeProperty ( const DOM::DOMString &propertyName );
162 
177  DOM::DOMString getPropertyPriority ( const DOM::DOMString &propertyName ) const;
178 
203  void setProperty ( const DOM::DOMString &propertyName, const DOM::DOMString &value, const DOM::DOMString &priority );
204 
218  DOM::DOMString item ( unsigned long index ) const;
219  DOM::DOMString item ( unsigned long index ); // ### KDE5: remove
220 
225  CSSStyleDeclarationImpl *handle() const;
226  bool isNull() const;
227 
228 protected:
229  CSSStyleDeclarationImpl *impl;
230 };
231 
232 
233 class CSSValueImpl;
234 
240 class KHTML_EXPORT CSSValue
241 {
242 public:
243  CSSValue();
244  CSSValue(const CSSValue &other);
245  CSSValue(CSSValueImpl *impl);
246 public:
247 
248  CSSValue & operator = (const CSSValue &other);
249 
250  ~CSSValue();
258  enum UnitTypes {
259  CSS_INHERIT = 0,
260  CSS_PRIMITIVE_VALUE = 1,
261  CSS_VALUE_LIST = 2,
262  CSS_CUSTOM = 3,
263  CSS_INITIAL = 4,
264 
265  CSS_SVG_VALUE = 1001
266  };
267 
272  DOM::DOMString cssText() const;
273 
285  void setCssText( const DOM::DOMString & );
286 
291  unsigned short cssValueType() const;
292 
297  bool isCSSValueList() const;
298  bool isCSSPrimitiveValue() const;
299  CSSValueImpl *handle() const;
300  bool isNull() const;
301 
302 protected:
303  CSSValueImpl *impl;
304 };
305 
306 
307 class CSSValueListImpl;
308 class CSSValue;
309 
315 class KHTML_EXPORT CSSValueList : public CSSValue
316 {
317 public:
318  CSSValueList();
319  CSSValueList(const CSSValueList &other);
320  CSSValueList(const CSSValue &other);
321  CSSValueList(CSSValueListImpl *impl);
322 public:
323 
324  CSSValueList & operator = (const CSSValueList &other);
325  CSSValueList & operator = (const CSSValue &other);
326 
327  ~CSSValueList();
328 
335  unsigned long length() const;
336 
349  CSSValue item ( unsigned long index );
350 
351 protected:
352  CSSValueListImpl *vimpl;
353 };
354 
355 
356 class CSSPrimitiveValueImpl;
357 class Counter;
358 class RGBColor;
359 class Rect;
360 
372 class KHTML_EXPORT CSSPrimitiveValue : public CSSValue
373 {
374 public:
375  CSSPrimitiveValue();
376  CSSPrimitiveValue(const CSSPrimitiveValue &other);
377  CSSPrimitiveValue(const CSSValue &other);
378  CSSPrimitiveValue(CSSPrimitiveValueImpl *impl);
379 public:
380 
381  CSSPrimitiveValue & operator = (const CSSPrimitiveValue &other);
382  CSSPrimitiveValue & operator = (const CSSValue &other);
383 
384  ~CSSPrimitiveValue();
389  enum UnitTypes {
390  CSS_UNKNOWN = 0,
391  CSS_NUMBER = 1,
392  CSS_PERCENTAGE = 2,
393  CSS_EMS = 3,
394  CSS_EXS = 4,
395  CSS_CHS = 5,
396  CSS_REMS = 6,
397  CSS_PX = 7,
398  CSS_CM = 8,
399  CSS_MM = 9,
400  CSS_IN = 10,
401  CSS_PT = 11,
402  CSS_PC = 12,
403  CSS_DEG = 13,
404  CSS_RAD = 14,
405  CSS_GRAD = 15,
406  CSS_MS = 16,
407  CSS_S = 17,
408  CSS_HZ = 18,
409  CSS_KHZ = 19,
410  CSS_DIMENSION = 20,
411  CSS_STRING = 21,
412  CSS_URI = 22,
413  CSS_IDENT = 23,
414  CSS_ATTR = 24,
415  CSS_COUNTER = 25,
416  CSS_RECT = 26,
417  CSS_RGBCOLOR = 27,
418  CSS_DPI = 28,
419  CSS_DPCM = 29,
420  CSS_PAIR = 100, // We envision this being exposed as a means of getting computed style values for pairs
421  CSS_HTML_RELATIVE = 255
422  };
423 
429  unsigned short primitiveType() const;
430 
459  void setFloatValue ( unsigned short unitType, float floatValue );
460 
486  float getFloatValue ( unsigned short unitType ) const;
487 
513  void setStringValue ( unsigned short stringType, const DOM::DOMString &stringValue );
514 
530  DOM::DOMString getStringValue ( ) const;
531 
545  Counter getCounterValue ( ) const;
546 
560  Rect getRectValue ( ) const;
561 
576  RGBColor getRGBColorValue ( ) const;
577 };
578 
579 
580 
589 class KHTML_EXPORT RGBColor
590 {
591 public:
592  RGBColor();
596  RGBColor(const QColor& c) { m_color = c.rgb(); }
597  RGBColor(QRgb color);
598 
599  RGBColor(const RGBColor &other);
600  RGBColor & operator = (const RGBColor &other);
601 
602  ~RGBColor();
603 
608  CSSPrimitiveValue red() const;
609 
614  CSSPrimitiveValue green() const;
615 
620  CSSPrimitiveValue blue() const;
621 
625  QRgb color() const { return m_color; }
626 protected:
627  QRgb m_color;
628 };
629 
630 class RectImpl;
631 
640 class KHTML_EXPORT Rect
641 {
642  friend class CSSPrimitiveValue;
643 public:
644  Rect();
645  Rect(const Rect &other);
646 
647  Rect & operator = (const Rect &other);
648 
649  ~Rect();
650 
655  CSSPrimitiveValue top() const;
656 
661  CSSPrimitiveValue right() const;
662 
667  CSSPrimitiveValue bottom() const;
668 
673  CSSPrimitiveValue left() const;
674 
679  RectImpl *handle() const;
680  bool isNull() const;
681 
682 protected:
683  RectImpl *impl;
684  Rect(RectImpl *i);
685 };
686 
687 class CounterImpl;
688 
697 class KHTML_EXPORT Counter
698 {
699  friend class CSSPrimitiveValue;
700 public:
701  Counter();
702  Counter(const Counter &other);
703 public:
704 
705  Counter & operator = (const Counter &other);
706 
707  ~Counter();
708 
713  DOM::DOMString identifier() const;
714 
719  DOM::DOMString listStyle() const;
720 
725  DOM::DOMString separator() const;
726 
731  CounterImpl *handle() const;
732  bool isNull() const;
733 
734 protected:
735  CounterImpl *impl;
736  Counter(CounterImpl *i);
737 };
738 
739 
740 } // namespace
741 
742 
743 #endif
dom_string.h
DOM::CSSStyleDeclaration::impl
CSSStyleDeclarationImpl * impl
Definition: css_value.h:229
DOM::CSSValue::UnitTypes
UnitTypes
An integer indicating which type of unit applies to the value.
Definition: css_value.h:258
DOM::CSSStyleDeclaration
The CSSStyleDeclaration interface represents a single CSS declaration block .
Definition: css_value.h:60
DOM::CSSValueList::vimpl
CSSValueListImpl * vimpl
Definition: css_value.h:352
DOM::RGBColor::color
QRgb color() const
Definition: css_value.h:625
DOM::CSSValueList
The CSSValueList interface provides the absraction of an ordered collection of CSS values...
Definition: css_value.h:315
QColor::rgb
QRgb rgb() const
DOM::CSSPrimitiveValue
The CSSPrimitiveValue interface represents a single CSS value .
Definition: css_value.h:372
khtml::XPath::stringValue
DOMString stringValue(NodeImpl *node)
Definition: util.cpp:68
DOM::DOMString
This class implements the basic string we use in the DOM.
Definition: dom_string.h:43
DOM::Counter::impl
CounterImpl * impl
Definition: css_value.h:735
DOM::Rect::impl
RectImpl * impl
Definition: css_value.h:683
QColor
DOM::RGBColor::RGBColor
RGBColor(const QColor &c)
Definition: css_value.h:596
DOM::Rect
The Rect interface is used to represent any rect value.
Definition: css_value.h:640
DOM::RGBColor::m_color
QRgb m_color
Definition: css_value.h:627
DOM::CSSRule
The CSSRule interface is the abstract base interface for any type of CSS statement ...
Definition: css_rule.h:52
DOM::RGBColor
The RGBColor interface is used to represent any RGB color value.
Definition: css_value.h:589
DOM::CSSValue::impl
CSSValueImpl * impl
Definition: css_value.h:303
DOM::CSSValue
The CSSValue interface represents a simple or a complexe value.
Definition: css_value.h:240
DOM::Counter
The Counter interface is used to represent any counter or counters function value.
Definition: css_value.h:697
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:26:18 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KHTML

Skip menu "KHTML"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal