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/Liason.h"
24 #include "support/lstrings.h"
26 using Liason::setMinibuffer;
29 ControlSearch::ControlSearch(LyXView & lv, Dialogs & d)
30 : ControlDialogBD(lv, d)
34 void ControlSearch::find(string const & search,
35 bool casesensitive, bool matchword, bool forward)
37 bool const found = lyxfind::LyXFind(bufferview(), search,
38 forward, casesensitive,
42 setMinibuffer(&lv_, _("String not found!"));
46 void ControlSearch::replace(string const & search, string const & replace,
47 bool casesensitive, bool matchword, bool all)
49 // If not replacing all instances of the word, then do not
50 // move on to the next instance once the present instance has been
52 bool const once = !all;
53 int const replace_count =
54 lyxfind::LyXReplace(bufferview(),
55 search, replace, true, casesensitive,
56 matchword, all, once);
58 if (replace_count == 0) {
59 setMinibuffer(&lv_, _("String not found!"));
61 if (replace_count == 1) {
62 setMinibuffer(&lv_, _("String has been replaced."));
64 string str = tostr(replace_count);
65 str += _(" strings have been replaced.");
66 setMinibuffer(&lv_, str.c_str());