]> git.lyx.org Git - lyx.git/blob - src/insets/InsetOptArg.cpp
Show corners of mathed with mouse hover, details see bug 3825
[lyx.git] / src / insets / InsetOptArg.cpp
1 /**
2  * \file InsetOptArg.cpp
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 "Color.h"
18 #include "Paragraph.h"
19
20 #include <sstream>
21
22
23 namespace lyx {
24
25 using std::string;
26 using std::auto_ptr;
27 using std::ostream;
28 using std::ostringstream;
29
30
31 InsetOptArg::InsetOptArg(BufferParams const & ins)
32         : InsetCollapsable(ins)
33 {
34         Font font(Font::ALL_SANE);
35         font.setColor(Color::collapsable);
36         setLabelFont(font);
37         setLabel(_("opt"));
38 }
39
40
41 InsetOptArg::InsetOptArg(InsetOptArg const & in)
42         : InsetCollapsable(in)
43 {
44         Font font(Font::ALL_SANE);
45         font.setColor(Color::collapsable);
46         setLabelFont(font);
47         setLabel(_("opt"));
48 }
49
50
51 auto_ptr<Inset> InsetOptArg::doClone() const
52 {
53         return auto_ptr<Inset>(new InsetOptArg(*this));
54 }
55
56
57 docstring const InsetOptArg::editMessage() const
58 {
59         return _("Opened Optional Argument Inset");
60 }
61
62
63 void InsetOptArg::write(Buffer const & buf, ostream & os) const
64 {
65         os << "OptArg" << "\n";
66         InsetCollapsable::write(buf, os);
67 }
68
69
70 int InsetOptArg::latex(Buffer const &, odocstream &,
71                        OutputParams const &) const
72 {
73         return 0;
74 }
75
76
77 int InsetOptArg::plaintext(Buffer const &, odocstream &,
78                            OutputParams const &) const
79 {
80         return 0; // do not output optional arguments
81 }
82
83
84 int InsetOptArg::docbook(Buffer const &, odocstream &,
85                          OutputParams const &) const
86 {
87         return 0;
88 }
89
90
91 int InsetOptArg::latexOptional(Buffer const & buf, odocstream & os,
92                                OutputParams const & runparams) const
93 {
94         odocstringstream ss;
95         int ret = InsetText::latex(buf, ss, runparams);
96         docstring str = ss.str();
97         if (str.find(']') != docstring::npos)
98                 str = '{' + str + '}';
99         os << '[' << str << ']';
100         return ret;
101 }
102
103
104 } // namespace lyx