# khtml Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# html_document.cpp

    00001
    00022 // --------------------------------------------------------------------------
    00023
    00024 #include "html_document.h"
    00025 #include "css/csshelper.h"
    00026 #include "dom/html_misc.h"
    00027 #include "dom/dom_exception.h"
    00028 #include "xml/dom_textimpl.h"
    00029 #include "html/html_documentimpl.h"
    00030 #include "html/html_miscimpl.h"
    00031 #include "misc/htmlhashes.h"
    00032
    00033 using namespace DOM;
    00034
    00035 HTMLDocument::HTMLDocument() : Document(false) // create the impl here
    00036 {
    00037     impl = DOMImplementationImpl::instance()->createHTMLDocument();
    00038     impl->ref();
    00039
    00040 }
    00041
    00042 HTMLDocument::HTMLDocument(KHTMLView *parent)
    00043     : Document(false) // create the impl here
    00044 {
    00045     impl = DOMImplementationImpl::instance()->createHTMLDocument(parent);
    00046     impl->ref();
    00047 }
    00048
    00049 HTMLDocument::HTMLDocument(const HTMLDocument &other) : Document(other)
    00050 {
    00051 }
    00052
    00053 HTMLDocument::HTMLDocument(HTMLDocumentImpl *impl) : Document(impl)
    00054 {
    00055 }
    00056
    00057 HTMLDocument &HTMLDocument::operator = (const Node &other)
    00058 {
    00059     if(other.nodeType() != DOCUMENT_NODE) {
    00060     if ( impl ) impl->deref();
    00061     impl = 0;
    00062     } else {
    00063     DocumentImpl *d = static_cast<DocumentImpl *>(other.handle());
    00064     if(!d->isHTMLDocument()) {
    00065         if ( impl ) impl->deref();
    00066             impl = 0;
    00067     } else {
    00068             Node::operator =(other);
    00069     }
    00070     }
    00071     return *this;
    00072 }
    00073
    00074 HTMLDocument &HTMLDocument::operator = (const HTMLDocument &other)
    00075 {
    00076     Document::operator =(other);
    00077     return *this;
    00078 }
    00079
    00080 HTMLDocument::~HTMLDocument()
    00081 {
    00082 }
    00083
    00084 DOMString HTMLDocument::title() const
    00085 {
    00086     if(!impl) return DOMString();
    00087     return static_cast<HTMLDocumentImpl *>(impl)->title();
    00088 }
    00089
    00090 void HTMLDocument::setTitle( const DOMString &value )
    00091 {
    00092     if (impl)
    00093         static_cast<HTMLDocumentImpl *>(impl)->setTitle(value);
    00094 }
    00095
    00096 DOMString HTMLDocument::referrer() const
    00097 {
    00098     if(!impl) return DOMString();
    00099     return ((HTMLDocumentImpl *)impl)->referrer();
    00100 }
    00101
    00102 DOMString HTMLDocument::completeURL(const DOMString& str) const
    00103 {
    00104     if(!impl) return str;
    00105     DOMString parsed = khtml::parseURL(str);
    00106     return ((HTMLDocumentImpl *)impl)->completeURL(parsed.string());
    00107 }
    00108
    00109 DOMString HTMLDocument::domain() const
    00110 {
    00111     if(!impl) return DOMString();
    00112     return ((HTMLDocumentImpl *)impl)->domain();
    00113 }
    00114
    00115 DOMString HTMLDocument::lastModified() const
    00116 {
    00117     if(!impl) return DOMString();
    00118     return ((HTMLDocumentImpl *)impl)->lastModified();
    00119 }
    00120
    00121 DOMString HTMLDocument::URL() const
    00122 {
    00123     if(!impl) return DOMString();
    00124     return ((HTMLDocumentImpl *)impl)->URL().url();
    00125 }
    00126
    00127 HTMLElement HTMLDocument::body() const
    00128 {
    00129     if(!impl) return 0;
    00130     return ((HTMLDocumentImpl *)impl)->body();
    00131 }
    00132
    00133 void HTMLDocument::setBody(const HTMLElement &_body)
    00134 {
    00135     if (!impl) return;
    00136     int exceptioncode = 0;
    00137     ((HTMLDocumentImpl *)impl)->setBody(static_cast<HTMLElementImpl *>(_body.handle()), exceptioncode);
    00138     if ( exceptioncode )
    00139         throw DOMException( exceptioncode );
    00140     return;
    00141 }
    00142
    00143 HTMLCollection HTMLDocument::images() const
    00144 {
    00145     if(!impl) return HTMLCollection();
    00146     return HTMLCollection(impl, HTMLCollectionImpl::DOC_IMAGES);
    00147 }
    00148
    00149 HTMLCollection HTMLDocument::applets() const
    00150 {
    00151     if(!impl) return HTMLCollection();
    00152     return HTMLCollection(impl, HTMLCollectionImpl::DOC_APPLETS);
    00153 }
    00154
    00155 HTMLCollection HTMLDocument::links() const
    00156 {
    00157     if(!impl) return HTMLCollection();
    00158     return HTMLCollection(impl, HTMLCollectionImpl::DOC_LINKS);
    00159 }
    00160
    00161 HTMLCollection HTMLDocument::forms() const
    00162 {
    00163     if(!impl) return HTMLCollection();
    00164     return HTMLCollection(impl, HTMLCollectionImpl::DOC_FORMS);
    00165 }
    00166
    00167 HTMLCollection HTMLDocument::layers() const
    00168 {
    00169     if(!impl) return HTMLCollection();
    00170     return HTMLCollection(impl, HTMLCollectionImpl::DOC_LAYERS);
    00171 }
    00172
    00173 HTMLCollection HTMLDocument::anchors() const
    00174 {
    00175     if(!impl) return HTMLCollection();
    00176     return HTMLCollection(impl, HTMLCollectionImpl::DOC_ANCHORS);
    00177 }
    00178
    00179 HTMLCollection HTMLDocument::all() const
    00180 {
    00181     if(!impl) return HTMLCollection();
    00182     return HTMLCollection(impl, HTMLCollectionImpl::DOC_ALL);
    00183 }
    00184
    00185 DOMString HTMLDocument::cookie() const
    00186 {
    00187    if (!impl) return DOMString();
    00188    return ((HTMLDocumentImpl *)impl)->cookie();
    00189 }
    00190
    00191 void HTMLDocument::setCookie( const DOMString & value )
    00192 {
    00193    if (impl)
    00194         ((HTMLDocumentImpl *)impl)->setCookie(value);
    00195
    00196 }
    00197
    00198 void HTMLDocument::open(  )
    00199 {
    00200     if(impl)
    00201         ((HTMLDocumentImpl *)impl)->open(  );
    00202 }
    00203
    00204 void HTMLDocument::close(  )
    00205 {
    00206     if(impl)
    00207         ((HTMLDocumentImpl *)impl)->close(  );
    00208 }
    00209
    00210 void HTMLDocument::write( const DOMString &text )
    00211 {
    00212     if(impl)
    00213         ((HTMLDocumentImpl *)impl)->write( text );
    00214 }
    00215
    00216 void HTMLDocument::writeln( const DOMString &text )
    00217 {
    00218     if(impl)
    00219         ((HTMLDocumentImpl *)impl)->writeln( text );
    00220 }
    00221
    00222 NodeList HTMLDocument::getElementsByName( const DOMString &elementName )
    00223 {
    00224     if(!impl) return 0;
    00225     return new NameNodeListImpl(impl, elementName);
    00226 }
    00227

This file is part of the documentation for khtml Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:33:10 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003