KTextAddons

autocorrection.h
1/*
2 SPDX-FileCopyrightText: 2012-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "autocorrectionsettings.h"
10#include "textautocorrectioncore_export.h"
11#include <QTextCursor>
12
13namespace TextAutoCorrectionCore
14{
15class AutoCorrectionPrivate;
16/**
17 * @brief The AutoCorrection class
18 * @author Laurent Montel <montel@kde.org>
19 */
20class TEXTAUTOCORRECTIONCORE_EXPORT AutoCorrection
21{
22public:
25
26 void writeConfig();
27 void readConfig();
28
29 bool autocorrect(bool htmlMode, QTextDocument &document, int &position);
30
31 void loadGlobalFileName(const QString &fname);
32
33 [[nodiscard]] AutoCorrectionSettings *autoCorrectionSettings() const;
34 void setAutoCorrectionSettings(AutoCorrectionSettings *newAutoCorrectionSettings);
35
36 void writeAutoCorrectionXmlFile(const QString &filename);
37
38private:
39 TEXTAUTOCORRECTIONCORE_NO_EXPORT void fixTwoUppercaseChars();
40 [[nodiscard]] TEXTAUTOCORRECTIONCORE_NO_EXPORT bool singleSpaces() const;
41 TEXTAUTOCORRECTIONCORE_NO_EXPORT void capitalizeWeekDays();
42 [[nodiscard]] TEXTAUTOCORRECTIONCORE_NO_EXPORT bool autoFractions() const;
43 TEXTAUTOCORRECTIONCORE_NO_EXPORT void uppercaseFirstCharOfSentence();
44 [[nodiscard]] TEXTAUTOCORRECTIONCORE_NO_EXPORT int advancedAutocorrect();
45 TEXTAUTOCORRECTIONCORE_NO_EXPORT void replaceTypographicQuotes();
46 TEXTAUTOCORRECTIONCORE_NO_EXPORT void superscriptAppendix();
47 TEXTAUTOCORRECTIONCORE_NO_EXPORT void addNonBreakingSpace();
48
49 TEXTAUTOCORRECTIONCORE_NO_EXPORT void selectPreviousWord(QTextCursor &cursor, int cursorPosition);
50 TEXTAUTOCORRECTIONCORE_NO_EXPORT void selectStringOnMaximumSearchString(QTextCursor &cursor, int cursorPosition);
51
52 [[nodiscard]] TEXTAUTOCORRECTIONCORE_NO_EXPORT bool autoFormatURLs();
53 [[nodiscard]] TEXTAUTOCORRECTIONCORE_NO_EXPORT bool autoBoldUnderline();
54
55 [[nodiscard]] TEXTAUTOCORRECTIONCORE_NO_EXPORT QString autoDetectURL(const QString &_word) const;
56 [[nodiscard]] TEXTAUTOCORRECTIONCORE_NO_EXPORT bool excludeToUppercase(const QString &word) const;
57 [[nodiscard]] TEXTAUTOCORRECTIONCORE_NO_EXPORT QColor linkColor();
58 friend class AutoCorrectionPrivate;
59 std::unique_ptr<AutoCorrectionPrivate> const d;
60};
61}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:02 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.