summaryrefslogtreecommitdiffstats
path: root/tdehtml/dom/html_element.h
blob: 1329793b207ab813c5898920a840e14e418cc4fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
/*
 * This file is part of the DOM implementation for KDE.
 *
 * (C) 1999 Lars Knoll (knoll@kde.org)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 *
 * This file includes excerpts from the Document Object Model (DOM)
 * Level 1 Specification (Recommendation)
 * http://www.w3.org/TR/REC-DOM-Level-1/
 * Copyright © World Wide Web Consortium , (Massachusetts Institute of
 * Technology , Institut National de Recherche en Informatique et en
 * Automatique , Keio University ). All Rights Reserved.
 *
 */
#ifndef HTML_ELEMENT_H
#define HTML_ELEMENT_H

#include <dom/dom_element.h>
#include <tdelibs_export.h>

class KHTMLView;

namespace DOM {

class HTMLElementImpl;
class DOMString;
class Element;
class HTMLCollection;

/**
 * All HTML element interfaces derive from this class. Elements that
 * only expose the HTML core attributes are represented by the base
 * \c HTMLElement interface. These elements are as
 * follows:
 *
 *  \li \c HEAD
 *
 *  \li special: <tt> SUB, SUP, SPAN, BDO </tt>
 *
 *  \li font: <tt> TT, I, B, U, S, STRIKE, BIG, SMALL </tt>
 *
 *  \li phrase: <tt> EM, STRONG, DFN, CODE, SAMP, KBD, VAR,
 * CITE, ACRONYM, ABBR</tt>
 *
 *  \li list: <tt> DD, DT </tt>
 *
 *  \li <tt> NOFRAMES, NOSCRIPT </tt>
 *
 *  \li <tt> ADDRESS, CENTER </tt>
 *
 *  Note: The \c style attribute for this
 * interface is reserved for future usage.
 *
 */
class KHTML_EXPORT HTMLElement : public Element
{
    friend class HTMLDocument;
    friend class ::KHTMLView;
    friend class HTMLTableElement;
    friend class HTMLTableRowElement;
    friend class HTMLTableSectionElement;

public:
    HTMLElement();
    HTMLElement(const HTMLElement &other);
    HTMLElement(const Node &other) : Element()
         {(*this)=other;}

protected:
    HTMLElement(HTMLElementImpl *impl);
public:

    HTMLElement & operator = (const HTMLElement &other);
    HTMLElement & operator = (const Node &other);

    ~HTMLElement();

    /**
     * The element's identifier. See the <a
     * href="http://www.w3.org/TR/REC-html40/struct/global.html#adef-id">
     * id attribute definition </a> in HTML 4.0.
     *
     */
    DOMString id() const;

    /**
     * see id
     */
    void setId( const DOMString & );

    /**
     * The element's advisory title. See the <a
     * href="http://www.w3.org/TR/REC-html40/struct/global.html#adef-title">
     * title attribute definition </a> in HTML 4.0.
     *
     */
    DOMString title() const;

    /**
     * see title
     */
    void setTitle( const DOMString & );

    /**
     * Language code defined in RFC 1766. See the <a
     * href="http://www.w3.org/TR/REC-html40/struct/dirlang.html#adef-lang">
     * lang attribute definition </a> in HTML 4.0.
     *
     */
    DOMString lang() const;

    /**
     * see lang
     */
    void setLang( const DOMString & );

    /**
     * Specifies the base direction of directionally neutral text and
     * the directionality of tables. See the <a
     * href="http://www.w3.org/TR/REC-html40/struct/dirlang.html#adef-dir">
     * dir attribute definition </a> in HTML 4.0.
     *
     */
    DOMString dir() const;

    /**
     * see dir
     */
    void setDir( const DOMString & );

    /**
     * The class attribute of the element. This attribute has been
     * renamed due to conflicts with the "class" keyword exposed by
     * many languages. See the <a
     * href="http://www.w3.org/TR/REC-html40/struct/global.html#adef-class">
     * class attribute definition </a> in HTML 4.0.
     *
     */
    DOMString className() const;

    /**
     * see className
     */
    void setClassName( const DOMString & );

    /**
     * The HTML code contained in this element.
     * This function is not part of the DOM specifications as defined by the w3c.
     */
    DOMString innerHTML() const;

    /**
     * Set the HTML content of this node.
     *
     * @exception DOMException
     * NO_MODIFICATION_ALLOWED_ERR: Raised if there is the element does not allow
     * children.
     */
    void setInnerHTML( const DOMString &html );

    /**
     * The text contained in this element.
     * This function is not part of the DOM specifications as defined by the w3c.
     */
    DOMString innerText() const;

    /**
     * Set the text content of this node.
     *
     * @exception DOMException
     * NO_MODIFICATION_ALLOWED_ERR: Raised if there is the element does not allow
     * children.
     */
    void setInnerText( const DOMString &text );

    /**
     * Retrieves a collection of nodes that are direct descendants of this node.
     * IE-specific extension.
     */
    HTMLCollection children() const;

    /**
     * Retrieves a collection of all nodes that descend from this node.
     * IE-specific extension.
     */
    HTMLCollection all() const;

    /*
     * @internal
     */
    void removeCSSProperty( const DOMString& property );

    /*
     * @internal
     */
    void addCSSProperty( const DOMString &property, const DOMString &value );

protected:
    /*
     * @internal
     */
    void assignOther( const Node &other, int elementId );
};

} //namespace

#endif