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"
26 ControlSearch::ControlSearch(LyXView & lv, Dialogs & d)
27 : ControlDialogBD(lv, d)
31 void ControlSearch::find(string const & search,
32 bool casesensitive, bool matchword, bool forward)
34 bool const found = lyx::find::find(bufferview(), search,
35 forward, casesensitive,
39 lv_.message(_("String not found!"));
43 void ControlSearch::replace(string const & search, string const & replace,
44 bool casesensitive, bool matchword, bool all)
46 // If not replacing all instances of the word, then do not
47 // move on to the next instance once the present instance has been
49 bool const once = !all;
50 int const replace_count =
51 lyx::find::replace(bufferview(),
52 search, replace, true, casesensitive,
53 matchword, all, once);
55 if (replace_count == 0) {
56 lv_.message(_("String not found!"));
58 if (replace_count == 1) {
59 lv_.message(_("String has been replaced."));
61 string str = tostr(replace_count);
62 str += _(" strings have been replaced.");