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