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 * $Id: css_ruleimpl.h,v 1.25 2003/08/16 06:38:39 pmk Exp $ 00024 */ 00025 #ifndef _CSS_css_ruleimpl_h_ 00026 #define _CSS_css_ruleimpl_h_ 00027 00028 #include "dom/dom_string.h" 00029 #include "dom/css_rule.h" 00030 #include "css/css_base.h" 00031 #include "misc/loader_client.h" 00032 #include "misc/shared.h" 00033 00034 namespace khtml { 00035 class CachedCSSStyleSheet; 00036 } 00037 00038 namespace DOM { 00039 00040 class CSSRule; 00041 class CSSStyleSheet; 00042 class CSSStyleSheetImpl; 00043 class CSSStyleDeclarationImpl; 00044 class MediaListImpl; 00045 00046 class CSSRuleImpl : public StyleBaseImpl 00047 { 00048 public: 00049 CSSRuleImpl(StyleBaseImpl *parent) 00050 : StyleBaseImpl(parent), m_type(CSSRule::UNKNOWN_RULE) {} 00051 00052 virtual bool isRule() const { return true; } 00053 unsigned short type() const { return m_type; } 00054 00055 CSSStyleSheetImpl *parentStyleSheet() const; 00056 CSSRuleImpl *parentRule() const; 00057 00058 DOM::DOMString cssText() const; 00059 void setCssText(DOM::DOMString str); 00060 virtual void init() {} 00061 00062 protected: 00063 CSSRule::RuleType m_type; 00064 }; 00065 00066 00067 class CSSCharsetRuleImpl : public CSSRuleImpl 00068 { 00069 public: 00070 CSSCharsetRuleImpl(StyleBaseImpl *parent) 00071 : CSSRuleImpl(parent) { m_type = CSSRule::CHARSET_RULE; } 00072 00073 virtual bool isCharsetRule() const { return true; } 00074 00075 DOMString encoding() const { return m_encoding; } 00076 void setEncoding(DOMString _encoding) { m_encoding = _encoding; } 00077 00078 protected: 00079 DOMString m_encoding; 00080 }; 00081 00082 00083 class CSSFontFaceRuleImpl : public CSSRuleImpl 00084 { 00085 public: 00086 CSSFontFaceRuleImpl(StyleBaseImpl *parent); 00087 00088 virtual ~CSSFontFaceRuleImpl(); 00089 00090 CSSStyleDeclarationImpl *style() const { return m_style; } 00091 00092 virtual bool isFontFaceRule() const { return true; } 00093 00094 protected: 00095 CSSStyleDeclarationImpl *m_style; 00096 }; 00097 00098 00099 class CSSImportRuleImpl : public khtml::CachedObjectClient, public CSSRuleImpl 00100 { 00101 public: 00102 CSSImportRuleImpl( StyleBaseImpl *parent, const DOM::DOMString &href, 00103 const DOM::DOMString &media ); 00104 CSSImportRuleImpl( StyleBaseImpl *parent, const DOM::DOMString &href, 00105 MediaListImpl *media ); 00106 00107 virtual ~CSSImportRuleImpl(); 00108 00109 DOM::DOMString href() const { return m_strHref; } 00110 MediaListImpl *media() const { return m_lstMedia; } 00111 CSSStyleSheetImpl *styleSheet() const { return m_styleSheet; } 00112 00113 virtual bool isImportRule() const { return true; } 00114 00115 // from CachedObjectClient 00116 virtual void setStyleSheet(const DOM::DOMString &url, const DOM::DOMString &sheet); 00117 virtual void error(int err, const QString &text); 00118 00119 bool isLoading(); 00120 virtual void init(); 00121 00122 protected: 00123 DOMString m_strHref; 00124 MediaListImpl *m_lstMedia; 00125 CSSStyleSheetImpl *m_styleSheet; 00126 khtml::CachedCSSStyleSheet *m_cachedSheet; 00127 bool m_loading; 00128 bool m_done; 00129 }; 00130 00131 class MediaList; 00132 00133 class CSSRuleListImpl : public khtml::Shared<CSSRuleListImpl> 00134 { 00135 public: 00136 CSSRuleListImpl() {} 00137 00138 ~CSSRuleListImpl(); 00139 00140 unsigned long length() const { return m_lstCSSRules.count(); } 00141 CSSRuleImpl *item ( unsigned long index ) { return m_lstCSSRules.at( index ); } 00142 00143 00144 /* not part of the DOM */ 00145 unsigned long insertRule ( CSSRuleImpl *rule, unsigned long index ); 00146 void deleteRule ( unsigned long index ); 00147 00148 void append( CSSRuleImpl *rule ) { m_lstCSSRules.append( rule ); } 00149 protected: 00150 QPtrList<CSSRuleImpl> m_lstCSSRules; 00151 }; 00152 00153 class CSSMediaRuleImpl : public CSSRuleImpl 00154 { 00155 public: 00156 CSSMediaRuleImpl( StyleBaseImpl *parent ); 00157 CSSMediaRuleImpl( StyleBaseImpl *parent, const DOM::DOMString &media ); 00158 CSSMediaRuleImpl( StyleBaseImpl *parent, MediaListImpl *mediaList, CSSRuleListImpl *ruleList ); 00159 00160 virtual ~CSSMediaRuleImpl(); 00161 00162 MediaListImpl *media() const { return m_lstMedia; } 00163 CSSRuleListImpl *cssRules() { return m_lstCSSRules; } 00164 00165 unsigned long insertRule ( const DOM::DOMString &rule, unsigned long index ); 00166 void deleteRule ( unsigned long index ) { m_lstCSSRules->deleteRule( index ); } 00167 00168 virtual bool isMediaRule() const { return true; } 00169 00170 /* Not part of the DOM */ 00171 unsigned long append( CSSRuleImpl *rule ); 00172 protected: 00173 MediaListImpl *m_lstMedia; 00174 CSSRuleListImpl *m_lstCSSRules; 00175 }; 00176 00177 00178 class CSSPageRuleImpl : public CSSRuleImpl 00179 { 00180 public: 00181 CSSPageRuleImpl(StyleBaseImpl *parent); 00182 00183 virtual ~CSSPageRuleImpl(); 00184 00185 CSSStyleDeclarationImpl *style() const { return m_style; } 00186 00187 virtual bool isPageRule() const { return true; } 00188 00189 DOM::DOMString selectorText() const; 00190 void setSelectorText(DOM::DOMString str); 00191 00192 protected: 00193 CSSStyleDeclarationImpl *m_style; 00194 }; 00195 00196 00197 class CSSStyleRuleImpl : public CSSRuleImpl 00198 { 00199 public: 00200 CSSStyleRuleImpl(StyleBaseImpl *parent); 00201 00202 virtual ~CSSStyleRuleImpl(); 00203 00204 CSSStyleDeclarationImpl *style() const { return m_style; } 00205 00206 virtual bool isStyleRule() const { return true; } 00207 00208 DOM::DOMString selectorText() const; 00209 void setSelectorText(DOM::DOMString str); 00210 00211 virtual bool parseString( const DOMString &string, bool = false ); 00212 00213 void setSelector( QPtrList<CSSSelector> *selector) { m_selector = selector; } 00214 void setDeclaration( CSSStyleDeclarationImpl *style); 00215 00216 QPtrList<CSSSelector> *selector() { return m_selector; } 00217 CSSStyleDeclarationImpl *declaration() { return m_style; } 00218 00219 void setNonCSSHints(); 00220 00221 protected: 00222 CSSStyleDeclarationImpl *m_style; 00223 QPtrList<CSSSelector> *m_selector; 00224 }; 00225 00226 00227 class CSSUnknownRuleImpl : public CSSRuleImpl 00228 { 00229 public: 00230 CSSUnknownRuleImpl(StyleBaseImpl *parent) : CSSRuleImpl(parent) {} 00231 00232 virtual bool isUnknownRule() const { return true; } 00233 }; 00234 00235 00236 } // namespace 00237 00238 #endif
KDE Logo
This file is part of the documentation for khtml Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Oct 8 11:16:04 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003