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