]> git.lyx.org Git - lyx.git/blob - src/insets/insetoptarg.C
3b4fe9809f1adfa78ae2fff85887df1b2fed2dc9
[lyx.git] / src / insets / insetoptarg.C
1 /**
2  * \file insetoptarg.C
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 #include "paragraph.h"
18
19 using std::auto_ptr;
20 using std::ostream;
21
22
23 InsetOptArg::InsetOptArg(BufferParams const & ins)
24         : InsetCollapsable(ins, true)
25 {
26         LyXFont font(LyXFont::ALL_SANE);
27         font.setColor(LColor::collapsable);
28         setLabelFont(font);
29         setLabel(_("opt"));
30 }
31
32
33 InsetOptArg::InsetOptArg(InsetOptArg const & in)
34         : InsetCollapsable(in)
35 {
36         LyXFont font(LyXFont::ALL_SANE);
37         font.setColor(LColor::collapsable);
38         setLabelFont(font);
39         setLabel(_("opt"));
40 }
41
42
43 auto_ptr<InsetBase> InsetOptArg::clone() const
44 {
45         return auto_ptr<InsetBase>(new InsetOptArg(*this));
46 }
47
48
49 string const InsetOptArg::editMessage() const
50 {
51         return _("Opened Optional Argument Inset");
52 }
53
54
55 void InsetOptArg::write(Buffer const & buf, ostream & os) const
56 {
57         os << "OptArg" << "\n";
58         InsetCollapsable::write(buf, os);
59 }
60
61
62 int InsetOptArg::latex(Buffer const &, ostream &,
63                        LatexRunParams const &) const
64 {
65         return 0;
66 }
67
68
69 int InsetOptArg::latexOptional(Buffer const & buf, ostream & os,
70                                LatexRunParams const & runparams) const
71 {
72         os << '[';
73         int const i = inset.latex(buf, os, runparams);
74         os << ']';
75         return i + 2;
76 }