File indexing completed on 2024-04-28 15:23:26

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 #ifndef HTML_ELEMENTIMPL_H
0024 #define HTML_ELEMENTIMPL_H
0025 
0026 #include "xml/dom_elementimpl.h"
0027 
0028 namespace DOM
0029 {
0030 
0031 class DOMString;
0032 class DocumentFragment;
0033 
0034 class HTMLElementImpl : public ElementImpl
0035 {
0036 public:
0037     HTMLElementImpl(DocumentImpl *doc);
0038 
0039     virtual ~HTMLElementImpl();
0040 
0041     bool isHTMLElement() const override
0042     {
0043         return true;
0044     }
0045 
0046     bool isInline() const override;
0047 
0048     Id id() const override = 0;
0049     DOMString namespaceURI() const override;
0050 
0051     void parseAttribute(AttributeImpl *token) override;
0052 
0053     void addCSSLength(int id, const DOMString &value, bool numOnly = false, bool multiLength = false);
0054     void addCSSProperty(int id, const DOMString &value);
0055     void addCSSProperty(int id, int value);
0056     void addHTMLColor(int id, const DOMString &c);
0057     void removeCSSProperty(int id);
0058 
0059     void recalcStyle(StyleChange) override;
0060 
0061     DOMString innerHTML() const;
0062     DOMString innerText() const;
0063     DocumentFragment createContextualFragment(const DOMString &html);
0064     void setInnerHTML(const DOMString &html, int &exceptioncode);
0065     void setInnerText(const DOMString &text, int &exceptioncode);
0066 
0067     virtual DOMString contentEditable() const;
0068     virtual void setContentEditable(AttributeImpl *attr);
0069     virtual void setContentEditable(const DOMString &enabled);
0070 
0071     DOMString toString() const override;
0072 
0073 protected:
0074     // for IMG, OBJECT and APPLET
0075     void addHTMLAlignment(DOMString alignment);
0076 };
0077 
0078 class HTMLGenericElementImpl : public HTMLElementImpl
0079 {
0080 public:
0081     HTMLGenericElementImpl(DocumentImpl *doc, ushort i);
0082     HTMLGenericElementImpl(DocumentImpl *doc, LocalName name);
0083 
0084     virtual ~HTMLGenericElementImpl();
0085 
0086     Id id() const override
0087     {
0088         return m_localName.id();
0089     }
0090 
0091 protected:
0092     LocalName m_localName;
0093 };
0094 
0095 } //namespace
0096 
0097 #endif