KHtml

html_documentimpl.h
1 /*
2  * This file is part of the DOM implementation for KDE.
3  *
4  * Copyright (C) 1999 Lars Knoll ([email protected])
5  * (C) 1999 Antti Koivisto ([email protected])
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public License
18  * along with this library; see the file COPYING.LIB. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  *
22  */
23 
24 #ifndef HTML_DOCUMENTIMPL_H
25 #define HTML_DOCUMENTIMPL_H
26 
27 #include "xml/dom_docimpl.h"
28 #include "html/html_miscimpl.h"
29 
30 #include <QMap>
31 
32 class KHTMLView;
33 class QString;
34 
35 namespace DOM
36 {
37 
38 class Element;
39 class HTMLElement;
40 class HTMLElementImpl;
41 class DOMString;
42 class HTMLMapElementImpl;
43 
44 class HTMLDocumentImpl : public DOM::DocumentImpl
45 {
46  Q_OBJECT
47 public:
48  HTMLDocumentImpl(KHTMLView *v = nullptr);
49  ~HTMLDocumentImpl();
50 
51  bool isHTMLDocument() const override
52  {
53  return true;
54  }
55 
56  DOMString referrer() const;
57  DOMString lastModified() const;
58  DOMString cookie() const;
59  void setCookie(const DOMString &);
60  NodeListImpl *getElementsByName(const DOMString &elementName);
61 
62  HTMLCollectionImpl *images();
63  HTMLCollectionImpl *applets();
64  HTMLCollectionImpl *links();
65  HTMLCollectionImpl *forms();
66  HTMLCollectionImpl *layers();
67  HTMLCollectionImpl *anchors();
68  HTMLCollectionImpl *all();
69  HTMLCollectionImpl *scripts();
70 
71  void setBody(HTMLElementImpl *_body, int &exceptioncode);
72 
73  khtml::Tokenizer *createTokenizer() override;
74 
75  bool childAllowed(NodeImpl *newChild) override;
76 
77  ElementImpl *createElement(const DOMString &tagName, int *pExceptioncode) override;
78 
79  // HTML5
80  ElementImpl *activeElement() const;
81 
82  HTMLMapElementImpl *getMap(const DOMString &url_);
83 
84  void determineParseMode() override;
85  void close() override;
86  void contentLoaded() override;
87 
88  void setAutoFill()
89  {
90  m_doAutoFill = true;
91  }
92 
93  // If true, HTML was requested by mimetype (e.g. HTTP Content-Type). Otherwise XHTML was requested.
94  // This is independent of the actual doctype, of course. (#86446)
95  void setHTMLRequested(bool html)
96  {
97  m_htmlRequested = html;
98  }
99 
100  // Change parse and html modes
101  void changeModes(ParseMode newPMode, HTMLMode newHMode);
102 
103 protected:
104  HTMLElementImpl *htmlElement;
105  friend class HTMLMapElementImpl;
106  friend class HTMLImageElementImpl;
108  bool m_doAutoFill;
109  bool m_htmlRequested;
110  bool m_determineParseMode;
111 
112 protected Q_SLOTS:
113  /**
114  * Repaints, so that all links get the proper color
115  */
116  void slotHistoryChanged();
117 };
118 
119 // Used to display text in iframes
120 class HTMLTextDocumentImpl: public HTMLDocumentImpl
121 {
122 public:
123  HTMLTextDocumentImpl(KHTMLView *v = nullptr);
124  khtml::Tokenizer *createTokenizer() override;
125 };
126 
127 } //namespace
128 
129 #endif
Renders and displays HTML in a QScrollArea.
Definition: khtmlview.h:97
const QList< QKeySequence > & close()
Q_OBJECTQ_OBJECT
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
This library provides a full-featured HTML parser and widget.
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Oct 26 2021 22:48:01 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.