KTextEditor

spellcheckdialog.h
1/*
2 SPDX-FileCopyrightText: 2009-2010 Michel Ludwig <michel.ludwig@kdemail.net>
3 SPDX-FileCopyrightText: 2008 Mirko Stocker <me@misto.ch>
4 SPDX-FileCopyrightText: 2004-2005 Anders Lund <anders@alweb.dk>
5 SPDX-FileCopyrightText: 2002 John Firebaugh <jfirebaugh@kde.org>
6 SPDX-FileCopyrightText: 2001-2004 Christoph Cullmann <cullmann@kde.org>
7 SPDX-FileCopyrightText: 2001 Joseph Wenninger <jowenn@kde.org>
8 SPDX-FileCopyrightText: 1999 Jochen Wilhelmy <digisnap@cs.tu-berlin.de>
9
10 SPDX-License-Identifier: LGPL-2.0-or-later
11*/
12
13#ifndef KATE_SPELLCHECKDIALOG_H
14#define KATE_SPELLCHECKDIALOG_H
15
16#include <QObject>
17
18namespace KTextEditor
19{
20class ViewPrivate;
21}
22
23class QAction;
25
26namespace Sonnet
27{
28class BackgroundChecker;
29class Speller;
30}
31
32#include "ktexteditor/range.h"
33
34namespace KTextEditor
35{
36class MovingRange;
37}
38
39class SpellCheckBar;
40
41class KateSpellCheckDialog : public QObject
42{
44public:
45 explicit KateSpellCheckDialog(KTextEditor::ViewPrivate *);
46 ~KateSpellCheckDialog() override;
47
48 void createActions(KActionCollection *);
49
50 // spellcheck from cursor, selection
51private Q_SLOTS:
52 void spellcheckFromCursor();
53
54 // defined here in anticipation of per view selections ;)
55 void spellcheckSelection();
56
57 void spellcheck();
58
59 /**
60 * Spellcheck a defined portion of the text.
61 *
62 * @param from Where to start the check
63 * @param to Where to end. If this is (0,0), it will be set to the end of the document.
64 */
65 void spellcheck(const KTextEditor::Cursor from, const KTextEditor::Cursor to = KTextEditor::Cursor());
66
67 void misspelling(const QString &, int);
68 void corrected(const QString &, int, const QString &);
69
70 void performSpellCheck(KTextEditor::Range range);
71 void installNextSpellCheckRange();
72
73 void cancelClicked();
74
75 void objectDestroyed(QObject *object);
76
77 void languageChanged(const QString &language);
78
79private:
80 KTextEditor::Cursor locatePosition(int pos);
81
82 KTextEditor::ViewPrivate *m_view;
83
84 Sonnet::Speller *m_speller;
85 Sonnet::BackgroundChecker *m_backgroundChecker;
86
87 SpellCheckBar *m_sonnetDialog;
88
89 // define the part of the text that is to be checked
90 KTextEditor::Range m_currentSpellCheckRange;
91 KTextEditor::MovingRange *m_globalSpellCheckRange;
92
93 QList<QPair<int, int>> m_currentDecToEncOffsetList;
94
95 QList<QPair<KTextEditor::Range, QString>> m_languagesInSpellCheckRange;
96 QList<QPair<KTextEditor::Range, QString>>::iterator m_currentLanguageRangeIterator;
97
98 // keep track of where we are.
99 KTextEditor::Cursor m_spellPosCursor;
100 uint m_spellLastPos;
101
102 bool m_spellCheckCancelledByUser;
103
104 QString m_userSpellCheckLanguage, m_previousGivenSpellCheckLanguage;
105
106 void spellCheckDone();
107};
108
109#endif
The Cursor represents a position in a Document.
Definition cursor.h:75
A range that is bound to a specific Document, and maintains its position.
An object representing a section of text, from one Cursor to another.
Spellcheck dialog.
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:53:44 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.