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 CSS_SVG_VALUE = 1001
00266 };
00267
00272 DOM::DOMString cssText() const;
00273
00285 void setCssText( const DOM::DOMString & );
00286
00291 unsigned short cssValueType() const;
00292
00297 bool isCSSValueList() const;
00298 bool isCSSPrimitiveValue() const;
00299 CSSValueImpl *handle() const;
00300 bool isNull() const;
00301
00302 protected:
00303 CSSValueImpl *impl;
00304 };
00305
00306
00307 class CSSValueListImpl;
00308 class CSSValue;
00309
00315 class KHTML_EXPORT CSSValueList : public CSSValue
00316 {
00317 public:
00318 CSSValueList();
00319 CSSValueList(const CSSValueList &other);
00320 CSSValueList(const CSSValue &other);
00321 CSSValueList(CSSValueListImpl *impl);
00322 public:
00323
00324 CSSValueList & operator = (const CSSValueList &other);
00325 CSSValueList & operator = (const CSSValue &other);
00326
00327 ~CSSValueList();
00328
00335 unsigned long length() const;
00336
00349 CSSValue item ( unsigned long index );
00350
00351 protected:
00352 CSSValueListImpl *vimpl;
00353 };
00354
00355
00356 class CSSPrimitiveValueImpl;
00357 class Counter;
00358 class RGBColor;
00359 class Rect;
00360
00372 class KHTML_EXPORT CSSPrimitiveValue : public CSSValue
00373 {
00374 public:
00375 CSSPrimitiveValue();
00376 CSSPrimitiveValue(const CSSPrimitiveValue &other);
00377 CSSPrimitiveValue(const CSSValue &other);
00378 CSSPrimitiveValue(CSSPrimitiveValueImpl *impl);
00379 public:
00380
00381 CSSPrimitiveValue & operator = (const CSSPrimitiveValue &other);
00382 CSSPrimitiveValue & operator = (const CSSValue &other);
00383
00384 ~CSSPrimitiveValue();
00389 enum UnitTypes {
00390 CSS_UNKNOWN = 0,
00391 CSS_NUMBER = 1,
00392 CSS_PERCENTAGE = 2,
00393 CSS_EMS = 3,
00394 CSS_EXS = 4,
00395 CSS_PX = 5,
00396 CSS_CM = 6,
00397 CSS_MM = 7,
00398 CSS_IN = 8,
00399 CSS_PT = 9,
00400 CSS_PC = 10,
00401 CSS_DEG = 11,
00402 CSS_RAD = 12,
00403 CSS_GRAD = 13,
00404 CSS_MS = 14,
00405 CSS_S = 15,
00406 CSS_HZ = 16,
00407 CSS_KHZ = 17,
00408 CSS_DIMENSION = 18,
00409 CSS_STRING = 19,
00410 CSS_URI = 20,
00411 CSS_IDENT = 21,
00412 CSS_ATTR = 22,
00413 CSS_COUNTER = 23,
00414 CSS_RECT = 24,
00415 CSS_RGBCOLOR = 25,
00416 CSS_DPI = 26,
00417 CSS_DPCM = 27,
00418 CSS_PAIR = 100,
00419 CSS_HTML_RELATIVE = 255
00420 };
00421
00427 unsigned short primitiveType() const;
00428
00457 void setFloatValue ( unsigned short unitType, float floatValue );
00458
00484 float getFloatValue ( unsigned short unitType ) const;
00485
00511 void setStringValue ( unsigned short stringType, const DOM::DOMString &stringValue );
00512
00528 DOM::DOMString getStringValue ( ) const;
00529
00543 Counter getCounterValue ( ) const;
00544
00558 Rect getRectValue ( ) const;
00559
00574 RGBColor getRGBColorValue ( ) const;
00575 };
00576
00577
00578
00587 class KHTML_EXPORT RGBColor
00588 {
00589 public:
00590 RGBColor();
00594 RGBColor(const QColor& c) { m_color = c.rgb(); }
00595 RGBColor(QRgb color);
00596
00597 RGBColor(const RGBColor &other);
00598 RGBColor & operator = (const RGBColor &other);
00599
00600 ~RGBColor();
00601
00606 CSSPrimitiveValue red() const;
00607
00612 CSSPrimitiveValue green() const;
00613
00618 CSSPrimitiveValue blue() const;
00619
00623 QRgb color() const { return m_color; }
00624 protected:
00625 QRgb m_color;
00626 };
00627
00628 class RectImpl;
00629
00638 class KHTML_EXPORT Rect
00639 {
00640 friend class CSSPrimitiveValue;
00641 public:
00642 Rect();
00643 Rect(const Rect &other);
00644
00645 Rect & operator = (const Rect &other);
00646
00647 ~Rect();
00648
00653 CSSPrimitiveValue top() const;
00654
00659 CSSPrimitiveValue right() const;
00660
00665 CSSPrimitiveValue bottom() const;
00666
00671 CSSPrimitiveValue left() const;
00672
00677 RectImpl *handle() const;
00678 bool isNull() const;
00679
00680 protected:
00681 RectImpl *impl;
00682 Rect(RectImpl *i);
00683 };
00684
00685 class CounterImpl;
00686
00695 class KHTML_EXPORT Counter
00696 {
00697 friend class CSSPrimitiveValue;
00698 public:
00699 Counter();
00700 Counter(const Counter &other);
00701 public:
00702
00703 Counter & operator = (const Counter &other);
00704
00705 ~Counter();
00706
00711 DOM::DOMString identifier() const;
00712
00717 DOM::DOMString listStyle() const;
00718
00723 DOM::DOMString separator() const;
00724
00729 CounterImpl *handle() const;
00730 bool isNull() const;
00731
00732 protected:
00733 CounterImpl *impl;
00734 Counter(CounterImpl *i);
00735 };
00736
00737
00738 }
00739
00740
00741 #endif