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 * (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., 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 <dom/dom_string.h> 00031 #include <dom/dom_node.h> 00032 #include <dom/dom_misc.h> 00033 00034 #include <kdelibs_export.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 }; 00195 }; 00196 00197 class CSSStyleSheetImpl; 00198 class CSSRule; 00199 class CSSRuleList; 00200 00207 class KHTML_EXPORT CSSStyleSheet : public StyleSheet 00208 { 00209 public: 00210 CSSStyleSheet(); 00211 CSSStyleSheet(const CSSStyleSheet &other); 00212 CSSStyleSheet(const StyleSheet &other); 00213 CSSStyleSheet(CSSStyleSheetImpl *impl); 00214 public: 00215 00216 CSSStyleSheet & operator = (const CSSStyleSheet &other); 00217 CSSStyleSheet & operator = (const StyleSheet &other); 00218 00219 ~CSSStyleSheet(); 00220 00232 CSSRule ownerRule() const; 00233 00243 CSSRuleList cssRules() const; 00244 00279 unsigned long insertRule ( const DOM::DOMString &rule, unsigned long index ); 00280 00297 void deleteRule ( unsigned long index ); 00298 }; 00299 00300 00301 class StyleSheetListImpl; 00302 class StyleSheet; 00303 00309 class KHTML_EXPORT StyleSheetList 00310 { 00311 public: 00312 StyleSheetList(); 00313 StyleSheetList(const StyleSheetList &other); 00314 StyleSheetList(StyleSheetListImpl *impl); 00315 public: 00316 00317 StyleSheetList & operator = (const StyleSheetList &other); 00318 00319 ~StyleSheetList(); 00320 00327 unsigned long length() const; 00328 00339 StyleSheet item ( unsigned long index ); 00340 00344 StyleSheetListImpl *handle() const; 00345 bool isNull() const; 00346 00347 protected: 00348 StyleSheetListImpl *impl; 00349 }; 00350 00351 00352 class MediaListImpl; 00353 class CSSRule; 00354 class CSSStyleSheet; 00355 00363 class KHTML_EXPORT MediaList 00364 { 00365 public: 00366 MediaList(); 00367 MediaList(const MediaList &other); 00368 MediaList(MediaListImpl *impl); 00369 public: 00370 00371 MediaList & operator = (const MediaList &other); 00372 00373 ~MediaList(); 00374 00385 DOM::DOMString mediaText() const; 00386 00390 void setMediaText(const DOM::DOMString &value); 00391 00395 unsigned long length() const; 00396 00397 00407 DOM::DOMString item(unsigned long index) const; 00408 00419 void deleteMedium(const DOM::DOMString &oldMedium); 00420 00433 void appendMedium(const DOM::DOMString &newMedium); 00434 00438 MediaListImpl *handle() const; 00439 bool isNull() const; 00440 00441 protected: 00442 MediaListImpl *impl; 00443 }; 00444 00445 class LinkStyleImpl; 00446 00447 class KHTML_EXPORT LinkStyle 00448 { 00449 public: 00450 LinkStyle(); 00451 LinkStyle(const LinkStyle &other); 00452 00453 LinkStyle & operator = (const LinkStyle &other); 00454 LinkStyle & operator = (const Node &other); 00455 00456 ~LinkStyle(); 00457 00458 StyleSheet sheet(); 00459 00460 bool isNull() const; 00461 00462 protected: 00463 DOM::NodeImpl *node; 00464 LinkStyleImpl *impl; 00465 }; 00466 00467 class DocumentStyleImpl; 00468 00469 class KHTML_EXPORT DocumentStyle 00470 { 00471 public: 00472 DocumentStyle(); 00473 DocumentStyle(const DocumentStyle &other); 00474 00475 DocumentStyle & operator = (const DocumentStyle &other); 00476 DocumentStyle & operator = (const Document &other); 00477 00478 ~DocumentStyle(); 00479 00480 // KDE 4:: make const 00481 StyleSheetList styleSheets(); 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