KDEUI
highlighter.h
Go to the documentation of this file.00001
00021 #ifndef SONNET_HIGHLIGHTER_H
00022 #define SONNET_HIGHLIGHTER_H
00023
00024 #include <QtGui/QSyntaxHighlighter>
00025 #include <QtCore/QStringList>
00026 #include <kdemacros.h>
00027 #include <kdeui_export.h>
00028
00029 class QTextEdit;
00030
00032 namespace Sonnet
00033 {
00035 class KDEUI_EXPORT Highlighter : public QSyntaxHighlighter
00036 {
00037 Q_OBJECT
00038 public:
00039 explicit Highlighter(QTextEdit *textEdit,
00040 const QString &configFile = QString(),
00041 const QColor &col=QColor());
00042 ~Highlighter();
00043
00044 bool spellCheckerFound() const;
00045
00046 QString currentLanguage() const;
00047 void setCurrentLanguage(const QString &lang);
00048
00049 static QStringList personalWords();
00050
00064 void setActive(bool active);
00065
00073 bool isActive() const;
00074
00075 bool automatic() const;
00076
00077 void setAutomatic(bool automatic);
00078
00086 void addWordToDictionary(const QString &word);
00087
00096 void ignoreWord(const QString &word);
00097
00109 QStringList suggestionsForWord(const QString &word, int max = 10 );
00110
00118 bool isWordMisspelled(const QString &word);
00119
00120 Q_SIGNALS:
00121
00128 void activeChanged(const QString &description);
00129
00138 QT_MOC_COMPAT void newSuggestions(const QString &originalWord, const QStringList &suggestions);
00139
00140 protected:
00141
00142 virtual void highlightBlock(const QString &text);
00143 virtual void setMisspelled(int start, int count);
00144 virtual void unsetMisspelled(int start, int count);
00145
00146 bool eventFilter(QObject *o, QEvent *e);
00147 bool intraWordEditing() const;
00148 void setIntraWordEditing(bool editing);
00149
00150 public Q_SLOTS:
00151 void slotAutoDetection();
00152 void slotRehighlight();
00153 private:
00154 virtual void connectNotify(const char* signal);
00155 virtual void disconnectNotify(const char* signal);
00156 class Private;
00157 Private *const d;
00158 Q_DISABLE_COPY( Highlighter )
00159 };
00160
00161 }
00162
00163 #endif