]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiSearch.h
d36b33b62a183e7f4d4ea05284a4e71f2c0a6713
[lyx.git] / src / frontends / qt4 / GuiSearch.h
1 // -*- C++ -*-
2 /**
3  * \file GuiSearch.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author John Levon
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef GUISEARCH_H
13 #define GUISEARCH_H
14
15 #include "GuiDialogView.h"
16 #include "ControlSearch.h"
17 #include "ui_SearchUi.h"
18
19 #include <string>
20
21 #include <QDialog>
22
23 namespace lyx {
24 namespace frontend {
25
26 class GuiSearch;
27
28 class GuiSearchDialog : public QDialog, public Ui::SearchUi {
29         Q_OBJECT
30 public:
31         GuiSearchDialog(GuiSearch * form);
32
33         virtual void show();
34 protected Q_SLOTS:
35         void findChanged();
36         void findClicked();
37         void replaceClicked();
38         void replaceallClicked();
39 protected:
40         virtual void closeEvent(QCloseEvent * e);
41
42 private:
43         GuiSearch * form_;
44 };
45
46
47 class GuiSearch : public GuiView<GuiSearchDialog>
48 {
49 public:
50         ///
51         friend class GuiSearchDialog;
52         ///
53         GuiSearch(GuiDialog &);
54         /// parent controller
55         ControlSearch & controller()
56         { return static_cast<ControlSearch &>(this->getController()); }
57         /// parent controller
58         ControlSearch const & controller() const
59         { return static_cast<ControlSearch const &>(this->getController()); }
60 private:
61         /// Apply changes
62         virtual void apply() {}
63         /// update
64         virtual void update_contents() {}
65         /// build the dialog
66         virtual void build_dialog();
67
68         void find(docstring const & str, bool casesens,
69                   bool words, bool backwards);
70
71         void replace(docstring const & findstr,
72                      docstring const & replacestr,
73                      bool casesens, bool words, bool backwards, bool all);
74 };
75
76 } // namespace frontend
77 } // namespace lyx
78
79 #endif // GUISEARCH_H