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)
31 InsetOptArg::InsetOptArg(InsetOptArg const & in)
32 : InsetCollapsable(in)
38 Inset * InsetOptArg::clone() const
40 return new InsetOptArg(*this);
44 docstring const InsetOptArg::editMessage() const
46 return _("Opened Optional Argument Inset");
50 void InsetOptArg::write(Buffer const & buf, std::ostream & os) const
52 os << "OptArg" << "\n";
53 InsetCollapsable::write(buf, os);
57 int InsetOptArg::latex(Buffer const &, odocstream &,
58 OutputParams const &) const
64 int InsetOptArg::plaintext(Buffer const &, odocstream &,
65 OutputParams const &) const
67 return 0; // do not output optional arguments
71 int InsetOptArg::docbook(Buffer const &, odocstream &,
72 OutputParams const &) const
78 int InsetOptArg::latexOptional(Buffer const & buf, odocstream & os,
79 OutputParams const & runparams) const
82 int ret = InsetText::latex(buf, ss, runparams);
83 docstring str = ss.str();
84 if (str.find(']') != docstring::npos)
85 str = '{' + str + '}';
86 os << '[' << str << ']';