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 casesensitive, matchword,
39 lv_.message(_("String not found!"));
43 void ControlSearch::replace(string const & search, string const & replace,
44 bool casesensitive, bool matchword,
45 bool forward, 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 int const replace_count = all ?
51 lyx::find::replaceAll(bufferview(), search, replace,
52 casesensitive, matchword)
53 : lyx::find::replace(bufferview(), search, replace,
54 casesensitive, matchword, forward);
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.");