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