/***************************************************************************
                            HTMLDocument.cpp -  description
                             -------------------
    begin                : Sun Jan 27 16:22:17 2002
    copyright            : (C) 2000-2001 Lost Highway Ltd.
    email                : Richard_Dale@tipitina.demon.co.uk
    generated by         : duke@tipitina on Sun Jan 27 16:22:17 2002, using kalyptus 0.9.
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
***************************************************************************/

#define _BOOL_H_
#include <dom/html_document.h>
#include <dom/html_misc.h>
#include <dom/dom_string.h>
#include <qstring.h>
#include <qcstring.h>

#include <qtjava/QtSupport.h>
#include <kdejava/KDESupport.h>
#include <kdejava/HTMLDocument.h>

class HTMLDocumentJBridge : public DOM::HTMLDocument
{
public:
	HTMLDocumentJBridge() : HTMLDocument() {}
	HTMLDocumentJBridge(KHTMLView* parent) : HTMLDocument(parent) {}
	HTMLDocumentJBridge(const HTMLDocument& other) : HTMLDocument(other) {}
	HTMLDocumentJBridge(const Node& other) : HTMLDocument(other) {}
	~HTMLDocumentJBridge() {QtSupport::qtKeyDeleted(this);}
};


JNIEXPORT void JNICALL
Java_org_kde_koala_HTMLDocument_newHTMLDocument__(JNIEnv *env, jobject obj)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new HTMLDocumentJBridge());
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_HTMLDocument_newHTMLDocument__Lorg_kde_koala_KHTMLView_2(JNIEnv *env, jobject obj, jobject parent)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new HTMLDocumentJBridge((KHTMLView*) QtSupport::getQt(env, parent)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_HTMLDocument_newHTMLDocument__Lorg_kde_koala_HTMLDocument_2(JNIEnv *env, jobject obj, jobject other)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new HTMLDocumentJBridge((DOM::HTMLDocument&) *(DOM::HTMLDocument *) QtSupport::getQt(env, other)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_HTMLDocument_newHTMLDocument__Lorg_kde_koala_DOMNode_2(JNIEnv *env, jobject obj, jobject other)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new HTMLDocumentJBridge((DOM::Node&) *(DOM::Node *) QtSupport::getQt(env, other)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_HTMLDocument_finalize(JNIEnv *env, jobject obj)
{
	if (QtSupport::allocatedInJavaWorld(env, obj)) {
		delete (DOM::HTMLDocument*)QtSupport::getQt(env, obj);
		QtSupport::setQt(env, obj, 0);
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_HTMLDocument_dispose(JNIEnv *env, jobject obj)
{
	Java_org_kde_koala_HTMLDocument_finalize(env, obj);
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_HTMLDocument_isDisposed(JNIEnv *env, jobject obj)
{
	return (QtSupport::getQt(env, obj) == 0);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_HTMLDocument_title(JNIEnv *env, jobject obj)
{
	DOM::DOMString _domstring;
	_domstring = ((DOM::HTMLDocument*) QtSupport::getQt(env, obj))->title();
	return KDESupport::fromDOMString(env, &_domstring);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_HTMLDocument_setTitle(JNIEnv *env, jobject obj, jstring arg1)
{
static DOM::DOMString * _domstring_arg1 = 0;
	((DOM::HTMLDocument*) QtSupport::getQt(env, obj))->setTitle((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, arg1, &_domstring_arg1));
	return;
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_HTMLDocument_referrer(JNIEnv *env, jobject obj)
{
	DOM::DOMString _domstring;
	_domstring = ((DOM::HTMLDocument*) QtSupport::getQt(env, obj))->referrer();
	return KDESupport::fromDOMString(env, &_domstring);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_HTMLDocument_domain(JNIEnv *env, jobject obj)
{
	DOM::DOMString _domstring;
	_domstring = ((DOM::HTMLDocument*) QtSupport::getQt(env, obj))->domain();
	return KDESupport::fromDOMString(env, &_domstring);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_HTMLDocument_URL(JNIEnv *env, jobject obj)
{
	DOM::DOMString _domstring;
	_domstring = ((DOM::HTMLDocument*) QtSupport::getQt(env, obj))->URL();
	return KDESupport::fromDOMString(env, &_domstring);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_HTMLDocument_body(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new DOM::HTMLElement (((DOM::HTMLDocument*) QtSupport::getQt(env, obj))->body()), "org.kde.koala.HTMLElement", TRUE);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_HTMLDocument_setBody(JNIEnv *env, jobject obj, jobject arg1)
{
	((DOM::HTMLDocument*) QtSupport::getQt(env, obj))->setBody((DOM::HTMLElement&) *(DOM::HTMLElement *) QtSupport::getQt(env, arg1));
	return;
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_HTMLDocument_images(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new DOM::HTMLCollection (((DOM::HTMLDocument*) QtSupport::getQt(env, obj))->images()), "org.kde.koala.HTMLCollection", TRUE);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_HTMLDocument_applets(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new DOM::HTMLCollection (((DOM::HTMLDocument*) QtSupport::getQt(env, obj))->applets()), "org.kde.koala.HTMLCollection", TRUE);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_HTMLDocument_links(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new DOM::HTMLCollection (((DOM::HTMLDocument*) QtSupport::getQt(env, obj))->links()), "org.kde.koala.HTMLCollection", TRUE);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_HTMLDocument_forms(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new DOM::HTMLCollection (((DOM::HTMLDocument*) QtSupport::getQt(env, obj))->forms()), "org.kde.koala.HTMLCollection", TRUE);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_HTMLDocument_anchors(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new DOM::HTMLCollection (((DOM::HTMLDocument*) QtSupport::getQt(env, obj))->anchors()), "org.kde.koala.HTMLCollection", TRUE);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_HTMLDocument_cookie(JNIEnv *env, jobject obj)
{
	DOM::DOMString _domstring;
	_domstring = ((DOM::HTMLDocument*) QtSupport::getQt(env, obj))->cookie();
	return KDESupport::fromDOMString(env, &_domstring);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_HTMLDocument_setCookie(JNIEnv *env, jobject obj, jstring arg1)
{
static DOM::DOMString * _domstring_arg1 = 0;
	((DOM::HTMLDocument*) QtSupport::getQt(env, obj))->setCookie((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, arg1, &_domstring_arg1));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_HTMLDocument_open(JNIEnv *env, jobject obj)
{
	((DOM::HTMLDocument*) QtSupport::getQt(env, obj))->open();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_HTMLDocument_close(JNIEnv *env, jobject obj)
{
	((DOM::HTMLDocument*) QtSupport::getQt(env, obj))->close();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_HTMLDocument_write(JNIEnv *env, jobject obj, jstring text)
{
static DOM::DOMString * _domstring_text = 0;
	((DOM::HTMLDocument*) QtSupport::getQt(env, obj))->write((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, text, &_domstring_text));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_HTMLDocument_writeln(JNIEnv *env, jobject obj, jstring text)
{
static DOM::DOMString * _domstring_text = 0;
	((DOM::HTMLDocument*) QtSupport::getQt(env, obj))->writeln((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, text, &_domstring_text));
	return;
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_HTMLDocument_getElementsByName(JNIEnv *env, jobject obj, jstring elementName)
{
	DOM::NodeList  _qlist;
static DOM::DOMString * _domstring_elementName = 0;
	_qlist = ((DOM::HTMLDocument*) QtSupport::getQt(env, obj))->getElementsByName((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, elementName, &_domstring_elementName));
	return (jobject) KDESupport::arrayWithNodeList(env, (DOM::NodeList *) &_qlist);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_HTMLDocument_completeURL(JNIEnv *env, jobject obj, jstring url)
{
	DOM::DOMString _domstring;
static DOM::DOMString * _domstring_url = 0;
	_domstring = ((DOM::HTMLDocument*) QtSupport::getQt(env, obj))->completeURL((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, url, &_domstring_url));
	return KDESupport::fromDOMString(env, &_domstring);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_HTMLDocument_lastModified(JNIEnv *env, jobject obj)
{
	DOM::DOMString _domstring;
	_domstring = ((DOM::HTMLDocument*) QtSupport::getQt(env, obj))->lastModified();
	return KDESupport::fromDOMString(env, &_domstring);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_HTMLDocument_all(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new DOM::HTMLCollection (((DOM::HTMLDocument*) QtSupport::getQt(env, obj))->all()), "org.kde.koala.HTMLCollection", TRUE);
}

