File indexing completed on 2024-04-21 03:58:27

0001 /*
0002     krichtextedit
0003     SPDX-FileCopyrightText: 2007 Laurent Montel <montel@kde.org>
0004     SPDX-FileCopyrightText: 2008 Thomas McGuire <thomas.mcguire@gmx.net>
0005     SPDX-FileCopyrightText: 2008 Stephen Kelly <steveire@gmail.com>
0006 
0007     SPDX-License-Identifier: LGPL-2.1-or-later
0008 */
0009 
0010 #ifndef KRICHTEXTEDIT_P_H
0011 #define KRICHTEXTEDIT_P_H
0012 
0013 #include "ktextedit_p.h"
0014 #include "nestedlisthelper_p.h"
0015 
0016 class KRichTextEditPrivate : public KTextEditPrivate
0017 {
0018     Q_DECLARE_PUBLIC(KRichTextEdit)
0019 
0020 public:
0021     explicit KRichTextEditPrivate(KRichTextEdit *qq)
0022         : KTextEditPrivate(qq)
0023         , nestedListHelper(new NestedListHelper(qq))
0024     {
0025     }
0026 
0027     ~KRichTextEditPrivate() override
0028     {
0029         delete nestedListHelper;
0030     }
0031 
0032     //
0033     // Normal functions
0034     //
0035 
0036     // If the text under the cursor is a link, the cursor's selection is set to
0037     // the complete link text. Otherwise selects the current word if there is no
0038     // selection.
0039     void selectLinkText() const;
0040 
0041     void init();
0042 
0043     // Switches to rich text mode and emits the mode changed signal if the
0044     // mode really changed.
0045     void activateRichText();
0046 
0047     // Applies formatting to the current word if there is no selection.
0048     void mergeFormatOnWordOrSelection(const QTextCharFormat &format);
0049 
0050     void setTextCursor(QTextCursor &cursor);
0051 
0052     // Data members
0053     KRichTextEdit::Mode mMode = KRichTextEdit::Plain;
0054 
0055     NestedListHelper *nestedListHelper;
0056 };
0057 
0058 #endif