]> git.lyx.org Git - lyx.git/blob - src/insets/insetoptarg.C
This commit cleans up everything related to singleton. The other important change...
[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 #include <sstream>
21
22 using lyx::docstring;
23
24 using std::string;
25 using std::auto_ptr;
26 using std::ostream;
27 using std::ostringstream;
28
29
30 InsetOptArg::InsetOptArg(BufferParams const & ins)
31         : InsetCollapsable(ins)
32 {
33         LyXFont font(LyXFont::ALL_SANE);
34         font.setColor(LColor::collapsable);
35         setLabelFont(font);
36         setLabel(_("opt"));
37 }
38
39
40 InsetOptArg::InsetOptArg(InsetOptArg const & in)
41         : InsetCollapsable(in)
42 {
43         LyXFont font(LyXFont::ALL_SANE);
44         font.setColor(LColor::collapsable);
45         setLabelFont(font);
46         setLabel(_("opt"));
47 }
48
49
50 auto_ptr<InsetBase> InsetOptArg::doClone() const
51 {
52         return auto_ptr<InsetBase>(new InsetOptArg(*this));
53 }
54
55
56 docstring const InsetOptArg::editMessage() const
57 {
58         return _("Opened Optional Argument Inset");
59 }
60
61
62 void InsetOptArg::write(Buffer const & buf, ostream & os) const
63 {
64         os << "OptArg" << "\n";
65         InsetCollapsable::write(buf, os);
66 }
67
68
69 int InsetOptArg::latex(Buffer const &, ostream &,
70                        OutputParams const &) const
71 {
72         return 0;
73 }
74
75 int InsetOptArg::docbook(Buffer const &, ostream &,
76                        OutputParams const &) const
77 {
78         return 0;
79 }
80
81
82 int InsetOptArg::plaintext(Buffer const &, ostream &,
83                        OutputParams const &) const
84 {
85         return 0;
86 }
87
88
89 int InsetOptArg::latexOptional(Buffer const & buf, ostream & os,
90                                OutputParams const & runparams) const
91 {
92         ostringstream ss;
93         int ret = InsetText::latex(buf, ss, runparams);
94         string str = ss.str();
95         if (str.find(']') != string::npos)
96                 str = '{' + str + '}';
97         os << '[' << str << ']';
98         return ret;
99 }