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