// LEXICON.H
//
// Copyright (c) 1997-1999 Symbian Ltd.  All rights reserved.
//
#if !defined(__LEXICON_H__)
#define __LEXICON_H__
#if !defined(__E32BASE_H__)
#include <e32base.h>
#endif

const TInt KLexiconMajorVN=1;
const TInt KLexiconMinorVN=0;
const TInt KLexiconBuildVN=32;

const TInt KSpellMaxWordLength=46;
const TInt KSpellMaximumForAnagramMinimum=20;
typedef TBuf<KSpellMaxWordLength> TSpellWord;

const TUid KUidSystemUserDictionaryEnabled={0x10000161};

const TInt KSpellXwordSingleChar='?';
const TInt KSpellXwordMultiChar='*';

const TInt KLexDoubleWordError=-128;
const TInt KLexAError=-129;
const TInt KLexAnError=-130;

enum TSpellPartOfSpeech
	{
	ESpellSpeechNoun,
	ESpellSpeechPronoun,
	ESpellSpeechVerb,
	ESpellSpeechAdjective,
	ESpellSpeechAdverb,
	ESpellSpeechPreposition,
	ESpellSpeechInterjection,
	ESpellSpeechConjunction,
	ESpellSpeechNumeral,
	ESpellSpeechUnknown,
	};
enum TSpellCrossRefType
	{
	ESpellRefSynonym,
	ESpellRefAntonym,
	ESpellRefUnknown,
	};
//
class RSpellClient : public RSessionBase
    {
public:
	enum TDictionarySource { EDictionaryMain, EDictionaryUser };
public:
    IMPORT_C TInt Connect();
    IMPORT_C static TVersion Version();
public:
	IMPORT_C TInt OpenSpeller();
	IMPORT_C void CloseSpeller();
	IMPORT_C void NotifyOnChange(TRequestStatus& aStatus);
	IMPORT_C void NotifyOnChangeCancel();
	//
	IMPORT_C TInt OpenThesaurus();
	IMPORT_C void CloseThesaurus();
public:
	IMPORT_C TInt FetchBaseWord(TDes& aConvertedBase);
	IMPORT_C TInt FetchNextWord(TDes& aWordBuffer);
	IMPORT_C TInt QuerySpelling(TBool& aIsCorrect,const TDesC& aWord);
	IMPORT_C TInt ExpandWildcards(const TDesC& aWord,TDictionarySource aSource=EDictionaryMain);
	IMPORT_C TInt FindAlternatives(const TDesC& aWord,TDictionarySource aSource=EDictionaryMain);
	IMPORT_C TInt FindAnagrams(const TDesC& aWord,TInt aMinWordLength,TDictionarySource aSource=EDictionaryMain);
	//
	IMPORT_C static TPtrC DefaultUserDictionaryName();
	IMPORT_C TInt CloseUserDictionary();
	IMPORT_C TInt UnlockUserDictionary();
	IMPORT_C TInt CreateUserDictionary();
	IMPORT_C TInt ListUserDictionary();
	IMPORT_C TInt OpenUserDictionary(const TDesC& aFile);
	IMPORT_C TInt UserDictionaryName(TFileName& aFile) const;
	IMPORT_C TInt SaveUserDictionaryAs(const TDesC& aFile,TBool aReplace);
	//
	IMPORT_C TInt AddUserWord(const TDesC& aWord);
	IMPORT_C TInt DeleteUserWord(const TDesC& aWord);
	//
	inline TInt CurrentThesaurusMeaningIndex() const;
	IMPORT_C TInt FindThesaurusEntry(const TDesC& aWord);
	IMPORT_C TInt FindThesaurusMeaning(TDes& aWordBuffer,TSpellPartOfSpeech& aType,TInt aMeaningIndex);
	IMPORT_C TInt FetchNextThesaurusCrossReference(TDes& aWordBuffer,TSpellCrossRefType& aType);
#if defined (_DEBUG)
public:
	IMPORT_C TInt __DbgMarkEnd();
	IMPORT_C TInt __DbgMarkHeap();
	IMPORT_C TInt __DbgFailNext(TInt aCount);
#endif // _DEBUG
private:
	TSpellWord iBaseWord;
	TInt iCurrentMeaningIndex;
	};
//
//	class RSpellClient

inline TInt RSpellClient::CurrentThesaurusMeaningIndex() const
	{
	return(iCurrentMeaningIndex);
	}
//
#endif
