2 * \file ControlSearch.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Angus Leeming
8 * Full author contact details are available in file CREDITS
13 #include "ControlSearch.h"
18 #include "frontends/LyXView.h"
20 #include "support/tostr.h"
23 ControlSearch::ControlSearch(LyXView & lv, Dialogs & d)
24 : ControlDialogBD(lv, d)
28 void ControlSearch::find(string const & search,
29 bool casesensitive, bool matchword, bool forward)
31 bool const found = lyxfind::LyXFind(bufferview(), search,
32 forward, casesensitive,
36 lv_.message(_("String not found!"));
40 void ControlSearch::replace(string const & search, string const & replace,
41 bool casesensitive, bool matchword, bool all)
43 // If not replacing all instances of the word, then do not
44 // move on to the next instance once the present instance has been
46 bool const once = !all;
47 int const replace_count =
48 lyxfind::LyXReplace(bufferview(),
49 search, replace, true, casesensitive,
50 matchword, all, once);
52 if (replace_count == 0) {
53 lv_.message(_("String not found!"));
55 if (replace_count == 1) {
56 lv_.message(_("String has been replaced."));
58 string str = tostr(replace_count);
59 str += _(" strings have been replaced.");