KDEUI
highlighter.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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
00031 namespace Sonnet
00032 {
00034 class KDEUI_EXPORT Highlighter : public QSyntaxHighlighter
00035 {
00036 Q_OBJECT
00037 public:
00038 explicit Highlighter(QTextEdit *textEdit,
00039 const QString &configFile = QString(),
00040 const QColor &col=QColor());
00041 ~Highlighter();
00042
00043 bool spellCheckerFound() const;
00044
00045 QString currentLanguage() const;
00046 void setCurrentLanguage(const QString &lang);
00047
00048 static QStringList personalWords();
00049
00063 void setActive(bool active);
00064
00072 bool isActive() const;
00073
00074 bool automatic() const;
00075
00076 void setAutomatic(bool automatic);
00077
00085 void addWordToDictionary(const QString &word);
00086
00095 void ignoreWord(const QString &word);
00096
00108 QStringList suggestionsForWord(const QString &word, int max = 10 );
00109
00117 bool isWordMisspelled(const QString &word);
00118
00123 void setMisspelledColor(const QColor &color);
00124
00125 Q_SIGNALS:
00126
00133 void activeChanged(const QString &description);
00134
00143 QT_MOC_COMPAT void newSuggestions(const QString &originalWord, const QStringList &suggestions);
00144
00145 protected:
00146
00147 virtual void highlightBlock(const QString &text);
00148 virtual void setMisspelled(int start, int count);
00149 virtual void unsetMisspelled(int start, int count);
00150
00151 bool eventFilter(QObject *o, QEvent *e);
00152 bool intraWordEditing() const;
00153 void setIntraWordEditing(bool editing);
00154
00155 public Q_SLOTS:
00156 void slotAutoDetection();
00157 void slotRehighlight();
00158 private:
00159 virtual void connectNotify(const char* signal);
00160 virtual void disconnectNotify(const char* signal);
00161 class Private;
00162 Private *const d;
00163 Q_DISABLE_COPY( Highlighter )
00164 };
00165
00166 }
00167
00168 #endif