]> git.lyx.org Git - lyx.git/blob - src/insets/InsetOptArg.cpp
cosmetics. mainly replace #include "dostring.h" by #include "strfwd.h"
[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
18 #include "support/docstream.h"
19
20
21 namespace lyx {
22
23
24 InsetOptArg::InsetOptArg(BufferParams const & ins)
25         : InsetCollapsable(ins)
26 {
27         FontInfo font = sane_font;
28         font.setColor(Color_collapsable);
29         setLabelFont(font);
30         setLabel(_("opt"));
31 }
32
33
34 InsetOptArg::InsetOptArg(InsetOptArg const & in)
35         : InsetCollapsable(in)
36 {
37         FontInfo font = sane_font;
38         font.setColor(Color_collapsable);
39         setLabelFont(font);
40         setLabel(_("opt"));
41 }
42
43
44 Inset * InsetOptArg::clone() const
45 {
46         return new InsetOptArg(*this);
47 }
48
49
50 docstring const InsetOptArg::editMessage() const
51 {
52         return _("Opened Optional Argument Inset");
53 }
54
55
56 void InsetOptArg::write(Buffer const & buf, std::ostream & os) const
57 {
58         os << "OptArg" << "\n";
59         InsetCollapsable::write(buf, os);
60 }
61
62
63 int InsetOptArg::latex(Buffer const &, odocstream &,
64                        OutputParams const &) const
65 {
66         return 0;
67 }
68
69
70 int InsetOptArg::plaintext(Buffer const &, odocstream &,
71                            OutputParams const &) const
72 {
73         return 0; // do not output optional arguments
74 }
75
76
77 int InsetOptArg::docbook(Buffer const &, odocstream &,
78                          OutputParams const &) const
79 {
80         return 0;
81 }
82
83
84 int InsetOptArg::latexOptional(Buffer const & buf, odocstream & os,
85                                OutputParams const & runparams) const
86 {
87         odocstringstream ss;
88         int ret = InsetText::latex(buf, ss, runparams);
89         docstring str = ss.str();
90         if (str.find(']') != docstring::npos)
91                 str = '{' + str + '}';
92         os << '[' << str << ']';
93         return ret;
94 }
95
96
97 } // namespace lyx