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);
37 setLabel(lyx::to_utf8(_("opt")));
41 InsetOptArg::InsetOptArg(InsetOptArg const & in)
42 : InsetCollapsable(in)
44 LyXFont font(LyXFont::ALL_SANE);
45 font.setColor(LColor::collapsable);
48 setLabel(lyx::to_utf8(_("opt")));
52 auto_ptr<InsetBase> InsetOptArg::doClone() const
54 return auto_ptr<InsetBase>(new InsetOptArg(*this));
58 docstring const InsetOptArg::editMessage() const
60 return _("Opened Optional Argument Inset");
64 void InsetOptArg::write(Buffer const & buf, ostream & os) const
66 os << "OptArg" << "\n";
67 InsetCollapsable::write(buf, os);
71 int InsetOptArg::latex(Buffer const &, ostream &,
72 OutputParams const &) const
77 int InsetOptArg::docbook(Buffer const &, ostream &,
78 OutputParams const &) const
84 int InsetOptArg::plaintext(Buffer const &, ostream &,
85 OutputParams const &) const
91 int InsetOptArg::latexOptional(Buffer const & buf, ostream & os,
92 OutputParams const & runparams) const
95 int ret = InsetText::latex(buf, ss, runparams);
96 string str = ss.str();
97 if (str.find(']') != string::npos)
98 str = '{' + str + '}';
99 os << '[' << str << ']';