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"
25 InsetOptArg::InsetOptArg(BufferParams const & ins)
26 : InsetCollapsable(ins)
30 InsetOptArg::InsetOptArg(InsetOptArg const & in)
31 : InsetCollapsable(in)
35 Inset * InsetOptArg::clone() const
37 return new InsetOptArg(*this);
41 docstring const InsetOptArg::editMessage() const
43 return _("Opened Optional Argument Inset");
47 void InsetOptArg::write(Buffer const & buf, ostream & os) const
49 os << "OptArg" << "\n";
50 InsetCollapsable::write(buf, os);
54 int InsetOptArg::latex(Buffer const &, odocstream &,
55 OutputParams const &) const
61 int InsetOptArg::plaintext(Buffer const &, odocstream &,
62 OutputParams const &) const
64 return 0; // do not output optional arguments
68 int InsetOptArg::docbook(Buffer const &, odocstream &,
69 OutputParams const &) const
75 int InsetOptArg::latexOptional(Buffer const & buf, odocstream & os,
76 OutputParams const & runparams) const
79 int ret = InsetText::latex(buf, ss, runparams);
80 docstring str = ss.str();
81 if (str.find(']') != docstring::npos)
82 str = '{' + str + '}';
83 os << '[' << str << ']';