File indexing completed on 2024-05-19 05:21:43

0001 /*
0002    SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "kpimtextedit_export.h"
0010 #include "richtextcomposer.h"
0011 #include <QObject>
0012 class KActionCollection;
0013 class QTextCharFormat;
0014 class QAction;
0015 namespace KPIMTextEdit
0016 {
0017 class RichTextComposerControler;
0018 /**
0019  * @brief The RichTextComposerActions class
0020  * @author Laurent Montel <montel@kde.org>
0021  */
0022 class KPIMTEXTEDIT_EXPORT RichTextComposerActions : public QObject
0023 {
0024     Q_OBJECT
0025 public:
0026     explicit RichTextComposerActions(KPIMTextEdit::RichTextComposerControler *controller, QObject *parent = nullptr);
0027     ~RichTextComposerActions() override;
0028 
0029     void createActions(KActionCollection *ac);
0030     [[nodiscard]] int numberOfActions() const;
0031 
0032     [[nodiscard]] QList<QAction *> richTextActionList() const;
0033 
0034     void uncheckActionFormatPainter();
0035     void updateActionStates();
0036     void textModeChanged(KPIMTextEdit::RichTextComposer::Mode mode);
0037 
0038 public Q_SLOTS:
0039     void setActionsEnabled(bool enabled);
0040 
0041 private:
0042     KPIMTEXTEDIT_NO_EXPORT void slotUpdateCharFormatActions(const QTextCharFormat &format);
0043     KPIMTEXTEDIT_NO_EXPORT void slotUpdateMiscActions();
0044 
0045     KPIMTEXTEDIT_NO_EXPORT void setHeadingLevel(int level);
0046     KPIMTEXTEDIT_NO_EXPORT void setListStyle(int _styleindex);
0047     class RichTextComposerActionsPrivate;
0048     std::unique_ptr<RichTextComposerActionsPrivate> const d;
0049 };
0050 }