2002-08-24 20:25:17 +00:00
|
|
|
/**
|
2007-04-25 01:24:38 +00:00
|
|
|
* \file InsetOptArg.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-08-23 09:05:32 +00:00
|
|
|
*
|
2002-12-01 22:59:25 +00:00
|
|
|
* \author Martin Vermeer
|
2002-09-25 14:26:13 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-08-24 20:25:17 +00:00
|
|
|
*/
|
2002-08-23 09:05:32 +00:00
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
#include "InsetOptArg.h"
|
2002-08-23 09:05:32 +00:00
|
|
|
|
|
|
|
#include "debug.h"
|
|
|
|
#include "gettext.h"
|
2003-10-06 15:43:21 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
2006-09-09 18:52:00 +00:00
|
|
|
|
2002-08-23 09:05:32 +00:00
|
|
|
|
|
|
|
InsetOptArg::InsetOptArg(BufferParams const & ins)
|
2005-06-02 15:01:16 +00:00
|
|
|
: InsetCollapsable(ins)
|
2002-08-23 09:05:32 +00:00
|
|
|
{
|
2007-04-29 18:17:15 +00:00
|
|
|
Font font(Font::ALL_SANE);
|
2007-10-25 12:41:02 +00:00
|
|
|
font.setColor(Color_collapsable);
|
2002-08-23 09:05:32 +00:00
|
|
|
setLabelFont(font);
|
2006-10-08 09:36:16 +00:00
|
|
|
setLabel(_("opt"));
|
2002-08-23 09:05:32 +00:00
|
|
|
}
|
|
|
|
|
2002-08-24 20:25:17 +00:00
|
|
|
|
2003-05-26 09:13:55 +00:00
|
|
|
InsetOptArg::InsetOptArg(InsetOptArg const & in)
|
|
|
|
: InsetCollapsable(in)
|
2002-08-23 09:05:32 +00:00
|
|
|
{
|
2007-04-29 18:17:15 +00:00
|
|
|
Font font(Font::ALL_SANE);
|
2007-10-25 12:41:02 +00:00
|
|
|
font.setColor(Color_collapsable);
|
2002-08-23 09:05:32 +00:00
|
|
|
setLabelFont(font);
|
2006-10-08 09:36:16 +00:00
|
|
|
setLabel(_("opt"));
|
2002-08-23 09:05:32 +00:00
|
|
|
}
|
|
|
|
|
2002-08-24 20:25:17 +00:00
|
|
|
|
2007-08-30 18:03:17 +00:00
|
|
|
Inset * InsetOptArg::clone() const
|
2002-08-23 09:05:32 +00:00
|
|
|
{
|
2007-08-30 18:03:17 +00:00
|
|
|
return new InsetOptArg(*this);
|
2002-08-23 09:05:32 +00:00
|
|
|
}
|
|
|
|
|
2002-08-24 20:25:17 +00:00
|
|
|
|
2006-09-09 18:52:00 +00:00
|
|
|
docstring const InsetOptArg::editMessage() const
|
2002-08-23 09:05:32 +00:00
|
|
|
{
|
2006-09-09 18:52:00 +00:00
|
|
|
return _("Opened Optional Argument Inset");
|
2002-08-23 09:05:32 +00:00
|
|
|
}
|
|
|
|
|
2002-08-24 20:25:17 +00:00
|
|
|
|
2007-08-30 18:03:17 +00:00
|
|
|
void InsetOptArg::write(Buffer const & buf, std::ostream & os) const
|
2002-08-23 09:05:32 +00:00
|
|
|
{
|
|
|
|
os << "OptArg" << "\n";
|
|
|
|
InsetCollapsable::write(buf, os);
|
|
|
|
}
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2006-10-19 16:51:30 +00:00
|
|
|
int InsetOptArg::latex(Buffer const &, odocstream &,
|
2007-05-28 22:27:45 +00:00
|
|
|
OutputParams const &) const
|
2002-08-23 09:05:32 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-02-15 23:44:33 +00:00
|
|
|
|
|
|
|
int InsetOptArg::plaintext(Buffer const &, odocstream &,
|
2007-05-28 22:27:45 +00:00
|
|
|
OutputParams const &) const
|
2005-02-28 13:14:48 +00:00
|
|
|
{
|
2007-02-18 18:55:11 +00:00
|
|
|
return 0; // do not output optional arguments
|
2005-02-28 13:14:48 +00:00
|
|
|
}
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2007-02-15 23:44:33 +00:00
|
|
|
int InsetOptArg::docbook(Buffer const &, odocstream &,
|
2007-05-28 22:27:45 +00:00
|
|
|
OutputParams const &) const
|
2005-05-11 09:47:54 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-19 16:51:30 +00:00
|
|
|
int InsetOptArg::latexOptional(Buffer const & buf, odocstream & os,
|
2003-11-05 12:06:20 +00:00
|
|
|
OutputParams const & runparams) const
|
2002-08-23 09:05:32 +00:00
|
|
|
{
|
2006-10-21 00:16:43 +00:00
|
|
|
odocstringstream ss;
|
2004-11-19 16:17:52 +00:00
|
|
|
int ret = InsetText::latex(buf, ss, runparams);
|
2006-10-19 16:51:30 +00:00
|
|
|
docstring str = ss.str();
|
|
|
|
if (str.find(']') != docstring::npos)
|
2004-08-13 23:30:26 +00:00
|
|
|
str = '{' + str + '}';
|
|
|
|
os << '[' << str << ']';
|
2004-11-19 16:17:52 +00:00
|
|
|
return ret;
|
2002-08-23 09:05:32 +00:00
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|