html_image.cpp
// --------------------------------------------------------------------------
#include "dom/dom_doc.h"
#include "dom/html_image.h"
#include "dom/html_misc.h"
#include "html/html_imageimpl.h"
#include "html/html_miscimpl.h"
#include "misc/htmlhashes.h"
#include "xml/dom_docimpl.h"
using namespace DOM;
HTMLAreaElement::HTMLAreaElement() : HTMLElement()
{
}
HTMLAreaElement::HTMLAreaElement(const HTMLAreaElement &other) : HTMLElement(other)
{
}
HTMLAreaElement::HTMLAreaElement(HTMLAreaElementImpl *impl) : HTMLElement(impl)
{
}
HTMLAreaElement &HTMLAreaElement::operator = (const Node &other)
{
assignOther( other, ID_AREA );
return *this;
}
HTMLAreaElement &HTMLAreaElement::operator = (const HTMLAreaElement &other)
{
HTMLElement::operator = (other);
return *this;
}
HTMLAreaElement::~HTMLAreaElement()
{
}
DOMString HTMLAreaElement::accessKey() const
{
if(!impl) return DOMString();
return ((ElementImpl *)impl)->getAttribute(ATTR_ACCESSKEY);
}
void HTMLAreaElement::setAccessKey( const DOMString &value )
{
if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ACCESSKEY, value);
}
DOMString HTMLAreaElement::alt() const
{
if(!impl) return DOMString();
return ((ElementImpl *)impl)->getAttribute(ATTR_ALT);
}
void HTMLAreaElement::setAlt( const DOMString &value )
{
if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALT, value);
}
DOMString HTMLAreaElement::coords() const
{
if(!impl) return DOMString();
return ((ElementImpl *)impl)->getAttribute(ATTR_COORDS);
}
void HTMLAreaElement::setCoords( const DOMString &value )
{
if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_COORDS, value);
}
DOMString HTMLAreaElement::href() const
{
if(!impl) return DOMString();
DOMString href = static_cast<ElementImpl*>(impl)->getAttribute(ATTR_HREF);
return !href.isNull() ? impl->getDocument()->completeURL(href.string()) : href;
}
void HTMLAreaElement::setHref( const DOMString &value )
{
if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_HREF, value);
}
bool HTMLAreaElement::noHref() const
{
if(!impl) return 0;
return !((ElementImpl *)impl)->getAttribute(ATTR_NOHREF).isNull();
}
void HTMLAreaElement::setNoHref( bool _noHref )
{
if(impl)
{
DOMString str;
if( _noHref )
str = "";
((ElementImpl *)impl)->setAttribute(ATTR_NOHREF, str);
}
}
DOMString HTMLAreaElement::shape() const
{
if(!impl) return DOMString();
return ((ElementImpl *)impl)->getAttribute(ATTR_SHAPE);
}
void HTMLAreaElement::setShape( const DOMString &value )
{
if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_SHAPE, value);
}
long HTMLAreaElement::tabIndex() const
{
if(!impl) return 0;
return ((ElementImpl *)impl)->getAttribute(ATTR_TABINDEX).toInt();
}
void HTMLAreaElement::setTabIndex( long _tabIndex )
{
if(impl) {
DOMString value(QString::number(_tabIndex));
((ElementImpl *)impl)->setAttribute(ATTR_TABINDEX,value);
}
}
DOMString HTMLAreaElement::target() const
{
if(!impl) return DOMString();
return ((ElementImpl *)impl)->getAttribute(ATTR_TARGET);
}
void HTMLAreaElement::setTarget( const DOMString &value )
{
if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_TARGET, value);
}
// --------------------------------------------------------------------------
HTMLImageElement::HTMLImageElement() : HTMLElement()
{
}
HTMLImageElement::HTMLImageElement(const HTMLImageElement &other) : HTMLElement(other)
{
}
HTMLImageElement::HTMLImageElement(HTMLImageElementImpl *impl) : HTMLElement(impl)
{
}
HTMLImageElement &HTMLImageElement::operator = (const Node &other)
{
assignOther( other, ID_IMG );
return *this;
}
HTMLImageElement &HTMLImageElement::operator = (const HTMLImageElement &other)
{
HTMLElement::operator = (other);
return *this;
}
HTMLImageElement::~HTMLImageElement()
{
}
DOMString HTMLImageElement::name() const
{
if(!impl) return DOMString();
return ((ElementImpl *)impl)->getAttribute(ATTR_NAME);
}
void HTMLImageElement::setName( const DOMString &value )
{
if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_NAME, value);
}
DOMString HTMLImageElement::align() const
{
if(!impl) return DOMString();
return ((ElementImpl *)impl)->getAttribute(ATTR_ALIGN);
}
void HTMLImageElement::setAlign( const DOMString &value )
{
if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALIGN, value);
}
DOMString HTMLImageElement::alt() const
{
if(!impl) return DOMString();
return ((ElementImpl *)impl)->getAttribute(ATTR_ALT);
}
void HTMLImageElement::setAlt( const DOMString &value )
{
if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_ALT, value);
}
long HTMLImageElement::border() const
{
if(!impl) return 0;
// ### return value in pixels
return static_cast<HTMLImageElementImpl*>(impl)->getAttribute(ATTR_BORDER).toInt();
}
void HTMLImageElement::setBorder( long value )
{
if (impl) static_cast<HTMLImageElementImpl*>(impl)->setAttribute(ATTR_BORDER, QString::number(value));
}
DOMString HTMLImageElement::getBorder() const
{
if(!impl) return DOMString();
return static_cast<HTMLImageElementImpl*>(impl)->getAttribute(ATTR_BORDER);
}
void HTMLImageElement::setBorder( const DOMString& value )
{
if (impl) static_cast<HTMLImageElementImpl*>(impl)->setAttribute(ATTR_BORDER, value);
}
long HTMLImageElement::height() const
{
if(!impl) return 0;
return static_cast<HTMLImageElementImpl*>(impl)->height();
}
void HTMLImageElement::setHeight( long value )
{
if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_HEIGHT, QString::number(value));
}
long HTMLImageElement::hspace() const
{
if(!impl) return 0;
// ### return actual value
return ((ElementImpl *)impl)->getAttribute(ATTR_HSPACE).toInt();
}
void HTMLImageElement::setHspace( long value )
{
if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_HSPACE, QString::number(value));
}
bool HTMLImageElement::isMap() const
{
if(!impl) return 0;
return !((ElementImpl *)impl)->getAttribute(ATTR_DISABLED).isNull();
}
void HTMLImageElement::setIsMap( bool _isMap )
{
if(impl)
{
DOMString str;
if( _isMap )
str = "";
((ElementImpl *)impl)->setAttribute(ATTR_ISMAP, str);
}
}
DOMString HTMLImageElement::longDesc() const
{
if(!impl) return DOMString();
return ((ElementImpl *)impl)->getAttribute(ATTR_LONGDESC);
}
void HTMLImageElement::setLongDesc( const DOMString &value )
{
if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_LONGDESC, value);
}
DOMString HTMLImageElement::src() const
{
if(!impl) return DOMString();
DOMString s = ((ElementImpl *)impl)->getAttribute(ATTR_SRC);
return !s.isNull() ? impl->getDocument()->completeURL( s.string() ) : s;
}
void HTMLImageElement::setSrc( const DOMString &value )
{
if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_SRC, value);
}
DOMString HTMLImageElement::useMap() const
{
if(!impl) return DOMString();
return ((ElementImpl *)impl)->getAttribute(ATTR_USEMAP);
}
void HTMLImageElement::setUseMap( const DOMString &value )
{
if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_USEMAP, value);
}
long HTMLImageElement::vspace() const
{
if(!impl) return 0;
// ### return actual vspace
return ((ElementImpl *)impl)->getAttribute(ATTR_VSPACE).toInt();
}
void HTMLImageElement::setVspace( long value )
{
if(impl) static_cast<ElementImpl*>(impl)->setAttribute(ATTR_VSPACE, QString::number(value));
}
long HTMLImageElement::width() const
{
if(!impl) return 0;
return static_cast<HTMLImageElementImpl*>(impl)->width();
}
void HTMLImageElement::setWidth( long value )
{
if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_WIDTH, QString::number(value));
}
long HTMLImageElement::x() const
{
if (impl && impl->renderer()) {
int x = 0;
int y = 0;
impl->renderer()->absolutePosition(x,y);
return x;
}
return 0;
}
long HTMLImageElement::y() const
{
if (impl && impl->renderer()) {
int x = 0;
int y = 0;
impl->renderer()->absolutePosition(x,y);
return y;
}
return 0;
}
// --------------------------------------------------------------------------
HTMLMapElement::HTMLMapElement() : HTMLElement()
{
}
HTMLMapElement::HTMLMapElement(const HTMLMapElement &other) : HTMLElement(other)
{
}
HTMLMapElement::HTMLMapElement(HTMLMapElementImpl *impl) : HTMLElement(impl)
{
}
HTMLMapElement &HTMLMapElement::operator = (const Node &other)
{
assignOther( other, ID_MAP );
return *this;
}
HTMLMapElement &HTMLMapElement::operator = (const HTMLMapElement &other)
{
HTMLElement::operator = (other);
return *this;
}
HTMLMapElement::~HTMLMapElement()
{
}
HTMLCollection HTMLMapElement::areas() const
{
if(!impl) return HTMLCollection();
return HTMLCollection(impl, HTMLCollectionImpl::MAP_AREAS);
}
DOMString HTMLMapElement::name() const
{
if(!impl) return DOMString();
return ((ElementImpl *)impl)->getAttribute(ATTR_NAME);
}
void HTMLMapElement::setName( const DOMString &value )
{
if(impl) ((ElementImpl *)impl)->setAttribute(ATTR_NAME, value);
}
DOM::HTMLImageElement::setSrc
void setSrc(const DOMString &)
see src
Definition: html_image.cpp:306
DOM::HTMLImageElement::setWidth
void setWidth(long)
see width
Definition: html_image.cpp:340
DOM::Node
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:274
DOM::HTMLImageElement::getBorder
DOMString getBorder() const
Width of border around image.
Definition: html_image.cpp:236
DOM::HTMLImageElement::vspace
long vspace() const
Vertical space above and below this image.
Definition: html_image.cpp:322
DOM::HTMLAreaElement
Client-side image map area definition.
Definition: html_image.h:47
DOM::HTMLAreaElement::setAccessKey
void setAccessKey(const DOMString &)
see accessKey
Definition: html_image.cpp:69
DOM::HTMLImageElement::setHeight
void setHeight(long)
see height
Definition: html_image.cpp:254
DOM::HTMLImageElement::isMap
bool isMap() const
Use server-side image map.
Definition: html_image.cpp:271
DOM::HTMLImageElement::setLongDesc
void setLongDesc(const DOMString &)
see longDesc
Definition: html_image.cpp:294
DOM::HTMLMapElement::setName
void setName(const DOMString &)
see name
Definition: html_image.cpp:409
DOM::HTMLImageElement::align
DOMString align() const
Aligns this object (vertically or horizontally) with respect to its surrounding text.
Definition: html_image.cpp:202
DOM::HTMLAreaElement::setCoords
void setCoords(const DOMString &)
see coords
Definition: html_image.cpp:91
DOM::Element::setAttribute
void setAttribute(const DOMString &name, const DOMString &value)
Adds a new attribute.
Definition: dom_element.cpp:162
DOM::HTMLImageElement::alt
DOMString alt() const
Alternate text for user agents not rendering the normal content of this element.
Definition: html_image.cpp:213
DOM::HTMLCollection
An HTMLCollection is a list of nodes.
Definition: html_misc.h:126
DOM::HTMLImageElement::x
long x() const
Nonstandard extension to DOM::ImgElement.
Definition: html_image.cpp:345
DOM::HTMLAreaElement::setHref
void setHref(const DOMString &)
see href
Definition: html_image.cpp:103
DOM::HTMLImageElement::setAlt
void setAlt(const DOMString &)
see alt
Definition: html_image.cpp:219
DOM::HTMLImageElement::src
DOMString src() const
URI designating the source of this image.
Definition: html_image.cpp:299
DOM::HTMLImageElement::hspace
long hspace() const
Horizontal space to the left and right of this image.
Definition: html_image.cpp:259
DOM::HTMLImageElement::setUseMap
void setUseMap(const DOMString &)
see useMap
Definition: html_image.cpp:317
DOM::HTMLImageElement::setName
void setName(const DOMString &)
see name
Definition: html_image.cpp:197
DOM::HTMLMapElement::name
DOMString name() const
Names the map (for use with usemap ).
Definition: html_image.cpp:403
DOM::HTMLAreaElement::target
DOMString target() const
Frame to render the resource in.
Definition: html_image.cpp:150
DOM::DOMString
This class implements the basic string we use in the DOM.
Definition: dom_string.h:43
DOM::HTMLAreaElement::tabIndex
long tabIndex() const
Index that represents the element's position in the tabbing order.
Definition: html_image.cpp:136
DOM::HTMLImageElement
Embedded image.
Definition: html_image.h:185
DOM::HTMLAreaElement::setShape
void setShape(const DOMString &)
see shape
Definition: html_image.cpp:131
DOM::HTMLImageElement::longDesc
DOMString longDesc() const
URI designating a long description of this image or frame.
Definition: html_image.cpp:288
DOM::HTMLAreaElement::coords
DOMString coords() const
Comma-separated list of lengths, defining an active region geometry.
Definition: html_image.cpp:85
DOM::HTMLAreaElement::setTabIndex
void setTabIndex(long)
see tabIndex
Definition: html_image.cpp:142
DOM::HTMLImageElement::border
long border() const KDE_DEPRECATED
Definition: html_image.cpp:224
DOM::HTMLImageElement::setHspace
void setHspace(long)
see hspace
Definition: html_image.cpp:266
DOM::HTMLImageElement::useMap
DOMString useMap() const
Use client-side image map.
Definition: html_image.cpp:311
DOM::HTMLImageElement::height
long height() const
Override height.
Definition: html_image.cpp:248
DOM::HTMLAreaElement::accessKey
DOMString accessKey() const
A single character access key to give access to the form control.
Definition: html_image.cpp:63
DOM::HTMLAreaElement::href
DOMString href() const
The URI of the linked resource.
Definition: html_image.cpp:96
DOM::HTMLAreaElement::setNoHref
void setNoHref(bool)
see noHref
Definition: html_image.cpp:114
DOM::HTMLMapElement::areas
HTMLCollection areas() const
The list of areas defined for the image map.
Definition: html_image.cpp:397
DOM::HTMLImageElement::setAlign
void setAlign(const DOMString &)
see align
Definition: html_image.cpp:208
DOM::Element::getAttribute
DOMString getAttribute(const DOMString &name)
Retrieves an attribute value by name.
Definition: dom_element.cpp:147
DOM::HTMLImageElement::name
DOMString name() const
The name of the element (for backwards compatibility).
Definition: html_image.cpp:191
DOM::HTMLAreaElement::noHref
bool noHref() const
Specifies that this area is inactive, i.e., has no associated action.
Definition: html_image.cpp:108
DOM::HTMLAreaElement::shape
DOMString shape() const
The shape of the active area.
Definition: html_image.cpp:125
DOM::HTMLImageElement::setVspace
void setVspace(long)
see vspace
Definition: html_image.cpp:329
DOM::HTMLMapElement
Client-side image map.
Definition: html_image.h:393
DOM::HTMLImageElement::setBorder
void setBorder(const DOMString &)
see border
Definition: html_image.cpp:242
DOM::HTMLAreaElement::setAlt
void setAlt(const DOMString &)
see alt
Definition: html_image.cpp:80
DOM::HTMLImageElement::setIsMap
void setIsMap(bool)
see isMap
Definition: html_image.cpp:277
DOM::HTMLAreaElement::setTarget
void setTarget(const DOMString &)
see target
Definition: html_image.cpp:156
DOM::HTMLElement
All HTML element interfaces derive from this class.
Definition: html_element.h:69
DOM::HTMLAreaElement::alt
DOMString alt() const
Alternate text for user agents not rendering the normal content of this element.
Definition: html_image.cpp:74
DOM::HTMLImageElement::width
long width() const
Override width.
Definition: html_image.cpp:334

KDE Home | KDE Accessibility Home | Description of Access Keys