2003-08-23 00:17:00 +00:00
|
|
|
// -*- C++ -*-
|
2003-03-26 01:20:25 +00:00
|
|
|
/**
|
|
|
|
* \file aspell_local.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.
|
2003-03-26 01:20:25 +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.
|
2003-03-26 01:20:25 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LYX_ASPELL_H
|
|
|
|
#define LYX_ASPELL_H
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
#include "SpellBase.h"
|
|
|
|
|
|
|
|
class AspellSpeller;
|
|
|
|
class AspellStringEnumeration;
|
|
|
|
class AspellCanHaveError;
|
|
|
|
class AspellConfig;
|
|
|
|
|
|
|
|
class BufferParams;
|
|
|
|
|
|
|
|
|
|
|
|
class ASpell : public SpellBase {
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Initialise the spellchecker with the given buffer params and language.
|
|
|
|
*/
|
2003-10-07 13:32:17 +00:00
|
|
|
ASpell(BufferParams const & params, std::string const & lang);
|
2003-03-26 01:20:25 +00:00
|
|
|
|
|
|
|
virtual ~ASpell();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* return true if the spellchecker instance still exists
|
|
|
|
* Always true for aspell, since there is no separate process
|
|
|
|
*/
|
|
|
|
virtual bool alive() { return true; }
|
|
|
|
|
|
|
|
/// check the given word and return the result
|
|
|
|
virtual enum Result check(WordLangTuple const &);
|
|
|
|
|
|
|
|
/// insert the given word into the personal dictionary
|
|
|
|
virtual void insert(WordLangTuple const &);
|
|
|
|
|
|
|
|
/// accept the given word temporarily
|
|
|
|
virtual void accept(WordLangTuple const &);
|
|
|
|
|
2005-01-20 16:17:37 +00:00
|
|
|
/// return the next near miss after a SUGGESTED_WORDS result
|
2003-10-07 13:32:17 +00:00
|
|
|
virtual std::string const nextMiss();
|
2003-03-26 01:20:25 +00:00
|
|
|
|
|
|
|
/// give an error message on messy exit
|
2003-10-07 13:32:17 +00:00
|
|
|
virtual std::string const error();
|
2003-03-26 01:20:25 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
/// add a speller of the given language
|
2003-10-07 13:32:17 +00:00
|
|
|
void addSpeller(std::string const & lang);
|
2003-03-26 01:20:25 +00:00
|
|
|
|
|
|
|
struct Speller {
|
|
|
|
AspellSpeller * speller;
|
|
|
|
AspellConfig * config;
|
|
|
|
};
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
typedef std::map<std::string, Speller> Spellers;
|
2003-03-26 01:20:25 +00:00
|
|
|
|
|
|
|
/// the spellers
|
|
|
|
Spellers spellers_;
|
|
|
|
|
|
|
|
/// FIXME
|
|
|
|
AspellStringEnumeration * els;
|
|
|
|
/// FIXME
|
|
|
|
AspellCanHaveError * spell_error_object;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ASPELL_H
|