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 #include <quentier/utility/Macros.h>
24 
25 #include <QObject>
26 #include <QVector>
27 
28 #include <utility>
29 
30 namespace quentier {
31 
32 QT_FORWARD_DECLARE_CLASS(Account)
33 QT_FORWARD_DECLARE_CLASS(FileIOProcessorAsync)
34 QT_FORWARD_DECLARE_CLASS(SpellCheckerPrivate)
35 
36 class QUENTIER_EXPORT SpellChecker : public QObject
37 {
38  Q_OBJECT
39 public:
41  FileIOProcessorAsync * pFileIOProcessorAsync,
42  const Account & account, QObject * parent = nullptr,
43  const QString & userDictionaryPath = {});
44 
45  // The second bool in the pair indicates whether the dictionary
46  // is enabled or disabled
47  QVector<std::pair<QString,bool>> listAvailableDictionaries() const;
48 
49  void setAccount(const Account & account);
50 
51  void enableDictionary(const QString & language);
52  void disableDictionary(const QString & language);
53 
54  bool checkSpell(const QString & word) const;
55 
56  QStringList spellCorrectionSuggestions(
57  const QString & misSpelledWord) const;
58 
59  void addToUserWordlist(const QString & word);
60  void removeFromUserWordList(const QString & word);
61  void ignoreWord(const QString & word);
62  void removeWord(const QString & word);
63 
64  bool isReady() const;
65 
66 Q_SIGNALS:
67  void ready();
68 
69 private:
70  SpellCheckerPrivate * const d_ptr;
71  Q_DECLARE_PRIVATE(SpellChecker)
72 };
73 
74 } // namespace quentier
75 
76 #endif // LIB_QUENTIER_NOTE_EDITOR_SPELL_CHECKER_H
quentier::Account
The Account class encapsulates some details about the account: its name, whether it is local or synch...
Definition: Account.h:40
quentier::SpellChecker
Definition: SpellChecker.h:37
quentier::FileIOProcessorAsync
The FileIOProcessorAsync class is a wrapper under simple file IO operations, it is meant to be used f...
Definition: FileIOProcessorAsync.h:41