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 "support/docstream.h"
24 InsetOptArg::InsetOptArg(BufferParams const & ins)
25 : InsetCollapsable(ins)
27 FontInfo font = sane_font;
28 font.setColor(Color_collapsable);
34 InsetOptArg::InsetOptArg(InsetOptArg const & in)
35 : InsetCollapsable(in)
37 FontInfo font = sane_font;
38 font.setColor(Color_collapsable);
44 Inset * InsetOptArg::clone() const
46 return new InsetOptArg(*this);
50 docstring const InsetOptArg::editMessage() const
52 return _("Opened Optional Argument Inset");
56 void InsetOptArg::write(Buffer const & buf, std::ostream & os) const
58 os << "OptArg" << "\n";
59 InsetCollapsable::write(buf, os);
63 int InsetOptArg::latex(Buffer const &, odocstream &,
64 OutputParams const &) const
70 int InsetOptArg::plaintext(Buffer const &, odocstream &,
71 OutputParams const &) const
73 return 0; // do not output optional arguments
77 int InsetOptArg::docbook(Buffer const &, odocstream &,
78 OutputParams const &) const
84 int InsetOptArg::latexOptional(Buffer const & buf, odocstream & os,
85 OutputParams const & runparams) const
88 int ret = InsetText::latex(buf, ss, runparams);
89 docstring str = ss.str();
90 if (str.find(']') != docstring::npos)
91 str = '{' + str + '}';
92 os << '[' << str << ']';