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