/***************************************************************************
                            CSSStyleDeclaration.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/css_value.h>
#include <dom/css_rule.h>
#include <dom/dom_string.h>
#include <qstring.h>
#include <qcstring.h>

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

class CSSStyleDeclarationJBridge : public DOM::CSSStyleDeclaration
{
public:
	CSSStyleDeclarationJBridge() : CSSStyleDeclaration() {}
	CSSStyleDeclarationJBridge(const CSSStyleDeclaration& other) : CSSStyleDeclaration(other) {}
	~CSSStyleDeclarationJBridge() {QtSupport::qtKeyDeleted(this);}
};


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

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

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

JNIEXPORT void JNICALL
Java_org_kde_koala_CSSStyleDeclaration_dispose(JNIEnv *env, jobject obj)
{
	Java_org_kde_koala_CSSStyleDeclaration_finalize(env, obj);
	return;
}

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

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

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

JNIEXPORT jlong JNICALL
Java_org_kde_koala_CSSStyleDeclaration_length(JNIEnv *env, jobject obj)
{
	return (jlong) ((DOM::CSSStyleDeclaration*) QtSupport::getQt(env, obj))->length();
}

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

JNIEXPORT jstring JNICALL
Java_org_kde_koala_CSSStyleDeclaration_getPropertyValue(JNIEnv *env, jobject obj, jstring propertyName)
{
	DOM::DOMString _domstring;
static DOM::DOMString * _domstring_propertyName = 0;
	_domstring = ((DOM::CSSStyleDeclaration*) QtSupport::getQt(env, obj))->getPropertyValue((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, propertyName, &_domstring_propertyName));
	return KDESupport::fromDOMString(env, &_domstring);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_CSSStyleDeclaration_getPropertyCSSValue(JNIEnv *env, jobject obj, jstring propertyName)
{
static DOM::DOMString * _domstring_propertyName = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)new DOM::CSSValue (((DOM::CSSStyleDeclaration*) QtSupport::getQt(env, obj))->getPropertyCSSValue((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, propertyName, &_domstring_propertyName))), "org.kde.koala.CSSValue", TRUE);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_CSSStyleDeclaration_removeProperty(JNIEnv *env, jobject obj, jstring propertyName)
{
	DOM::DOMString _domstring;
static DOM::DOMString * _domstring_propertyName = 0;
	_domstring = ((DOM::CSSStyleDeclaration*) QtSupport::getQt(env, obj))->removeProperty((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, propertyName, &_domstring_propertyName));
	return KDESupport::fromDOMString(env, &_domstring);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_CSSStyleDeclaration_getPropertyPriority(JNIEnv *env, jobject obj, jstring propertyName)
{
	DOM::DOMString _domstring;
static DOM::DOMString * _domstring_propertyName = 0;
	_domstring = ((DOM::CSSStyleDeclaration*) QtSupport::getQt(env, obj))->getPropertyPriority((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, propertyName, &_domstring_propertyName));
	return KDESupport::fromDOMString(env, &_domstring);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_CSSStyleDeclaration_setProperty(JNIEnv *env, jobject obj, jstring propertyName, jstring value, jstring priority)
{
static DOM::DOMString * _domstring_priority = 0;
static DOM::DOMString * _domstring_value = 0;
static DOM::DOMString * _domstring_propertyName = 0;
	((DOM::CSSStyleDeclaration*) QtSupport::getQt(env, obj))->setProperty((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, propertyName, &_domstring_propertyName), (DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, value, &_domstring_value), (DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, priority, &_domstring_priority));
	return;
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_CSSStyleDeclaration_item(JNIEnv *env, jobject obj, jlong index)
{
	DOM::DOMString _domstring;
	_domstring = ((DOM::CSSStyleDeclaration*) QtSupport::getQt(env, obj))->item((unsigned long) index);
	return KDESupport::fromDOMString(env, &_domstring);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_CSSStyleDeclaration_handle(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)((DOM::CSSStyleDeclaration*) QtSupport::getQt(env, obj))->handle(), "org.kde.koala.CSSStyleDeclarationImpl");
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_CSSStyleDeclaration_isNull(JNIEnv *env, jobject obj)
{
	return (jboolean) ((DOM::CSSStyleDeclaration*) QtSupport::getQt(env, obj))->isNull();
}

