2003-08-23 00:17:00 +00:00
|
|
|
// -*- C++ -*-
|
2002-08-04 23:11:50 +00:00
|
|
|
/**
|
|
|
|
* \file pspell.h
|
2003-08-23 00:17:00 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-08-04 23:11:50 +00:00
|
|
|
*
|
|
|
|
* \author Kevin Atkinson
|
2003-08-23 00:17:00 +00:00
|
|
|
* \author John Levon
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-08-04 23:11:50 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LYX_PSPELL_H
|
|
|
|
#define LYX_PSPELL_H
|
|
|
|
|
|
|
|
#include "SpellBase.h"
|
|
|
|
|
2003-09-07 01:45:40 +00:00
|
|
|
#include <map>
|
|
|
|
|
2002-08-04 23:11:50 +00:00
|
|
|
class PspellManager;
|
|
|
|
class PspellStringEmulation;
|
|
|
|
class PspellCanHaveError;
|
2002-12-01 22:59:25 +00:00
|
|
|
class PspellConfig;
|
2002-08-04 23:11:50 +00:00
|
|
|
|
|
|
|
class BufferParams;
|
|
|
|
|
|
|
|
|
|
|
|
class PSpell : public SpellBase {
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Initialise the spellchecker with the given buffer params and language.
|
|
|
|
*/
|
2003-10-06 15:43:21 +00:00
|
|
|
PSpell(BufferParams const & params, std::string const & lang);
|
2002-08-04 23:11:50 +00:00
|
|
|
|
|
|
|
virtual ~PSpell();
|
|
|
|
|
2002-08-06 22:38:44 +00:00
|
|
|
/**
|
|
|
|
* return true if the spellchecker instance still exists
|
|
|
|
* Always true for pspell, since there is no separate process
|
|
|
|
*/
|
|
|
|
virtual bool alive() { return true; }
|
2002-08-04 23:11:50 +00:00
|
|
|
|
|
|
|
/// check the given word and return the result
|
2002-08-06 22:38:44 +00:00
|
|
|
virtual enum Result check(WordLangTuple const &);
|
2002-08-04 23:11:50 +00:00
|
|
|
|
|
|
|
/// insert the given word into the personal dictionary
|
2002-08-06 22:38:44 +00:00
|
|
|
virtual void insert(WordLangTuple const &);
|
2002-08-04 23:11:50 +00:00
|
|
|
|
|
|
|
/// accept the given word temporarily
|
2002-08-06 22:38:44 +00:00
|
|
|
virtual void accept(WordLangTuple const &);
|
2002-08-04 23:11:50 +00:00
|
|
|
|
2005-01-20 16:17:37 +00:00
|
|
|
/// return the next near miss after a SUGGESTED_WORDS result
|
2003-10-06 15:43:21 +00:00
|
|
|
virtual std::string const nextMiss();
|
2002-08-04 23:11:50 +00:00
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
/// give an error message on messy exit
|
2003-10-06 15:43:21 +00:00
|
|
|
virtual std::string const error();
|
2002-08-04 23:11:50 +00:00
|
|
|
|
|
|
|
private:
|
2002-08-06 22:38:44 +00:00
|
|
|
/// add a manager of the given language
|
2003-10-06 15:43:21 +00:00
|
|
|
void addManager(std::string const & lang);
|
2002-08-06 22:38:44 +00:00
|
|
|
|
|
|
|
struct Manager {
|
|
|
|
PspellManager * manager;
|
|
|
|
PspellConfig * config;
|
|
|
|
};
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
typedef std::map<std::string, struct Manager> Managers;
|
2002-08-06 22:38:44 +00:00
|
|
|
|
|
|
|
/// the managers
|
|
|
|
Managers managers_;
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-08-04 23:11:50 +00:00
|
|
|
/// FIXME
|
|
|
|
PspellStringEmulation * els;
|
|
|
|
/// FIXME
|
|
|
|
PspellCanHaveError * spell_error_object;
|
|
|
|
};
|
|
|
|
|
2005-05-02 13:35:30 +00:00
|
|
|
#endif // LYX_PSPELL_H
|