KHTML
html_block.cpp
Go to the documentation of this file.00001
00023
00024
00025
00026 #include "dom/html_block.h"
00027 #include "dom/html_misc.h"
00028 #include "html/html_blockimpl.h"
00029 #include "html/html_miscimpl.h"
00030
00031 using namespace DOM;
00032
00033 #include "misc/htmlhashes.h"
00034
00035 HTMLBlockquoteElement::HTMLBlockquoteElement()
00036 : HTMLElement()
00037 {
00038 }
00039
00040 HTMLBlockquoteElement::HTMLBlockquoteElement(const HTMLBlockquoteElement &other)
00041 : HTMLElement(other)
00042 {
00043 }
00044
00045 HTMLBlockquoteElement::HTMLBlockquoteElement(HTMLElementImpl *impl)
00046 : HTMLElement(impl)
00047 {
00048 }
00049
00050 HTMLBlockquoteElement &HTMLBlockquoteElement::operator = (const Node &other)
00051 {
00052 assignOther( other, ID_BLOCKQUOTE );
00053 return *this;
00054 }
00055
00056 HTMLBlockquoteElement &HTMLBlockquoteElement::operator = (const HTMLBlockquoteElement &other)
00057 {
00058 HTMLElement::operator = (other);
00059 return *this;
00060 }
00061
00062 HTMLBlockquoteElement::~HTMLBlockquoteElement()
00063 {
00064 }
00065
00066 DOMString HTMLBlockquoteElement::cite() const
00067 {
00068 if(!impl) return DOMString();
00069 return ((ElementImpl *)impl)->getAttribute(ATTR_CITE);
00070 }
00071
00072 void HTMLBlockquoteElement::setCite( const DOMString &value )
00073 {
00074 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_CITE, value);
00075 }
00076
00077
00078
00079 HTMLDivElement::HTMLDivElement()
00080 : HTMLElement()
00081 {
00082 }
00083
00084 HTMLDivElement::HTMLDivElement(const HTMLDivElement &other)
00085 : HTMLElement(other)
00086 {
00087 }
00088
00089 HTMLDivElement::HTMLDivElement(HTMLDivElementImpl *impl)
00090 : HTMLElement(impl)
00091 {
00092 }
00093
00094 HTMLDivElement &HTMLDivElement::operator = (const Node &other)
00095 {
00096 assignOther( other, ID_DIV );
00097 return *this;
00098 }
00099
00100 HTMLDivElement &HTMLDivElement::operator = (const HTMLDivElement &other)
00101 {
00102 HTMLElement::operator = (other);
00103 return *this;
00104 }
00105
00106 HTMLDivElement::~HTMLDivElement()
00107 {
00108 }
00109
00110 DOMString HTMLDivElement::align() const
00111 {
00112 if(!impl) return DOMString();
00113 return ((ElementImpl *)impl)->getAttribute(ATTR_ALIGN);
00114 }
00115
00116 void HTMLDivElement::setAlign( const DOMString &value )
00117 {
00118 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALIGN, value);
00119 }
00120
00121
00122
00123 HTMLHRElement::HTMLHRElement()
00124 : HTMLElement()
00125 {
00126 }
00127
00128 HTMLHRElement::HTMLHRElement(const HTMLHRElement &other)
00129 : HTMLElement(other)
00130 {
00131 }
00132
00133 HTMLHRElement::HTMLHRElement(HTMLHRElementImpl *impl)
00134 : HTMLElement(impl)
00135 {
00136 }
00137
00138 HTMLHRElement &HTMLHRElement::operator = (const Node &other)
00139 {
00140 assignOther( other, ID_HR );
00141 return *this;
00142 }
00143
00144 HTMLHRElement &HTMLHRElement::operator = (const HTMLHRElement &other)
00145 {
00146 HTMLElement::operator = (other);
00147 return *this;
00148 }
00149
00150 HTMLHRElement::~HTMLHRElement()
00151 {
00152 }
00153
00154 DOMString HTMLHRElement::align() const
00155 {
00156 if(!impl) return DOMString();
00157 return ((ElementImpl *)impl)->getAttribute(ATTR_ALIGN);
00158 }
00159
00160 void HTMLHRElement::setAlign( const DOMString &value )
00161 {
00162 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALIGN, value);
00163 }
00164
00165 bool HTMLHRElement::noShade() const
00166 {
00167 if(!impl) return false;
00168 return !((ElementImpl *)impl)->getAttribute(ATTR_NOSHADE).isNull();
00169 }
00170
00171 void HTMLHRElement::setNoShade( bool _noShade )
00172 {
00173 if(impl)
00174 {
00175 DOMString str;
00176 if( _noShade )
00177 str = "";
00178 ((ElementImpl *)impl)->setAttribute(ATTR_NOSHADE, str);
00179 }
00180 }
00181
00182 DOMString HTMLHRElement::size() const
00183 {
00184 if(!impl) return DOMString();
00185 return ((ElementImpl *)impl)->getAttribute(ATTR_SIZE);
00186 }
00187
00188 void HTMLHRElement::setSize( const DOMString &value )
00189 {
00190 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_SIZE, value);
00191 }
00192
00193 DOMString HTMLHRElement::width() const
00194 {
00195 if(!impl) return DOMString();
00196 return ((ElementImpl *)impl)->getAttribute(ATTR_WIDTH);
00197 }
00198
00199 void HTMLHRElement::setWidth( const DOMString &value )
00200 {
00201 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_WIDTH, value);
00202 }
00203
00204
00205
00206 HTMLHeadingElement::HTMLHeadingElement()
00207 : HTMLElement()
00208 {
00209 }
00210
00211 HTMLHeadingElement::HTMLHeadingElement(const HTMLHeadingElement &other)
00212 : HTMLElement(other)
00213 {
00214 }
00215
00216 HTMLHeadingElement::HTMLHeadingElement(HTMLElementImpl *impl)
00217 : HTMLElement(impl)
00218 {
00219 }
00220
00221 HTMLHeadingElement &HTMLHeadingElement::operator = (const Node &other)
00222 {
00223 if(other.elementId() != ID_H1 &&
00224 other.elementId() != ID_H2 &&
00225 other.elementId() != ID_H3 &&
00226 other.elementId() != ID_H4 &&
00227 other.elementId() != ID_H5 &&
00228 other.elementId() != ID_H6 )
00229 {
00230 if ( impl ) impl->deref();
00231 impl = 0;
00232 } else {
00233 Node::operator = (other);
00234 }
00235 return *this;
00236 }
00237
00238 HTMLHeadingElement &HTMLHeadingElement::operator = (const HTMLHeadingElement &other)
00239 {
00240 HTMLElement::operator = (other);
00241 return *this;
00242 }
00243
00244 HTMLHeadingElement::~HTMLHeadingElement()
00245 {
00246 }
00247
00248 DOMString HTMLHeadingElement::align() const
00249 {
00250 if(!impl) return DOMString();
00251 return ((ElementImpl *)impl)->getAttribute(ATTR_ALIGN);
00252 }
00253
00254 void HTMLHeadingElement::setAlign( const DOMString &value )
00255 {
00256 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALIGN, value);
00257 }
00258
00259
00260
00261 HTMLParagraphElement::HTMLParagraphElement() : HTMLElement()
00262 {
00263 }
00264
00265 HTMLParagraphElement::HTMLParagraphElement(const HTMLParagraphElement &other)
00266 : HTMLElement(other)
00267 {
00268 }
00269
00270 HTMLParagraphElement::HTMLParagraphElement(HTMLElementImpl *impl)
00271 : HTMLElement(impl)
00272 {
00273 }
00274
00275 HTMLParagraphElement &HTMLParagraphElement::operator = (const Node &other)
00276 {
00277 assignOther( other, ID_P );
00278 return *this;
00279 }
00280
00281 HTMLParagraphElement &HTMLParagraphElement::operator = (const HTMLParagraphElement &other)
00282 {
00283 HTMLElement::operator = (other);
00284 return *this;
00285 }
00286
00287 HTMLParagraphElement::~HTMLParagraphElement()
00288 {
00289 }
00290
00291 DOMString HTMLParagraphElement::align() const
00292 {
00293 if(!impl) return DOMString();
00294 return ((ElementImpl *)impl)->getAttribute(ATTR_ALIGN);
00295 }
00296
00297 void HTMLParagraphElement::setAlign( const DOMString &value )
00298 {
00299 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALIGN, value);
00300 }
00301
00302
00303
00304 HTMLPreElement::HTMLPreElement() : HTMLElement()
00305 {
00306 }
00307
00308 HTMLPreElement::HTMLPreElement(const HTMLPreElement &other)
00309 : HTMLElement(other)
00310 {
00311 }
00312
00313 HTMLPreElement::HTMLPreElement(HTMLPreElementImpl *impl)
00314 : HTMLElement(impl)
00315 {
00316 }
00317
00318 HTMLPreElement &HTMLPreElement::operator = (const Node &other)
00319 {
00320 assignOther( other, ID_PRE );
00321 return *this;
00322 }
00323
00324 HTMLPreElement &HTMLPreElement::operator = (const HTMLPreElement &other)
00325 {
00326 HTMLElement::operator = (other);
00327 return *this;
00328 }
00329
00330 HTMLPreElement::~HTMLPreElement()
00331 {
00332 }
00333
00334 long HTMLPreElement::width() const
00335 {
00336 if(!impl) return 0;
00337 DOMString w = ((ElementImpl *)impl)->getAttribute(ATTR_WIDTH);
00338 return w.toInt();
00339 }
00340
00341 void HTMLPreElement::setWidth( long _width )
00342 {
00343 if(!impl) return;
00344
00345 QString aStr;
00346 aStr.sprintf("%ld", _width);
00347 DOMString value(aStr);
00348 ((ElementImpl *)impl)->setAttribute(ATTR_WIDTH, value);
00349 }
00350
00351
00352
00353 HTMLLayerElement::HTMLLayerElement() : HTMLElement()
00354 {
00355 }
00356
00357 HTMLLayerElement::HTMLLayerElement(const HTMLLayerElement &other)
00358 : HTMLElement(other)
00359 {
00360 }
00361
00362 HTMLLayerElement::HTMLLayerElement(HTMLLayerElementImpl *impl)
00363 : HTMLElement(impl)
00364 {
00365 }
00366
00367 HTMLLayerElement &HTMLLayerElement::operator = (const Node &other)
00368 {
00369 assignOther( other, ID_LAYER );
00370 return *this;
00371 }
00372
00373 HTMLLayerElement &HTMLLayerElement::operator = (const HTMLLayerElement &other)
00374 {
00375 HTMLElement::operator = (other);
00376 return *this;
00377 }
00378
00379 HTMLLayerElement::~HTMLLayerElement()
00380 {
00381 }
00382
00383 long HTMLLayerElement::top() const
00384 {
00385 if(!impl) return 0;
00386 DOMString t = ((ElementImpl *)impl)->getAttribute(ATTR_TOP);
00387 return t.toInt();
00388 }
00389
00390 void HTMLLayerElement::setTop( long _top )
00391 {
00392 if(!impl) return;
00393
00394 QString aStr;
00395 aStr.sprintf("%ld", _top);
00396 DOMString value(aStr);
00397 ((ElementImpl *)impl)->setAttribute(ATTR_TOP, value);
00398 }
00399
00400 long HTMLLayerElement::left() const
00401 {
00402 if(!impl) return 0;
00403 DOMString l = ((ElementImpl *)impl)->getAttribute(ATTR_LEFT);
00404 return l.toInt();
00405 }
00406
00407 void HTMLLayerElement::setLeft( long _left )
00408 {
00409 if(!impl) return;
00410
00411 QString aStr;
00412 aStr.sprintf("%ld", _left);
00413 DOMString value(aStr);
00414 ((ElementImpl *)impl)->setAttribute(ATTR_LEFT, value);
00415 }
00416
00417 DOMString HTMLLayerElement::visibility() const
00418 {
00419 if(!impl) return DOMString();
00420 return ((ElementImpl *)impl)->getAttribute(ATTR_VISIBILITY);
00421 }
00422
00423 void HTMLLayerElement::setVisibility( const DOMString &value )
00424 {
00425 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_VISIBILITY, value);
00426 }
00427
00428 DOMString HTMLLayerElement::bgColor() const
00429 {
00430 if(!impl) return DOMString();
00431 return ((ElementImpl *)impl)->getAttribute(ATTR_BGCOLOR);
00432 }
00433
00434 void HTMLLayerElement::setBgColor( const DOMString &value )
00435 {
00436 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_BGCOLOR, value);
00437 }
00438
00439 HTMLCollection HTMLLayerElement::layers() const
00440 {
00441 if(!impl) return HTMLCollection();
00442 return HTMLCollection(impl, HTMLCollectionImpl::DOC_LAYERS);
00443 }