]> git.lyx.org Git - lyx.git/blob - src/insets/InsetOptArg.cpp
header cleanup.
[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
19 namespace lyx {
20
21 using std::string;
22 using std::auto_ptr;
23 using std::ostream;
24
25
26 InsetOptArg::InsetOptArg(BufferParams const & ins)
27         : InsetCollapsable(ins)
28 {
29         Font font(Font::ALL_SANE);
30         font.setColor(Color::collapsable);
31         setLabelFont(font);
32         setLabel(_("opt"));
33 }
34
35
36 InsetOptArg::InsetOptArg(InsetOptArg const & in)
37         : InsetCollapsable(in)
38 {
39         Font font(Font::ALL_SANE);
40         font.setColor(Color::collapsable);
41         setLabelFont(font);
42         setLabel(_("opt"));
43 }
44
45
46 auto_ptr<Inset> InsetOptArg::doClone() const
47 {
48         return auto_ptr<Inset>(new InsetOptArg(*this));
49 }
50
51
52 docstring const InsetOptArg::editMessage() const
53 {
54         return _("Opened Optional Argument Inset");
55 }
56
57
58 void InsetOptArg::write(Buffer const & buf, ostream & os) const
59 {
60         os << "OptArg" << "\n";
61         InsetCollapsable::write(buf, os);
62 }
63
64
65 int InsetOptArg::latex(Buffer const &, odocstream &,
66                        OutputParams const &) const
67 {
68         return 0;
69 }
70
71
72 int InsetOptArg::plaintext(Buffer const &, odocstream &,
73                            OutputParams const &) const
74 {
75         return 0; // do not output optional arguments
76 }
77
78
79 int InsetOptArg::docbook(Buffer const &, odocstream &,
80                          OutputParams const &) const
81 {
82         return 0;
83 }
84
85
86 int InsetOptArg::latexOptional(Buffer const & buf, odocstream & os,
87                                OutputParams const & runparams) const
88 {
89         odocstringstream ss;
90         int ret = InsetText::latex(buf, ss, runparams);
91         docstring str = ss.str();
92         if (str.find(']') != docstring::npos)
93                 str = '{' + str + '}';
94         os << '[' << str << ']';
95         return ret;
96 }
97
98
99 } // namespace lyx