KHTML
css_value.h
Go to the documentation of this file.
00001 /* 00002 * This file is part of the DOM implementation for KDE. 00003 * 00004 * Copyright 1999 Lars Knoll (knoll@kde.org) 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Library General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Library General Public License 00017 * along with this library; see the file COPYING.LIB. If not, write to 00018 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 * Boston, MA 02110-1301, USA. 00020 * 00021 * This file includes excerpts from the Document Object Model (DOM) 00022 * Level 2 Specification (Style) 00023 * http://www.w3.org/TR/DOM-Level-2-Style/ 00024 * Copyright © 2000 W3C® (MIT, INRIA, Keio), All Rights Reserved. 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 ); // ### KDE5: remove 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, // We envision this being exposed as a means of getting computed style values for pairs 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 } // namespace 00739 00740 00741 #endif
KDE 4.6 API Reference