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 "SpellBase.h"
|
|
|
|
|
2006-10-21 07:26:07 +00:00
|
|
|
#include <map>
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
2006-12-30 21:05:44 +00:00
|
|
|
struct AspellSpeller;
|
|
|
|
struct AspellStringEnumeration;
|
|
|
|
struct AspellCanHaveError;
|
|
|
|
struct AspellConfig;
|
2003-03-26 01:20:25 +00:00
|
|
|
|
2006-10-21 07:26:07 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
2003-03-26 01:20:25 +00:00
|
|
|
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
|
2006-12-08 19:46:16 +00:00
|
|
|
virtual docstring const nextMiss();
|
2003-03-26 01:20:25 +00:00
|
|
|
|
|
|
|
/// give an error message on messy exit
|
2006-10-21 00:16:43 +00:00
|
|
|
virtual docstring 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;
|
|
|
|
};
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
2005-05-02 13:35:30 +00:00
|
|
|
#endif // LYX_ASPELL_H
|