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
00079
00080 Q_SIGNALS:
00087 void activeChanged(const QString &description);
00088
00095 void newSuggestions(const QString &originalWord, const QStringList &suggestions);
00096
00097 protected:
00098 virtual void highlightBlock(const QString &text);
00099
00100 virtual void setMisspelled(int start, int count);
00101 virtual void unsetMisspelled(int start, int count);
00102
00103 bool eventFilter(QObject *o, QEvent *e);
00104 bool intraWordEditing() const;
00105 void setIntraWordEditing(bool editing);
00106
00107 public Q_SLOTS:
00108 void slotAutoDetection();
00109 void slotRehighlight();
00110 private:
00111 virtual void connectNotify(const char* signal);
00112 virtual void disconnectNotify(const char* signal);
00113 class Private;
00114 Private *const d;
00115 Q_DISABLE_COPY( Highlighter )
00116 };
00117
00118 }
00119
00120 #endif