2002-09-05 14:10:50 +00:00
|
|
|
/**
|
|
|
|
* \file ControlCommand.C
|
2002-09-05 15:14:23 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2001-03-15 13:37:04 +00:00
|
|
|
*
|
2002-09-05 14:10:50 +00:00
|
|
|
* \author Angus Leeming
|
2001-03-15 13:37:04 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2001-03-15 13:37:04 +00:00
|
|
|
*/
|
|
|
|
|
2002-05-29 16:21:03 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2001-03-15 13:37:04 +00:00
|
|
|
#include "ControlCommand.h"
|
2002-08-14 19:19:47 +00:00
|
|
|
|
2002-08-07 08:11:41 +00:00
|
|
|
#include "funcrequest.h"
|
2003-02-25 14:51:38 +00:00
|
|
|
#include "insets/insetcommand.h"
|
2002-08-07 08:11:41 +00:00
|
|
|
|
2001-03-15 13:37:04 +00:00
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
using std::string;
|
|
|
|
|
2004-05-19 15:11:37 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
2003-10-06 15:43:21 +00:00
|
|
|
|
2003-02-27 13:26:07 +00:00
|
|
|
ControlCommand::ControlCommand(Dialog & dialog, string const & lfun_name)
|
2003-02-25 14:51:38 +00:00
|
|
|
: Dialog::Controller(dialog),
|
2003-02-27 13:26:07 +00:00
|
|
|
lfun_name_(lfun_name)
|
2001-03-15 13:37:04 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
2003-03-14 00:20:42 +00:00
|
|
|
bool ControlCommand::initialiseParams(string const & data)
|
2001-03-15 13:37:04 +00:00
|
|
|
{
|
2003-12-11 15:23:15 +00:00
|
|
|
// The name passed with LFUN_INSET_APPLY is also the name
|
|
|
|
// used to identify the mailer.
|
|
|
|
InsetCommandMailer::string2params(lfun_name_, data, params_);
|
2003-03-14 00:20:42 +00:00
|
|
|
return true;
|
2001-03-15 13:37:04 +00:00
|
|
|
}
|
|
|
|
|
2001-04-24 17:33:01 +00:00
|
|
|
|
2003-02-25 14:51:38 +00:00
|
|
|
void ControlCommand::clearParams()
|
2001-03-15 13:37:04 +00:00
|
|
|
{
|
2003-09-18 22:26:46 +00:00
|
|
|
params_ = InsetCommandParams();
|
2001-03-15 13:37:04 +00:00
|
|
|
}
|
|
|
|
|
2001-04-24 17:33:01 +00:00
|
|
|
|
2003-02-25 14:51:38 +00:00
|
|
|
void ControlCommand::dispatchParams()
|
2001-03-15 13:37:04 +00:00
|
|
|
{
|
2003-02-27 13:26:07 +00:00
|
|
|
if (lfun_name_.empty())
|
2002-08-07 08:11:41 +00:00
|
|
|
return;
|
2003-02-25 14:51:38 +00:00
|
|
|
|
2003-02-27 13:26:07 +00:00
|
|
|
string const lfun = InsetCommandMailer::params2string(lfun_name_,
|
|
|
|
params_);
|
|
|
|
kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
|
2001-03-15 13:37:04 +00:00
|
|
|
}
|
2004-05-19 15:11:37 +00:00
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|