/***************************************************************************
                            Element.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/dom_element.h>
#include <qstring.h>
#include <qcstring.h>

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

class ElementJBridge : public DOM::Element
{
public:
	ElementJBridge() : Element() {}
	ElementJBridge(const Node& other) : Element(other) {}
	ElementJBridge(const Element& other) : Element(other) {}
	~ElementJBridge() {QtSupport::qtKeyDeleted(this);}
};


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

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

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

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

JNIEXPORT void JNICALL
Java_org_kde_koala_Element_dispose(JNIEnv *env, jobject obj)
{
	Java_org_kde_koala_Element_finalize(env, obj);
	return;
}

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

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

JNIEXPORT jstring JNICALL
Java_org_kde_koala_Element_getAttribute(JNIEnv *env, jobject obj, jstring name)
{
	DOM::DOMString _domstring;
static DOM::DOMString * _domstring_name = 0;
	_domstring = ((DOM::Element*) QtSupport::getQt(env, obj))->getAttribute((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, name, &_domstring_name));
	return KDESupport::fromDOMString(env, &_domstring);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Element_setAttribute(JNIEnv *env, jobject obj, jstring name, jstring value)
{
static DOM::DOMString * _domstring_value = 0;
static DOM::DOMString * _domstring_name = 0;
	((DOM::Element*) QtSupport::getQt(env, obj))->setAttribute((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, name, &_domstring_name), (DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, value, &_domstring_value));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Element_removeAttribute(JNIEnv *env, jobject obj, jstring name)
{
static DOM::DOMString * _domstring_name = 0;
	((DOM::Element*) QtSupport::getQt(env, obj))->removeAttribute((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, name, &_domstring_name));
	return;
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_Element_getAttributeNode(JNIEnv *env, jobject obj, jstring name)
{
static DOM::DOMString * _domstring_name = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)new DOM::Attr (((DOM::Element*) QtSupport::getQt(env, obj))->getAttributeNode((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, name, &_domstring_name))), "org.kde.koala.Attr", TRUE);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_Element_setAttributeNode(JNIEnv *env, jobject obj, jobject newAttr)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new DOM::Attr (((DOM::Element*) QtSupport::getQt(env, obj))->setAttributeNode((DOM::Attr&) *(DOM::Attr *) QtSupport::getQt(env, newAttr))), "org.kde.koala.Attr", TRUE);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_Element_removeAttributeNode(JNIEnv *env, jobject obj, jobject oldAttr)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new DOM::Attr (((DOM::Element*) QtSupport::getQt(env, obj))->removeAttributeNode((DOM::Attr&) *(DOM::Attr *) QtSupport::getQt(env, oldAttr))), "org.kde.koala.Attr", TRUE);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_Element_getElementsByTagName(JNIEnv *env, jobject obj, jstring name)
{
	DOM::NodeList  _qlist;
static DOM::DOMString * _domstring_name = 0;
	_qlist = ((DOM::Element*) QtSupport::getQt(env, obj))->getElementsByTagName((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, name, &_domstring_name));
	return (jobject) KDESupport::arrayWithNodeList(env, (DOM::NodeList *) &_qlist);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_Element_getElementsByTagNameNS(JNIEnv *env, jobject obj, jstring namespaceURI, jstring localName)
{
	DOM::NodeList  _qlist;
static DOM::DOMString * _domstring_localName = 0;
static DOM::DOMString * _domstring_namespaceURI = 0;
	_qlist = ((DOM::Element*) QtSupport::getQt(env, obj))->getElementsByTagNameNS((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, namespaceURI, &_domstring_namespaceURI), (DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, localName, &_domstring_localName));
	return (jobject) KDESupport::arrayWithNodeList(env, (DOM::NodeList *) &_qlist);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_Element_getAttributeNS(JNIEnv *env, jobject obj, jstring namespaceURI, jstring localName)
{
	DOM::DOMString _domstring;
static DOM::DOMString * _domstring_localName = 0;
static DOM::DOMString * _domstring_namespaceURI = 0;
	_domstring = ((DOM::Element*) QtSupport::getQt(env, obj))->getAttributeNS((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, namespaceURI, &_domstring_namespaceURI), (DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, localName, &_domstring_localName));
	return KDESupport::fromDOMString(env, &_domstring);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Element_setAttributeNS(JNIEnv *env, jobject obj, jstring namespaceURI, jstring qualifiedName, jstring value)
{
static DOM::DOMString * _domstring_value = 0;
static DOM::DOMString * _domstring_qualifiedName = 0;
static DOM::DOMString * _domstring_namespaceURI = 0;
	((DOM::Element*) QtSupport::getQt(env, obj))->setAttributeNS((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, namespaceURI, &_domstring_namespaceURI), (DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, qualifiedName, &_domstring_qualifiedName), (DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, value, &_domstring_value));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_Element_removeAttributeNS(JNIEnv *env, jobject obj, jstring namespaceURI, jstring localName)
{
static DOM::DOMString * _domstring_localName = 0;
static DOM::DOMString * _domstring_namespaceURI = 0;
	((DOM::Element*) QtSupport::getQt(env, obj))->removeAttributeNS((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, namespaceURI, &_domstring_namespaceURI), (DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, localName, &_domstring_localName));
	return;
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_Element_getAttributeNodeNS(JNIEnv *env, jobject obj, jstring namespaceURI, jstring localName)
{
static DOM::DOMString * _domstring_localName = 0;
static DOM::DOMString * _domstring_namespaceURI = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)new DOM::Attr (((DOM::Element*) QtSupport::getQt(env, obj))->getAttributeNodeNS((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, namespaceURI, &_domstring_namespaceURI), (DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, localName, &_domstring_localName))), "org.kde.koala.Attr", TRUE);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_Element_setAttributeNodeNS(JNIEnv *env, jobject obj, jobject newAttr)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new DOM::Attr (((DOM::Element*) QtSupport::getQt(env, obj))->setAttributeNodeNS((DOM::Attr&) *(DOM::Attr *) QtSupport::getQt(env, newAttr))), "org.kde.koala.Attr", TRUE);
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_Element_hasAttribute(JNIEnv *env, jobject obj, jstring name)
{
static DOM::DOMString * _domstring_name = 0;
	return (jboolean) ((DOM::Element*) QtSupport::getQt(env, obj))->hasAttribute((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, name, &_domstring_name));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_Element_hasAttributeNS(JNIEnv *env, jobject obj, jstring namespaceURI, jstring localName)
{
static DOM::DOMString * _domstring_localName = 0;
static DOM::DOMString * _domstring_namespaceURI = 0;
	return (jboolean) ((DOM::Element*) QtSupport::getQt(env, obj))->hasAttributeNS((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, namespaceURI, &_domstring_namespaceURI), (DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, localName, &_domstring_localName));
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_Element_style(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new DOM::CSSStyleDeclaration (((DOM::Element*) QtSupport::getQt(env, obj))->style()), "org.kde.koala.CSSStyleDeclaration", TRUE);
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_Element_isHTMLElement(JNIEnv *env, jobject obj)
{
	return (jboolean) ((DOM::Element*) QtSupport::getQt(env, obj))->isHTMLElement();
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_Element_khtmlValidAttrName(JNIEnv *env, jclass obj, jstring name)
{
static DOM::DOMString * _domstring_name = 0;
	return (jboolean) ElementJBridge::khtmlValidAttrName((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, name, &_domstring_name));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_Element_khtmlValidPrefix(JNIEnv *env, jclass obj, jstring name)
{
static DOM::DOMString * _domstring_name = 0;
	return (jboolean) ElementJBridge::khtmlValidPrefix((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, name, &_domstring_name));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_Element_khtmlValidQualifiedName(JNIEnv *env, jclass obj, jstring name)
{
static DOM::DOMString * _domstring_name = 0;
	return (jboolean) ElementJBridge::khtmlValidQualifiedName((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, name, &_domstring_name));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_Element_khtmlMalformedQualifiedName(JNIEnv *env, jclass obj, jstring name)
{
static DOM::DOMString * _domstring_name = 0;
	return (jboolean) ElementJBridge::khtmlMalformedQualifiedName((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, name, &_domstring_name));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_Element_khtmlMalformedPrefix(JNIEnv *env, jclass obj, jstring name)
{
static DOM::DOMString * _domstring_name = 0;
	return (jboolean) ElementJBridge::khtmlMalformedPrefix((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, name, &_domstring_name));
}

