# khtml Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# css_stylesheetimpl.h

    00001 /*
    00002  * This file is part of the DOM implementation for KDE.
    00003  *
    00004  * (C) 1999-2003 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., 59 Temple Place - Suite 330,
    00019  * Boston, MA 02111-1307, USA.
    00020  *
    00021  */
    00022 #ifndef _CSS_css_stylesheetimpl_h_
    00023 #define _CSS_css_stylesheetimpl_h_
    00024
    00025 #include <qvaluelist.h>
    00026 #include <qptrlist.h>
    00027
    00028 #include "dom/dom_string.h"
    00029 #include "css/css_base.h"
    00030 #include "misc/loader_client.h"
    00031 #include "xml/dom_docimpl.h"
    00032
    00033 namespace khtml {
    00034     class CachedCSSStyleSheet;
    00035     class DocLoader;
    00036 }
    00037
    00038 namespace DOM {
    00039
    00040 class StyleSheet;
    00041 class CSSStyleSheet;
    00042 class MediaListImpl;
    00043 class CSSRuleImpl;
    00044 class CSSRuleList;
    00045 class CSSStyleRuleImpl;
    00046 class CSSValueImpl;
    00047 class NodeImpl;
    00048 class DocumentImpl;
    00049
    00050 class StyleSheetImpl : public StyleListImpl
    00051 {
    00052 public:
    00053     StyleSheetImpl(DOM::NodeImpl *ownerNode, DOM::DOMString href = DOMString());
    00054     StyleSheetImpl(StyleSheetImpl *parentSheet, DOM::DOMString href = DOMString());
    00055     StyleSheetImpl(StyleBaseImpl *owner, DOM::DOMString href  = DOMString());
    00056     StyleSheetImpl(khtml::CachedCSSStyleSheet *cached, DOM::DOMString href  = DOMString());
    00057     virtual ~StyleSheetImpl();
    00058
    00059     virtual bool isStyleSheet() const { return true; }
    00060
    00061     virtual DOM::DOMString type() const { return DOMString(); }
    00062
    00063     bool disabled() const { return m_disabled; }
    00064     void setDisabled( bool disabled ) { m_disabled = disabled; }
    00065
    00066     DOM::NodeImpl *ownerNode() const { return m_parentNode; }
    00067     StyleSheetImpl *parentStyleSheet() const;
    00068     DOM::DOMString href() const { return m_strHref; }
    00069     DOM::DOMString title() const { return m_strTitle; }
    00070     MediaListImpl *media() const { return m_media; }
    00071     void setMedia( MediaListImpl *media );
    00072
    00073 protected:
    00074     DOM::NodeImpl *m_parentNode;
    00075     DOM::DOMString m_strHref;
    00076     DOM::DOMString m_strTitle;
    00077     MediaListImpl *m_media;
    00078     bool m_disabled;
    00079 };
    00080
    00081 class CSSStyleSheetImpl : public StyleSheetImpl
    00082 {
    00083 public:
    00084     CSSStyleSheetImpl(DOM::NodeImpl *parentNode, DOM::DOMString href = DOMString(), bool _implicit = false);
    00085     CSSStyleSheetImpl(CSSStyleSheetImpl *parentSheet, DOM::DOMString href = DOMString());
    00086     CSSStyleSheetImpl(CSSRuleImpl *ownerRule, DOM::DOMString href = DOMString());
    00087     // clone from a cached version of the sheet
    00088     CSSStyleSheetImpl(DOM::NodeImpl *parentNode, CSSStyleSheetImpl *orig);
    00089     CSSStyleSheetImpl(CSSRuleImpl *ownerRule, CSSStyleSheetImpl *orig);
    00090
    00091     virtual bool isCSSStyleSheet() const { return true; }
    00092
    00093     virtual DOM::DOMString type() const { return "text/css"; }
    00094
    00095     CSSRuleImpl *ownerRule() const;
    00096     CSSRuleList cssRules();
    00097     unsigned long insertRule ( const DOM::DOMString &rule, unsigned long index, int &exceptioncode );
    00098     void deleteRule ( unsigned long index, int &exceptioncode );
    00099
    00100     virtual bool parseString( const DOMString &string, bool strict = true );
    00101
    00102     bool isLoading() const;
    00103     void setNonCSSHints();
    00104
    00105     virtual void checkLoaded() const;
    00106
    00107     // ### remove? (clients should use sheet->doc()->docLoader())
    00108     khtml::DocLoader *docLoader() const
    00109     { return m_doc ? m_doc->docLoader() : 0; }
    00110
    00111     DocumentImpl *doc() const { return m_doc; }
    00112     bool implicit() const { return m_implicit; }
    00113 protected:
    00114     DocumentImpl *m_doc;
    00115     bool m_implicit;
    00116 };
    00117
    00118 // ----------------------------------------------------------------------------
    00119
    00120 class StyleSheetListImpl : public khtml::Shared<StyleSheetListImpl>
    00121 {
    00122 public:
    00123     StyleSheetListImpl() {}
    00124     ~StyleSheetListImpl();
    00125
    00126     // the following two ignore implicit stylesheets
    00127     unsigned long length() const;
    00128     StyleSheetImpl *item ( unsigned long index );
    00129
    00130     void add(StyleSheetImpl* s);
    00131     void remove(StyleSheetImpl* s);
    00132
    00133     QPtrList<StyleSheetImpl> styleSheets;
    00134 };
    00135
    00136 // ----------------------------------------------------------------------------
    00137
    00138 class MediaListImpl : public StyleBaseImpl
    00139 {
    00140 public:
    00141     MediaListImpl()
    00142     : StyleBaseImpl( 0 ) {}
    00143     MediaListImpl( CSSStyleSheetImpl *parentSheet )
    00144         : StyleBaseImpl(parentSheet) {}
    00145     MediaListImpl( CSSStyleSheetImpl *parentSheet,
    00146                    const DOM::DOMString &media );
    00147     MediaListImpl( CSSRuleImpl *parentRule, const DOM::DOMString &media );
    00148
    00149     virtual bool isMediaList() const { return true; }
    00150
    00151     CSSStyleSheetImpl *parentStyleSheet() const;
    00152     CSSRuleImpl *parentRule() const;
    00153     unsigned long length() const { return m_lstMedia.count(); }
    00154     DOM::DOMString item ( unsigned long index ) const { return m_lstMedia[index]; }
    00155     void deleteMedium ( const DOM::DOMString &oldMedium );
    00156     void appendMedium ( const DOM::DOMString &newMedium ) { m_lstMedia.append(newMedium); }
    00157
    00158     DOM::DOMString mediaText() const;
    00159     void setMediaText(const DOM::DOMString &value);
    00160
    00169     bool contains( const DOM::DOMString &medium ) const;
    00170
    00171 protected:
    00172     QValueList<DOM::DOMString> m_lstMedia;
    00173 };
    00174
    00175
    00176 } // namespace
    00177
    00178 #endif
    00179

This file is part of the documentation for khtml Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:33:08 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003