2002-08-24 20:25:17 +00:00
|
|
|
/**
|
|
|
|
* \file insetoptarg.C
|
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>
|
|
|
|
|
2003-09-05 09:01:27 +00:00
|
|
|
#include "insetoptarg.h"
|
2002-08-23 09:05:32 +00:00
|
|
|
|
|
|
|
#include "debug.h"
|
|
|
|
#include "gettext.h"
|
2003-09-16 10:54:23 +00:00
|
|
|
#include "LColor.h"
|
2003-09-06 12:36:58 +00:00
|
|
|
#include "paragraph.h"
|
2002-08-23 09:05:32 +00:00
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
|
|
|
|
using std::string;
|
2003-09-05 09:01:27 +00:00
|
|
|
using std::auto_ptr;
|
2002-08-23 09:05:32 +00:00
|
|
|
using std::ostream;
|
2003-07-25 17:11:25 +00:00
|
|
|
|
2002-08-23 09:05:32 +00:00
|
|
|
|
|
|
|
InsetOptArg::InsetOptArg(BufferParams const & ins)
|
|
|
|
: InsetCollapsable(ins, true)
|
|
|
|
{
|
2002-08-24 20:25:17 +00:00
|
|
|
LyXFont font(LyXFont::ALL_SANE);
|
2002-08-23 09:05:32 +00:00
|
|
|
font.setColor(LColor::collapsable);
|
|
|
|
setLabelFont(font);
|
|
|
|
setLabel(_("opt"));
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2002-08-24 20:25:17 +00:00
|
|
|
LyXFont font(LyXFont::ALL_SANE);
|
2002-08-23 09:05:32 +00:00
|
|
|
font.setColor(LColor::collapsable);
|
|
|
|
setLabelFont(font);
|
|
|
|
setLabel(_("opt"));
|
|
|
|
}
|
|
|
|
|
2002-08-24 20:25:17 +00:00
|
|
|
|
2003-07-25 17:11:25 +00:00
|
|
|
auto_ptr<InsetBase> InsetOptArg::clone() const
|
2002-08-23 09:05:32 +00:00
|
|
|
{
|
2003-07-25 17:11:25 +00:00
|
|
|
return auto_ptr<InsetBase>(new InsetOptArg(*this));
|
2002-08-23 09:05:32 +00:00
|
|
|
}
|
|
|
|
|
2002-08-24 20:25:17 +00:00
|
|
|
|
2002-08-23 09:05:32 +00:00
|
|
|
string const InsetOptArg::editMessage() const
|
|
|
|
{
|
|
|
|
return _("Opened Optional Argument Inset");
|
|
|
|
}
|
|
|
|
|
2002-08-24 20:25:17 +00:00
|
|
|
|
2003-08-28 07:41:31 +00:00
|
|
|
void InsetOptArg::write(Buffer const & buf, 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
|
|
|
|
2003-08-28 07:41:31 +00:00
|
|
|
int InsetOptArg::latex(Buffer const &, ostream &,
|
2003-05-23 08:59:47 +00:00
|
|
|
LatexRunParams const &) const
|
2002-08-23 09:05:32 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2003-08-28 07:41:31 +00:00
|
|
|
int InsetOptArg::latexOptional(Buffer const & buf, ostream & os,
|
2003-05-23 08:59:47 +00:00
|
|
|
LatexRunParams const & runparams) const
|
2002-08-23 09:05:32 +00:00
|
|
|
{
|
|
|
|
os << '[';
|
2003-05-23 08:59:47 +00:00
|
|
|
int const i = inset.latex(buf, os, runparams);
|
2002-08-23 09:05:32 +00:00
|
|
|
os << ']';
|
|
|
|
return i + 2;
|
|
|
|
}
|