2002-08-04 23:11:50 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2009-03-29 19:49:52 +00:00
|
|
|
* \file SpellChecker.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 unknown
|
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 SPELL_BASE_H
|
|
|
|
#define SPELL_BASE_H
|
|
|
|
|
2007-10-31 22:40:34 +00:00
|
|
|
#include "support/strfwd.h"
|
2006-09-11 08:54:10 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
2002-08-04 23:11:50 +00:00
|
|
|
class BufferParams;
|
2010-02-10 08:10:31 +00:00
|
|
|
class Language;
|
2002-08-13 14:40:38 +00:00
|
|
|
class WordLangTuple;
|
2009-08-02 09:17:32 +00:00
|
|
|
class docstring_list;
|
2002-08-04 23:11:50 +00:00
|
|
|
|
|
|
|
/**
|
2009-05-06 17:52:58 +00:00
|
|
|
* Pure virtual base class of all spellchecker implementations.
|
2002-08-04 23:11:50 +00:00
|
|
|
*/
|
2009-03-29 19:49:52 +00:00
|
|
|
class SpellChecker {
|
2002-08-04 23:11:50 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
/// the result from checking a single word
|
|
|
|
enum Result {
|
2005-01-20 16:17:37 +00:00
|
|
|
/// word is correct
|
|
|
|
OK = 1,
|
|
|
|
/// root of given word was found
|
|
|
|
ROOT,
|
|
|
|
/// word found through compound formation
|
|
|
|
COMPOUND_WORD,
|
|
|
|
/// word not found
|
|
|
|
UNKNOWN_WORD,
|
|
|
|
/// number of other ignored "word"
|
|
|
|
IGNORED_WORD
|
2002-08-04 23:11:50 +00:00
|
|
|
};
|
|
|
|
|
2009-03-29 19:49:52 +00:00
|
|
|
virtual ~SpellChecker() {}
|
2002-08-04 23:11:50 +00:00
|
|
|
|
2002-08-06 22:38:44 +00:00
|
|
|
/// check the given word of the given lang code and return the result
|
2009-03-29 19:49:52 +00:00
|
|
|
virtual enum Result check(WordLangTuple const &) = 0;
|
2009-08-02 09:17:32 +00:00
|
|
|
|
|
|
|
/// Gives suggestions.
|
|
|
|
virtual void suggest(WordLangTuple const &, docstring_list & suggestions) = 0;
|
2002-08-04 23:11:50 +00:00
|
|
|
|
|
|
|
/// insert the given word into the personal dictionary
|
2009-03-29 19:49:52 +00:00
|
|
|
virtual void insert(WordLangTuple const &) = 0;
|
2002-08-04 23:11:50 +00:00
|
|
|
|
|
|
|
/// accept the given word temporarily
|
2009-03-29 19:49:52 +00:00
|
|
|
virtual void accept(WordLangTuple const &) = 0;
|
2002-08-04 23:11:50 +00:00
|
|
|
|
2010-02-10 08:10:31 +00:00
|
|
|
/// check if dictionary exists
|
|
|
|
virtual bool hasDictionary(Language const *) const = 0;
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
/// give an error message on messy exit
|
2009-03-29 19:49:52 +00:00
|
|
|
virtual docstring const error() = 0;
|
2002-08-04 23:11:50 +00:00
|
|
|
};
|
|
|
|
|
2009-03-30 07:44:01 +00:00
|
|
|
/// Access to the singleton SpellChecker.
|
|
|
|
/// Implemented in LyX.cpp
|
|
|
|
SpellChecker * theSpellChecker();
|
2006-10-21 00:16:43 +00:00
|
|
|
|
2009-08-08 17:05:31 +00:00
|
|
|
/// Set the singleton SpellChecker engine.
|
|
|
|
/// Implemented in LyX.cpp
|
|
|
|
void setSpellChecker();
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|
|
|
|
|
2002-08-04 23:11:50 +00:00
|
|
|
#endif // SPELL_BASE_H
|