KHtml

html_misc.cpp
1 /**
2  * This file is part of the DOM implementation for KDE.
3  *
4  * Copyright 1999 Lars Knoll ([email protected])
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License
17  * along with this library; see the file COPYING.LIB. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21  */
22 // --------------------------------------------------------------------------
23 
24 #include "dom/html_misc.h"
25 #include "html/html_miscimpl.h"
26 
27 using namespace DOM;
28 
29 HTMLBaseFontElement::HTMLBaseFontElement() : HTMLElement()
30 {
31 }
32 
33 HTMLBaseFontElement::HTMLBaseFontElement(const HTMLBaseFontElement &other) : HTMLElement(other)
34 {
35 }
36 
37 HTMLBaseFontElement::HTMLBaseFontElement(HTMLBaseFontElementImpl *impl) : HTMLElement(impl)
38 {
39 }
40 
41 HTMLBaseFontElement &HTMLBaseFontElement::operator = (const Node &other)
42 {
43  assignOther(other, ID_BASEFONT);
44  return *this;
45 }
46 
47 HTMLBaseFontElement &HTMLBaseFontElement::operator = (const HTMLBaseFontElement &other)
48 {
49  HTMLElement::operator = (other);
50  return *this;
51 }
52 
53 HTMLBaseFontElement::~HTMLBaseFontElement()
54 {
55 }
56 
58 {
59  if (!impl) {
60  return DOMString();
61  }
62  return ((ElementImpl *)impl)->getAttribute(ATTR_COLOR);
63 }
64 
66 {
67  if (impl) {
68  ((ElementImpl *)impl)->setAttribute(ATTR_COLOR, value);
69  }
70 }
71 
73 {
74  if (!impl) {
75  return DOMString();
76  }
77  return ((ElementImpl *)impl)->getAttribute(ATTR_FACE);
78 }
79 
81 {
82  if (impl) {
83  ((ElementImpl *)impl)->setAttribute(ATTR_FACE, value);
84  }
85 }
86 
87 #ifndef KHTML_NO_DEPRECATED
89 {
90  if (!impl) {
91  return DOMString();
92  }
93  return ((ElementImpl *)impl)->getAttribute(ATTR_SIZE);
94 }
95 #endif
96 
97 #ifndef KHTML_NO_DEPRECATED
99 {
100  if (impl) {
101  ((ElementImpl *)impl)->setAttribute(ATTR_SIZE, value);
102  }
103 }
104 #endif
105 
107 {
108  if (!impl) {
109  return 0;
110  }
111  return ((ElementImpl *)impl)->getAttribute(ATTR_SIZE).toInt();
112 }
113 
115 {
116  if (impl) {
117  DOMString value(QString::number(_value));
118  ((ElementImpl *)impl)->setAttribute(ATTR_SIZE, value);
119  }
120 }
121 
122 // --------------------------------------------------------------------------
123 
124 HTMLCollection::HTMLCollection()
125  : impl(nullptr)
126 {
127 }
128 
129 HTMLCollection::HTMLCollection(HTMLCollectionImpl *_impl): impl(_impl)
130 {
131  if (impl) {
132  impl->ref();
133  }
134 }
135 
136 HTMLCollection::HTMLCollection(const HTMLCollection &other)
137 {
138  impl = other.impl;
139  if (impl) {
140  impl->ref();
141  }
142 }
143 
144 HTMLCollection::HTMLCollection(NodeImpl *base, int type)
145 {
146  impl = new HTMLCollectionImpl(base, type);
147  impl->ref();
148 }
149 
150 HTMLCollection &HTMLCollection::operator = (const HTMLCollection &other)
151 {
152  if (impl != other.impl) {
153  if (impl) {
154  impl->deref();
155  }
156  impl = other.impl;
157  if (impl) {
158  impl->ref();
159  }
160  }
161  return *this;
162 }
163 
164 HTMLCollection::~HTMLCollection()
165 {
166  if (impl) {
167  impl->deref();
168  }
169 }
170 
171 unsigned long HTMLCollection::length() const
172 {
173  if (!impl) {
174  return 0;
175  }
176  return ((HTMLCollectionImpl *)impl)->length();
177 }
178 
179 Node HTMLCollection::item(unsigned long index) const
180 {
181  if (!impl) {
182  return nullptr;
183  }
184  return ((HTMLCollectionImpl *)impl)->item(index);
185 }
186 
188 {
189  if (!impl) {
190  return nullptr;
191  }
192  return ((HTMLCollectionImpl *)impl)->namedItem(name);
193 }
194 
196 {
197  if (!impl) {
198  return nullptr;
199  }
200 
201  return static_cast<HTMLCollectionImpl *>(impl)->m_refNode;
202 }
203 
204 Node HTMLCollection::firstItem() const
205 {
206  if (!impl) {
207  return nullptr;
208  }
209  return static_cast<HTMLCollectionImpl *>(impl)->firstItem();
210 }
211 
212 Node HTMLCollection::nextItem() const
213 {
214  if (!impl) {
215  return nullptr;
216  }
217  return static_cast<HTMLCollectionImpl *>(impl)->nextItem();
218 }
219 
220 Node HTMLCollection::nextNamedItem(const DOMString &name) const
221 {
222  if (!impl) {
223  return nullptr;
224  }
225  return static_cast<HTMLCollectionImpl *>(impl)->nextNamedItem(name);
226 }
227 
228 HTMLCollectionImpl *HTMLCollection::handle() const
229 {
230  return impl;
231 }
232 
233 bool HTMLCollection::isNull() const
234 {
235  return (impl == nullptr);
236 }
237 
238 // -----------------------------------------------------------------------------
239 
240 HTMLFormCollection::HTMLFormCollection(NodeImpl *base)
241  : HTMLCollection()
242 {
243  impl = new HTMLFormCollectionImpl(base);
244  impl->ref();
245 }
246 
QString number(int n, int base)
DOMString color() const
Font color.
Definition: html_misc.cpp:57
All HTML element interfaces derive from this class.
Definition: html_element.h:70
Node base() const
Definition: html_misc.cpp:195
This library provides a full-featured HTML parser and widget.
An HTMLCollection is a list of nodes.
Definition: html_misc.h:133
void setSize(long)
see size
Definition: html_misc.cpp:114
void setColor(const DOMString &)
see color
Definition: html_misc.cpp:65
Node namedItem(const DOMString &name) const
This method retrieves a Node using a name.
Definition: html_misc.cpp:187
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
DOMString face() const
Font face identifier.
Definition: html_misc.cpp:72
unsigned long length() const
This attribute specifies the length or size of the list.
Definition: html_misc.cpp:171
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:278
KHTML_DEPRECATED DOMString size() const
Definition: html_misc.cpp:88
Node item(unsigned long index) const
This method retrieves a node specified by ordinal index.
Definition: html_misc.cpp:179
void setFace(const DOMString &)
see face
Definition: html_misc.cpp:80
long getSize() const
Computed Font size.
Definition: html_misc.cpp:106
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon May 8 2023 03:55:32 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.