• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDE3Support

k3syntaxhighlighter.h

Go to the documentation of this file.
00001 /*
00002  ksyntaxhighlighter.cpp
00003 
00004  Copyright (c) 2003 Trolltech AS
00005  Copyright (c) 2003 Scott Wheeler <wheeler@kde.org>
00006 
00007  This file is part of the KDE libraries
00008 
00009  This library is free software; you can redistribute it and/or
00010  modify it under the terms of the GNU Library General Public
00011  License version 2 as published by the Free Software Foundation.
00012 
00013  This library is distributed in the hope that it will be useful,
00014  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  Library General Public License for more details.
00017 
00018  You should have received a copy of the GNU Library General Public License
00019  along with this library; see the file COPYING.LIB.  If not, write to
00020  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00021  Boston, MA 02110-1301, USA.
00022 */
00023 
00024 #ifndef K3SYNTAXHIGHLIGHTER_H
00025 #define K3SYNTAXHIGHLIGHTER_H
00026 
00027 #include <kde3support_export.h>
00028 
00029 #include <Qt3Support/Q3TextEdit>
00030 #include <Qt3Support/Q3SyntaxHighlighter>
00031 #include <QtGui/QColor>
00032 #include <QtCore/QStringList>
00033 
00034 class K3Spell;
00035 class K3SpellConfig;
00036 
00040 class KDE3SUPPORT_EXPORT K3SyntaxHighlighter : public Q3SyntaxHighlighter
00041 {
00042 public:
00043     enum SyntaxMode {
00044     PlainTextMode,
00045     RichTextMode
00046     };
00047     K3SyntaxHighlighter( Q3TextEdit *textEdit,
00048              bool colorQuoting = false,
00049              const QColor& QuoteColor0 = Qt::black,
00050              const QColor& QuoteColor1 = QColor( 0x00, 0x80, 0x00 ),
00051              const QColor& QuoteColor2 = QColor( 0x00, 0x80, 0x00 ),
00052              const QColor& QuoteColor3 = QColor( 0x00, 0x80, 0x00 ),
00053              SyntaxMode mode = PlainTextMode );
00054     ~K3SyntaxHighlighter();
00055 
00056     int highlightParagraph( const QString& text, int endStateOfLastPara );
00057 
00058 private:
00059     class K3SyntaxHighlighterPrivate;
00060     K3SyntaxHighlighterPrivate *const d;
00061 };
00062 
00063 class KDE3SUPPORT_EXPORT K3SpellingHighlighter : public K3SyntaxHighlighter
00064 {
00065 public:
00066     K3SpellingHighlighter( Q3TextEdit *textEdit,
00067               const QColor& spellColor = Qt::red,
00068               bool colorQuoting = false,
00069               const QColor& QuoteColor0 = Qt::black,
00070               const QColor& QuoteColor1 = QColor( 0x00, 0x80, 0x00 ),
00071               const QColor& QuoteColor2 = QColor( 0x00, 0x80, 0x00 ),
00072               const QColor& QuoteColor3 = QColor( 0x00, 0x80, 0x00 ) );
00073     ~K3SpellingHighlighter();
00074 
00075     virtual int highlightParagraph( const QString &text,
00076                     int endStateOfLastPara );
00077     virtual bool isMisspelled( const QString& word ) = 0;
00078     bool intraWordEditing() const;
00079     void setIntraWordEditing( bool editing );
00080     static QStringList personalWords();
00081 
00082 private:
00083     void flushCurrentWord();
00084 
00085     class K3SpellingHighlighterPrivate;
00086     K3SpellingHighlighterPrivate *const d;
00087 };
00088 
00092 class KDE3SUPPORT_EXPORT K3DictSpellingHighlighter : public QObject, public K3SpellingHighlighter
00093 {
00094 Q_OBJECT
00095 
00096 public:
00097     K3DictSpellingHighlighter( Q3TextEdit *textEdit,
00098                   bool spellCheckingActive = true,
00099                   bool autoEnable = true,
00100                   const QColor& spellColor = Qt::red,
00101                   bool colorQuoting = false,
00102                   const QColor& QuoteColor0 = Qt::black,
00103                   const QColor& QuoteColor1 = QColor( 0x00, 0x80, 0x00 ),
00104                   const QColor& QuoteColor2 = QColor( 0x00, 0x70, 0x00 ),
00105                   const QColor& QuoteColor3 = QColor( 0x00, 0x60, 0x00 ),
00106                               K3SpellConfig *spellConfig = 0 );
00107     ~K3DictSpellingHighlighter();
00108 
00109     virtual bool isMisspelled( const QString &word );
00110     static void dictionaryChanged();
00111     void restartBackgroundSpellCheck();
00112 
00125     void setActive( bool active );
00126 
00134     bool isActive() const;
00135 
00147     void setAutomatic( bool automatic );
00148 
00156     bool automatic() const;
00157 
00158 Q_SIGNALS:
00159     void activeChanged(const QString &);
00160     void newSuggestions(const QString& originalword, const QStringList& suggestions,
00161                         unsigned int pos);
00162 
00163 protected:
00164     QString spellKey();
00165     bool eventFilter(QObject *o, QEvent *e);
00166 
00167 protected Q_SLOTS:
00168     void slotMisspelling( const QString &originalWord, const QStringList &suggestions, unsigned int pos );
00169     void slotCorrected( const QString &originalWord, const QString &, unsigned int );
00170     void slotRehighlight();
00171     void slotDictionaryChanged();
00172     void slotSpellReady( K3Spell *spell );
00173     void slotAutoDetection();
00174     void slotLocalSpellConfigChanged();
00175     void slotK3SpellNotResponding();
00176 
00177 private:
00178     class K3DictSpellingHighlighterPrivate;
00179     K3DictSpellingHighlighterPrivate *const d;
00180 };
00181 
00182 #endif

KDE3Support

Skip menu "KDE3Support"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal