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