khtml Library API Documentation

css_stylesheetimpl.h

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., 59 Temple Place - Suite 330,
00019  * Boston, MA 02111-1307, USA.
00020  *
00021  * $Id: css_stylesheetimpl.h,v 1.24 2002/04/11 08:53:07 knoll Exp $
00022  */
00023 #ifndef _CSS_css_stylesheetimpl_h_
00024 #define _CSS_css_stylesheetimpl_h_
00025 
00026 #include <qvaluelist.h>
00027 #include <qptrlist.h>
00028 
00029 #include "dom/dom_string.h"
00030 #include "css/cssparser.h"
00031 #include "misc/loader_client.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 
00058     virtual ~StyleSheetImpl();
00059 
00060     virtual bool isStyleSheet() const { return true; }
00061 
00062     virtual DOM::DOMString type() const { return DOMString(); }
00063 
00064     bool disabled() const;
00065     void setDisabled( bool );
00066 
00067     DOM::NodeImpl *ownerNode() const;
00068     StyleSheetImpl *parentStyleSheet() const;
00069     DOM::DOMString href() const;
00070     DOM::DOMString title() const;
00071     MediaListImpl *media() const;
00072     void setMedia( MediaListImpl *media );
00073 
00074 protected:
00075     DOM::NodeImpl *m_parentNode;
00076     DOM::DOMString m_strHref;
00077     DOM::DOMString m_strTitle;
00078     MediaListImpl *m_media;
00079     bool m_disabled;
00080 };
00081 
00082 class CSSStyleSheetImpl : public StyleSheetImpl
00083 {
00084 public:
00085     CSSStyleSheetImpl(DOM::NodeImpl *parentNode, DOM::DOMString href = DOMString(), bool _implicit = false);
00086     CSSStyleSheetImpl(CSSStyleSheetImpl *parentSheet, DOM::DOMString href = DOMString());
00087     CSSStyleSheetImpl(CSSRuleImpl *ownerRule, DOM::DOMString href = DOMString());
00088     // clone from a cached version of the sheet
00089     CSSStyleSheetImpl(DOM::NodeImpl *parentNode, CSSStyleSheetImpl *orig);
00090     CSSStyleSheetImpl(CSSRuleImpl *ownerRule, CSSStyleSheetImpl *orig);
00091 
00092     virtual ~CSSStyleSheetImpl();
00093 
00094     virtual bool isCSSStyleSheet() const { return true; }
00095 
00096     virtual DOM::DOMString type() const { return "text/css"; }
00097 
00098     CSSRuleImpl *ownerRule() const;
00099     CSSRuleList cssRules();
00100     unsigned long insertRule ( const DOM::DOMString &rule, unsigned long index, int &exceptioncode );
00101     void deleteRule ( unsigned long index, int &exceptioncode );
00102 
00103     virtual bool parseString( const DOMString &string, bool strict = true );
00104 
00105     bool isLoading();
00106     void setNonCSSHints();
00107 
00108     virtual void checkLoaded();
00109     khtml::DocLoader *docLoader();
00110     DocumentImpl *doc() { return m_doc; }
00111     bool implicit() { return m_implicit; }
00112 protected:
00113     DocumentImpl *m_doc;
00114     bool m_implicit;
00115 };
00116 
00117 // ----------------------------------------------------------------------------
00118 
00119 class StyleSheetListImpl : public khtml::Shared<StyleSheetListImpl>
00120 {
00121 public:
00122     StyleSheetListImpl();
00123     ~StyleSheetListImpl();
00124 
00125     // the following two ignore implicit stylesheets
00126     unsigned long length() const;
00127     StyleSheetImpl *item ( unsigned long index );
00128 
00129     void add(StyleSheetImpl* s);
00130     void remove(StyleSheetImpl* s);
00131 
00132     QPtrList<StyleSheetImpl> styleSheets;
00133 };
00134 
00135 // ----------------------------------------------------------------------------
00136 
00137 class MediaListImpl : public StyleBaseImpl
00138 {
00139 public:
00140     MediaListImpl( CSSStyleSheetImpl *parentSheet );
00141     MediaListImpl( CSSStyleSheetImpl *parentSheet,
00142                    const DOM::DOMString &media );
00143     MediaListImpl( CSSRuleImpl *parentRule );
00144     MediaListImpl( CSSRuleImpl *parentRule, const DOM::DOMString &media );
00145 
00146     virtual ~MediaListImpl();
00147 
00148     virtual bool isMediaList() { return true; }
00149 
00150     CSSStyleSheetImpl *parentStyleSheet() const;
00151     CSSRuleImpl *parentRule() const;
00152     unsigned long length() const;
00153     DOM::DOMString item ( unsigned long index ) const;
00154     void deleteMedium ( const DOM::DOMString &oldMedium );
00155     void appendMedium ( const DOM::DOMString &newMedium );
00156 
00157     DOM::DOMString mediaText() const;
00158     void setMediaText(const DOM::DOMString &value);
00159 
00168     bool contains( const DOM::DOMString &medium ) const;
00169 
00170 protected:
00171     QValueList<DOM::DOMString> m_lstMedia;
00172 };
00173 
00174 
00175 }; // namespace
00176 
00177 #endif
00178 
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:22:34 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001