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

KDE3Support

  • 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
34class K3Spell;
35class K3SpellConfig;
36
40class KDE3SUPPORT_EXPORT K3SyntaxHighlighter : public Q3SyntaxHighlighter
41{
42public:
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
58private:
59 class K3SyntaxHighlighterPrivate;
60 K3SyntaxHighlighterPrivate *const d;
61};
62
63class KDE3SUPPORT_EXPORT K3SpellingHighlighter : public K3SyntaxHighlighter
64{
65public:
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
82private:
83 void flushCurrentWord();
84
85 class K3SpellingHighlighterPrivate;
86 K3SpellingHighlighterPrivate *const d;
87};
88
92class KDE3SUPPORT_EXPORT K3DictSpellingHighlighter : public QObject, public K3SpellingHighlighter
93{
94Q_OBJECT
95
96public:
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
158Q_SIGNALS:
159 void activeChanged(const QString &);
160 void newSuggestions(const QString& originalword, const QStringList& suggestions,
161 unsigned int pos);
162
163protected:
164 QString spellKey();
165 bool eventFilter(QObject *o, QEvent *e);
166
167protected 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
177private:
178 class K3DictSpellingHighlighterPrivate;
179 K3DictSpellingHighlighterPrivate *const d;
180};
181
182#endif
K3DictSpellingHighlighter
Dictionary sensitive text highlighter.
Definition: k3syntaxhighlighter.h:93
K3DictSpellingHighlighter::newSuggestions
void newSuggestions(const QString &originalword, const QStringList &suggestions, unsigned int pos)
K3DictSpellingHighlighter::activeChanged
void activeChanged(const QString &)
K3SpellConfig
A configuration class/dialog for K3Spell.
Definition: k3sconfig.h:89
K3Spell
KDE Spellchecker
Definition: k3spell.h:47
K3SpellingHighlighter
Definition: k3syntaxhighlighter.h:64
K3SpellingHighlighter::isMisspelled
virtual bool isMisspelled(const QString &word)=0
K3SyntaxHighlighter
Syntax sensitive text highlighter.
Definition: k3syntaxhighlighter.h:41
K3SyntaxHighlighter::SyntaxMode
SyntaxMode
Definition: k3syntaxhighlighter.h:43
K3SyntaxHighlighter::PlainTextMode
@ PlainTextMode
Definition: k3syntaxhighlighter.h:44
Q3SyntaxHighlighter
Q3TextEdit
QEvent
QObject
kde3support_export.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
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