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
14 #include "ControlSearch.h"
19 #include "frontends/LyXView.h"
21 #include "support/lstrings.h"
24 ControlSearch::ControlSearch(LyXView & lv, Dialogs & d)
25 : ControlDialogBD(lv, d)
29 void ControlSearch::find(string const & search,
30 bool casesensitive, bool matchword, bool forward)
32 bool const found = lyxfind::LyXFind(bufferview(), search,
33 forward, casesensitive,
37 lv_.message(_("String not found!"));
41 void ControlSearch::replace(string const & search, string const & replace,
42 bool casesensitive, bool matchword, bool all)
44 // If not replacing all instances of the word, then do not
45 // move on to the next instance once the present instance has been
47 bool const once = !all;
48 int const replace_count =
49 lyxfind::LyXReplace(bufferview(),
50 search, replace, true, casesensitive,
51 matchword, all, once);
53 if (replace_count == 0) {
54 lv_.message(_("String not found!"));
56 if (replace_count == 1) {
57 lv_.message(_("String has been replaced."));
59 string str = tostr(replace_count);
60 str += _(" strings have been replaced.");