]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QSearch.h
* src/frontends/qt4/ui/TextLayoutUi.ui:
[lyx.git] / src / frontends / qt4 / QSearch.h
1 // -*- C++ -*-
2 /**
3  * \file QSearch.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 QSEARCH_H
13 #define QSEARCH_H
14
15 #include "QDialogView.h"
16 #include "ui/SearchUi.h"
17 #include <string>
18
19 #include <QDialog>
20
21 namespace lyx {
22 namespace frontend {
23
24 class ControlSearch;
25
26 class QSearch;
27
28 class QSearchDialog : public QDialog, public Ui::QSearchUi {
29         Q_OBJECT
30 public:
31         QSearchDialog(QSearch * 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         // add a string to the combo if needed
44         void remember(std::string const & find, QComboBox & combo);
45
46         QSearch * form_;
47 };
48
49
50 class QSearch
51         : public QController<ControlSearch, QView<QSearchDialog> >
52 {
53 public:
54         ///
55         friend class QSearchDialog;
56         ///
57         QSearch(Dialog &);
58 private:
59         /// Apply changes
60         virtual void apply() {}
61         /// update
62         virtual void update_contents() {}
63         /// build the dialog
64         virtual void build_dialog();
65
66         void find(docstring const & str, bool casesens,
67                   bool words, bool backwards);
68
69         void replace(docstring const & findstr,
70                      docstring const & replacestr,
71                      bool casesens, bool words, bool backwards, bool all);
72 };
73
74 } // namespace frontend
75 } // namespace lyx
76
77 #endif // QSEARCH_H