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"
15 #include "support/debug.h"
16 #include "support/gettext.h"
18 #include "support/docstream.h"
24 InsetOptArg::InsetOptArg(BufferParams const & ins)
25 : InsetCollapsable(ins)
29 InsetOptArg::InsetOptArg(InsetOptArg const & in)
30 : InsetCollapsable(in)
34 Inset * InsetOptArg::clone() const
36 return new InsetOptArg(*this);
40 docstring const InsetOptArg::editMessage() const
42 return _("Opened Optional Argument Inset");
46 void InsetOptArg::write(Buffer const & buf, std::ostream & os) const
48 os << "OptArg" << "\n";
49 InsetCollapsable::write(buf, os);
53 int InsetOptArg::latex(Buffer const &, odocstream &,
54 OutputParams const &) const
60 int InsetOptArg::plaintext(Buffer const &, odocstream &,
61 OutputParams const &) const
63 return 0; // do not output optional arguments
67 int InsetOptArg::docbook(Buffer const &, odocstream &,
68 OutputParams const &) const
74 int InsetOptArg::latexOptional(Buffer const & buf, odocstream & os,
75 OutputParams const & runparams) const
78 int ret = InsetText::latex(buf, ss, runparams);
79 docstring str = ss.str();
80 if (str.find(']') != docstring::npos)
81 str = '{' + str + '}';
82 os << '[' << str << ']';