]> git.lyx.org Git - lyx.git/blob - src/frontends/qt/FindAndReplace.h
Address some deprecation warnings
[lyx.git] / src / frontends / qt / FindAndReplace.h
1 // -*- C++ -*-
2 /**
3  * \file FindAndReplace.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Tommaso Cucinotta
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef QSEARCHADV_H
13 #define QSEARCHADV_H
14
15 #include "DockView.h"
16 // This is needed so that ui_FindAndReplaceUi.h can find qt_()
17 #include "qt_helpers.h"
18 #include "ui_FindAndReplaceUi.h"
19
20 #include <string>
21
22 namespace lyx {
23
24 class FindAndReplaceOptions;
25
26 namespace frontend {
27
28 class FindAndReplaceWidget : public QTabWidget, public Ui::FindAndReplaceUi
29 {
30         Q_OBJECT
31
32 public:
33         FindAndReplaceWidget(GuiView & view);
34         bool initialiseParams(std::string const & params);
35         void updateGUI();
36
37 public Q_SLOTS:
38         ///
39         void dockLocationChanged(Qt::DockWidgetArea area);
40
41 private:
42         ///
43         GuiView & view_;
44         ///
45         Buffer * old_buffer_;
46
47         /// add a string to the combo if needed
48         void remember(std::string const & find, QComboBox & combo);
49
50         /// Perform the scope-related buffer switch while searching
51         bool findAndReplaceScope(FindAndReplaceOptions & opt, bool replace_all = false);
52
53         /// Collect options from the GUI elements, then perform the search
54         bool findAndReplace(bool backwards, bool replace, bool replace_all = false);
55
56         /// FIXME Probably to be merged with findAndReplace(bool, bool, bool)
57         bool findAndReplace(bool casesensitive, bool matchword, bool backwards,
58                 bool expandmacros, bool ignoreformat, bool replace,
59                 bool keep_case, bool replace_all = false);
60
61         bool eventFilter(QObject *obj, QEvent *event) override;
62
63         void virtual showEvent(QShowEvent *ev) override;
64         void virtual hideEvent(QHideEvent *ev) override;
65
66         void hideDialog();
67
68 protected Q_SLOTS:
69         void on_findNextPB_clicked();
70         void on_replacePB_clicked();
71         void on_replaceallPB_clicked();
72 };
73
74
75 class FindAndReplace : public DockView
76 {
77         Q_OBJECT
78 public:
79         FindAndReplace(
80                 GuiView & parent, ///< the main window where to dock.
81                 Qt::DockWidgetArea area = Qt::RightDockWidgetArea, ///< Position of the dock (and also drawer)
82                 Qt::WindowFlags flags = {});
83
84         ~FindAndReplace();
85
86         bool initialiseParams(std::string const &) override;
87         void clearParams() override {}
88         void dispatchParams() override {}
89         bool isBufferDependent() const override { return false; }
90         bool canApplyToReadOnly() const override { return true; }
91         void selectAll();
92
93         /// update
94         void updateView() override;
95         //virtual void update_contents() {}
96
97 protected:
98         bool wantInitialFocus() const override { return true; }
99
100 private:
101         /// The encapsulated widget.
102         FindAndReplaceWidget * widget_;
103 };
104
105
106 } // namespace frontend
107 } // namespace lyx
108
109 #endif // QSEARCHADV_H