]> git.lyx.org Git - lyx.git/blob - src/insets/InsetOptArg.cpp
pimpl not needed here
[lyx.git] / src / insets / InsetOptArg.cpp
1 /**
2  * \file InsetOptArg.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Martin Vermeer
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "InsetOptArg.h"
14
15 #include "debug.h"
16 #include "gettext.h"
17
18 #include "support/docstream.h"
19
20
21 namespace lyx {
22
23
24 InsetOptArg::InsetOptArg(BufferParams const & ins)
25         : InsetCollapsable(ins)
26 {
27         setLabel(_("opt"));
28 }
29
30
31 InsetOptArg::InsetOptArg(InsetOptArg const & in)
32         : InsetCollapsable(in)
33 {
34         setLabel(_("opt"));
35 }
36
37
38 Inset * InsetOptArg::clone() const
39 {
40         return new InsetOptArg(*this);
41 }
42
43
44 docstring const InsetOptArg::editMessage() const
45 {
46         return _("Opened Optional Argument Inset");
47 }
48
49
50 void InsetOptArg::write(Buffer const & buf, std::ostream & os) const
51 {
52         os << "OptArg" << "\n";
53         InsetCollapsable::write(buf, os);
54 }
55
56
57 int InsetOptArg::latex(Buffer const &, odocstream &,
58                        OutputParams const &) const
59 {
60         return 0;
61 }
62
63
64 int InsetOptArg::plaintext(Buffer const &, odocstream &,
65                            OutputParams const &) const
66 {
67         return 0; // do not output optional arguments
68 }
69
70
71 int InsetOptArg::docbook(Buffer const &, odocstream &,
72                          OutputParams const &) const
73 {
74         return 0;
75 }
76
77
78 int InsetOptArg::latexOptional(Buffer const & buf, odocstream & os,
79                                OutputParams const & runparams) const
80 {
81         odocstringstream ss;
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 << ']';
87         return ret;
88 }
89
90
91 } // namespace lyx