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