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 bool isCSSStyleSheet() const; 00162 StyleSheetImpl *handle() const { return impl; } 00163 bool isNull() const { return !impl; } 00164 protected: 00165 StyleSheetImpl *impl; 00166 }; 00167 00168 00173 class KHTML_EXPORT CSSException 00174 { 00175 public: 00176 CSSException(unsigned short _code) { code = _code; } 00177 CSSException(const CSSException &other) { code = other.code; } 00178 00179 CSSException & operator = (const CSSException &other) 00180 { code = other.code; return *this; } 00181 00182 virtual ~CSSException() {} 00187 unsigned short code; 00188 00189 enum ExceptionCode 00190 { 00191 SYNTAX_ERR = 0, 00192 INVALID_MODIFICATION_ERR = 1, 00193 _EXCEPTION_OFFSET = 1000, 00194 _EXCEPTION_MAX = 1999 00195 }; 00196 }; 00197 00198 class CSSStyleSheetImpl; 00199 class CSSRule; 00200 class CSSRuleList; 00201 00208 class KHTML_EXPORT CSSStyleSheet : public StyleSheet 00209 { 00210 public: 00211 CSSStyleSheet(); 00212 CSSStyleSheet(const CSSStyleSheet &other); 00213 CSSStyleSheet(const StyleSheet &other); 00214 CSSStyleSheet(CSSStyleSheetImpl *impl); 00215 public: 00216 00217 CSSStyleSheet & operator = (const CSSStyleSheet &other); 00218 CSSStyleSheet & operator = (const StyleSheet &other); 00219 00220 ~CSSStyleSheet(); 00221 00233 CSSRule ownerRule() const; 00234 00244 CSSRuleList cssRules() const; 00245 00280 unsigned long insertRule ( const DOM::DOMString &rule, unsigned long index ); 00281 00298 void deleteRule ( unsigned long index ); 00299 }; 00300 00301 00302 class StyleSheetListImpl; 00303 class StyleSheet; 00304 00310 class KHTML_EXPORT StyleSheetList 00311 { 00312 public: 00313 StyleSheetList(); 00314 StyleSheetList(const StyleSheetList &other); 00315 StyleSheetList(StyleSheetListImpl *impl); 00316 public: 00317 00318 StyleSheetList & operator = (const StyleSheetList &other); 00319 00320 ~StyleSheetList(); 00321 00328 unsigned long length() const; 00329 00340 StyleSheet item ( unsigned long index ); 00341 00345 StyleSheetListImpl *handle() const; 00346 bool isNull() const; 00347 00348 protected: 00349 StyleSheetListImpl *impl; 00350 }; 00351 00352 00353 class MediaListImpl; 00354 class CSSRule; 00355 class CSSStyleSheet; 00356 00364 class KHTML_EXPORT MediaList 00365 { 00366 public: 00367 MediaList(); 00368 MediaList(const MediaList &other); 00369 MediaList(MediaListImpl *impl); 00370 public: 00371 00372 MediaList & operator = (const MediaList &other); 00373 00374 ~MediaList(); 00375 00386 DOM::DOMString mediaText() const; 00387 00391 void setMediaText(const DOM::DOMString &value); 00392 00396 unsigned long length() const; 00397 00398 00408 DOM::DOMString item(unsigned long index) const; 00409 00420 void deleteMedium(const DOM::DOMString &oldMedium); 00421 00434 void appendMedium(const DOM::DOMString &newMedium); 00435 00439 MediaListImpl *handle() const; 00440 bool isNull() const; 00441 00442 protected: 00443 MediaListImpl *impl; 00444 }; 00445 00446 class LinkStyleImpl; 00447 00448 class KHTML_EXPORT LinkStyle 00449 { 00450 public: 00451 LinkStyle(); 00452 LinkStyle(const LinkStyle &other); 00453 00454 LinkStyle & operator = (const LinkStyle &other); 00455 LinkStyle & operator = (const Node &other); 00456 00457 ~LinkStyle(); 00458 00459 StyleSheet sheet(); 00460 00461 bool isNull() const; 00462 00463 protected: 00464 DOM::NodeImpl *node; 00465 LinkStyleImpl *impl; 00466 }; 00467 00468 class DocumentStyleImpl; 00469 00470 class KHTML_EXPORT DocumentStyle 00471 { 00472 public: 00473 DocumentStyle(); 00474 DocumentStyle(const DocumentStyle &other); 00475 00476 DocumentStyle & operator = (const DocumentStyle &other); 00477 DocumentStyle & operator = (const Document &other); 00478 00479 ~DocumentStyle(); 00480 00481 StyleSheetList styleSheets() const ; 00482 00483 DOMString preferredStylesheetSet() const; 00484 DOMString selectedStylesheetSet() const; 00485 void setSelectedStylesheetSet( const DOMString& aString ); 00486 00487 bool isNull() const { return !impl; } 00488 00489 protected: 00490 DOM::DocumentImpl *doc; 00491 DocumentStyleImpl *impl; 00492 }; 00493 00494 } // namespace 00495 00496 #endif