]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlSearch.C
Handle the new LFUN_WORD_FIND and LFUN_WORD_REPLACE.
[lyx.git] / src / frontends / controllers / ControlSearch.C
1 /**
2  * \file ControlSearch.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Angus Leeming
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "ControlSearch.h"
14
15 #include "funcrequest.h"
16 #include "lyxfind.h"
17
18 #include "frontends/LyXView.h"
19
20 using std::string;
21
22
23 /* The ControlSeach class is now in a fit state to derive from
24    Dialog::Controller
25 */
26 ControlSearch::ControlSearch(LyXView & lv, Dialogs & d)
27         : ControlDialogBD(lv, d)
28 {}
29
30
31 void ControlSearch::find(string const & search,
32                          bool casesensitive, bool matchword, bool forward)
33 {
34         string const data =
35                 lyx::find::find2string(search,
36                                        casesensitive, matchword, forward);
37         FuncRequest const fr(bufferview(), LFUN_WORD_FIND, data);
38         lv_.dispatch(fr);
39 }
40
41
42 void ControlSearch::replace(string const & search, string const & replace,
43                             bool casesensitive, bool matchword,
44                             bool forward, bool all)
45 {
46         string const data =
47                 lyx::find::replace2string(search, replace,
48                                           casesensitive, matchword,
49                                           all, forward);
50         FuncRequest const fr(bufferview(), LFUN_WORD_REPLACE, data);
51         lv_.dispatch(fr);
52 }