File indexing completed on 2024-04-21 14:57:27
0001 /* 0002 * This file is part of the DOM implementation for KDE. 0003 * 0004 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 0005 * (C) 1999 Antti Koivisto (koivisto@kde.org) 0006 * 0007 * This library is free software; you can redistribute it and/or 0008 * modify it under the terms of the GNU Library General Public 0009 * License as published by the Free Software Foundation; either 0010 * version 2 of the License, or (at your option) any later version. 0011 * 0012 * This library is distributed in the hope that it will be useful, 0013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0015 * Library General Public License for more details. 0016 * 0017 * You should have received a copy of the GNU Library General Public License 0018 * along with this library; see the file COPYING.LIB. If not, write to 0019 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0020 * Boston, MA 02110-1301, USA. 0021 * 0022 */ 0023 0024 #ifndef HTML_DOCUMENTIMPL_H 0025 #define HTML_DOCUMENTIMPL_H 0026 0027 #include "xml/dom_docimpl.h" 0028 #include "html/html_miscimpl.h" 0029 0030 #include <QMap> 0031 0032 class KHTMLView; 0033 class QString; 0034 0035 namespace DOM 0036 { 0037 0038 class Element; 0039 class HTMLElement; 0040 class HTMLElementImpl; 0041 class DOMString; 0042 class HTMLMapElementImpl; 0043 0044 class HTMLDocumentImpl : public DOM::DocumentImpl 0045 { 0046 Q_OBJECT 0047 public: 0048 HTMLDocumentImpl(KHTMLView *v = nullptr); 0049 ~HTMLDocumentImpl(); 0050 0051 bool isHTMLDocument() const override 0052 { 0053 return true; 0054 } 0055 0056 DOMString referrer() const; 0057 DOMString lastModified() const; 0058 DOMString cookie() const; 0059 void setCookie(const DOMString &); 0060 NodeListImpl *getElementsByName(const DOMString &elementName); 0061 0062 HTMLCollectionImpl *images(); 0063 HTMLCollectionImpl *applets(); 0064 HTMLCollectionImpl *links(); 0065 HTMLCollectionImpl *forms(); 0066 HTMLCollectionImpl *layers(); 0067 HTMLCollectionImpl *anchors(); 0068 HTMLCollectionImpl *all(); 0069 HTMLCollectionImpl *scripts(); 0070 0071 void setBody(HTMLElementImpl *_body, int &exceptioncode); 0072 0073 khtml::Tokenizer *createTokenizer() override; 0074 0075 bool childAllowed(NodeImpl *newChild) override; 0076 0077 ElementImpl *createElement(const DOMString &tagName, int *pExceptioncode) override; 0078 0079 // HTML5 0080 ElementImpl *activeElement() const; 0081 0082 HTMLMapElementImpl *getMap(const DOMString &url_); 0083 0084 void determineParseMode() override; 0085 void close() override; 0086 void contentLoaded() override; 0087 0088 void setAutoFill() 0089 { 0090 m_doAutoFill = true; 0091 } 0092 0093 // If true, HTML was requested by mimetype (e.g. HTTP Content-Type). Otherwise XHTML was requested. 0094 // This is independent of the actual doctype, of course. (#86446) 0095 void setHTMLRequested(bool html) 0096 { 0097 m_htmlRequested = html; 0098 } 0099 0100 // Change parse and html modes 0101 void changeModes(ParseMode newPMode, HTMLMode newHMode); 0102 0103 protected: 0104 HTMLElementImpl *htmlElement; 0105 friend class HTMLMapElementImpl; 0106 friend class HTMLImageElementImpl; 0107 QMap<QString, HTMLMapElementImpl *> mapMap; 0108 bool m_doAutoFill; 0109 bool m_htmlRequested; 0110 bool m_determineParseMode; 0111 0112 protected Q_SLOTS: 0113 /** 0114 * Repaints, so that all links get the proper color 0115 */ 0116 void slotHistoryChanged(); 0117 }; 0118 0119 // Used to display text in iframes 0120 class HTMLTextDocumentImpl: public HTMLDocumentImpl 0121 { 0122 public: 0123 HTMLTextDocumentImpl(KHTMLView *v = nullptr); 0124 khtml::Tokenizer *createTokenizer() override; 0125 }; 0126 0127 } //namespace 0128 0129 #endif