1 /*********************************************************************** 2 * 3 * Copyright (C) 2009, 2010, 2012, 2013, 2014 Graeme Gott <graeme@gottcode.org> 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program 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 General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * 18 ***********************************************************************/ 19 20 #ifndef SPELL_H 21 #define SPELL_H 22 23 class DictionaryRef; 24 25 #include <QDialog> 26 #include <QTextCursor> 27 class QAction; 28 class QLineEdit; 29 class QListWidget; 30 class QListWidgetItem; 31 class QTextEdit; 32 33 class SpellChecker : public QDialog 34 { 35 Q_OBJECT 36 37 public: 38 static void checkDocument(QTextEdit* document, DictionaryRef& dictionary); 39 40 public slots: 41 virtual void reject(); 42 43 private slots: 44 void suggestionChanged(QListWidgetItem* suggestion); 45 void add(); 46 void ignore(); 47 void ignoreAll(); 48 void change(); 49 void changeAll(); 50 51 private: 52 SpellChecker(QTextEdit* document, DictionaryRef& dictionary); 53 void check(); 54 55 private: 56 DictionaryRef& m_dictionary; 57 58 QTextEdit* m_document; 59 QTextEdit* m_context; 60 QLineEdit* m_suggestion; 61 QListWidget* m_suggestions; 62 QTextCursor m_cursor; 63 QTextCursor m_start_cursor; 64 65 int m_checked_blocks; 66 int m_total_blocks; 67 bool m_loop_available; 68 69 QString m_word; 70 QStringList m_ignored; 71 }; 72 73 #endif 74