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

KDE3Support

  • sources
  • kde-4.14
  • kdelibs
  • kde3support
  • kdeui
k3syntaxhighlighter.h
Go to the documentation of this file.
1 /*
2  ksyntaxhighlighter.cpp
3 
4  Copyright (c) 2003 Trolltech AS
5  Copyright (c) 2003 Scott Wheeler <wheeler@kde.org>
6 
7  This file is part of the KDE libraries
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Library General Public
11  License version 2 as published by the Free Software Foundation.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Library General Public License for more details.
17 
18  You should have received a copy of the GNU Library General Public License
19  along with this library; see the file COPYING.LIB. If not, write to
20  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  Boston, MA 02110-1301, USA.
22 */
23 
24 #ifndef K3SYNTAXHIGHLIGHTER_H
25 #define K3SYNTAXHIGHLIGHTER_H
26 
27 #include <kde3support_export.h>
28 
29 #include <Qt3Support/Q3TextEdit>
30 #include <Qt3Support/Q3SyntaxHighlighter>
31 #include <QtGui/QColor>
32 #include <QtCore/QStringList>
33 
34 class K3Spell;
35 class K3SpellConfig;
36 
40 class KDE3SUPPORT_EXPORT K3SyntaxHighlighter : public Q3SyntaxHighlighter
41 {
42 public:
43  enum SyntaxMode {
44  PlainTextMode,
45  RichTextMode
46  };
47  K3SyntaxHighlighter( Q3TextEdit *textEdit,
48  bool colorQuoting = false,
49  const QColor& QuoteColor0 = Qt::black,
50  const QColor& QuoteColor1 = QColor( 0x00, 0x80, 0x00 ),
51  const QColor& QuoteColor2 = QColor( 0x00, 0x80, 0x00 ),
52  const QColor& QuoteColor3 = QColor( 0x00, 0x80, 0x00 ),
53  SyntaxMode mode = PlainTextMode );
54  ~K3SyntaxHighlighter();
55 
56  int highlightParagraph( const QString& text, int endStateOfLastPara );
57 
58 private:
59  class K3SyntaxHighlighterPrivate;
60  K3SyntaxHighlighterPrivate *const d;
61 };
62 
63 class KDE3SUPPORT_EXPORT K3SpellingHighlighter : public K3SyntaxHighlighter
64 {
65 public:
66  K3SpellingHighlighter( Q3TextEdit *textEdit,
67  const QColor& spellColor = Qt::red,
68  bool colorQuoting = false,
69  const QColor& QuoteColor0 = Qt::black,
70  const QColor& QuoteColor1 = QColor( 0x00, 0x80, 0x00 ),
71  const QColor& QuoteColor2 = QColor( 0x00, 0x80, 0x00 ),
72  const QColor& QuoteColor3 = QColor( 0x00, 0x80, 0x00 ) );
73  ~K3SpellingHighlighter();
74 
75  virtual int highlightParagraph( const QString &text,
76  int endStateOfLastPara );
77  virtual bool isMisspelled( const QString& word ) = 0;
78  bool intraWordEditing() const;
79  void setIntraWordEditing( bool editing );
80  static QStringList personalWords();
81 
82 private:
83  void flushCurrentWord();
84 
85  class K3SpellingHighlighterPrivate;
86  K3SpellingHighlighterPrivate *const d;
87 };
88 
92 class KDE3SUPPORT_EXPORT K3DictSpellingHighlighter : public QObject, public K3SpellingHighlighter
93 {
94 Q_OBJECT
95 
96 public:
97  K3DictSpellingHighlighter( Q3TextEdit *textEdit,
98  bool spellCheckingActive = true,
99  bool autoEnable = true,
100  const QColor& spellColor = Qt::red,
101  bool colorQuoting = false,
102  const QColor& QuoteColor0 = Qt::black,
103  const QColor& QuoteColor1 = QColor( 0x00, 0x80, 0x00 ),
104  const QColor& QuoteColor2 = QColor( 0x00, 0x70, 0x00 ),
105  const QColor& QuoteColor3 = QColor( 0x00, 0x60, 0x00 ),
106  K3SpellConfig *spellConfig = 0 );
107  ~K3DictSpellingHighlighter();
108 
109  virtual bool isMisspelled( const QString &word );
110  static void dictionaryChanged();
111  void restartBackgroundSpellCheck();
112 
125  void setActive( bool active );
126 
134  bool isActive() const;
135 
147  void setAutomatic( bool automatic );
148 
156  bool automatic() const;
157 
158 Q_SIGNALS:
159  void activeChanged(const QString &);
160  void newSuggestions(const QString& originalword, const QStringList& suggestions,
161  unsigned int pos);
162 
163 protected:
164  QString spellKey();
165  bool eventFilter(QObject *o, QEvent *e);
166 
167 protected Q_SLOTS:
168  void slotMisspelling( const QString &originalWord, const QStringList &suggestions, unsigned int pos );
169  void slotCorrected( const QString &originalWord, const QString &, unsigned int );
170  void slotRehighlight();
171  void slotDictionaryChanged();
172  void slotSpellReady( K3Spell *spell );
173  void slotAutoDetection();
174  void slotLocalSpellConfigChanged();
175  void slotK3SpellNotResponding();
176 
177 private:
178  class K3DictSpellingHighlighterPrivate;
179  K3DictSpellingHighlighterPrivate *const d;
180 };
181 
182 #endif
K3SyntaxHighlighter
Syntax sensitive text highlighter.
Definition: k3syntaxhighlighter.h:40
QEvent
Q3SyntaxHighlighter
Q3SyntaxHighlighter::highlightParagraph
virtual int highlightParagraph(const QString &text, int endStateOfLastPara)=0
K3SyntaxHighlighter::PlainTextMode
Definition: k3syntaxhighlighter.h:44
K3SpellConfig
A configuration class/dialog for K3Spell.
Definition: k3sconfig.h:88
K3SpellingHighlighter
Definition: k3syntaxhighlighter.h:63
K3SyntaxHighlighter::SyntaxMode
SyntaxMode
Definition: k3syntaxhighlighter.h:43
kde3support_export.h
QObject
QObject::eventFilter
virtual bool eventFilter(QObject *watched, QEvent *event)
QString
QColor
QStringList
Q3TextEdit
K3DictSpellingHighlighter
Dictionary sensitive text highlighter.
Definition: k3syntaxhighlighter.h:92
K3SpellingHighlighter::isMisspelled
virtual bool isMisspelled(const QString &word)=0
K3Spell
KDE Spellchecker
Definition: k3spell.h:46
K3SyntaxHighlighter::highlightParagraph
int highlightParagraph(const QString &text, int endStateOfLastPara)
Definition: k3syntaxhighlighter.cpp:145
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:26:48 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDE3Support

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal