khtml Library API Documentation

css_ruleimpl.h

00001 /* 00002 * This file is part of the DOM implementation for KDE. 00003 * 00004 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 00005 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) 00006 * Copyright (C) 2002 Apple Computer, Inc. 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Library General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2 of the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Library General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Library General Public License 00019 * along with this library; see the file COPYING.LIB. If not, write to 00020 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00021 * Boston, MA 02111-1307, USA. 00022 * 00023 */ 00024 #ifndef _CSS_css_ruleimpl_h_ 00025 #define _CSS_css_ruleimpl_h_ 00026 00027 #include "dom/dom_string.h" 00028 #include "dom/css_rule.h" 00029 #include "css/css_base.h" 00030 #include "misc/loader_client.h" 00031 #include "misc/shared.h" 00032 00033 namespace khtml { 00034 class CachedCSSStyleSheet; 00035 } 00036 00037 namespace DOM { 00038 00039 class CSSRule; 00040 class CSSStyleSheet; 00041 class CSSStyleSheetImpl; 00042 class CSSStyleDeclarationImpl; 00043 class MediaListImpl; 00044 00045 class CSSRuleImpl : public StyleBaseImpl 00046 { 00047 public: 00048 CSSRuleImpl(StyleBaseImpl *parent) 00049 : StyleBaseImpl(parent), m_type(CSSRule::UNKNOWN_RULE) {} 00050 00051 virtual bool isRule() const { return true; } 00052 unsigned short type() const { return m_type; } 00053 00054 CSSStyleSheetImpl *parentStyleSheet() const; 00055 CSSRuleImpl *parentRule() const; 00056 00057 DOM::DOMString cssText() const; 00058 void setCssText(DOM::DOMString str); 00059 virtual void init() {} 00060 00061 protected: 00062 CSSRule::RuleType m_type; 00063 }; 00064 00065 00066 class CSSCharsetRuleImpl : public CSSRuleImpl 00067 { 00068 public: 00069 CSSCharsetRuleImpl(StyleBaseImpl *parent) 00070 : CSSRuleImpl(parent) { m_type = CSSRule::CHARSET_RULE; } 00071 00072 virtual bool isCharsetRule() const { return true; } 00073 00074 DOMString encoding() const { return m_encoding; } 00075 void setEncoding(DOMString _encoding) { m_encoding = _encoding; } 00076 00077 protected: 00078 DOMString m_encoding; 00079 }; 00080 00081 00082 class CSSFontFaceRuleImpl : public CSSRuleImpl 00083 { 00084 public: 00085 CSSFontFaceRuleImpl(StyleBaseImpl *parent); 00086 00087 virtual ~CSSFontFaceRuleImpl(); 00088 00089 CSSStyleDeclarationImpl *style() const { return m_style; } 00090 00091 virtual bool isFontFaceRule() const { return true; } 00092 00093 protected: 00094 CSSStyleDeclarationImpl *m_style; 00095 }; 00096 00097 00098 class CSSImportRuleImpl : public khtml::CachedObjectClient, public CSSRuleImpl 00099 { 00100 public: 00101 CSSImportRuleImpl( StyleBaseImpl *parent, const DOM::DOMString &href, 00102 const DOM::DOMString &media ); 00103 CSSImportRuleImpl( StyleBaseImpl *parent, const DOM::DOMString &href, 00104 MediaListImpl *media ); 00105 00106 virtual ~CSSImportRuleImpl(); 00107 00108 DOM::DOMString href() const { return m_strHref; } 00109 MediaListImpl *media() const { return m_lstMedia; } 00110 CSSStyleSheetImpl *styleSheet() const { return m_styleSheet; } 00111 00112 virtual bool isImportRule() const { return true; } 00113 00114 // from CachedObjectClient 00115 virtual void setStyleSheet(const DOM::DOMString &url, const DOM::DOMString &sheet); 00116 virtual void error(int err, const QString &text); 00117 00118 bool isLoading(); 00119 virtual void init(); 00120 00121 protected: 00122 DOMString m_strHref; 00123 MediaListImpl *m_lstMedia; 00124 CSSStyleSheetImpl *m_styleSheet; 00125 khtml::CachedCSSStyleSheet *m_cachedSheet; 00126 bool m_loading; 00127 bool m_done; 00128 }; 00129 00130 class MediaList; 00131 00132 class CSSRuleListImpl : public khtml::Shared<CSSRuleListImpl> 00133 { 00134 public: 00135 CSSRuleListImpl() {} 00136 00137 ~CSSRuleListImpl(); 00138 00139 unsigned long length() const { return m_lstCSSRules.count(); } 00140 CSSRuleImpl *item ( unsigned long index ) { return m_lstCSSRules.at( index ); } 00141 00142 00143 /* not part of the DOM */ 00144 unsigned long insertRule ( CSSRuleImpl *rule, unsigned long index ); 00145 void deleteRule ( unsigned long index ); 00146 00147 void append( CSSRuleImpl *rule ) { m_lstCSSRules.append( rule ); } 00148 protected: 00149 QPtrList<CSSRuleImpl> m_lstCSSRules; 00150 }; 00151 00152 class CSSMediaRuleImpl : public CSSRuleImpl 00153 { 00154 public: 00155 CSSMediaRuleImpl( StyleBaseImpl *parent ); 00156 CSSMediaRuleImpl( StyleBaseImpl *parent, const DOM::DOMString &media ); 00157 CSSMediaRuleImpl( StyleBaseImpl *parent, MediaListImpl *mediaList, CSSRuleListImpl *ruleList ); 00158 00159 virtual ~CSSMediaRuleImpl(); 00160 00161 MediaListImpl *media() const { return m_lstMedia; } 00162 CSSRuleListImpl *cssRules() { return m_lstCSSRules; } 00163 00164 unsigned long insertRule ( const DOM::DOMString &rule, unsigned long index ); 00165 void deleteRule ( unsigned long index ) { m_lstCSSRules->deleteRule( index ); } 00166 00167 virtual bool isMediaRule() const { return true; } 00168 00169 /* Not part of the DOM */ 00170 unsigned long append( CSSRuleImpl *rule ); 00171 protected: 00172 MediaListImpl *m_lstMedia; 00173 CSSRuleListImpl *m_lstCSSRules; 00174 }; 00175 00176 00177 class CSSPageRuleImpl : public CSSRuleImpl 00178 { 00179 public: 00180 CSSPageRuleImpl(StyleBaseImpl *parent); 00181 00182 virtual ~CSSPageRuleImpl(); 00183 00184 CSSStyleDeclarationImpl *style() const { return m_style; } 00185 00186 virtual bool isPageRule() const { return true; } 00187 00188 DOM::DOMString selectorText() const; 00189 void setSelectorText(DOM::DOMString str); 00190 00191 protected: 00192 CSSStyleDeclarationImpl *m_style; 00193 }; 00194 00195 00196 class CSSStyleRuleImpl : public CSSRuleImpl 00197 { 00198 public: 00199 CSSStyleRuleImpl(StyleBaseImpl *parent); 00200 00201 virtual ~CSSStyleRuleImpl(); 00202 00203 CSSStyleDeclarationImpl *style() const { return m_style; } 00204 00205 virtual bool isStyleRule() const { return true; } 00206 00207 DOM::DOMString selectorText() const; 00208 void setSelectorText(DOM::DOMString str); 00209 00210 virtual bool parseString( const DOMString &string, bool = false ); 00211 00212 void setSelector( QPtrList<CSSSelector> *selector) { m_selector = selector; } 00213 void setDeclaration( CSSStyleDeclarationImpl *style); 00214 00215 QPtrList<CSSSelector> *selector() { return m_selector; } 00216 CSSStyleDeclarationImpl *declaration() { return m_style; } 00217 00218 void setNonCSSHints(); 00219 00220 protected: 00221 CSSStyleDeclarationImpl *m_style; 00222 QPtrList<CSSSelector> *m_selector; 00223 }; 00224 00225 00226 class CSSUnknownRuleImpl : public CSSRuleImpl 00227 { 00228 public: 00229 CSSUnknownRuleImpl(StyleBaseImpl *parent) : CSSRuleImpl(parent) {} 00230 00231 virtual bool isUnknownRule() const { return true; } 00232 }; 00233 00234 00235 } // namespace 00236 00237 #endif
KDE Logo
This file is part of the documentation for khtml Library Version 3.4.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Apr 12 23:31:21 2005 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003