2002-09-25 14:26:13 +00:00
|
|
|
/**
|
2007-04-25 01:24:38 +00:00
|
|
|
* \file InsetCommand.cpp
|
2002-09-25 14:26:13 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-21 17:09:55 +00:00
|
|
|
*
|
2002-09-25 14:26:13 +00:00
|
|
|
* \author Angus Leeming
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Lars Gullik Bjønnes
|
2002-03-21 17:09:55 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-09-25 14:26:13 +00:00
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
#include "InsetCommand.h"
|
2003-09-05 09:01:27 +00:00
|
|
|
|
2007-05-01 08:26:40 +00:00
|
|
|
#include "Buffer.h"
|
2017-01-30 06:44:55 +00:00
|
|
|
#include "BufferEncodings.h"
|
2017-06-06 22:55:23 +00:00
|
|
|
#include "BufferParams.h"
|
2003-02-26 15:01:10 +00:00
|
|
|
#include "BufferView.h"
|
2010-10-31 01:04:03 +00:00
|
|
|
#include "Cursor.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "DispatchResult.h"
|
|
|
|
#include "FuncRequest.h"
|
2005-04-22 08:57:22 +00:00
|
|
|
#include "FuncStatus.h"
|
2007-04-26 11:30:54 +00:00
|
|
|
#include "Lexer.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "MetricsInfo.h"
|
2016-06-19 02:39:38 +00:00
|
|
|
#include "texstream.h"
|
2003-02-26 15:01:10 +00:00
|
|
|
|
2009-09-26 17:19:18 +00:00
|
|
|
#include "insets/InsetBox.h"
|
|
|
|
#include "insets/InsetBranch.h"
|
|
|
|
#include "insets/InsetCommand.h"
|
|
|
|
#include "insets/InsetERT.h"
|
|
|
|
#include "insets/InsetExternal.h"
|
|
|
|
#include "insets/InsetFloat.h"
|
|
|
|
#include "insets/InsetGraphics.h"
|
2011-01-04 11:32:04 +00:00
|
|
|
#include "insets/InsetIndex.h"
|
2010-09-07 00:41:00 +00:00
|
|
|
#include "insets/InsetLine.h"
|
2009-09-26 17:19:18 +00:00
|
|
|
#include "insets/InsetListings.h"
|
|
|
|
#include "insets/InsetNote.h"
|
|
|
|
#include "insets/InsetPhantom.h"
|
|
|
|
#include "insets/InsetSpace.h"
|
|
|
|
#include "insets/InsetTabular.h"
|
|
|
|
#include "insets/InsetVSpace.h"
|
|
|
|
#include "insets/InsetWrap.h"
|
|
|
|
|
2008-03-27 22:26:24 +00:00
|
|
|
#include "support/debug.h"
|
|
|
|
#include "support/gettext.h"
|
2017-06-06 22:55:23 +00:00
|
|
|
#include "support/lstrings.h"
|
2008-03-27 22:26:24 +00:00
|
|
|
|
|
|
|
#include "frontends/Application.h"
|
|
|
|
|
2004-07-24 10:55:30 +00:00
|
|
|
#include <sstream>
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
using namespace std;
|
2017-06-06 22:55:23 +00:00
|
|
|
using namespace lyx::support;
|
2003-10-06 15:43:21 +00:00
|
|
|
|
2006-10-19 16:51:30 +00:00
|
|
|
|
2008-03-27 22:26:24 +00:00
|
|
|
namespace lyx {
|
2000-03-28 02:18:55 +00:00
|
|
|
|
2015-05-17 15:27:12 +00:00
|
|
|
// FIXME Would it now be possible to use the InsetCode in
|
2007-10-23 18:51:04 +00:00
|
|
|
// place of the mailer name and recover that information?
|
2010-10-29 00:46:21 +00:00
|
|
|
InsetCommand::InsetCommand(Buffer * buf, InsetCommandParams const & p)
|
|
|
|
: Inset(buf), p_(p)
|
2001-07-24 15:07:09 +00:00
|
|
|
{}
|
2000-08-04 13:12:30 +00:00
|
|
|
|
|
|
|
|
2010-05-01 23:04:08 +00:00
|
|
|
// The sole purpose of this copy constructor is to make sure
|
|
|
|
// that the mouse_hover_ map is not copied and remains empty.
|
|
|
|
InsetCommand::InsetCommand(InsetCommand const & rhs)
|
2010-10-29 00:46:21 +00:00
|
|
|
: Inset(rhs), p_(rhs.p_)
|
2010-05-01 23:04:08 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
2015-10-11 09:16:09 +00:00
|
|
|
InsetCommand & InsetCommand::operator=(InsetCommand const & rhs)
|
|
|
|
{
|
|
|
|
if (&rhs == this)
|
|
|
|
return *this;
|
|
|
|
|
|
|
|
Inset::operator=(rhs);
|
|
|
|
p_ = rhs.p_;
|
|
|
|
mouse_hover_.clear();
|
|
|
|
button_ = RenderButton();
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-12-11 15:23:15 +00:00
|
|
|
InsetCommand::~InsetCommand()
|
|
|
|
{
|
2010-10-29 00:46:21 +00:00
|
|
|
if (p_.code() != NO_CODE)
|
|
|
|
hideDialogs(insetName(p_.code()), this);
|
2010-10-18 14:20:03 +00:00
|
|
|
|
2010-04-30 14:55:37 +00:00
|
|
|
map<BufferView const *, bool>::iterator it = mouse_hover_.begin();
|
|
|
|
map<BufferView const *, bool>::iterator end = mouse_hover_.end();
|
|
|
|
for (; it != end; ++it)
|
|
|
|
if (it->second)
|
|
|
|
it->first->clearLastInset(this);
|
2003-12-11 15:23:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-21 20:39:47 +00:00
|
|
|
void InsetCommand::metrics(MetricsInfo & mi, Dimension & dim) const
|
2003-06-12 08:52:36 +00:00
|
|
|
{
|
2017-05-24 09:28:08 +00:00
|
|
|
button_.update(screenLabel(), editable() || clickable(*mi.base.bv, 0, 0),
|
|
|
|
inheritFont());
|
2003-06-12 08:52:36 +00:00
|
|
|
button_.metrics(mi, dim);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-04-30 14:47:46 +00:00
|
|
|
bool InsetCommand::setMouseHover(BufferView const * bv, bool mouse_hover)
|
2010-10-24 19:24:36 +00:00
|
|
|
const
|
2006-12-04 04:31:18 +00:00
|
|
|
{
|
2010-04-30 14:47:46 +00:00
|
|
|
mouse_hover_[bv] = mouse_hover;
|
2006-12-04 04:31:18 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-06-12 08:52:36 +00:00
|
|
|
void InsetCommand::draw(PainterInfo & pi, int x, int y) const
|
|
|
|
{
|
2010-04-30 14:47:46 +00:00
|
|
|
button_.setRenderState(mouse_hover_[pi.base.bv]);
|
2003-06-12 08:52:36 +00:00
|
|
|
button_.draw(pi, x, y);
|
2003-06-03 15:10:14 +00:00
|
|
|
}
|
2003-05-26 09:13:55 +00:00
|
|
|
|
|
|
|
|
2010-11-25 16:53:56 +00:00
|
|
|
void InsetCommand::setParam(string const & name, docstring const & value)
|
2008-03-27 22:26:24 +00:00
|
|
|
{
|
|
|
|
p_[name] = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-25 16:53:56 +00:00
|
|
|
docstring const & InsetCommand::getParam(string const & name) const
|
2008-03-27 22:26:24 +00:00
|
|
|
{
|
|
|
|
return p_[name];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-02-16 15:59:55 +00:00
|
|
|
void InsetCommand::setParams(InsetCommandParams const & p)
|
2000-08-04 13:12:30 +00:00
|
|
|
{
|
2003-09-18 22:26:46 +00:00
|
|
|
p_ = p;
|
2008-03-03 17:58:26 +00:00
|
|
|
initView();
|
2000-08-04 13:12:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-10 20:02:48 +00:00
|
|
|
void InsetCommand::latex(otexstream & os, OutputParams const & runparams_in) const
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
2010-02-13 13:08:32 +00:00
|
|
|
OutputParams runparams = runparams_in;
|
2017-06-06 22:55:23 +00:00
|
|
|
docstring command = getCommand(runparams);
|
|
|
|
if (buffer().params().use_minted
|
|
|
|
&& prefixIs(command, from_ascii("\\lstlistoflistings")))
|
|
|
|
command.erase(1, 3);
|
|
|
|
os << command;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-03-08 19:52:18 +00:00
|
|
|
int InsetCommand::plaintext(odocstringstream & os,
|
|
|
|
OutputParams const &, size_t) const
|
2000-04-24 20:58:23 +00:00
|
|
|
{
|
2008-02-27 20:43:16 +00:00
|
|
|
docstring const str = "[" + buffer().B_("LaTeX Command: ")
|
|
|
|
+ from_utf8(getCmdName()) + "]";
|
2007-02-20 18:02:46 +00:00
|
|
|
os << str;
|
|
|
|
return str.size();
|
2000-04-24 20:58:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-27 20:43:16 +00:00
|
|
|
int InsetCommand::docbook(odocstream &, OutputParams const &) const
|
2000-03-06 02:42:40 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2003-02-25 14:51:38 +00:00
|
|
|
|
|
|
|
|
2017-01-30 06:44:55 +00:00
|
|
|
void InsetCommand::validate(LaTeXFeatures & features) const
|
|
|
|
{
|
2017-01-30 07:27:53 +00:00
|
|
|
if (params().info().hasParam("literal")
|
|
|
|
&& params()["literal"] == "true")
|
2017-01-30 06:44:55 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
ParamInfo::const_iterator it = params().info().begin();
|
|
|
|
ParamInfo::const_iterator end = params().info().end();
|
|
|
|
for (; it != end; ++it) {
|
|
|
|
if (it->handling() == ParamInfo::HANDLING_LATEXIFY) {
|
|
|
|
docstring const text = params()[it->name()];
|
|
|
|
// Validate the contents (if we LaTeXify, specific
|
|
|
|
// macros might require packages)
|
|
|
|
for (pos_type i = 0; i < int(text.size()) ; ++i)
|
|
|
|
BufferEncodings::validate(text[i], features);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-04-26 14:56:30 +00:00
|
|
|
void InsetCommand::doDispatch(Cursor & cur, FuncRequest & cmd)
|
2003-02-26 15:01:10 +00:00
|
|
|
{
|
2010-04-09 19:00:42 +00:00
|
|
|
switch (cmd.action()) {
|
2003-03-07 15:58:02 +00:00
|
|
|
case LFUN_INSET_MODIFY: {
|
2008-03-24 13:33:48 +00:00
|
|
|
if (cmd.getArg(0) == "changetype") {
|
2010-11-29 09:47:46 +00:00
|
|
|
cur.recordUndo();
|
2008-03-24 13:33:48 +00:00
|
|
|
p_.setCmdName(cmd.getArg(1));
|
2010-11-01 20:57:10 +00:00
|
|
|
cur.forceBufferUpdate();
|
2008-03-24 13:33:48 +00:00
|
|
|
initView();
|
|
|
|
break;
|
|
|
|
}
|
2007-10-19 17:22:55 +00:00
|
|
|
InsetCommandParams p(p_.code());
|
2010-10-29 00:25:28 +00:00
|
|
|
InsetCommand::string2params(to_utf8(cmd.argument()), p);
|
2005-05-09 17:29:22 +00:00
|
|
|
if (p.getCmdName().empty())
|
2010-07-08 20:04:35 +00:00
|
|
|
cur.noScreenUpdate();
|
2010-12-08 09:24:04 +00:00
|
|
|
else {
|
|
|
|
cur.recordUndo();
|
2004-02-16 11:58:51 +00:00
|
|
|
setParams(p);
|
2010-12-08 09:24:04 +00:00
|
|
|
}
|
2010-07-09 14:37:00 +00:00
|
|
|
// FIXME We might also want to check here if this one is in the TOC.
|
|
|
|
// But I think most of those are labeled.
|
|
|
|
if (isLabeled())
|
|
|
|
cur.forceBufferUpdate();
|
2004-02-16 11:58:51 +00:00
|
|
|
break;
|
2003-03-07 15:58:02 +00:00
|
|
|
}
|
2003-02-26 19:28:38 +00:00
|
|
|
|
2006-09-01 15:41:38 +00:00
|
|
|
case LFUN_INSET_DIALOG_UPDATE: {
|
2006-10-21 00:16:43 +00:00
|
|
|
string const name = to_utf8(cmd.argument());
|
2010-10-29 00:25:28 +00:00
|
|
|
cur.bv().updateDialog(name, params2string(params()));
|
2004-02-16 11:58:51 +00:00
|
|
|
break;
|
2006-09-01 15:41:38 +00:00
|
|
|
}
|
2003-02-26 15:01:10 +00:00
|
|
|
|
2003-03-07 15:58:02 +00:00
|
|
|
default:
|
2007-04-29 13:39:47 +00:00
|
|
|
Inset::doDispatch(cur, cmd);
|
2004-02-16 11:58:51 +00:00
|
|
|
break;
|
2003-03-07 15:58:02 +00:00
|
|
|
}
|
2003-02-26 15:01:10 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2003-03-11 11:52:05 +00:00
|
|
|
|
2007-04-26 14:56:30 +00:00
|
|
|
bool InsetCommand::getStatus(Cursor & cur, FuncRequest const & cmd,
|
2005-04-22 08:57:22 +00:00
|
|
|
FuncStatus & status) const
|
|
|
|
{
|
2010-04-09 19:00:42 +00:00
|
|
|
switch (cmd.action()) {
|
2005-04-22 08:57:22 +00:00
|
|
|
// suppress these
|
2006-05-05 20:23:12 +00:00
|
|
|
case LFUN_ERT_INSERT:
|
2008-05-29 15:14:00 +00:00
|
|
|
status.setEnabled(false);
|
2005-04-22 08:57:22 +00:00
|
|
|
return true;
|
2015-05-17 15:27:12 +00:00
|
|
|
|
2005-04-22 08:57:22 +00:00
|
|
|
// we handle these
|
|
|
|
case LFUN_INSET_MODIFY:
|
2008-03-24 13:33:48 +00:00
|
|
|
if (cmd.getArg(0) == "changetype") {
|
|
|
|
string const newtype = cmd.getArg(1);
|
2008-05-29 15:14:00 +00:00
|
|
|
status.setEnabled(p_.isCompatibleCommand(p_.code(), newtype));
|
2008-03-24 13:33:48 +00:00
|
|
|
status.setOnOff(newtype == p_.getCmdName());
|
2014-12-22 00:01:26 +00:00
|
|
|
}
|
2008-05-29 15:14:00 +00:00
|
|
|
status.setEnabled(true);
|
2008-03-24 13:33:48 +00:00
|
|
|
return true;
|
2015-05-17 15:27:12 +00:00
|
|
|
|
2005-04-22 08:57:22 +00:00
|
|
|
case LFUN_INSET_DIALOG_UPDATE:
|
2008-05-29 15:14:00 +00:00
|
|
|
status.setEnabled(true);
|
2005-04-22 08:57:22 +00:00
|
|
|
return true;
|
2015-05-17 15:27:12 +00:00
|
|
|
|
2005-04-22 08:57:22 +00:00
|
|
|
default:
|
2007-04-29 13:39:47 +00:00
|
|
|
return Inset::getStatus(cur, cmd, status);
|
2005-04-22 08:57:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-10-29 14:48:55 +00:00
|
|
|
string InsetCommand::contextMenuName() const
|
2008-03-09 11:22:39 +00:00
|
|
|
{
|
2011-10-29 14:48:55 +00:00
|
|
|
return "context-" + insetName(p_.code());
|
2008-03-09 11:22:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-04-09 22:08:00 +00:00
|
|
|
bool InsetCommand::showInsetDialog(BufferView * bv) const
|
2007-09-10 16:06:01 +00:00
|
|
|
{
|
2010-10-29 00:46:21 +00:00
|
|
|
if (p_.code() != NO_CODE)
|
|
|
|
bv->showDialog(insetName(p_.code()), params2string(p_),
|
2009-04-09 22:08:00 +00:00
|
|
|
const_cast<InsetCommand *>(this));
|
|
|
|
return true;
|
2003-02-25 14:51:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-10-29 00:25:28 +00:00
|
|
|
bool InsetCommand::string2params(string const & data,
|
2008-03-27 22:26:24 +00:00
|
|
|
InsetCommandParams & params)
|
2003-02-25 14:51:38 +00:00
|
|
|
{
|
Rework InsetCommandParams interface and file storage
* src/insets/insetcommandparams.[Ch]:
(operator[]): New, access a parameter
(clear): New, clear all parameters
(info_): New, stire info about this command
(cmdname): Rename to name_
(contents, options, sec_options): Replace with params_. Parameters
are now stored as docstring.
(findInfo): New factor for command info for all commands
(read, write): Use new syntax
(parameter set and get methods): reimplemenmt for new parameter storage
* src/insets/insetcommand.h
(getParam): New, get a parameter
(setParam): New, set a parameter
(parameter set and get methods): Adjust to InsetCommandParams changes
* src/insets/insetbibitem.[Ch]
(write): Remove, not needed anymore
(directWrite): ditto
* src/insets/insetbibitem.C
(InsetBibitem::read): Use InsetCommand::read
* src/insets/insetref.C
(InsetRef::latex): Use new InsetCommandParams interface
* src/mathed/InsetMathHull.C
(InsetMathHull::doDispatch): ditto
* src/text3.C
(LyXText::dispatch): ditto
* src/factory.C
(createInset): Create InsetCommandParams with command name
(readInset): ditto
(readInset): Remove error message for bibitem, since bibitem is
now a normal command inset
* src/buffer.C: Bump file format number
* src/frontends/controllers/ControlCommand.[Ch]
(ControlCommand): take an additional command name parameter
* src/text.C
(readParToken): Remove code for \bibitem
* lib/lyx2lyx/LyX.py: Bump latest file format number
* lib/lyx2lyx/lyx_1_5.py
(convert_bibitem, convert_commandparams): new, convert to new format
(revert_commandparams): new, convert to old format
* development/FORMAT: document new format
* many other files: Adjust to the changes above
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15357 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-17 21:07:16 +00:00
|
|
|
params.clear();
|
2010-10-28 16:28:57 +00:00
|
|
|
if (data.empty())
|
2008-04-10 19:53:50 +00:00
|
|
|
return false;
|
2010-09-12 07:56:08 +00:00
|
|
|
// This happens when inset-insert is called without argument except for the
|
|
|
|
// inset type; ex:
|
|
|
|
// "inset-insert toc"
|
2010-10-29 00:25:28 +00:00
|
|
|
string const name = insetName(params.code());
|
2010-10-28 16:28:57 +00:00
|
|
|
if (data == name)
|
2010-09-12 07:56:08 +00:00
|
|
|
return true;
|
2010-10-28 16:28:57 +00:00
|
|
|
istringstream dstream(data);
|
2008-04-02 23:06:22 +00:00
|
|
|
Lexer lex;
|
2010-10-28 16:28:57 +00:00
|
|
|
lex.setStream(dstream);
|
2008-04-05 10:34:29 +00:00
|
|
|
lex.setContext("InsetCommand::string2params");
|
|
|
|
lex >> name.c_str(); // check for name
|
|
|
|
lex >> "CommandInset";
|
2015-05-20 13:49:15 +00:00
|
|
|
params.read(lex);
|
2007-10-16 18:53:10 +00:00
|
|
|
return true;
|
2003-02-25 14:51:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-10-29 00:25:28 +00:00
|
|
|
string InsetCommand::params2string(InsetCommandParams const & params)
|
2003-02-25 14:51:38 +00:00
|
|
|
{
|
|
|
|
ostringstream data;
|
2010-10-29 00:25:28 +00:00
|
|
|
data << insetName(params.code()) << ' ';
|
2003-02-25 14:51:38 +00:00
|
|
|
params.write(data);
|
|
|
|
data << "\\end_inset\n";
|
2003-09-15 11:00:00 +00:00
|
|
|
return data.str();
|
2003-02-25 14:51:38 +00:00
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
2009-09-26 17:19:18 +00:00
|
|
|
bool decodeInsetParam(string const & name, string & data,
|
|
|
|
Buffer const & buffer)
|
|
|
|
{
|
|
|
|
InsetCode const code = insetCode(name);
|
|
|
|
switch (code) {
|
|
|
|
case BIBITEM_CODE:
|
|
|
|
case BIBTEX_CODE:
|
2011-01-04 11:32:04 +00:00
|
|
|
case INDEX_PRINT_CODE:
|
2009-09-26 17:19:18 +00:00
|
|
|
case LABEL_CODE:
|
2010-09-07 00:41:00 +00:00
|
|
|
case LINE_CODE:
|
2009-09-26 17:19:18 +00:00
|
|
|
case NOMENCL_CODE:
|
|
|
|
case NOMENCL_PRINT_CODE:
|
|
|
|
case REF_CODE:
|
|
|
|
case TOC_CODE:
|
|
|
|
case HYPERLINK_CODE: {
|
|
|
|
InsetCommandParams p(code);
|
2010-10-29 00:25:28 +00:00
|
|
|
data = InsetCommand::params2string(p);
|
2009-09-26 17:19:18 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case INCLUDE_CODE: {
|
|
|
|
// data is the include type: one of "include",
|
|
|
|
// "input", "verbatiminput" or "verbatiminput*"
|
|
|
|
if (data.empty())
|
|
|
|
// default type is requested
|
|
|
|
data = "include";
|
|
|
|
InsetCommandParams p(INCLUDE_CODE, data);
|
2010-10-29 00:25:28 +00:00
|
|
|
data = InsetCommand::params2string(p);
|
2009-09-26 17:19:18 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case BOX_CODE: {
|
|
|
|
// \c data == "Boxed" || "Frameless" etc
|
|
|
|
InsetBoxParams p(data);
|
|
|
|
data = InsetBox::params2string(p);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case BRANCH_CODE: {
|
|
|
|
InsetBranchParams p;
|
|
|
|
data = InsetBranch::params2string(p);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CITE_CODE: {
|
|
|
|
InsetCommandParams p(CITE_CODE);
|
2010-10-29 00:25:28 +00:00
|
|
|
data = InsetCommand::params2string(p);
|
2009-09-26 17:19:18 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case ERT_CODE: {
|
|
|
|
data = InsetERT::params2string(InsetCollapsable::Open);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EXTERNAL_CODE: {
|
|
|
|
InsetExternalParams p;
|
|
|
|
data = InsetExternal::params2string(p, buffer);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case FLOAT_CODE: {
|
|
|
|
InsetFloatParams p;
|
|
|
|
data = InsetFloat::params2string(p);
|
|
|
|
break;
|
|
|
|
}
|
2011-01-04 11:32:04 +00:00
|
|
|
case INDEX_CODE: {
|
|
|
|
InsetIndexParams p;
|
|
|
|
data = InsetIndex::params2string(p);
|
|
|
|
break;
|
|
|
|
}
|
2009-09-26 17:19:18 +00:00
|
|
|
case LISTINGS_CODE: {
|
|
|
|
InsetListingsParams p;
|
|
|
|
data = InsetListings::params2string(p);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GRAPHICS_CODE: {
|
|
|
|
InsetGraphicsParams p;
|
|
|
|
data = InsetGraphics::params2string(p, buffer);
|
|
|
|
break;
|
|
|
|
}
|
2011-08-27 10:45:59 +00:00
|
|
|
case MATH_SPACE_CODE: {
|
2015-05-17 15:27:12 +00:00
|
|
|
InsetSpaceParams p(true);
|
2011-08-27 10:45:59 +00:00
|
|
|
data = InsetSpace::params2string(p);
|
|
|
|
break;
|
|
|
|
}
|
2009-09-26 17:19:18 +00:00
|
|
|
case NOTE_CODE: {
|
|
|
|
InsetNoteParams p;
|
|
|
|
data = InsetNote::params2string(p);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case PHANTOM_CODE: {
|
|
|
|
InsetPhantomParams p;
|
|
|
|
data = InsetPhantom::params2string(p);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SPACE_CODE: {
|
|
|
|
InsetSpaceParams p;
|
|
|
|
data = InsetSpace::params2string(p);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case VSPACE_CODE: {
|
|
|
|
VSpace space;
|
|
|
|
data = InsetVSpace::params2string(space);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case WRAP_CODE: {
|
|
|
|
InsetWrapParams p;
|
|
|
|
data = InsetWrap::params2string(p);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
} // end switch(code)
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|