KHTML
html_image.cpp
Go to the documentation of this file.
00001 00022 // -------------------------------------------------------------------------- 00023 00024 #include "html_image.h" 00025 #include "dom_doc.h" 00026 #include "html_misc.h" 00027 00028 #include <html/html_imageimpl.h> 00029 #include <html/html_miscimpl.h> 00030 #include <xml/dom_docimpl.h> 00031 00032 using namespace DOM; 00033 00034 HTMLAreaElement::HTMLAreaElement() : HTMLElement() 00035 { 00036 } 00037 00038 HTMLAreaElement::HTMLAreaElement(const HTMLAreaElement &other) : HTMLElement(other) 00039 { 00040 } 00041 00042 HTMLAreaElement::HTMLAreaElement(HTMLAreaElementImpl *impl) : HTMLElement(impl) 00043 { 00044 } 00045 00046 HTMLAreaElement &HTMLAreaElement::operator = (const Node &other) 00047 { 00048 assignOther( other, ID_AREA ); 00049 return *this; 00050 } 00051 00052 HTMLAreaElement &HTMLAreaElement::operator = (const HTMLAreaElement &other) 00053 { 00054 HTMLElement::operator = (other); 00055 return *this; 00056 } 00057 00058 HTMLAreaElement::~HTMLAreaElement() 00059 { 00060 } 00061 00062 DOMString HTMLAreaElement::accessKey() const 00063 { 00064 if(!impl) return DOMString(); 00065 return ((ElementImpl *)impl)->getAttribute(ATTR_ACCESSKEY); 00066 } 00067 00068 void HTMLAreaElement::setAccessKey( const DOMString &value ) 00069 { 00070 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ACCESSKEY, value); 00071 } 00072 00073 DOMString HTMLAreaElement::alt() const 00074 { 00075 if(!impl) return DOMString(); 00076 return ((ElementImpl *)impl)->getAttribute(ATTR_ALT); 00077 } 00078 00079 void HTMLAreaElement::setAlt( const DOMString &value ) 00080 { 00081 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALT, value); 00082 } 00083 00084 DOMString HTMLAreaElement::coords() const 00085 { 00086 if(!impl) return DOMString(); 00087 return ((ElementImpl *)impl)->getAttribute(ATTR_COORDS); 00088 } 00089 00090 void HTMLAreaElement::setCoords( const DOMString &value ) 00091 { 00092 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_COORDS, value); 00093 } 00094 00095 DOMString HTMLAreaElement::href() const 00096 { 00097 if(!impl) return DOMString(); 00098 DOMString href = static_cast<ElementImpl*>(impl)->getAttribute(ATTR_HREF); 00099 return !href.isNull() ? impl->document()->completeURL(href.string()) : href; 00100 } 00101 00102 void HTMLAreaElement::setHref( const DOMString &value ) 00103 { 00104 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_HREF, value); 00105 } 00106 00107 bool HTMLAreaElement::noHref() const 00108 { 00109 if(!impl) return 0; 00110 return !((ElementImpl *)impl)->getAttribute(ATTR_NOHREF).isNull(); 00111 } 00112 00113 void HTMLAreaElement::setNoHref( bool _noHref ) 00114 { 00115 if(impl) 00116 { 00117 DOMString str; 00118 if( _noHref ) 00119 str = ""; 00120 ((ElementImpl *)impl)->setAttribute(ATTR_NOHREF, str); 00121 } 00122 } 00123 00124 DOMString HTMLAreaElement::shape() const 00125 { 00126 if(!impl) return DOMString(); 00127 return ((ElementImpl *)impl)->getAttribute(ATTR_SHAPE); 00128 } 00129 00130 void HTMLAreaElement::setShape( const DOMString &value ) 00131 { 00132 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_SHAPE, value); 00133 } 00134 00135 long HTMLAreaElement::tabIndex() const 00136 { 00137 if(!impl) return 0; 00138 return ((ElementImpl *)impl)->getAttribute(ATTR_TABINDEX).toInt(); 00139 } 00140 00141 void HTMLAreaElement::setTabIndex( long _tabIndex ) 00142 { 00143 if(impl) { 00144 DOMString value(QString::number(_tabIndex)); 00145 ((ElementImpl *)impl)->setAttribute(ATTR_TABINDEX,value); 00146 } 00147 } 00148 00149 DOMString HTMLAreaElement::target() const 00150 { 00151 if(!impl) return DOMString(); 00152 return ((ElementImpl *)impl)->getAttribute(ATTR_TARGET); 00153 } 00154 00155 void HTMLAreaElement::setTarget( const DOMString &value ) 00156 { 00157 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_TARGET, value); 00158 } 00159 00160 // -------------------------------------------------------------------------- 00161 00162 HTMLImageElement::HTMLImageElement() : HTMLElement() 00163 { 00164 } 00165 00166 HTMLImageElement::HTMLImageElement(const HTMLImageElement &other) : HTMLElement(other) 00167 { 00168 } 00169 00170 HTMLImageElement::HTMLImageElement(HTMLImageElementImpl *impl) : HTMLElement(impl) 00171 { 00172 } 00173 00174 HTMLImageElement &HTMLImageElement::operator = (const Node &other) 00175 { 00176 assignOther( other, ID_IMG ); 00177 return *this; 00178 } 00179 00180 HTMLImageElement &HTMLImageElement::operator = (const HTMLImageElement &other) 00181 { 00182 HTMLElement::operator = (other); 00183 return *this; 00184 } 00185 00186 HTMLImageElement::~HTMLImageElement() 00187 { 00188 } 00189 00190 DOMString HTMLImageElement::name() const 00191 { 00192 if(!impl) return DOMString(); 00193 return ((ElementImpl *)impl)->getAttribute(ATTR_NAME); 00194 } 00195 00196 void HTMLImageElement::setName( const DOMString &value ) 00197 { 00198 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_NAME, value); 00199 } 00200 00201 DOMString HTMLImageElement::align() const 00202 { 00203 if(!impl) return DOMString(); 00204 return ((ElementImpl *)impl)->getAttribute(ATTR_ALIGN); 00205 } 00206 00207 void HTMLImageElement::setAlign( const DOMString &value ) 00208 { 00209 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALIGN, value); 00210 } 00211 00212 DOMString HTMLImageElement::alt() const 00213 { 00214 if(!impl) return DOMString(); 00215 return ((ElementImpl *)impl)->getAttribute(ATTR_ALT); 00216 } 00217 00218 void HTMLImageElement::setAlt( const DOMString &value ) 00219 { 00220 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALT, value); 00221 } 00222 00223 #ifndef KDE_NO_DEPRECATED 00224 long HTMLImageElement::border() const 00225 { 00226 if(!impl) return 0; 00227 // ### return value in pixels 00228 return static_cast<HTMLImageElementImpl*>(impl)->getAttribute(ATTR_BORDER).toInt(); 00229 } 00230 #endif 00231 00232 #ifndef KDE_NO_DEPRECATED 00233 void HTMLImageElement::setBorder( long value ) 00234 { 00235 if (impl) static_cast<HTMLImageElementImpl*>(impl)->setAttribute(ATTR_BORDER, QString::number(value)); 00236 } 00237 #endif 00238 00239 DOMString HTMLImageElement::getBorder() const 00240 { 00241 if(!impl) return DOMString(); 00242 return static_cast<HTMLImageElementImpl*>(impl)->getAttribute(ATTR_BORDER); 00243 } 00244 00245 void HTMLImageElement::setBorder( const DOMString& value ) 00246 { 00247 if (impl) static_cast<HTMLImageElementImpl*>(impl)->setAttribute(ATTR_BORDER, value); 00248 } 00249 00250 00251 long HTMLImageElement::height() const 00252 { 00253 if(!impl) return 0; 00254 return static_cast<HTMLImageElementImpl*>(impl)->height(); 00255 } 00256 00257 void HTMLImageElement::setHeight( long value ) 00258 { 00259 if(impl) ((HTMLImageElementImpl *)impl)->setHeight(value); 00260 } 00261 00262 long HTMLImageElement::hspace() const 00263 { 00264 if(!impl) return 0; 00265 // ### return actual value 00266 return ((ElementImpl *)impl)->getAttribute(ATTR_HSPACE).toInt(); 00267 } 00268 00269 void HTMLImageElement::setHspace( long value ) 00270 { 00271 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_HSPACE, QString::number(value)); 00272 } 00273 00274 bool HTMLImageElement::isMap() const 00275 { 00276 if(!impl) return 0; 00277 return !((ElementImpl *)impl)->getAttribute(ATTR_ISMAP).isNull(); 00278 } 00279 00280 void HTMLImageElement::setIsMap( bool _isMap ) 00281 { 00282 if(impl) 00283 { 00284 DOMString str; 00285 if( _isMap ) 00286 str = ""; 00287 ((ElementImpl *)impl)->setAttribute(ATTR_ISMAP, str); 00288 } 00289 } 00290 00291 DOMString HTMLImageElement::longDesc() const 00292 { 00293 if(!impl) return DOMString(); 00294 return ((ElementImpl *)impl)->getAttribute(ATTR_LONGDESC); 00295 } 00296 00297 void HTMLImageElement::setLongDesc( const DOMString &value ) 00298 { 00299 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_LONGDESC, value); 00300 } 00301 00302 DOMString HTMLImageElement::src() const 00303 { 00304 if(!impl) return DOMString(); 00305 DOMString s = ((ElementImpl *)impl)->getAttribute(ATTR_SRC); 00306 return !s.isNull() ? impl->document()->completeURL( s.string() ) : s; 00307 } 00308 00309 void HTMLImageElement::setSrc( const DOMString &value ) 00310 { 00311 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_SRC, value); 00312 } 00313 00314 DOMString HTMLImageElement::useMap() const 00315 { 00316 if(!impl) return DOMString(); 00317 return ((ElementImpl *)impl)->getAttribute(ATTR_USEMAP); 00318 } 00319 00320 void HTMLImageElement::setUseMap( const DOMString &value ) 00321 { 00322 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_USEMAP, value); 00323 } 00324 00325 long HTMLImageElement::vspace() const 00326 { 00327 if(!impl) return 0; 00328 // ### return actual vspace 00329 return ((ElementImpl *)impl)->getAttribute(ATTR_VSPACE).toInt(); 00330 } 00331 00332 void HTMLImageElement::setVspace( long value ) 00333 { 00334 if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_VSPACE, QString::number(value)); 00335 } 00336 00337 long HTMLImageElement::width() const 00338 { 00339 if(!impl) return 0; 00340 return static_cast<HTMLImageElementImpl*>(impl)->width(); 00341 } 00342 00343 void HTMLImageElement::setWidth( long value ) 00344 { 00345 if(impl) ((HTMLImageElementImpl *)impl)->setWidth(value); 00346 } 00347 00348 long HTMLImageElement::x() const 00349 { 00350 if (impl) return static_cast<const HTMLImageElementImpl*>(impl)->x(); 00351 return 0; 00352 } 00353 00354 long HTMLImageElement::y() const 00355 { 00356 if (impl) return static_cast<const HTMLImageElementImpl*>(impl)->y(); 00357 return 0; 00358 } 00359 00360 // -------------------------------------------------------------------------- 00361 00362 HTMLMapElement::HTMLMapElement() : HTMLElement() 00363 { 00364 } 00365 00366 HTMLMapElement::HTMLMapElement(const HTMLMapElement &other) : HTMLElement(other) 00367 { 00368 } 00369 00370 HTMLMapElement::HTMLMapElement(HTMLMapElementImpl *impl) : HTMLElement(impl) 00371 { 00372 } 00373 00374 HTMLMapElement &HTMLMapElement::operator = (const Node &other) 00375 { 00376 assignOther( other, ID_MAP ); 00377 return *this; 00378 } 00379 00380 HTMLMapElement &HTMLMapElement::operator = (const HTMLMapElement &other) 00381 { 00382 HTMLElement::operator = (other); 00383 return *this; 00384 } 00385 00386 HTMLMapElement::~HTMLMapElement() 00387 { 00388 } 00389 00390 HTMLCollection HTMLMapElement::areas() const 00391 { 00392 if(!impl) return HTMLCollection(); 00393 return HTMLCollection(((HTMLMapElementImpl*)impl)->areas()); 00394 } 00395 00396 DOMString HTMLMapElement::name() const 00397 { 00398 if(!impl) return DOMString(); 00399 return ((ElementImpl *)impl)->getAttribute(ATTR_NAME); 00400 } 00401 00402 void HTMLMapElement::setName( const DOMString &value ) 00403 { 00404 if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_NAME, value); 00405 } 00406
KDE 4.6 API Reference