1 /* 2 * This file is part of the DOM implementation for KDE. 3 * 4 * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) 5 * (C) 2000-2003 Dirk Mueller (mueller@kde.org) 6 * (C) 1999 Antti Koivisto (koivisto@kde.org) 7 * (C) 2000 Simon Hausmann <hausmann@kde.org> 8 * Copyright (C) 2002 Apple Computer, Inc. 9 * 10 * This library is free software; you can redistribute it and/or 11 * modify it under the terms of the GNU Library General Public 12 * License as published by the Free Software Foundation; either 13 * version 2 of the License, or (at your option) any later version. 14 * 15 * This library is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 * Library General Public License for more details. 19 * 20 * You should have received a copy of the GNU Library General Public License 21 * along with this library; see the file COPYING.LIB. If not, write to 22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 23 * Boston, MA 02110-1301, USA. 24 * 25 */ 26 27 #ifndef HTML_BASEIMPL_H 28 #define HTML_BASEIMPL_H 29 30 #include "html/dtd.h" 31 #include "html/html_elementimpl.h" 32 #include "html/html_objectimpl.h" 33 #include "misc/khtmllayout.h" 34 35 class KHTMLPart; 36 37 namespace khtml 38 { 39 class RenderFrameSet; 40 class RenderFrame; 41 class RenderPartObject; 42 } 43 44 namespace DOM 45 { 46 47 class DOMString; 48 class CSSStyleSheetImpl; 49 class HTMLFrameElement; 50 51 // ------------------------------------------------------------------------- 52 53 class HTMLBodyElementImpl : public HTMLElementImpl 54 { 55 public: 56 HTMLBodyElementImpl(DocumentImpl *doc); 57 ~HTMLBodyElementImpl(); 58 59 Id id() const override; 60 61 DOMString aLink() const; 62 void setALink(const DOMString &value); 63 DOMString bgColor() const; 64 void setBgColor(const DOMString &value); 65 DOMString link() const; 66 void setLink(const DOMString &value); 67 DOMString text() const; 68 void setText(const DOMString &value); 69 DOMString vLink() const; 70 void setVLink(const DOMString &value); 71 72 void parseAttribute(AttributeImpl *) override; 73 void attach() override; 74 75 void insertedIntoDocument() override; 76 void removedFromDocument() override; 77 sheet()78 CSSStyleSheetImpl *sheet() const 79 { 80 return m_styleSheet; 81 } 82 83 protected: 84 CSSStyleSheetImpl *m_styleSheet; 85 bool m_bgSet; 86 bool m_fgSet; 87 }; 88 89 // ------------------------------------------------------------------------- 90 91 class HTMLFrameElementImpl : public HTMLPartContainerElementImpl 92 { 93 friend class khtml::RenderFrame; 94 friend class khtml::RenderPartObject; 95 96 public: 97 HTMLFrameElementImpl(DocumentImpl *doc); 98 99 ~HTMLFrameElementImpl(); 100 101 Id id() const override; 102 103 void parseAttribute(AttributeImpl *) override; 104 void attach() override; 105 void defaultEventHandler(EventImpl *evt) override; 106 noResize()107 bool noResize() 108 { 109 return noresize; 110 } 111 void setLocation(const QString &str); 112 113 bool isFocusableImpl(FocusType ft) const override; 114 void setFocus(bool) override; 115 116 DocumentImpl *contentDocument() const; 117 KHTMLPart *contentPart() const; 118 119 QString url; 120 DOMString name; //Computed name for the frame map 121 122 int marginWidth; 123 int marginHeight; 124 Qt::ScrollBarPolicy scrolling; 125 126 bool frameBorder : 1; 127 bool frameBorderSet : 1; 128 bool noresize : 1; 129 130 void ensureUniqueName(); 131 void computeContent() override; 132 void setWidgetNotify(QWidget *widget) override; 133 }; 134 135 // ------------------------------------------------------------------------- 136 137 class HTMLFrameSetElementImpl : public HTMLElementImpl 138 { 139 friend class khtml::RenderFrameSet; 140 public: 141 HTMLFrameSetElementImpl(DocumentImpl *doc); 142 143 ~HTMLFrameSetElementImpl(); 144 145 Id id() const override; 146 147 void parseAttribute(AttributeImpl *) override; 148 void attach() override; 149 150 void defaultEventHandler(EventImpl *evt) override; 151 frameBorder()152 bool frameBorder() 153 { 154 return frameborder; 155 } noResize()156 bool noResize() 157 { 158 return noresize; 159 } 160 totalRows()161 int totalRows() const 162 { 163 return m_totalRows; 164 } totalCols()165 int totalCols() const 166 { 167 return m_totalCols; 168 } border()169 int border() const 170 { 171 return frameborder ? m_border : 0; 172 } 173 void detach() override; 174 175 void recalcStyle(StyleChange ch) override; 176 177 protected: 178 khtml::Length *m_rows; 179 khtml::Length *m_cols; 180 181 int m_totalRows; 182 int m_totalCols; 183 int m_border; 184 185 bool frameborder : 1; 186 bool frameBorderSet : 1; 187 bool noresize : 1; 188 bool m_resizing : 1; // is the user resizing currently 189 }; 190 191 // ------------------------------------------------------------------------- 192 193 class HTMLHeadElementImpl : public HTMLElementImpl 194 { 195 public: HTMLHeadElementImpl(DocumentImpl * doc)196 HTMLHeadElementImpl(DocumentImpl *doc) 197 : HTMLElementImpl(doc) {} 198 199 Id id() const override; 200 }; 201 202 // ------------------------------------------------------------------------- 203 204 class HTMLHtmlElementImpl : public HTMLElementImpl 205 { 206 public: HTMLHtmlElementImpl(DocumentImpl * doc)207 HTMLHtmlElementImpl(DocumentImpl *doc) 208 : HTMLElementImpl(doc) {} 209 210 Id id() const override; 211 }; 212 213 // ------------------------------------------------------------------------- 214 215 class HTMLIFrameElementImpl : public HTMLFrameElementImpl 216 { 217 public: 218 HTMLIFrameElementImpl(DocumentImpl *doc); 219 220 ~HTMLIFrameElementImpl(); 221 222 Id id() const override; 223 224 void parseAttribute(AttributeImpl *attr) override; 225 void attach() override; 226 227 void computeContent() override; 228 void setWidgetNotify(QWidget *widget) override; 229 230 void insertedIntoDocument() override; 231 void removedFromDocument() override; 232 protected: 233 234 void updateFrame(); 235 bool m_frame; 236 }; 237 238 } //namespace 239 240 #endif 241 242