summaryrefslogtreecommitdiffstats
path: root/tdehtml/dom/html_misc.h
blob: 643e5caf6977e7aa8a2590f5de7d63640db489eb (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
222
/*
 * 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_MISC_H
#define HTML_MISC_H

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

namespace DOM {

class HTMLBaseFontElementImpl;
class DOMString;
class HTMLCollectionImpl;

/**
 * Base font. See the <a
 * href="http://www.w3.org/TR/REC-html40/present/graphics.html#edef-BASEFONT">
 * BASEFONT element definition </a> in HTML 4.0. This element is
 * deprecated in HTML 4.0.
 *
 */
class KHTML_EXPORT HTMLBaseFontElement : public HTMLElement
{
public:
    HTMLBaseFontElement();
    HTMLBaseFontElement(const HTMLBaseFontElement &other);
    HTMLBaseFontElement(const Node &other) : HTMLElement()
         {(*this)=other;}
protected:
    HTMLBaseFontElement(HTMLBaseFontElementImpl *impl);
public:

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

    ~HTMLBaseFontElement();

    /**
     * Font color. See the <a href="http://www.w3.org/TR/REC-html40/">
     * color attribute definition </a> in HTML 4.0. This attribute is
     * deprecated in HTML 4.0.
     *
     */
    DOMString color() const;

    /**
     * see color
     */
    void setColor( const DOMString & );

    /**
     * Font face identifier. See the <a
     * href="http://www.w3.org/TR/REC-html40/"> face attribute
     * definition </a> in HTML 4.0. This attribute is deprecated in
     * HTML 4.0.
     *
     */
    DOMString face() const;

    /**
     * see face
     */
    void setFace( const DOMString & );

    /**
     * Computed Font size. See the <a
     * href="http://www.w3.org/TR/REC-html40/present/graphics.html#adef-size-BASEFONT">
     * size attribute definition </a> in HTML 4.0. This attribute is
     * deprecated in HTML 4.0.
     *
     */
    long getSize() const;

     /**
      * see size
      */
    void setSize( long );

    /**
     * @deprecated
     */
    DOMString size() const KDE_DEPRECATED;

    /**
     * @deprecated
     */
    void setSize( const DOMString & ) KDE_DEPRECATED;
};

// --------------------------------------------------------------------------

/**
 * An \c HTMLCollection is a list of nodes. An individual
 * node may be accessed by either ordinal index or the node's
 * \c name or \c id attributes. Note: Collections in
 * the HTML DOM are assumed to be live meaning that they are
 * automatically updated when the underlying document is changed.
 *
 */
class KHTML_EXPORT HTMLCollection
{
    friend class HTMLDocument;
    friend class HTMLSelectElement;
    friend class HTMLImageElement;
    friend class HTMLMapElement;
    friend class HTMLTableElement;
    friend class HTMLTableRowElement;
    friend class HTMLTableSectionElement;
    friend class HTMLLayerElement;
    friend class HTMLElement;

public:
    HTMLCollection();
    HTMLCollection(const HTMLCollection &other);
protected:
    HTMLCollection(NodeImpl *base, int type);
public:

    HTMLCollection & operator = (const HTMLCollection &other);

    ~HTMLCollection();

    /**
     * This attribute specifies the length or size of the list.
     *
     */
    unsigned long length() const;

    /**
     * This method retrieves a node specified by ordinal index. Nodes
     * are numbered in tree order (depth-first traversal order).
     *
     * @param index The index of the node to be fetched. The index
     * origin is 0.
     *
     * @return The \c Node at the corresponding position
     * upon success. A value of \c null is returned if the
     * index is out of range.
     *
     */
    Node item ( unsigned long index ) const;

    /**
     * This method retrieves a \c Node using a name. It
     * first searches for a \c Node with a matching
     * \c id attribute. If it doesn't find one, it then searches
     * for a \c Node with a matching \c name
     * attribute, but only on those elements that are allowed a name
     * attribute.
     *
     * @param name The name of the \c Node to be fetched.
     *
     * @return The \c Node with a \c name or
     * \c id attribute whose value corresponds to the
     * specified string. Upon failure (e.g., no node with this name
     * exists), returns \c null .
     *
     */
    Node namedItem ( const DOMString &name ) const;

    /**
     * @internal
     * not part of the DOM
     */
    Node base() const;
    HTMLCollectionImpl *handle() const;
    bool isNull() const;
    // Fast iteration
    Node firstItem() const;
    Node nextItem() const;
    // In case of multiple items named the same way
    Node nextNamedItem( const DOMString &name ) const;

protected:
    HTMLCollectionImpl *impl;
};

class KHTML_EXPORT HTMLFormCollection : public HTMLCollection
{
    friend class HTMLFormElement;
protected:
    HTMLFormCollection(NodeImpl *base);
};

/**
  @internal. Not part of the public API
*/
class KHTML_EXPORT HTMLMappedNameCollection : public HTMLCollection
{
public:
    HTMLMappedNameCollection(NodeImpl *base, int type, const DOMString &name );
};

} //namespace

#endif