]> git.lyx.org Git - features.git/blob - src/frontends/controllers/ControlCommand.cpp
Whitespace cleanup
[features.git] / src / frontends / controllers / ControlCommand.cpp
1 /**
2  * \file ControlCommand.cpp
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 & command_name,
25                                string const & lfun_name)
26         : Dialog::Controller(dialog), params_(command_name),
27           lfun_name_(lfun_name)
28 {}
29
30
31 bool ControlCommand::initialiseParams(string const & data)
32 {
33         // The name passed with LFUN_INSET_APPLY is also the name
34         // used to identify the mailer.
35         InsetCommandMailer::string2params(lfun_name_, data, params_);
36         return true;
37 }
38
39
40 void ControlCommand::clearParams()
41 {
42         params_.clear();
43 }
44
45
46 void ControlCommand::dispatchParams()
47 {
48         if (lfun_name_.empty())
49                 return;
50
51         string const lfun = InsetCommandMailer::params2string(lfun_name_,
52                                                               params_);
53         kernel().dispatch(FuncRequest(getLfun(), lfun));
54 }
55
56 } // namespace frontend
57 } // namespace lyx