/***************************************************************************
                            KSpell.m -  description
                             -------------------
    begin                : Fri Mar  8 13:55:08 2002
    copyright            : (C) 2000-2002 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Fri Mar  8 13:55:08 2002, using kalyptus 0.9.
 ***************************************************************************/

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

#include <qtc/qt_QString.h>
#include <qtc/qt_QCString.h>
#include <kdec/kde_KSpell.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KSpell.h>
#include <kdeobjc/KProcIO.h>
#include <kdeobjc/KProcess.h>
#include <kdeobjc/KSpellConfig.h>
#include <qtobjc/QWidget.h>


@implementation  KSpell


- initWithWidget: (QWidget *)_parent _caption: (NSString *)_caption obj: (QObject *)obj slot: (NSString *)slot _kcs: (KSpellConfig*)_kcs _progressbar: (BOOL)_progressbar _modal: (BOOL)_modal
{
static qt_QString * _qstring__caption = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_KSpell((qt_QWidget *) [_parent qt], (qt_QString *) [_caption toQString: &_qstring__caption], (qt_QObject *) [obj qt], (char*) [slot cString], (kde_KSpellConfig*) [_kcs qt], (int)_progressbar, (int)_modal)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithWidget: (QWidget *)_parent _caption: (NSString *)_caption obj: (QObject *)obj slot: (NSString *)slot 
{
static qt_QString * _qstring__caption = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_KSpell((qt_QWidget *) [_parent qt], (qt_QString *) [_caption toQString: &_qstring__caption], (qt_QObject *) [obj qt], (char*) [slot cString], 0, 1, 0)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- (int) status
{
	return (int) kde_KSpell_status((kde_KSpell *)[self qt]);
}

- cleanUp
{
	kde_KSpell_cleanUp((kde_KSpell *)[self qt]);
	return self;
}

- setAutoDelete: (BOOL)_autoDelete
{
	kde_KSpell_setAutoDelete((kde_KSpell *)[self qt], (int)_autoDelete);
	return self;
}

- (BOOL) check: (NSString *)_buffer
{
static qt_QString * _qstring__buffer = 0L;
	return (BOOL) kde_KSpell_check((kde_KSpell *)[self qt], (qt_QString *) [_buffer toQString: &_qstring__buffer]);
}

- (int) lastPosition
{
	return (int) kde_KSpell_lastPosition((kde_KSpell *)[self qt]);
}

- (BOOL) checkList: (NSArray *)_wordlist
{
static qt_QStringList * _qlist__wordlist = 0L;
	return (BOOL) kde_KSpell_checkList((kde_KSpell *)[self qt], (qt_QStringList*) [_wordlist toQStringList: (void *)&_qlist__wordlist]);
}

- (BOOL) checkWord: (NSString *)_buffer usedialog: (BOOL)usedialog
{
static qt_QString * _qstring__buffer = 0L;
	return (BOOL) kde_KSpell_checkWord((kde_KSpell *)[self qt], (qt_QString *) [_buffer toQString: &_qstring__buffer], (int)usedialog);
}

- (BOOL) checkWord: (NSString *)_buffer 
{
static qt_QString * _qstring__buffer = 0L;
	return (BOOL) kde_KSpell_checkWord((kde_KSpell *)[self qt], (qt_QString *) [_buffer toQString: &_qstring__buffer], 0);
}

- hide
{
	kde_KSpell_hide((kde_KSpell *)[self qt]);
	return self;
}

- (NSArray *) suggestions
{
static qt_QStringList * _qlist = 0L;
	_qlist = kde_KSpell_suggestions((kde_KSpell *)[self qt]);
	return (NSArray *) [NSMutableArray arrayWithQStringList: _qlist];
}

- (int) dlgResult
{
	return (int) kde_KSpell_dlgResult((kde_KSpell *)[self qt]);
}

- moveDlg: (int)x y: (int)y
{
	kde_KSpell_moveDlg((kde_KSpell *)[self qt], (int)x, (int)y);
	return self;
}

- (int) heightDlg
{
	return (int) kde_KSpell_heightDlg((kde_KSpell *)[self qt]);
}

- (int) widthDlg
{
	return (int) kde_KSpell_widthDlg((kde_KSpell *)[self qt]);
}

- (NSString *) intermediateBuffer
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KSpell_intermediateBuffer((kde_KSpell *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (BOOL) ignore: (NSString *)word
{
static qt_QString * _qstring_word = 0L;
	return (BOOL) kde_KSpell_ignore((kde_KSpell *)[self qt], (qt_QString *) [word toQString: &_qstring_word]);
}

- (BOOL) addPersonal: (NSString *)word
{
static qt_QString * _qstring_word = 0L;
	return (BOOL) kde_KSpell_addPersonal((kde_KSpell *)[self qt], (qt_QString *) [word toQString: &_qstring_word]);
}

- (KSpellConfig*) ksConfig
{
	return (KSpellConfig*) [QtSupport objectForQtKey: kde_KSpell_ksConfig((kde_KSpell *)[self qt]) withClass: [KSpellConfig class] allocatedInObjcWorld: YES];
}

- setProgressResolution: (unsigned int)res
{
	kde_KSpell_setProgressResolution((kde_KSpell *)[self qt], (unsigned int)res);
	return self;
}

- (void) dealloc
{
	if ([self qt] != 0L) {
		if ([self allocatedInObjcWorld] && [self parent] == nil) {
			kde_del_KSpell((kde_KSpell *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- setIgnoreUpperWords: (BOOL)_b
{
	kde_KSpell_setIgnoreUpperWords((kde_KSpell *)[self qt], (int)_b);
	return self;
}

- setIgnoreTitleCase: (BOOL)_b
{
	kde_KSpell_setIgnoreTitleCase((kde_KSpell *)[self qt], (int)_b);
	return self;
}

+ (int) modalCheck: (NSString *)text
{
static qt_QString * _qstring_text = 0L;
	return (int) kde_KSpell_modalCheck((qt_QString *) [text toQString: &_qstring_text]);
}

+ (int) modalCheck: (NSString *)text _kcs: (KSpellConfig*)_kcs
{
static qt_QString * _qstring_text = 0L;
	return (int) kde_KSpell_modalCheck1((qt_QString *) [text toQString: &_qstring_text], (kde_KSpellConfig*) [_kcs qt]);
}

- (int) parseOneResponse: (NSString *)_buffer word: (NSString *)word sugg: (NSArray *)sugg
{
static qt_QStringList * _qlist_sugg = 0L;
static qt_QString * _qstring_word = 0L;
static qt_QString * _qstring__buffer = 0L;
	return (int) kde_KSpell_parseOneResponse((kde_KSpell *)[self qt], (qt_QString *) [_buffer toQString: &_qstring__buffer], (qt_QString *) [word toQString: &_qstring_word], (qt_QStringList*) [sugg toQStringList: (void *)&_qlist_sugg]);
}

- (NSString *) funnyWord: (NSString *)word
{
static qt_QString * _qstring = 0L;
static qt_QString * _qstring_word = 0L;
	_qstring = kde_KSpell_funnyWord((kde_KSpell *)[self qt], (qt_QString *) [word toQString: &_qstring_word]);
	return [NSString fromQString: _qstring];
}

- dialog: (NSString *)word sugg: (NSArray *)sugg _slot: (NSString *)_slot
{
static qt_QStringList * _qlist_sugg = 0L;
static qt_QString * _qstring_word = 0L;
	kde_KSpell_dialog((kde_KSpell *)[self qt], (qt_QString *) [word toQString: &_qstring_word], (qt_QStringList*) [sugg toQStringList: (void *)&_qlist_sugg], (char*) [_slot cString]);
	return self;
}

- (NSString *) replacement
{
static qt_QString * _qstring = 0L;
	_qstring = kde_KSpell_replacement((kde_KSpell *)[self qt]);
	return [NSString fromQString: _qstring];
}

- setUpDialog: (BOOL)reallyusedialogbox
{
	kde_KSpell_setUpDialog((kde_KSpell *)[self qt], (int)reallyusedialogbox);
	return self;
}

- setUpDialog
{
	kde_KSpell_setUpDialog((kde_KSpell *)[self qt], 1);
	return self;
}

- emitProgress
{
	kde_KSpell_emitProgress((kde_KSpell *)[self qt]);
	return self;
}

- (BOOL) cleanFputs: (NSString *)s appendCR: (BOOL)appendCR
{
static qt_QString * _qstring_s = 0L;
	return (BOOL) kde_KSpell_cleanFputs((kde_KSpell *)[self qt], (qt_QString *) [s toQString: &_qstring_s], (int)appendCR);
}

- (BOOL) cleanFputs: (NSString *)s 
{
static qt_QString * _qstring_s = 0L;
	return (BOOL) kde_KSpell_cleanFputs((kde_KSpell *)[self qt], (qt_QString *) [s toQString: &_qstring_s], 1);
}

- (BOOL) cleanFputsWord: (NSString *)s appendCR: (BOOL)appendCR
{
static qt_QString * _qstring_s = 0L;
	return (BOOL) kde_KSpell_cleanFputsWord((kde_KSpell *)[self qt], (qt_QString *) [s toQString: &_qstring_s], (int)appendCR);
}

- (BOOL) cleanFputsWord: (NSString *)s 
{
static qt_QString * _qstring_s = 0L;
	return (BOOL) kde_KSpell_cleanFputsWord((kde_KSpell *)[self qt], (qt_QString *) [s toQString: &_qstring_s], 1);
}

- startIspell
{
	kde_KSpell_startIspell((kde_KSpell *)[self qt]);
	return self;
}

- (BOOL) writePersonalDictionary
{
	return (BOOL) kde_KSpell_writePersonalDictionary((kde_KSpell *)[self qt]);
}

- KSpell2: (KProcIO*)arg1
{
	kde_KSpell_KSpell2((kde_KSpell *)[self qt], (kde_KProcIO*) [arg1 qt]);
	return self;
}

- checkWord2: (KProcIO*)arg1
{
	kde_KSpell_checkWord2((kde_KSpell *)[self qt], (kde_KProcIO*) [arg1 qt]);
	return self;
}

- checkWord3
{
	kde_KSpell_checkWord3((kde_KSpell *)[self qt]);
	return self;
}

- check2: (KProcIO*)arg1
{
	kde_KSpell_check2((kde_KSpell *)[self qt], (kde_KProcIO*) [arg1 qt]);
	return self;
}

- checkList2
{
	kde_KSpell_checkList2((kde_KSpell *)[self qt]);
	return self;
}

- checkList3a: (KProcIO*)arg1
{
	kde_KSpell_checkList3a((kde_KSpell *)[self qt], (kde_KProcIO*) [arg1 qt]);
	return self;
}

- checkListReplaceCurrent
{
	kde_KSpell_checkListReplaceCurrent((kde_KSpell *)[self qt]);
	return self;
}

- checkList4
{
	kde_KSpell_checkList4((kde_KSpell *)[self qt]);
	return self;
}

- dialog2: (int)dlgresult
{
	kde_KSpell_dialog2((kde_KSpell *)[self qt], (int)dlgresult);
	return self;
}

- check3
{
	kde_KSpell_check3((kde_KSpell *)[self qt]);
	return self;
}

- slotStopCancel: (int)arg1
{
	kde_KSpell_slotStopCancel((kde_KSpell *)[self qt], (int)arg1);
	return self;
}

- ispellExit: (KProcess*)arg1
{
	kde_KSpell_ispellExit((kde_KSpell *)[self qt], (kde_KProcess*) [arg1 qt]);
	return self;
}

- emitDeath
{
	kde_KSpell_emitDeath((kde_KSpell *)[self qt]);
	return self;
}

- ispellErrors: (KProcess*)arg1 string: (NSString *)arg2 int: (int)arg3
{
	kde_KSpell_ispellErrors((kde_KSpell *)[self qt], (kde_KProcess*) [arg1 qt], (char*) [arg2 cString], (int)arg3);
	return self;
}

+ (int) Starting
{
	return (int) KSPELL_Starting;
}

+ (int) Running
{
	return (int) KSPELL_Running;
}

+ (int) Cleaning
{
	return (int) KSPELL_Cleaning;
}

+ (int) Finished
{
	return (int) KSPELL_Finished;
}

+ (int) Error
{
	return (int) KSPELL_Error;
}

+ (int) Crashed
{
	return (int) KSPELL_Crashed;
}

@end
