File indexing completed on 2024-12-22 04:28:10

0001 /*
0002    SPDX-FileCopyrightText: 2012-2024 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 #include <TextCustomEditor/TextEditFindBarBase>
0011 
0012 class QPlainTextEdit;
0013 namespace TextCustomEditor
0014 {
0015 class PlainTextEditFindBarPrivate;
0016 /**
0017  * @brief The PlainTextEditFindBar class
0018  * @author Laurent Montel <montel@kde.org>
0019  */
0020 class TEXTCUSTOMEDITOR_EXPORT PlainTextEditFindBar : public TextEditFindBarBase
0021 {
0022     Q_OBJECT
0023 
0024 public:
0025     explicit PlainTextEditFindBar(QPlainTextEdit *view, QWidget *parent = nullptr);
0026     ~PlainTextEditFindBar() override;
0027 
0028 protected:
0029     [[nodiscard]] bool viewIsReadOnly() const override;
0030     [[nodiscard]] bool documentIsEmpty() const override;
0031     [[nodiscard]] bool searchInDocument(const QString &text, TextEditFindBarBase::FindFlags searchOptions) override;
0032     [[nodiscard]] bool searchInDocument(const QRegularExpression &regExp, TextEditFindBarBase::FindFlags searchOptions) override;
0033     void autoSearchMoveCursor() override;
0034 
0035 public Q_SLOTS:
0036     void slotSearchText(bool backward = false, bool isAutoSearch = true) override;
0037 
0038 private Q_SLOTS:
0039     void slotReplaceText() override;
0040     void slotReplaceAllText() override;
0041 
0042 private:
0043     std::unique_ptr<PlainTextEditFindBarPrivate> const d;
0044 };
0045 }