3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Martin Vermeer
8 * Full author contact details are available in file CREDITS.
13 #include "insetoptarg.h"
18 #include "paragraph.h"
27 using std::ostringstream;
30 InsetOptArg::InsetOptArg(BufferParams const & ins)
31 : InsetCollapsable(ins)
33 LyXFont font(LyXFont::ALL_SANE);
34 font.setColor(LColor::collapsable);
40 InsetOptArg::InsetOptArg(InsetOptArg const & in)
41 : InsetCollapsable(in)
43 LyXFont font(LyXFont::ALL_SANE);
44 font.setColor(LColor::collapsable);
50 auto_ptr<InsetBase> InsetOptArg::doClone() const
52 return auto_ptr<InsetBase>(new InsetOptArg(*this));
56 docstring const InsetOptArg::editMessage() const
58 return _("Opened Optional Argument Inset");
62 void InsetOptArg::write(Buffer const & buf, ostream & os) const
64 os << "OptArg" << "\n";
65 InsetCollapsable::write(buf, os);
69 int InsetOptArg::latex(Buffer const &, ostream &,
70 OutputParams const &) const
75 int InsetOptArg::docbook(Buffer const &, ostream &,
76 OutputParams const &) const
82 int InsetOptArg::plaintext(Buffer const &, lyx::odocstream &,
83 OutputParams const &) const
89 int InsetOptArg::latexOptional(Buffer const & buf, ostream & os,
90 OutputParams const & runparams) const
93 int ret = InsetText::latex(buf, ss, runparams);
94 string str = ss.str();
95 if (str.find(']') != string::npos)
96 str = '{' + str + '}';
97 os << '[' << str << ']';