html_document.cpp
// --------------------------------------------------------------------------
#include "html_document.h"
#include "css/csshelper.h"
#include "dom/html_misc.h"
#include "dom/dom_exception.h"
#include "xml/dom_textimpl.h"
#include "html/html_documentimpl.h"
#include "html/html_miscimpl.h"
#include "misc/htmlhashes.h"
using namespace DOM;
HTMLDocument::HTMLDocument() : Document(false) // create the impl here
{
impl = DOMImplementationImpl::instance()->createHTMLDocument();
impl->ref();
}
HTMLDocument::HTMLDocument(KHTMLView *parent)
: Document(false) // create the impl here
{
impl = DOMImplementationImpl::instance()->createHTMLDocument(parent);
impl->ref();
}
HTMLDocument::HTMLDocument(const HTMLDocument &other) : Document(other)
{
}
HTMLDocument::HTMLDocument(HTMLDocumentImpl *impl) : Document(impl)
{
}
HTMLDocument &HTMLDocument::operator = (const Node &other)
{
if(other.nodeType() != DOCUMENT_NODE) {
if ( impl ) impl->deref();
impl = 0;
} else {
DocumentImpl *d = static_cast<DocumentImpl *>(other.handle());
if(!d->isHTMLDocument()) {
if ( impl ) impl->deref();
impl = 0;
} else {
Node::operator =(other);
}
}
return *this;
}
HTMLDocument &HTMLDocument::operator = (const HTMLDocument &other)
{
Document::operator =(other);
return *this;
}
HTMLDocument::~HTMLDocument()
{
}
DOMString HTMLDocument::title() const
{
if(!impl) return DOMString();
return static_cast<HTMLDocumentImpl *>(impl)->title();
}
void HTMLDocument::setTitle( const DOMString &value )
{
if (impl)
static_cast<HTMLDocumentImpl *>(impl)->setTitle(value);
}
DOMString HTMLDocument::referrer() const
{
if(!impl) return DOMString();
return ((HTMLDocumentImpl *)impl)->referrer();
}
DOMString HTMLDocument::completeURL(const DOMString& str) const
{
if(!impl) return str;
DOMString parsed = khtml::parseURL(str);
return ((HTMLDocumentImpl *)impl)->completeURL(parsed.string());
}
DOMString HTMLDocument::domain() const
{
if(!impl) return DOMString();
return ((HTMLDocumentImpl *)impl)->domain();
}
DOMString HTMLDocument::lastModified() const
{
if(!impl) return DOMString();
return ((HTMLDocumentImpl *)impl)->lastModified();
}
DOMString HTMLDocument::URL() const
{
if(!impl) return DOMString();
return ((HTMLDocumentImpl *)impl)->URL().url();
}
HTMLElement HTMLDocument::body() const
{
if(!impl) return 0;
return ((HTMLDocumentImpl *)impl)->body();
}
void HTMLDocument::setBody(const HTMLElement &_body)
{
if (!impl) return;
int exceptioncode = 0;
((HTMLDocumentImpl *)impl)->setBody(static_cast<HTMLElementImpl *>(_body.handle()), exceptioncode);
if ( exceptioncode )
throw DOMException( exceptioncode );
return;
}
HTMLCollection HTMLDocument::images() const
{
if(!impl) return HTMLCollection();
return HTMLCollection(impl, HTMLCollectionImpl::DOC_IMAGES);
}
HTMLCollection HTMLDocument::applets() const
{
if(!impl) return HTMLCollection();
return HTMLCollection(impl, HTMLCollectionImpl::DOC_APPLETS);
}
HTMLCollection HTMLDocument::scripts() const
{
if(!impl) return HTMLCollection();
return HTMLCollection(impl, HTMLCollectionImpl::DOC_SCRIPTS);
}
HTMLCollection HTMLDocument::links() const
{
if(!impl) return HTMLCollection();
return HTMLCollection(impl, HTMLCollectionImpl::DOC_LINKS);
}
HTMLCollection HTMLDocument::forms() const
{
if(!impl) return HTMLCollection();
return HTMLCollection(impl, HTMLCollectionImpl::DOC_FORMS);
}
HTMLCollection HTMLDocument::layers() const
{
if(!impl) return HTMLCollection();
return HTMLCollection(impl, HTMLCollectionImpl::DOC_LAYERS);
}
HTMLCollection HTMLDocument::anchors() const
{
if(!impl) return HTMLCollection();
return HTMLCollection(impl, HTMLCollectionImpl::DOC_ANCHORS);
}
HTMLCollection HTMLDocument::all() const
{
if(!impl) return HTMLCollection();
return HTMLCollection(impl, HTMLCollectionImpl::DOC_ALL);
}
DOMString HTMLDocument::cookie() const
{
if (!impl) return DOMString();
return ((HTMLDocumentImpl *)impl)->cookie();
}
void HTMLDocument::setCookie( const DOMString & value )
{
if (impl)
((HTMLDocumentImpl *)impl)->setCookie(value);
}
void HTMLDocument::open( )
{
if(impl)
((HTMLDocumentImpl *)impl)->open( );
}
void HTMLDocument::close( )
{
if(impl)
((HTMLDocumentImpl *)impl)->close( );
}
void HTMLDocument::write( const DOMString &text )
{
if(impl)
((HTMLDocumentImpl *)impl)->write( text );
}
void HTMLDocument::writeln( const DOMString &text )
{
if(impl)
((HTMLDocumentImpl *)impl)->writeln( text );
}
NodeList HTMLDocument::getElementsByName( const DOMString &elementName )
{
if(!impl) return 0;
return new NameNodeListImpl(impl, elementName);
}
DOM::HTMLDocument::images
HTMLCollection images() const
A collection of all the IMG elements in a document.
Definition: html_document.cpp:143
DOM::Node
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:274
DOM::HTMLDocument
An HTMLDocument is the root of the HTML hierarchy and holds the entire content.
Definition: html_document.h:73
DOM::HTMLDocument::layers
HTMLCollection layers() const
A collection of all the layers of a document.
Definition: html_document.cpp:173
DOM::HTMLDocument::write
void write(const DOMString &text)
Write a string of text to a document stream opened by open() .
Definition: html_document.cpp:216
DOM::HTMLDocument::setCookie
void setCookie(const DOMString &)
see cookie
Definition: html_document.cpp:197
KHTMLView
Renders and displays HTML in a QScrollView.
Definition: khtmlview.h:78
DOM::HTMLDocument::cookie
DOMString cookie() const
The cookies associated with this document.
Definition: html_document.cpp:191
DOM::DOMException
DOM operations only raise exceptions in "exceptional" circumstances, i.e., when an operation is impos...
Definition: dom_exception.h:57
DOM::HTMLDocument::close
void close()
Closes a document stream opened by open() and forces rendering.
Definition: html_document.cpp:210
DOM::HTMLDocument::applets
HTMLCollection applets() const
A collection of all the OBJECT elements that include applets and APPLET ( deprecated ) elements in a ...
Definition: html_document.cpp:149
DOM::HTMLDocument::completeURL
DOMString completeURL(const DOMString &url) const
not part of the DOM
Definition: html_document.cpp:102
DOM::HTMLDocument::title
DOMString title() const
The title of a document as specified by the TITLE element in the head of the document.
Definition: html_document.cpp:84
DOM::HTMLCollection
An HTMLCollection is a list of nodes.
Definition: html_misc.h:126
DOM::HTMLDocument::setBody
void setBody(const HTMLElement &)
see body
Definition: html_document.cpp:133
DOM::HTMLDocument::setTitle
void setTitle(const DOMString &)
see title
Definition: html_document.cpp:90
DOM::HTMLDocument::scripts
HTMLCollection scripts() const
A collection of all the scripts in the document.
Definition: html_document.cpp:155
DOM::DOMString
This class implements the basic string we use in the DOM.
Definition: dom_string.h:43
DOM::Document
The Document interface represents the entire HTML or XML document.
Definition: dom_doc.h:245
DOM::HTMLDocument::referrer
DOMString referrer() const
Returns the URI of the page that linked to this page.
Definition: html_document.cpp:96
DOM::HTMLDocument::forms
HTMLCollection forms() const
A collection of all the forms of a document.
Definition: html_document.cpp:167
DOM::HTMLDocument::getElementsByName
NodeList getElementsByName(const DOMString &elementName)
Returns the (possibly empty) collection of elements whose name value is given by elementName ...
Definition: html_document.cpp:228
DOM::HTMLDocument::links
HTMLCollection links() const
A collection of all AREA elements and anchor ( A ) elements in a document with a value for the href a...
Definition: html_document.cpp:161
DOM::HTMLDocument::all
HTMLCollection all() const
Not part of the DOM.
Definition: html_document.cpp:185
DOM::NodeList
The NodeList interface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented.
Definition: dom_node.h:931
DOM::HTMLDocument::lastModified
DOMString lastModified() const
Not part of the DOM.
Definition: html_document.cpp:115
DOM::HTMLDocument::anchors
HTMLCollection anchors() const
A collection of all the anchor ( A ) elements in a document with a value for the name attribute...
Definition: html_document.cpp:179
DOM::HTMLDocument::writeln
void writeln(const DOMString &text)
Write a string of text followed by a newline character to a document stream opened by open() ...
Definition: html_document.cpp:222
DOM::HTMLDocument::open
void open()
Note.
Definition: html_document.cpp:204
DOM::HTMLElement
All HTML element interfaces derive from this class.
Definition: html_element.h:69
DOM::HTMLDocument::URL
DOMString URL() const
The absolute URI of the document.
Definition: html_document.cpp:121
DOM::HTMLDocument::domain
DOMString domain() const
The domain name of the server that served the document, or a null string if the server cannot be iden...
Definition: html_document.cpp:109
DOM::HTMLDocument::body
HTMLElement body() const
The element that contains the content for the document.
Definition: html_document.cpp:127
DOM::Node::nodeType
unsigned short nodeType() const
A code representing the type of the underlying object, as defined above.
Definition: dom_node.cpp:199

KDE Home | KDE Accessibility Home | Description of Access Keys