]> git.lyx.org Git - lyx.git/blob - src/insets/insetoptarg.C
* src/LyXAction.C: mark goto-clear-bookmark as working without buffer
[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
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         LyXFont font(LyXFont::ALL_SANE);
35         font.setColor(LColor::collapsable);
36         setLabelFont(font);
37         setLabel(_("opt"));
38 }
39
40
41 InsetOptArg::InsetOptArg(InsetOptArg const & in)
42         : InsetCollapsable(in)
43 {
44         LyXFont font(LyXFont::ALL_SANE);
45         font.setColor(LColor::collapsable);
46         setLabelFont(font);
47         setLabel(_("opt"));
48 }
49
50
51 auto_ptr<InsetBase> InsetOptArg::doClone() const
52 {
53         return auto_ptr<InsetBase>(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 int InsetOptArg::docbook(Buffer const &, odocstream &,
77                        OutputParams const &) const
78 {
79         return 0;
80 }
81
82
83 int InsetOptArg::plaintext(Buffer const &, odocstream &,
84                        OutputParams const &) const
85 {
86         return 0;
87 }
88
89
90 int InsetOptArg::latexOptional(Buffer const & buf, odocstream & os,
91                                OutputParams const & runparams) const
92 {
93         odocstringstream ss;
94         int ret = InsetText::latex(buf, ss, runparams);
95         docstring str = ss.str();
96         if (str.find(']') != docstring::npos)
97                 str = '{' + str + '}';
98         os << '[' << str << ']';
99         return ret;
100 }
101
102
103 } // namespace lyx