KHTML
css_rule.h
Go to the documentation of this file.00001 /* 00002 * This file is part of the DOM implementation for KDE. 00003 * 00004 * (C) 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 (Candidate Recommendation) 00023 * http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/ 00024 * Copyright © 2000 W3C® (MIT, INRIA, Keio), All Rights Reserved. 00025 * 00026 */ 00027 #ifndef _CSS_css_rule_h_ 00028 #define _CSS_css_rule_h_ 00029 00030 #include <dom/dom_string.h> 00031 #include <dom/css_stylesheet.h> 00032 #include <dom/css_value.h> 00033 00034 namespace DOM { 00035 00036 class CSSRuleImpl; 00037 00052 class KHTML_EXPORT CSSRule 00053 { 00054 public: 00055 CSSRule(); 00056 CSSRule(const CSSRule &other); 00057 CSSRule(CSSRuleImpl *impl); 00058 public: 00059 00060 CSSRule & operator = (const CSSRule &other); 00061 00062 ~CSSRule(); 00067 enum RuleType { 00068 UNKNOWN_RULE = 0, 00069 STYLE_RULE = 1, 00070 CHARSET_RULE = 2, 00071 IMPORT_RULE = 3, 00072 MEDIA_RULE = 4, 00073 FONT_FACE_RULE = 5, 00074 PAGE_RULE = 6, 00075 QUIRKS_RULE = 100 // KHTML CSS Extension 00076 }; 00077 00085 unsigned short type() const; 00086 00092 DOM::DOMString cssText() const; 00093 00111 void setCssText( const DOM::DOMString & ); 00112 00117 CSSStyleSheet parentStyleSheet() const; 00118 00126 CSSRule parentRule() const; 00127 00132 CSSRuleImpl *handle() const; 00133 bool isNull() const; 00134 00135 protected: 00136 CSSRuleImpl *impl; 00137 00138 void assignOther( const CSSRule &other, RuleType thisType ); 00139 }; 00140 00141 class CSSCharsetRuleImpl; 00142 00149 class KHTML_EXPORT CSSCharsetRule : public CSSRule 00150 { 00151 public: 00152 CSSCharsetRule(); 00153 CSSCharsetRule(const CSSCharsetRule &other); 00154 CSSCharsetRule(const CSSRule &other); 00155 CSSCharsetRule(CSSCharsetRuleImpl *impl); 00156 public: 00157 00158 CSSCharsetRule & operator = (const CSSCharsetRule &other); 00159 CSSCharsetRule & operator = (const CSSRule &other); 00160 00161 ~CSSCharsetRule(); 00162 00168 DOM::DOMString encoding() const; 00169 00181 void setEncoding( const DOM::DOMString & ); 00182 }; 00183 00184 00185 class CSSFontFaceRuleImpl; 00193 class KHTML_EXPORT CSSFontFaceRule : public CSSRule 00194 { 00195 public: 00196 CSSFontFaceRule(); 00197 CSSFontFaceRule(const CSSFontFaceRule &other); 00198 CSSFontFaceRule(const CSSRule &other); 00199 CSSFontFaceRule(CSSFontFaceRuleImpl *impl); 00200 public: 00201 00202 CSSFontFaceRule & operator = (const CSSFontFaceRule &other); 00203 CSSFontFaceRule & operator = (const CSSRule &other); 00204 00205 ~CSSFontFaceRule(); 00206 00212 CSSStyleDeclaration style() const; 00213 }; 00214 00215 class CSSImportRuleImpl; 00223 class KHTML_EXPORT CSSImportRule : public CSSRule 00224 { 00225 public: 00226 CSSImportRule(); 00227 CSSImportRule(const CSSImportRule &other); 00228 CSSImportRule(const CSSRule &other); 00229 CSSImportRule(CSSImportRuleImpl *impl); 00230 public: 00231 00232 CSSImportRule & operator = (const CSSImportRule &other); 00233 CSSImportRule & operator = (const CSSRule &other); 00234 00235 ~CSSImportRule(); 00236 00243 DOM::DOMString href() const; 00244 00249 MediaList media() const; 00250 00259 CSSStyleSheet styleSheet() const; 00260 }; 00261 00262 class CSSMediaRuleImpl; 00270 class KHTML_EXPORT CSSMediaRule : public CSSRule 00271 { 00272 public: 00273 CSSMediaRule(); 00274 CSSMediaRule(const CSSMediaRule &other); 00275 CSSMediaRule(const CSSRule &other); 00276 CSSMediaRule(CSSMediaRuleImpl *impl); 00277 public: 00278 00279 CSSMediaRule & operator = (const CSSMediaRule &other); 00280 CSSMediaRule & operator = (const CSSRule &other); 00281 00282 ~CSSMediaRule(); 00283 00290 MediaList media() const; 00291 00296 CSSRuleList cssRules() const; 00297 00331 unsigned long insertRule ( const DOM::DOMString &rule, unsigned long index ); 00332 00349 void deleteRule ( unsigned long index ); 00350 }; 00351 00352 00353 class CSSPageRuleImpl; 00362 class KHTML_EXPORT CSSPageRule : public CSSRule 00363 { 00364 public: 00365 CSSPageRule(); 00366 CSSPageRule(const CSSPageRule &other); 00367 CSSPageRule(const CSSRule &other); 00368 CSSPageRule(CSSPageRuleImpl *impl); 00369 public: 00370 00371 CSSPageRule & operator = (const CSSPageRule &other); 00372 CSSPageRule & operator = (const CSSRule &other); 00373 00374 ~CSSPageRule(); 00375 00381 DOM::DOMString selectorText() const; 00382 00394 void setSelectorText( const DOM::DOMString & ); 00395 00401 CSSStyleDeclaration style() const; 00402 }; 00403 00404 class CSSStyleRuleImpl; 00411 class KHTML_EXPORT CSSStyleRule : public CSSRule 00412 { 00413 public: 00414 CSSStyleRule(); 00415 CSSStyleRule(const CSSStyleRule &other); 00416 CSSStyleRule(const CSSRule &other); 00417 CSSStyleRule(CSSStyleRuleImpl *impl); 00418 public: 00419 00420 CSSStyleRule & operator = (const CSSStyleRule &other); 00421 CSSStyleRule & operator = (const CSSRule &other); 00422 00423 ~CSSStyleRule(); 00424 00432 DOM::DOMString selectorText() const; 00433 00445 void setSelectorText( const DOM::DOMString & ); 00446 00452 CSSStyleDeclaration style() const; 00453 }; 00454 00455 class CSSUnknownRuleImpl; 00461 class KHTML_EXPORT CSSUnknownRule : public CSSRule 00462 { 00463 public: 00464 CSSUnknownRule(); 00465 CSSUnknownRule(const CSSUnknownRule &other); 00466 CSSUnknownRule(const CSSRule &other); 00467 CSSUnknownRule(CSSUnknownRuleImpl *impl); 00468 public: 00469 00470 CSSUnknownRule & operator = (const CSSUnknownRule &other); 00471 CSSUnknownRule & operator = (const CSSRule &other); 00472 00473 ~CSSUnknownRule(); 00474 }; 00475 00476 00477 class CSSRuleListImpl; 00478 class StyleListImpl; 00484 class KHTML_EXPORT CSSRuleList 00485 { 00486 public: 00487 CSSRuleList(); 00488 CSSRuleList(const CSSRuleList &other); 00489 CSSRuleList(CSSRuleListImpl *i); 00490 CSSRuleList(StyleListImpl *i); 00491 public: 00492 00493 CSSRuleList & operator = (const CSSRuleList &other); 00494 00495 ~CSSRuleList(); 00496 00503 unsigned long length() const; 00504 00517 CSSRule item ( unsigned long index ); 00518 00523 CSSRuleListImpl *handle() const; 00524 bool isNull() const; 00525 00526 protected: 00527 // we just need a pointer to an implementation here. 00528 CSSRuleListImpl *impl; 00529 }; 00530 00531 00532 } // namespace 00533 00534 #endif