KHtml

css_stylesheet.h
1 /*
2  * This file is part of the DOM implementation for KDE.
3  *
4  * Copyright 1999 Lars Knoll ([email protected])
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License
17  * along with this library; see the file COPYING.LIB. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21  * This file includes excerpts from the Document Object Model (DOM)
22  * Level 2 Specification (Candidate Recommendation)
23  * https://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/
24  * Copyright © 2000 W3C® (MIT, INRIA, Keio), All Rights Reserved.
25  *
26  */
27 #ifndef _CSS_css_stylesheet_h_
28 #define _CSS_css_stylesheet_h_
29 
30 #include <khtml_export.h>
31 
32 #include <dom/dom_string.h>
33 #include <dom/dom_node.h>
34 #include <dom/dom_misc.h>
35 
36 namespace DOM
37 {
38 
39 class StyleSheetImpl;
40 class MediaList;
41 class NodeImpl;
42 class DocumentImpl;
43 
59 class KHTML_EXPORT StyleSheet
60 {
61 public:
62  StyleSheet();
63  StyleSheet(const StyleSheet &other);
64  StyleSheet(StyleSheetImpl *impl);
65 public:
66 
67  StyleSheet &operator = (const StyleSheet &other);
68 
69  ~StyleSheet();
70 
87  DOM::DOMString type() const;
88 
95  bool disabled() const;
96 
100  void setDisabled(bool);
101 
110  DOM::Node ownerNode() const;
111 
120  StyleSheet parentStyleSheet() const;
121 
133  DOM::DOMString href() const;
134 
145  DOM::DOMString title() const;
146 
157  MediaList media() const;
158 
162  QUrl baseUrl();
163  bool isCSSStyleSheet() const;
164  StyleSheetImpl *handle() const
165  {
166  return impl;
167  }
168  bool isNull() const
169  {
170  return !impl;
171  }
172 protected:
173  StyleSheetImpl *impl;
174 };
175 
180 class KHTML_EXPORT CSSException
181 {
182 public:
183  CSSException(unsigned short _code)
184  {
185  code = _code;
186  }
187  CSSException(const CSSException &other)
188  {
189  code = other.code;
190  }
191 
192  CSSException &operator = (const CSSException &other)
193  {
194  code = other.code;
195  return *this;
196  }
197 
198  virtual ~CSSException() {}
203  unsigned short code;
204 
205  enum ExceptionCode {
206  SYNTAX_ERR = 0,
207  INVALID_MODIFICATION_ERR = 1,
208  _EXCEPTION_OFFSET = 1000,
209  _EXCEPTION_MAX = 1999
210  };
211 
213  DOMString codeAsString() const;
214 
216  static DOMString codeAsString(int cssCode);
217 
219  static bool isCSSExceptionCode(int exceptioncode);
220 };
221 
222 class CSSStyleSheetImpl;
223 class CSSRule;
224 class CSSRuleList;
225 
232 class KHTML_EXPORT CSSStyleSheet : public StyleSheet
233 {
234 public:
235  CSSStyleSheet();
236  CSSStyleSheet(const CSSStyleSheet &other);
237  CSSStyleSheet(const StyleSheet &other);
238  CSSStyleSheet(CSSStyleSheetImpl *impl);
239 public:
240 
241  CSSStyleSheet &operator = (const CSSStyleSheet &other);
242  CSSStyleSheet &operator = (const StyleSheet &other);
243 
244  ~CSSStyleSheet();
245 
257  CSSRule ownerRule() const;
258 
268  CSSRuleList cssRules() const;
269 
304  unsigned long insertRule(const DOM::DOMString &rule, unsigned long index);
305 
322  void deleteRule(unsigned long index);
323 
325  DOM::DOMString charset() const;
326 };
327 
328 class StyleSheetListImpl;
329 class StyleSheet;
330 
336 class KHTML_EXPORT StyleSheetList
337 {
338 public:
339  StyleSheetList();
340  StyleSheetList(const StyleSheetList &other);
341  StyleSheetList(StyleSheetListImpl *impl);
342 public:
343 
344  StyleSheetList &operator = (const StyleSheetList &other);
345 
346  ~StyleSheetList();
347 
354  unsigned long length() const;
355 
366  StyleSheet item(unsigned long index);
367 
371  StyleSheetListImpl *handle() const;
372  bool isNull() const;
373 
374 protected:
375  StyleSheetListImpl *impl;
376 };
377 
378 class MediaListImpl;
379 class CSSRule;
380 class CSSStyleSheet;
381 
389 class KHTML_EXPORT MediaList
390 {
391 public:
392  MediaList();
393  MediaList(const MediaList &other);
394  MediaList(MediaListImpl *impl);
395 public:
396 
397  MediaList &operator = (const MediaList &other);
398 
399  ~MediaList();
400 
411  DOM::DOMString mediaText() const;
412 
416  void setMediaText(const DOM::DOMString &value);
417 
421  unsigned long length() const;
422 
432  DOM::DOMString item(unsigned long index) const;
433 
444  void deleteMedium(const DOM::DOMString &oldMedium);
445 
458  void appendMedium(const DOM::DOMString &newMedium);
459 
463  MediaListImpl *handle() const;
464  bool isNull() const;
465 
466 protected:
467  MediaListImpl *impl;
468 };
469 
470 class LinkStyleImpl;
471 
472 class KHTML_EXPORT LinkStyle
473 {
474 public:
475  LinkStyle();
476  LinkStyle(const LinkStyle &other);
477 
478  LinkStyle &operator = (const LinkStyle &other);
479  LinkStyle &operator = (const Node &other);
480 
481  ~LinkStyle();
482 
483  StyleSheet sheet();
484 
485  bool isNull() const;
486 
487 protected:
488  DOM::NodeImpl *node;
489  LinkStyleImpl *impl;
490 };
491 
492 class DocumentStyleImpl;
493 
494 class KHTML_EXPORT DocumentStyle
495 {
496 public:
497  DocumentStyle();
498  DocumentStyle(const DocumentStyle &other);
499 
500  DocumentStyle &operator = (const DocumentStyle &other);
501  DocumentStyle &operator = (const Document &other);
502 
503  ~DocumentStyle();
504 
505  StyleSheetList styleSheets() const;
506 
507  DOMString preferredStylesheetSet() const;
508  DOMString selectedStylesheetSet() const;
509  void setSelectedStylesheetSet(const DOMString &aString);
510 
511  bool isNull() const
512  {
513  return !impl;
514  }
515 
516 protected:
517  DOM::DocumentImpl *doc;
518  DocumentStyleImpl *impl;
519 };
520 
521 } // namespace
522 
523 #endif
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:278
The CSSNamespaceRule interface represents an.
Definition: css_rule.h:455
The CSSStyleSheet interface is a concrete interface used to represent a CSS style sheet i...
The MediaList interface provides the abstraction of an ordered collection of media, without defining or constraining how this collection is implemented.
The StyleSheetList interface provides the abstraction of an ordered collection of style sheets...
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
The Document interface represents the entire HTML or XML document.
Definition: dom_doc.h:246
This library provides a full-featured HTML parser and widget.
The CSSRuleList interface provides the abstraction of an ordered collection of CSS rules...
Definition: css_rule.h:507
The StyleSheet interface is the abstract base interface for any type of style sheet.
The CSSRule interface is the abstract base interface for any type of CSS statement ...
Definition: css_rule.h:53
This exception is raised when a specific CSS operation is impossible to perform.
unsigned short code
An integer indicating the type of error generated.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Aug 6 2020 22:45:19 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.