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