]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlCommand.C
fix crash due to invalidated iterator
[lyx.git] / src / frontends / controllers / ControlCommand.C
1 /**
2  * \file ControlCommand.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Angus Leeming
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "ControlCommand.h"
14
15 #include "funcrequest.h"
16 #include "insets/insetcommand.h"
17
18
19 using std::string;
20
21 namespace lyx {
22 namespace frontend {
23
24 ControlCommand::ControlCommand(Dialog & dialog, string const & lfun_name)
25         : Dialog::Controller(dialog),
26           lfun_name_(lfun_name)
27 {}
28
29
30 bool ControlCommand::initialiseParams(string const & data)
31 {
32         // The name passed with LFUN_INSET_APPLY is also the name
33         // used to identify the mailer.
34         InsetCommandMailer::string2params(lfun_name_, data, params_);
35         return true;
36 }
37
38
39 void ControlCommand::clearParams()
40 {
41         params_ = InsetCommandParams();
42 }
43
44
45 void ControlCommand::dispatchParams()
46 {
47         if (lfun_name_.empty())
48                 return;
49
50         string const lfun = InsetCommandMailer::params2string(lfun_name_,
51                                                               params_);
52         kernel().dispatch(FuncRequest(getLfun(), lfun));
53 }
54
55 } // namespace frontend
56 } // namespace lyx