]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QSearch.C
some tabular fixes for the problems reported by Helge
[lyx.git] / src / frontends / qt2 / QSearch.C
1 /**
2  * \file QSearch.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "QSearch.h"
14 #include "QSearchDialog.h"
15 #include "Qt2BC.h"
16
17 #include "controllers/ControlSearch.h"
18
19 #include <qcombobox.h>
20 #include <qpushbutton.h>
21
22 using std::string;
23
24 namespace lyx {
25 namespace frontend {
26
27 typedef QController<ControlSearch, QView<QSearchDialog> > base_class;
28
29
30 QSearch::QSearch(Dialog & parent)
31         : base_class(parent, _("LyX: Find and Replace"))
32 {
33 }
34
35
36 void QSearch::build_dialog()
37 {
38         dialog_.reset(new QSearchDialog(this));
39
40         bcview().setCancel(dialog_->closePB);
41         bcview().addReadOnly(dialog_->replaceCO);
42         bcview().addReadOnly(dialog_->replacePB);
43         bcview().addReadOnly(dialog_->replaceallPB);
44
45         dialog_->replacePB->setEnabled(false);
46         dialog_->replaceallPB->setEnabled(false);
47 }
48
49
50 void QSearch::find(string const & str, bool casesens,
51                    bool words, bool backwards)
52 {
53         controller().find(str, casesens, words, !backwards);
54 }
55
56
57 void QSearch::replace(string const & findstr, string const & replacestr,
58         bool casesens, bool words, bool backwards, bool all)
59 {
60         controller().replace(findstr, replacestr, casesens, words,
61                              !backwards, all);
62 }
63
64 } // namespace frontend
65 } // namespace lyx