]> git.lyx.org Git - lyx.git/blob - src/SpellChecker.h
b46b97400a715be39e632246a8949af9e1eba6c1
[lyx.git] / src / SpellChecker.h
1 // -*- C++ -*-
2 /**
3  * \file SpellChecker.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author unknown
8  * \author John Levon
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef SPELL_BASE_H
14 #define SPELL_BASE_H
15
16 #include "support/strfwd.h"
17
18
19 namespace lyx {
20
21 class BufferParams;
22 class WordLangTuple;
23
24 /**
25  * Pure virtual base class of all spellchecker implementations.
26  */
27 class SpellChecker {
28 public:
29
30         /// the result from checking a single word
31         enum Result  {
32                 /// word is correct
33                 OK = 1,
34                 /// root of given word was found
35                 ROOT,
36                 /// word found through compound formation
37                 COMPOUND_WORD,
38                 /// word not found
39                 UNKNOWN_WORD,
40                 /// not found, with suggestions
41                 SUGGESTED_WORDS,
42                 /// number of other ignored "word"
43                 IGNORED_WORD
44         };
45
46         virtual ~SpellChecker() {}
47
48         /// check the given word of the given lang code and return the result
49         virtual enum Result check(WordLangTuple const &) = 0;
50
51
52         /// insert the given word into the personal dictionary
53         virtual void insert(WordLangTuple const &) = 0;
54
55         /// accept the given word temporarily
56         virtual void accept(WordLangTuple const &) = 0;
57
58         /// return the next near miss after a SUGGESTED_WORDS result
59         virtual docstring const nextMiss() = 0;
60
61         /// give an error message on messy exit
62         virtual docstring const error() = 0;
63 };
64
65 /// Access to the singleton SpellChecker.
66 /// Implemented in LyX.cpp
67 SpellChecker * theSpellChecker();
68
69 } // namespace lyx
70
71 #endif // SPELL_BASE_H