]> git.lyx.org Git - lyx.git/blob - src/SpellChecker.h
c6e3748c848ffb79058104f2dbd22fda6030a219
[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 class docstring_list;
24
25 /**
26  * Pure virtual base class of all spellchecker implementations.
27  */
28 class SpellChecker {
29 public:
30
31         /// the result from checking a single word
32         enum Result  {
33                 /// word is correct
34                 OK = 1,
35                 /// root of given word was found
36                 ROOT,
37                 /// word found through compound formation
38                 COMPOUND_WORD,
39                 /// word not found
40                 UNKNOWN_WORD,
41                 /// number of other ignored "word"
42                 IGNORED_WORD
43         };
44
45         virtual ~SpellChecker() {}
46
47         /// check the given word of the given lang code and return the result
48         virtual enum Result check(WordLangTuple const &) = 0;
49         
50         /// Gives suggestions.
51         virtual void suggest(WordLangTuple const &, docstring_list & suggestions) = 0;
52
53         /// insert the given word into the personal dictionary
54         virtual void insert(WordLangTuple const &) = 0;
55
56         /// accept the given word temporarily
57         virtual void accept(WordLangTuple const &) = 0;
58
59         /// give an error message on messy exit
60         virtual docstring const error() = 0;
61 };
62
63 /// Access to the singleton SpellChecker.
64 /// Implemented in LyX.cpp
65 SpellChecker * theSpellChecker();
66
67 } // namespace lyx
68
69 #endif // SPELL_BASE_H