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