KHTML
css_value.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef _CSS_css_value_h_
00028 #define _CSS_css_value_h_
00029
00030 #include <dom/dom_string.h>
00031
00032 #include <QtGui/QColor>
00033
00034 #include <kdemacros.h>
00035
00036 namespace DOM {
00037
00038 class CSSStyleDeclarationImpl;
00039 class CSSRule;
00040 class CSSValue;
00041
00060 class KHTML_EXPORT CSSStyleDeclaration
00061 {
00062 public:
00063 CSSStyleDeclaration();
00064 CSSStyleDeclaration(const CSSStyleDeclaration &other);
00065 CSSStyleDeclaration(CSSStyleDeclarationImpl *impl);
00066 public:
00067
00068 CSSStyleDeclaration & operator = (const CSSStyleDeclaration &other);
00069
00070 ~CSSStyleDeclaration();
00071
00079 DOM::DOMString cssText() const;
00080
00092 void setCssText( const DOM::DOMString & );
00093
00099 unsigned long length() const;
00100
00105 CSSRule parentRule() const;
00106
00120 DOM::DOMString getPropertyValue ( const DOM::DOMString &propertyName ) const;
00121
00141 CSSValue getPropertyCSSValue ( const DOM::DOMString &propertyName ) const;
00142
00161 DOM::DOMString removeProperty ( const DOM::DOMString &propertyName );
00162
00177 DOM::DOMString getPropertyPriority ( const DOM::DOMString &propertyName ) const;
00178
00203 void setProperty ( const DOM::DOMString &propertyName, const DOM::DOMString &value, const DOM::DOMString &priority );
00204
00218 DOM::DOMString item ( unsigned long index ) const;
00219 DOM::DOMString item ( unsigned long index );
00220
00225 CSSStyleDeclarationImpl *handle() const;
00226 bool isNull() const;
00227
00228 protected:
00229 CSSStyleDeclarationImpl *impl;
00230 };
00231
00232
00233 class CSSValueImpl;
00234
00240 class KHTML_EXPORT CSSValue
00241 {
00242 public:
00243 CSSValue();
00244 CSSValue(const CSSValue &other);
00245 CSSValue(CSSValueImpl *impl);
00246 public:
00247
00248 CSSValue & operator = (const CSSValue &other);
00249
00250 ~CSSValue();
00258 enum UnitTypes {
00259 CSS_INHERIT = 0,
00260 CSS_PRIMITIVE_VALUE = 1,
00261 CSS_VALUE_LIST = 2,
00262 CSS_CUSTOM = 3,
00263 CSS_INITIAL = 4
00264 };
00265
00270 DOM::DOMString cssText() const;
00271
00283 void setCssText( const DOM::DOMString & );
00284
00289 unsigned short cssValueType() const;
00290
00295 bool isCSSValueList() const;
00296 bool isCSSPrimitiveValue() const;
00297 CSSValueImpl *handle() const;
00298 bool isNull() const;
00299
00300 protected:
00301 CSSValueImpl *impl;
00302 };
00303
00304
00305 class CSSValueListImpl;
00306 class CSSValue;
00307
00313 class KHTML_EXPORT CSSValueList : public CSSValue
00314 {
00315 public:
00316 CSSValueList();
00317 CSSValueList(const CSSValueList &other);
00318 CSSValueList(const CSSValue &other);
00319 CSSValueList(CSSValueListImpl *impl);
00320 public:
00321
00322 CSSValueList & operator = (const CSSValueList &other);
00323 CSSValueList & operator = (const CSSValue &other);
00324
00325 ~CSSValueList();
00326
00333 unsigned long length() const;
00334
00347 CSSValue item ( unsigned long index );
00348
00349 protected:
00350 CSSValueListImpl *vimpl;
00351 };
00352
00353
00354 class CSSPrimitiveValueImpl;
00355 class Counter;
00356 class RGBColor;
00357 class Rect;
00358
00370 class KHTML_EXPORT CSSPrimitiveValue : public CSSValue
00371 {
00372 public:
00373 CSSPrimitiveValue();
00374 CSSPrimitiveValue(const CSSPrimitiveValue &other);
00375 CSSPrimitiveValue(const CSSValue &other);
00376 CSSPrimitiveValue(CSSPrimitiveValueImpl *impl);
00377 public:
00378
00379 CSSPrimitiveValue & operator = (const CSSPrimitiveValue &other);
00380 CSSPrimitiveValue & operator = (const CSSValue &other);
00381
00382 ~CSSPrimitiveValue();
00387 enum UnitTypes {
00388 CSS_UNKNOWN = 0,
00389 CSS_NUMBER = 1,
00390 CSS_PERCENTAGE = 2,
00391 CSS_EMS = 3,
00392 CSS_EXS = 4,
00393 CSS_PX = 5,
00394 CSS_CM = 6,
00395 CSS_MM = 7,
00396 CSS_IN = 8,
00397 CSS_PT = 9,
00398 CSS_PC = 10,
00399 CSS_DEG = 11,
00400 CSS_RAD = 12,
00401 CSS_GRAD = 13,
00402 CSS_MS = 14,
00403 CSS_S = 15,
00404 CSS_HZ = 16,
00405 CSS_KHZ = 17,
00406 CSS_DIMENSION = 18,
00407 CSS_STRING = 19,
00408 CSS_URI = 20,
00409 CSS_IDENT = 21,
00410 CSS_ATTR = 22,
00411 CSS_COUNTER = 23,
00412 CSS_RECT = 24,
00413 CSS_RGBCOLOR = 25,
00414 CSS_DPI = 26,
00415 CSS_DPCM = 27,
00416 CSS_PAIR = 100,
00417 CSS_HTML_RELATIVE = 255
00418 };
00419
00425 unsigned short primitiveType() const;
00426
00455 void setFloatValue ( unsigned short unitType, float floatValue );
00456
00482 float getFloatValue ( unsigned short unitType ) const;
00483
00509 void setStringValue ( unsigned short stringType, const DOM::DOMString &stringValue );
00510
00526 DOM::DOMString getStringValue ( ) const;
00527
00541 Counter getCounterValue ( ) const;
00542
00556 Rect getRectValue ( ) const;
00557
00572 RGBColor getRGBColorValue ( ) const;
00573 };
00574
00575
00576
00585 class KHTML_EXPORT RGBColor
00586 {
00587 public:
00588 RGBColor();
00592 RGBColor(const QColor& c) { m_color = c.rgb(); }
00593 RGBColor(QRgb color);
00594
00595 RGBColor(const RGBColor &other);
00596 RGBColor & operator = (const RGBColor &other);
00597
00598 ~RGBColor();
00599
00604 CSSPrimitiveValue red() const;
00605
00610 CSSPrimitiveValue green() const;
00611
00616 CSSPrimitiveValue blue() const;
00617
00621 QRgb color() const { return m_color; }
00622 protected:
00623 QRgb m_color;
00624 };
00625
00626 class RectImpl;
00627
00636 class KHTML_EXPORT Rect
00637 {
00638 friend class CSSPrimitiveValue;
00639 public:
00640 Rect();
00641 Rect(const Rect &other);
00642
00643 Rect & operator = (const Rect &other);
00644
00645 ~Rect();
00646
00651 CSSPrimitiveValue top() const;
00652
00657 CSSPrimitiveValue right() const;
00658
00663 CSSPrimitiveValue bottom() const;
00664
00669 CSSPrimitiveValue left() const;
00670
00675 RectImpl *handle() const;
00676 bool isNull() const;
00677
00678 protected:
00679 RectImpl *impl;
00680 Rect(RectImpl *i);
00681 };
00682
00683 class CounterImpl;
00684
00693 class KHTML_EXPORT Counter
00694 {
00695 friend class CSSPrimitiveValue;
00696 public:
00697 Counter();
00698 Counter(const Counter &other);
00699 public:
00700
00701 Counter & operator = (const Counter &other);
00702
00703 ~Counter();
00704
00709 DOM::DOMString identifier() const;
00710
00715 DOM::DOMString listStyle() const;
00716
00721 DOM::DOMString separator() const;
00722
00727 CounterImpl *handle() const;
00728 bool isNull() const;
00729
00730 protected:
00731 CounterImpl *impl;
00732 Counter(CounterImpl *i);
00733 };
00734
00735
00736 }
00737
00738
00739 #endif