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"
23 using lyx::odocstream;
28 using std::ostringstream;
31 InsetOptArg::InsetOptArg(BufferParams const & ins)
32 : InsetCollapsable(ins)
34 LyXFont font(LyXFont::ALL_SANE);
35 font.setColor(LColor::collapsable);
41 InsetOptArg::InsetOptArg(InsetOptArg const & in)
42 : InsetCollapsable(in)
44 LyXFont font(LyXFont::ALL_SANE);
45 font.setColor(LColor::collapsable);
51 auto_ptr<InsetBase> InsetOptArg::doClone() const
53 return auto_ptr<InsetBase>(new InsetOptArg(*this));
57 docstring const InsetOptArg::editMessage() const
59 return _("Opened Optional Argument Inset");
63 void InsetOptArg::write(Buffer const & buf, ostream & os) const
65 os << "OptArg" << "\n";
66 InsetCollapsable::write(buf, os);
70 int InsetOptArg::latex(Buffer const &, odocstream &,
71 OutputParams const &) const
76 int InsetOptArg::docbook(Buffer const &, ostream &,
77 OutputParams const &) const
83 int InsetOptArg::plaintext(Buffer const &, odocstream &,
84 OutputParams const &) const
90 int InsetOptArg::latexOptional(Buffer const & buf, odocstream & os,
91 OutputParams const & runparams) const
93 lyx::odocstringstream ss;
94 int ret = InsetText::latex(buf, ss, runparams);
95 docstring str = ss.str();
96 if (str.find(']') != docstring::npos)
97 str = '{' + str + '}';
98 os << '[' << str << ']';