KPimTextEdit

richtextcomposercontroler.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 "kpimtextedit_export.h"
10#include "richtextcomposer.h"
11#include <QObject>
12#include <memory>
13namespace KPIMTextEdit
14{
15class RichTextComposer;
16class NestedListHelper;
17class RichTextComposerImages;
18/**
19 * @brief The RichTextComposerControler class
20 * @author Laurent Montel <montel@kde.org>
21 */
22class KPIMTEXTEDIT_EXPORT RichTextComposerControler : public QObject
23{
24 Q_OBJECT
25public:
26 explicit RichTextComposerControler(RichTextComposer *richtextComposer, QObject *parent = nullptr);
28
29 [[nodiscard]] RichTextComposer *richTextComposer() const;
30
31 [[nodiscard]] QString currentLinkUrl() const;
32
33 [[nodiscard]] QString currentLinkText() const;
34 void selectLinkText() const;
35 [[nodiscard]] QString toCleanHtml() const;
36
37 [[nodiscard]] bool canIndentList() const;
38 [[nodiscard]] bool canDedentList() const;
39
40 [[nodiscard]] NestedListHelper *nestedListHelper() const;
41 void insertLink(const QString &url);
42 void setCursorPositionFromStart(unsigned int pos);
43 void ensureCursorVisible();
44
45 RichTextComposerImages *composerImages() const;
46 [[nodiscard]] bool painterActive() const;
47 void disablePainter();
48 [[nodiscard]] bool isFormattingUsed() const;
49
50 void setFontForWholeText(const QFont &font);
51 void textModeChanged(KPIMTextEdit::RichTextComposer::Mode mode);
52 void updateLink(const QString &linkUrl, const QString &linkText);
53 [[nodiscard]] QString toWrappedPlainText(QTextDocument *doc) const;
54 [[nodiscard]] QString toWrappedPlainText() const;
55 [[nodiscard]] QString toCleanPlainText(const QString &plainText = QString()) const;
56 void addQuotes(const QString &defaultQuote);
57public Q_SLOTS:
58 void addCheckbox(bool add = true);
59 void insertHorizontalRule();
60 void setHeadingLevel(int level);
61 void alignLeft();
62 void alignCenter();
63 void alignRight();
64 void alignJustify();
65 void makeRightToLeft();
66 void makeLeftToRight();
67 void setTextBold(bool bold);
68 void setTextItalic(bool italic);
69 void setTextUnderline(bool underline);
70 void setTextStrikeOut(bool strikeOut);
71 void setTextForegroundColor(const QColor &color);
72 void setTextBackgroundColor(const QColor &color);
73 void setFontFamily(const QString &fontFamily);
74 void setFontSize(int size);
75 void setFont(const QFont &font);
76 void setTextSuperScript(bool superscript);
77 void setTextSubScript(bool subscript);
78 void setChangeTextForegroundColor();
79 void setChangeTextBackgroundColor();
80 void manageLink();
81 void indentListMore();
82 void indentListLess();
83 void setListStyle(int styleIndex);
84 void slotAddEmoticon(const QString &text);
85 void slotInsertHtml();
86 void slotFormatReset();
87 void slotPasteWithoutFormatting();
88 void slotPasteAsQuotation();
89 void slotRemoveQuotes();
90 void slotAddQuotes();
91 void slotAddImage();
92 void slotFormatPainter(bool active);
93 void ensureCursorVisibleDelayed();
94
95protected:
96 bool event(QEvent *ev) override;
97
98private:
99 KPIMTEXTEDIT_NO_EXPORT void regenerateColorScheme();
100 class RichTextComposerControllerPrivate;
101 std::unique_ptr<RichTextComposerControllerPrivate> const d;
102};
103}
The RichTextComposerControler class.
The RichTextComposer class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:07:41 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.