KHtml

html_block.cpp
1 
23 // --------------------------------------------------------------------------
24 
25 #include "dom/html_block.h"
26 #include "dom/html_misc.h"
27 #include "html/html_blockimpl.h"
28 #include "html/html_miscimpl.h"
29 
30 using namespace DOM;
31 
32 HTMLBlockquoteElement::HTMLBlockquoteElement()
33  : HTMLElement()
34 {
35 }
36 
37 HTMLBlockquoteElement::HTMLBlockquoteElement(const HTMLBlockquoteElement &other)
38  : HTMLElement(other)
39 {
40 }
41 
42 HTMLBlockquoteElement::HTMLBlockquoteElement(HTMLElementImpl *impl)
43  : HTMLElement(impl)
44 {
45 }
46 
47 HTMLBlockquoteElement &HTMLBlockquoteElement::operator = (const Node &other)
48 {
49  assignOther(other, ID_BLOCKQUOTE);
50  return *this;
51 }
52 
53 HTMLBlockquoteElement &HTMLBlockquoteElement::operator = (const HTMLBlockquoteElement &other)
54 {
55  HTMLElement::operator = (other);
56  return *this;
57 }
58 
59 HTMLBlockquoteElement::~HTMLBlockquoteElement()
60 {
61 }
62 
64 {
65  if (!impl) {
66  return DOMString();
67  }
68  return ((ElementImpl *)impl)->getAttribute(ATTR_CITE);
69 }
70 
72 {
73  if (impl) {
74  ((ElementImpl *)impl)->setAttribute(ATTR_CITE, value);
75  }
76 }
77 
78 // --------------------------------------------------------------------------
79 
80 HTMLDivElement::HTMLDivElement()
81  : HTMLElement()
82 {
83 }
84 
85 HTMLDivElement::HTMLDivElement(const HTMLDivElement &other)
86  : HTMLElement(other)
87 {
88 }
89 
90 HTMLDivElement::HTMLDivElement(HTMLDivElementImpl *impl)
91  : HTMLElement(impl)
92 {
93 }
94 
95 HTMLDivElement &HTMLDivElement::operator = (const Node &other)
96 {
97  assignOther(other, ID_DIV);
98  return *this;
99 }
100 
101 HTMLDivElement &HTMLDivElement::operator = (const HTMLDivElement &other)
102 {
103  HTMLElement::operator = (other);
104  return *this;
105 }
106 
107 HTMLDivElement::~HTMLDivElement()
108 {
109 }
110 
112 {
113  if (!impl) {
114  return DOMString();
115  }
116  return ((ElementImpl *)impl)->getAttribute(ATTR_ALIGN);
117 }
118 
120 {
121  if (impl) {
122  ((ElementImpl *)impl)->setAttribute(ATTR_ALIGN, value);
123  }
124 }
125 
126 // --------------------------------------------------------------------------
127 
128 HTMLHRElement::HTMLHRElement()
129  : HTMLElement()
130 {
131 }
132 
133 HTMLHRElement::HTMLHRElement(const HTMLHRElement &other)
134  : HTMLElement(other)
135 {
136 }
137 
138 HTMLHRElement::HTMLHRElement(HTMLHRElementImpl *impl)
139  : HTMLElement(impl)
140 {
141 }
142 
143 HTMLHRElement &HTMLHRElement::operator = (const Node &other)
144 {
145  assignOther(other, ID_HR);
146  return *this;
147 }
148 
149 HTMLHRElement &HTMLHRElement::operator = (const HTMLHRElement &other)
150 {
151  HTMLElement::operator = (other);
152  return *this;
153 }
154 
155 HTMLHRElement::~HTMLHRElement()
156 {
157 }
158 
160 {
161  if (!impl) {
162  return DOMString();
163  }
164  return ((ElementImpl *)impl)->getAttribute(ATTR_ALIGN);
165 }
166 
168 {
169  if (impl) {
170  ((ElementImpl *)impl)->setAttribute(ATTR_ALIGN, value);
171  }
172 }
173 
175 {
176  if (!impl) {
177  return false;
178  }
179  return !((ElementImpl *)impl)->getAttribute(ATTR_NOSHADE).isNull();
180 }
181 
182 void HTMLHRElement::setNoShade(bool _noShade)
183 {
184  if (impl) {
185  DOMString str;
186  if (_noShade) {
187  str = "";
188  }
189  ((ElementImpl *)impl)->setAttribute(ATTR_NOSHADE, str);
190  }
191 }
192 
194 {
195  if (!impl) {
196  return DOMString();
197  }
198  return ((ElementImpl *)impl)->getAttribute(ATTR_SIZE);
199 }
200 
202 {
203  if (impl) {
204  ((ElementImpl *)impl)->setAttribute(ATTR_SIZE, value);
205  }
206 }
207 
209 {
210  if (!impl) {
211  return DOMString();
212  }
213  return ((ElementImpl *)impl)->getAttribute(ATTR_WIDTH);
214 }
215 
217 {
218  if (impl) {
219  ((ElementImpl *)impl)->setAttribute(ATTR_WIDTH, value);
220  }
221 }
222 
223 // --------------------------------------------------------------------------
224 
225 HTMLHeadingElement::HTMLHeadingElement()
226  : HTMLElement()
227 {
228 }
229 
230 HTMLHeadingElement::HTMLHeadingElement(const HTMLHeadingElement &other)
231  : HTMLElement(other)
232 {
233 }
234 
235 HTMLHeadingElement::HTMLHeadingElement(HTMLElementImpl *impl)
236  : HTMLElement(impl)
237 {
238 }
239 
240 HTMLHeadingElement &HTMLHeadingElement::operator = (const Node &other)
241 {
242  if (other.elementId() != ID_H1 &&
243  other.elementId() != ID_H2 &&
244  other.elementId() != ID_H3 &&
245  other.elementId() != ID_H4 &&
246  other.elementId() != ID_H5 &&
247  other.elementId() != ID_H6) {
248  if (impl) {
249  impl->deref();
250  }
251  impl = nullptr;
252  } else {
253  Node::operator = (other);
254  }
255  return *this;
256 }
257 
258 HTMLHeadingElement &HTMLHeadingElement::operator = (const HTMLHeadingElement &other)
259 {
260  HTMLElement::operator = (other);
261  return *this;
262 }
263 
264 HTMLHeadingElement::~HTMLHeadingElement()
265 {
266 }
267 
269 {
270  if (!impl) {
271  return DOMString();
272  }
273  return ((ElementImpl *)impl)->getAttribute(ATTR_ALIGN);
274 }
275 
277 {
278  if (impl) {
279  ((ElementImpl *)impl)->setAttribute(ATTR_ALIGN, value);
280  }
281 }
282 
283 // --------------------------------------------------------------------------
284 
285 HTMLParagraphElement::HTMLParagraphElement() : HTMLElement()
286 {
287 }
288 
289 HTMLParagraphElement::HTMLParagraphElement(const HTMLParagraphElement &other)
290  : HTMLElement(other)
291 {
292 }
293 
294 HTMLParagraphElement::HTMLParagraphElement(HTMLElementImpl *impl)
295  : HTMLElement(impl)
296 {
297 }
298 
299 HTMLParagraphElement &HTMLParagraphElement::operator = (const Node &other)
300 {
301  assignOther(other, ID_P);
302  return *this;
303 }
304 
305 HTMLParagraphElement &HTMLParagraphElement::operator = (const HTMLParagraphElement &other)
306 {
307  HTMLElement::operator = (other);
308  return *this;
309 }
310 
311 HTMLParagraphElement::~HTMLParagraphElement()
312 {
313 }
314 
316 {
317  if (!impl) {
318  return DOMString();
319  }
320  return ((ElementImpl *)impl)->getAttribute(ATTR_ALIGN);
321 }
322 
324 {
325  if (impl) {
326  ((ElementImpl *)impl)->setAttribute(ATTR_ALIGN, value);
327  }
328 }
329 
330 // --------------------------------------------------------------------------
331 
332 HTMLPreElement::HTMLPreElement() : HTMLElement()
333 {
334 }
335 
336 HTMLPreElement::HTMLPreElement(const HTMLPreElement &other)
337  : HTMLElement(other)
338 {
339 }
340 
341 HTMLPreElement::HTMLPreElement(HTMLPreElementImpl *impl)
342  : HTMLElement(impl)
343 {
344 }
345 
346 HTMLPreElement &HTMLPreElement::operator = (const Node &other)
347 {
348  assignOther(other, (impl ? impl->id() : ID_PRE));
349  return *this;
350 }
351 
352 HTMLPreElement &HTMLPreElement::operator = (const HTMLPreElement &other)
353 {
354  HTMLElement::operator = (other);
355  return *this;
356 }
357 
358 HTMLPreElement::~HTMLPreElement()
359 {
360 }
361 
363 {
364  if (!impl) {
365  return 0;
366  }
367  DOMString w = ((ElementImpl *)impl)->getAttribute(ATTR_WIDTH);
368  return w.toInt();
369 }
370 
371 void HTMLPreElement::setWidth(long _width)
372 {
373  if (!impl) {
374  return;
375  }
376 
377  QString aStr;
378  aStr.sprintf("%ld", _width);
379  DOMString value(aStr);
380  ((ElementImpl *)impl)->setAttribute(ATTR_WIDTH, value);
381 }
382 
383 // --------------------------------------------------------------------------
384 
385 HTMLLayerElement::HTMLLayerElement() : HTMLElement()
386 {
387 }
388 
389 HTMLLayerElement::HTMLLayerElement(const HTMLLayerElement &other)
390  : HTMLElement(other)
391 {
392 }
393 
394 HTMLLayerElement::HTMLLayerElement(HTMLLayerElementImpl *impl)
395  : HTMLElement(impl)
396 {
397 }
398 
399 HTMLLayerElement &HTMLLayerElement::operator = (const Node &other)
400 {
401  assignOther(other, ID_LAYER);
402  return *this;
403 }
404 
405 HTMLLayerElement &HTMLLayerElement::operator = (const HTMLLayerElement &other)
406 {
407  HTMLElement::operator = (other);
408  return *this;
409 }
410 
411 HTMLLayerElement::~HTMLLayerElement()
412 {
413 }
414 
416 {
417  if (!impl) {
418  return 0;
419  }
420  DOMString t = ((ElementImpl *)impl)->getAttribute(ATTR_TOP);
421  return t.toInt();
422 }
423 
425 {
426  if (!impl) {
427  return;
428  }
429 
430  QString aStr;
431  aStr.sprintf("%ld", _top);
432  DOMString value(aStr);
433  ((ElementImpl *)impl)->setAttribute(ATTR_TOP, value);
434 }
435 
437 {
438  if (!impl) {
439  return 0;
440  }
441  DOMString l = ((ElementImpl *)impl)->getAttribute(ATTR_LEFT);
442  return l.toInt();
443 }
444 
446 {
447  if (!impl) {
448  return;
449  }
450 
451  QString aStr;
452  aStr.sprintf("%ld", _left);
453  DOMString value(aStr);
454  ((ElementImpl *)impl)->setAttribute(ATTR_LEFT, value);
455 }
456 
458 {
459  if (!impl) {
460  return DOMString();
461  }
462  return ((ElementImpl *)impl)->getAttribute(ATTR_VISIBILITY);
463 }
464 
466 {
467  if (impl) {
468  ((ElementImpl *)impl)->setAttribute(ATTR_VISIBILITY, value);
469  }
470 }
471 
473 {
474  if (!impl) {
475  return DOMString();
476  }
477  return ((ElementImpl *)impl)->getAttribute(ATTR_BGCOLOR);
478 }
479 
481 {
482  if (impl) {
483  ((ElementImpl *)impl)->setAttribute(ATTR_BGCOLOR, value);
484  }
485 }
486 
488 {
489  if (!impl) {
490  return HTMLCollection();
491  }
492  return HTMLCollection(impl, HTMLCollectionImpl::DOC_LAYERS);
493 }
long top() const
The absolute position of the layer from the top.
Definition: html_block.cpp:415
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:278
Layer container for Netscape 4.x compatibility.
Definition: html_block.h:349
long left() const
The absolute position of the layer from the left.
Definition: html_block.cpp:436
void setAlign(const DOMString &)
see align
Definition: html_block.cpp:323
long width() const
Fixed width for content.
Definition: html_block.cpp:362
DOMString bgColor() const
The background color of the layer.
Definition: html_block.cpp:472
void setBgColor(const DOMString &)
see bgColor
Definition: html_block.cpp:480
DOMString width() const
The width of the rule.
Definition: html_block.cpp:208
QString & sprintf(const char *cformat,...)
An HTMLCollection is a list of nodes.
Definition: html_misc.h:133
void setTop(long)
see top
Definition: html_block.cpp:424
DOMString cite() const
A URI designating a document that describes the reason for the change.
Definition: html_block.cpp:63
DOMString align() const
Horizontal text alignment.
Definition: html_block.cpp:268
HTMLCollection layers() const
The collection of sub-layers.
Definition: html_block.cpp:487
void setAlign(const DOMString &)
see align
Definition: html_block.cpp:119
bool noShade() const
Indicates to the user agent that there should be no shading in the rendering of this element...
Definition: html_block.cpp:174
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
For the H1 to H6 elements.
Definition: html_block.h:223
void setNoShade(bool)
see noShade
Definition: html_block.cpp:182
DOMString size() const
The height of the rule.
Definition: html_block.cpp:193
void setLeft(long)
see left
Definition: html_block.cpp:445
DOMString align() const
Align the rule on the page.
Definition: html_block.cpp:159
DOMString align() const
Horizontal text alignment.
Definition: html_block.cpp:111
??? See the BLOCKQUOTE element definition in HTML 4.0.
Definition: html_block.h:50
Preformatted text.
Definition: html_block.h:309
This library provides a full-featured HTML parser and widget.
void setWidth(const DOMString &)
see width
Definition: html_block.cpp:216
Generic block container.
Definition: html_block.h:93
DOMString align() const
Horizontal text alignment.
Definition: html_block.cpp:315
void setAlign(const DOMString &)
see align
Definition: html_block.cpp:276
quint32 elementId() const
Definition: dom_node.cpp:509
void setWidth(long)
see width
Definition: html_block.cpp:371
void setVisibility(const DOMString &)
see visibility
Definition: html_block.cpp:465
void setAlign(const DOMString &)
see align
Definition: html_block.cpp:167
void setCite(const DOMString &)
see cite
Definition: html_block.cpp:71
All HTML element interfaces derive from this class.
Definition: html_element.h:70
void setSize(const DOMString &)
see size
Definition: html_block.cpp:201
DOMString visibility() const
The visibility of layers is either "show" or "hide".
Definition: html_block.cpp:457
Create a horizontal rule.
Definition: html_block.h:137
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Aug 14 2020 22:45:46 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.