File indexing completed on 2025-11-30 14:18:47

0001 /*
0002    SPDX-FileCopyrightText: 2023 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "textcustomeditor_export.h"
0010 
0011 #include <QWidget>
0012 
0013 namespace TextCustomEditor
0014 {
0015 class RichTextBrowser;
0016 class RichTextBrowserWidgetPrivate;
0017 /**
0018  * @brief The RichTextBrowserWidget class
0019  * @author Laurent Montel <montel@kde.org>
0020  */
0021 class TEXTCUSTOMEDITOR_EXPORT RichTextBrowserWidget : public QWidget
0022 {
0023     Q_OBJECT
0024 public:
0025     explicit RichTextBrowserWidget(QWidget *parent = nullptr);
0026     explicit RichTextBrowserWidget(RichTextBrowser *customEditor, QWidget *parent = nullptr);
0027     ~RichTextBrowserWidget() override;
0028 
0029     void clear();
0030 
0031     Q_REQUIRED_RESULT RichTextBrowser *editor() const;
0032 
0033     void setHtml(const QString &html);
0034     Q_REQUIRED_RESULT QString toHtml() const;
0035 
0036     void setPlainText(const QString &text);
0037     Q_REQUIRED_RESULT QString toPlainText() const;
0038 
0039     void setAcceptRichText(bool b);
0040     bool acceptRichText() const;
0041 
0042     Q_REQUIRED_RESULT bool isEmpty() const;
0043 public Q_SLOTS:
0044     void slotFindNext();
0045     void slotFind();
0046 
0047 private:
0048     TEXTCUSTOMEDITOR_NO_EXPORT void slotHideFindBar();
0049     TEXTCUSTOMEDITOR_NO_EXPORT void init(RichTextBrowser *customEditor = nullptr);
0050     std::unique_ptr<RichTextBrowserWidgetPrivate> const d;
0051 };
0052 }