2 * \file InsetOptArg.cpp
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"
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
77 int InsetOptArg::plaintext(Buffer const &, odocstream &,
78 OutputParams const &) const
80 return 0; // do not output optional arguments
84 int InsetOptArg::docbook(Buffer const &, odocstream &,
85 OutputParams const &) const
91 int InsetOptArg::latexOptional(Buffer const & buf, odocstream & os,
92 OutputParams const & runparams) const
95 int ret = InsetText::latex(buf, ss, runparams);
96 docstring str = ss.str();
97 if (str.find(']') != docstring::npos)
98 str = '{' + str + '}';
99 os << '[' << str << ']';