KTextAddons

plaintextsyntaxspellcheckinghighlighter.h
1/*
2 SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "textcustomeditor_export.h"
10
11#include <KSyntaxHighlighting/SyntaxHighlighter>
12#include <Sonnet/Highlighter>
13
14namespace KSyntaxHighlighting
15{
16class Format;
17}
18
19namespace TextCustomEditor
20{
21class PlainTextEditor;
22class PlainTextSyntaxSpellCheckingHighlighterPrivate;
23/**
24 * @brief The PlainTextSyntaxSpellCheckingHighlighter class
25 * @author Laurent Montel <montel@kde.org>
26 */
28{
29public:
30 explicit PlainTextSyntaxSpellCheckingHighlighter(PlainTextEditor *plainText, const QColor &misspelledColor = Qt::red);
32
33 void toggleSpellHighlighting(bool on);
34
35 void setDefinition(const KSyntaxHighlighting::Definition &def) override;
36
37 /**
38 * Reimplemented to highlight quote blocks.
39 */
40 void highlightBlock(const QString &text) override;
41
42protected:
43 /**
44 * Reimplemented, the base version sets the text color to black, which
45 * is not what we want. We do nothing, the format is already reset by
46 * Qt.
47 * @param start the beginning of text
48 * @param count the amount of characters to set
49 */
50 void unsetMisspelled(int start, int count) override;
51
52 /**
53 * Reimplemented to set the color of the misspelled word to a color
54 * defined by setQuoteColor().
55 */
56 void setMisspelled(int start, int count) override;
57
58 void applyFormat(int offset, int length, const KSyntaxHighlighting::Format &format) override;
59
60private:
61 std::unique_ptr<PlainTextSyntaxSpellCheckingHighlighterPrivate> const d;
62};
63}
The PlainTextEditor class.
Q_SCRIPTABLE Q_NOREPLY void start()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:19:49 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.