KHTML
css_stylesheet.h
Go to the documentation of this file.00001 /* 00002 * This file is part of the DOM implementation for KDE. 00003 * 00004 * Copyright 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_stylesheet_h_ 00028 #define _CSS_css_stylesheet_h_ 00029 00030 #include <khtml_export.h> 00031 00032 #include <dom/dom_string.h> 00033 #include <dom/dom_node.h> 00034 #include <dom/dom_misc.h> 00035 00036 namespace DOM { 00037 00038 class StyleSheetImpl; 00039 class MediaList; 00040 class NodeImpl; 00041 class DocumentImpl; 00042 00058 class KHTML_EXPORT StyleSheet 00059 { 00060 public: 00061 StyleSheet(); 00062 StyleSheet(const StyleSheet &other); 00063 StyleSheet(StyleSheetImpl *impl); 00064 public: 00065 00066 StyleSheet & operator = (const StyleSheet &other); 00067 00068 ~StyleSheet(); 00069 00086 DOM::DOMString type() const; 00087 00094 bool disabled() const; 00095 00099 void setDisabled( bool ); 00100 00109 DOM::Node ownerNode() const; 00110 00119 StyleSheet parentStyleSheet() const; 00120 00132 DOM::DOMString href() const; 00133 00144 DOM::DOMString title() const; 00145 00156 MediaList media() const; 00157 00161 KUrl baseUrl(); 00162 bool isCSSStyleSheet() const; 00163 StyleSheetImpl *handle() const { return impl; } 00164 bool isNull() const { return !impl; } 00165 protected: 00166 StyleSheetImpl *impl; 00167 }; 00168 00169 00174 class KHTML_EXPORT CSSException 00175 { 00176 public: 00177 CSSException(unsigned short _code) { code = _code; } 00178 CSSException(const CSSException &other) { code = other.code; } 00179 00180 CSSException & operator = (const CSSException &other) 00181 { code = other.code; return *this; } 00182 00183 virtual ~CSSException() {} 00188 unsigned short code; 00189 00190 enum ExceptionCode 00191 { 00192 SYNTAX_ERR = 0, 00193 INVALID_MODIFICATION_ERR = 1, 00194 _EXCEPTION_OFFSET = 1000, 00195 _EXCEPTION_MAX = 1999 00196 }; 00197 }; 00198 00199 class CSSStyleSheetImpl; 00200 class CSSRule; 00201 class CSSRuleList; 00202 00209 class KHTML_EXPORT CSSStyleSheet : public StyleSheet 00210 { 00211 public: 00212 CSSStyleSheet(); 00213 CSSStyleSheet(const CSSStyleSheet &other); 00214 CSSStyleSheet(const StyleSheet &other); 00215 CSSStyleSheet(CSSStyleSheetImpl *impl); 00216 public: 00217 00218 CSSStyleSheet & operator = (const CSSStyleSheet &other); 00219 CSSStyleSheet & operator = (const StyleSheet &other); 00220 00221 ~CSSStyleSheet(); 00222 00234 CSSRule ownerRule() const; 00235 00245 CSSRuleList cssRules() const; 00246 00281 unsigned long insertRule ( const DOM::DOMString &rule, unsigned long index ); 00282 00299 void deleteRule ( unsigned long index ); 00300 00302 DOM::DOMString charset() const; 00303 }; 00304 00305 00306 class StyleSheetListImpl; 00307 class StyleSheet; 00308 00314 class KHTML_EXPORT StyleSheetList 00315 { 00316 public: 00317 StyleSheetList(); 00318 StyleSheetList(const StyleSheetList &other); 00319 StyleSheetList(StyleSheetListImpl *impl); 00320 public: 00321 00322 StyleSheetList & operator = (const StyleSheetList &other); 00323 00324 ~StyleSheetList(); 00325 00332 unsigned long length() const; 00333 00344 StyleSheet item ( unsigned long index ); 00345 00349 StyleSheetListImpl *handle() const; 00350 bool isNull() const; 00351 00352 protected: 00353 StyleSheetListImpl *impl; 00354 }; 00355 00356 00357 class MediaListImpl; 00358 class CSSRule; 00359 class CSSStyleSheet; 00360 00368 class KHTML_EXPORT MediaList 00369 { 00370 public: 00371 MediaList(); 00372 MediaList(const MediaList &other); 00373 MediaList(MediaListImpl *impl); 00374 public: 00375 00376 MediaList & operator = (const MediaList &other); 00377 00378 ~MediaList(); 00379 00390 DOM::DOMString mediaText() const; 00391 00395 void setMediaText(const DOM::DOMString &value); 00396 00400 unsigned long length() const; 00401 00402 00412 DOM::DOMString item(unsigned long index) const; 00413 00424 void deleteMedium(const DOM::DOMString &oldMedium); 00425 00438 void appendMedium(const DOM::DOMString &newMedium); 00439 00443 MediaListImpl *handle() const; 00444 bool isNull() const; 00445 00446 protected: 00447 MediaListImpl *impl; 00448 }; 00449 00450 class LinkStyleImpl; 00451 00452 class KHTML_EXPORT LinkStyle 00453 { 00454 public: 00455 LinkStyle(); 00456 LinkStyle(const LinkStyle &other); 00457 00458 LinkStyle & operator = (const LinkStyle &other); 00459 LinkStyle & operator = (const Node &other); 00460 00461 ~LinkStyle(); 00462 00463 StyleSheet sheet(); 00464 00465 bool isNull() const; 00466 00467 protected: 00468 DOM::NodeImpl *node; 00469 LinkStyleImpl *impl; 00470 }; 00471 00472 class DocumentStyleImpl; 00473 00474 class KHTML_EXPORT DocumentStyle 00475 { 00476 public: 00477 DocumentStyle(); 00478 DocumentStyle(const DocumentStyle &other); 00479 00480 DocumentStyle & operator = (const DocumentStyle &other); 00481 DocumentStyle & operator = (const Document &other); 00482 00483 ~DocumentStyle(); 00484 00485 StyleSheetList styleSheets() const ; 00486 00487 DOMString preferredStylesheetSet() const; 00488 DOMString selectedStylesheetSet() const; 00489 void setSelectedStylesheetSet( const DOMString& aString ); 00490 00491 bool isNull() const { return !impl; } 00492 00493 protected: 00494 DOM::DocumentImpl *doc; 00495 DocumentStyleImpl *impl; 00496 }; 00497 00498 } // namespace 00499 00500 #endif