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 00199 DOMString codeAsString() const; 00200 00202 static DOMString codeAsString(int cssCode); 00203 00205 static bool isCSSExceptionCode(int exceptioncode); 00206 }; 00207 00208 class CSSStyleSheetImpl; 00209 class CSSRule; 00210 class CSSRuleList; 00211 00218 class KHTML_EXPORT CSSStyleSheet : public StyleSheet 00219 { 00220 public: 00221 CSSStyleSheet(); 00222 CSSStyleSheet(const CSSStyleSheet &other); 00223 CSSStyleSheet(const StyleSheet &other); 00224 CSSStyleSheet(CSSStyleSheetImpl *impl); 00225 public: 00226 00227 CSSStyleSheet & operator = (const CSSStyleSheet &other); 00228 CSSStyleSheet & operator = (const StyleSheet &other); 00229 00230 ~CSSStyleSheet(); 00231 00243 CSSRule ownerRule() const; 00244 00254 CSSRuleList cssRules() const; 00255 00290 unsigned long insertRule ( const DOM::DOMString &rule, unsigned long index ); 00291 00308 void deleteRule ( unsigned long index ); 00309 00311 DOM::DOMString charset() const; 00312 }; 00313 00314 00315 class StyleSheetListImpl; 00316 class StyleSheet; 00317 00323 class KHTML_EXPORT StyleSheetList 00324 { 00325 public: 00326 StyleSheetList(); 00327 StyleSheetList(const StyleSheetList &other); 00328 StyleSheetList(StyleSheetListImpl *impl); 00329 public: 00330 00331 StyleSheetList & operator = (const StyleSheetList &other); 00332 00333 ~StyleSheetList(); 00334 00341 unsigned long length() const; 00342 00353 StyleSheet item ( unsigned long index ); 00354 00358 StyleSheetListImpl *handle() const; 00359 bool isNull() const; 00360 00361 protected: 00362 StyleSheetListImpl *impl; 00363 }; 00364 00365 00366 class MediaListImpl; 00367 class CSSRule; 00368 class CSSStyleSheet; 00369 00377 class KHTML_EXPORT MediaList 00378 { 00379 public: 00380 MediaList(); 00381 MediaList(const MediaList &other); 00382 MediaList(MediaListImpl *impl); 00383 public: 00384 00385 MediaList & operator = (const MediaList &other); 00386 00387 ~MediaList(); 00388 00399 DOM::DOMString mediaText() const; 00400 00404 void setMediaText(const DOM::DOMString &value); 00405 00409 unsigned long length() const; 00410 00411 00421 DOM::DOMString item(unsigned long index) const; 00422 00433 void deleteMedium(const DOM::DOMString &oldMedium); 00434 00447 void appendMedium(const DOM::DOMString &newMedium); 00448 00452 MediaListImpl *handle() const; 00453 bool isNull() const; 00454 00455 protected: 00456 MediaListImpl *impl; 00457 }; 00458 00459 class LinkStyleImpl; 00460 00461 class KHTML_EXPORT LinkStyle 00462 { 00463 public: 00464 LinkStyle(); 00465 LinkStyle(const LinkStyle &other); 00466 00467 LinkStyle & operator = (const LinkStyle &other); 00468 LinkStyle & operator = (const Node &other); 00469 00470 ~LinkStyle(); 00471 00472 StyleSheet sheet(); 00473 00474 bool isNull() const; 00475 00476 protected: 00477 DOM::NodeImpl *node; 00478 LinkStyleImpl *impl; 00479 }; 00480 00481 class DocumentStyleImpl; 00482 00483 class KHTML_EXPORT DocumentStyle 00484 { 00485 public: 00486 DocumentStyle(); 00487 DocumentStyle(const DocumentStyle &other); 00488 00489 DocumentStyle & operator = (const DocumentStyle &other); 00490 DocumentStyle & operator = (const Document &other); 00491 00492 ~DocumentStyle(); 00493 00494 StyleSheetList styleSheets() const ; 00495 00496 DOMString preferredStylesheetSet() const; 00497 DOMString selectedStylesheetSet() const; 00498 void setSelectedStylesheetSet( const DOMString& aString ); 00499 00500 bool isNull() const { return !impl; } 00501 00502 protected: 00503 DOM::DocumentImpl *doc; 00504 DocumentStyleImpl *impl; 00505 }; 00506 00507 } // namespace 00508 00509 #endif
KDE 4.6 API Reference