libquentier  0.5.0
The library for rich desktop clients of Evernote service
SpellChecker.h
1 /*
2  * Copyright 2017-2020 Dmitry Ivanov
3  *
4  * This file is part of libquentier
5  *
6  * libquentier is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, version 3 of the License.
9  *
10  * libquentier is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with libquentier. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef LIB_QUENTIER_NOTE_EDITOR_SPELL_CHECKER_H
20 #define LIB_QUENTIER_NOTE_EDITOR_SPELL_CHECKER_H
21 
22 #include <quentier/utility/Linkage.h>
23 
24 #include <QObject>
25 #include <QVector>
26 
27 #include <utility>
28 
29 namespace quentier {
30 
31 QT_FORWARD_DECLARE_CLASS(Account)
32 QT_FORWARD_DECLARE_CLASS(FileIOProcessorAsync)
33 QT_FORWARD_DECLARE_CLASS(SpellCheckerPrivate)
34 
35 class QUENTIER_EXPORT SpellChecker : public QObject
36 {
37  Q_OBJECT
38 public:
40  FileIOProcessorAsync * pFileIOProcessorAsync, const Account & account,
41  QObject * parent = nullptr, const QString & userDictionaryPath = {});
42 
43  // The second bool in the pair indicates whether the dictionary
44  // is enabled or disabled
45  QVector<std::pair<QString, bool>> listAvailableDictionaries() const;
46 
47  void setAccount(const Account & account);
48 
49  void enableDictionary(const QString & language);
50  void disableDictionary(const QString & language);
51 
52  bool checkSpell(const QString & word) const;
53 
54  QStringList spellCorrectionSuggestions(
55  const QString & misSpelledWord) const;
56 
57  void addToUserWordlist(const QString & word);
58  void removeFromUserWordList(const QString & word);
59  void ignoreWord(const QString & word);
60  void removeWord(const QString & word);
61 
62  bool isReady() const;
63 
64 Q_SIGNALS:
65  void ready();
66 
67 private:
68  SpellCheckerPrivate * const d_ptr;
69  Q_DECLARE_PRIVATE(SpellChecker)
70 };
71 
72 } // namespace quentier
73 
74 #endif // LIB_QUENTIER_NOTE_EDITOR_SPELL_CHECKER_H
The Account class encapsulates some details about the account: its name, whether it is local or synch...
Definition: Account.h:39
The FileIOProcessorAsync class is a wrapper under simple file IO operations, it is meant to be used f...
Definition: FileIOProcessorAsync.h:40
Definition: SpellChecker.h:36