]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlCommand.C
5 new lfuns, move all apply code out of ControlDocument and into the core.
[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
22 ControlCommand::ControlCommand(Dialog & dialog, string const & lfun_name)
23         : Dialog::Controller(dialog),
24           lfun_name_(lfun_name)
25 {}
26
27
28 bool ControlCommand::initialiseParams(string const & data)
29 {
30         // The name passed with LFUN_INSET_APPLY is also the name
31         // used to identify the mailer.
32         InsetCommandMailer::string2params(lfun_name_, data, params_);
33         return true;
34 }
35
36
37 void ControlCommand::clearParams()
38 {
39         params_ = InsetCommandParams();
40 }
41
42
43 void ControlCommand::dispatchParams()
44 {
45         if (lfun_name_.empty())
46                 return;
47
48         string const lfun = InsetCommandMailer::params2string(lfun_name_,
49                                                               params_);
50         kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
51 }