css_value.h
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 <qcolor.h>
00033 
00034 #include <kdemacros.h>
00035 
00036 namespace DOM {
00037 
00038 class CSSStyleDeclarationImpl;
00039 class CSSRule;
00040 class CSSValue;
00041 
00060 class 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     DOM::DOMString getPropertyValue ( const DOM::DOMString &propertyName );
00122 
00142     CSSValue getPropertyCSSValue ( const DOM::DOMString &propertyName ) const;
00143     CSSValue getPropertyCSSValue ( const DOM::DOMString &propertyName );
00144 
00163     DOM::DOMString removeProperty ( const DOM::DOMString &propertyName );
00164 
00179     DOM::DOMString getPropertyPriority ( const DOM::DOMString &propertyName ) const;
00180     DOM::DOMString getPropertyPriority ( const DOM::DOMString &propertyName );
00181 
00206     void setProperty ( const DOM::DOMString &propertyName, const DOM::DOMString &value, const DOM::DOMString &priority );
00207 
00221     DOM::DOMString item ( unsigned long index ) const;
00222     DOM::DOMString item ( unsigned long index );
00223 
00228     CSSStyleDeclarationImpl *handle() const;
00229     bool isNull() const;
00230 
00231 protected:
00232     CSSStyleDeclarationImpl *impl;
00233 };
00234 
00235 
00236 class CSSValueImpl;
00237 
00243 class CSSValue
00244 {
00245 public:
00246     CSSValue();
00247     CSSValue(const CSSValue &other);
00248     CSSValue(CSSValueImpl *impl);
00249 public:
00250 
00251     CSSValue & operator = (const CSSValue &other);
00252 
00253     ~CSSValue();
00261     enum UnitTypes {
00262     CSS_INHERIT = 0,
00263         CSS_PRIMITIVE_VALUE = 1,
00264         CSS_VALUE_LIST = 2,
00265         CSS_CUSTOM = 3
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 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 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_HTML_RELATIVE = 255
00417     };
00418 
00424     unsigned short primitiveType() const;
00425 
00454     void setFloatValue ( unsigned short unitType, float floatValue );
00455 
00481     
00482     float getFloatValue ( unsigned short unitType );
00483 
00509     void setStringValue ( unsigned short stringType, const DOM::DOMString &stringValue );
00510 
00526     
00527     DOM::DOMString getStringValue (  );
00528 
00542     
00543     Counter getCounterValue (  );
00544 
00558     
00559     Rect getRectValue (  );
00560 
00575     
00576     RGBColor getRGBColorValue (  );
00577 };
00578 
00579 
00580 
00589 class RGBColor
00590 {
00591 public:
00592     RGBColor();
00596     RGBColor(const QColor& c) { m_color = c.rgb(); }
00597     RGBColor(QRgb color);
00598 
00599     RGBColor(const RGBColor &other);
00600     RGBColor & operator = (const RGBColor &other);
00601 
00602     ~RGBColor();
00603 
00608     CSSPrimitiveValue red() const;
00609 
00614     CSSPrimitiveValue green() const;
00615 
00620     CSSPrimitiveValue blue() const;
00621 
00625     QRgb color() const { return m_color; }
00626 protected:
00627     QRgb m_color;
00628 };
00629 
00630 class RectImpl;
00631 
00640 class Rect
00641 {
00642     friend class CSSPrimitiveValue;
00643 public:
00644     Rect();
00645     Rect(const Rect &other);
00646 
00647     Rect & operator = (const Rect &other);
00648 
00649     ~Rect();
00650 
00655     CSSPrimitiveValue top() const;
00656 
00661     CSSPrimitiveValue right() const;
00662 
00667     CSSPrimitiveValue bottom() const;
00668 
00673     CSSPrimitiveValue left() const;
00674 
00679     RectImpl *handle() const;
00680     bool isNull() const;
00681 
00682 protected:
00683     RectImpl *impl;
00684     Rect(RectImpl *i);
00685 };
00686 
00687 class CounterImpl;
00688 
00697 class Counter
00698 {
00699     friend class CSSPrimitiveValue;
00700 public:
00701     Counter();
00702     Counter(const Counter &other);
00703 public:
00704 
00705     Counter & operator = (const Counter &other);
00706 
00707     ~Counter();
00708 
00713     DOM::DOMString identifier() const;
00714 
00719     DOM::DOMString listStyle() const;
00720 
00725     DOM::DOMString separator() const;
00726 
00731     CounterImpl *handle() const;
00732     bool isNull() const;
00733 
00734 protected:
00735     CounterImpl *impl;
00736     Counter(CounterImpl *i);
00737 };
00738 
00739 
00740 } 
00741 
00742 #endif
 
This file is part of the documentation for khtml Library Version 3.2.0.