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
00124 void setMisspelledColor(const QColor &color);
00125
00126 Q_SIGNALS:
00127
00134 void activeChanged(const QString &description);
00135
00144 QT_MOC_COMPAT void newSuggestions(const QString &originalWord, const QStringList &suggestions);
00145
00146 protected:
00147
00148 virtual void highlightBlock(const QString &text);
00149 virtual void setMisspelled(int start, int count);
00150 virtual void unsetMisspelled(int start, int count);
00151
00152 bool eventFilter(QObject *o, QEvent *e);
00153 bool intraWordEditing() const;
00154 void setIntraWordEditing(bool editing);
00155
00156 public Q_SLOTS:
00157 void slotAutoDetection();
00158 void slotRehighlight();
00159 private:
00160 virtual void connectNotify(const char* signal);
00161 virtual void disconnectNotify(const char* signal);
00162 class Private;
00163 Private *const d;
00164 Q_DISABLE_COPY( Highlighter )
00165 };
00166
00167 }
00168
00169 #endif