KTextEditor

spellcheck.h
1/*
2 SPDX-FileCopyrightText: 2008-2009 Michel Ludwig <michel.ludwig@kdemail.net>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef SPELLCHECK_H
8#define SPELLCHECK_H
9
10#include <QList>
11#include <QObject>
12#include <QPair>
13#include <QString>
14
15#include <ktexteditor/document.h>
16#include <sonnet/backgroundchecker.h>
17#include <sonnet/speller.h>
18
19namespace KTextEditor
20{
21class DocumentPrivate;
22}
23
24class KateSpellCheckManager : public QObject
25{
27
28 typedef QPair<KTextEditor::Range, QString> RangeDictionaryPair;
29
30public:
31 explicit KateSpellCheckManager(QObject *parent = nullptr);
32 ~KateSpellCheckManager() override;
33
34 static QStringList suggestions(const QString &word, const QString &dictionary);
35
36 void ignoreWord(const QString &word, const QString &dictionary);
37 void addToDictionary(const QString &word, const QString &dictionary);
38
39 /**
40 * 'r2' is a subrange of 'r1', which is extracted from 'r1' and the remaining ranges are returned
41 **/
43
45 /**
46 * These signals are used to propagate the dictionary changes to the
47 * BackgroundChecker instance in other components (e.g. onTheFlyChecker).
48 */
49 void wordAddedToDictionary(const QString &word);
50 void wordIgnored(const QString &word);
51
52public:
53 static QList<QPair<KTextEditor::Range, QString>> spellCheckLanguageRanges(KTextEditor::DocumentPrivate *doc, KTextEditor::Range range);
54
55 QList<QPair<KTextEditor::Range, QString>> spellCheckWrtHighlightingRanges(KTextEditor::DocumentPrivate *doc,
57 const QString &dictionary = QString(),
58 bool singleLine = false,
59 bool returnSingleRange = false);
60 QList<QPair<KTextEditor::Range, QString>> spellCheckRanges(KTextEditor::DocumentPrivate *doc, KTextEditor::Range range, bool singleLine = false);
61
62 static void replaceCharactersEncodedIfNecessary(const QString &newWord, KTextEditor::DocumentPrivate *doc, KTextEditor::Range replacementRange);
63
64private:
65 static void trimRange(KTextEditor::DocumentPrivate *doc, KTextEditor::Range &r);
66};
67
68#endif
An object representing a section of text, from one Cursor to another.
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Feb 24 2024 20:00:58 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.