]> git.lyx.org Git - lyx.git/blob - src/insets/InsetOptArg.cpp
progress on buffer-reference-in-insets. beware of instabilities...
[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 "support/debug.h"
16 #include "support/docstream.h"
17 #include "support/gettext.h"
18
19 using namespace std;
20
21 namespace lyx {
22
23
24 InsetOptArg::InsetOptArg(BufferParams const & ins)
25         : InsetCollapsable(ins)
26 {}
27
28
29 InsetOptArg::InsetOptArg(InsetOptArg const & in)
30         : InsetCollapsable(in)
31 {}
32
33
34 Inset * InsetOptArg::clone() const
35 {
36         return new InsetOptArg(*this);
37 }
38
39
40 docstring InsetOptArg::editMessage() const
41 {
42         return _("Opened Optional Argument Inset");
43 }
44
45
46 void InsetOptArg::write(ostream & os) const
47 {
48         os << "OptArg" << "\n";
49         InsetCollapsable::write(os);
50 }
51
52
53 int InsetOptArg::latex(odocstream &, OutputParams const &) const
54 {
55         return 0;
56 }
57
58
59 int InsetOptArg::plaintext(odocstream &, OutputParams const &) const
60 {
61         return 0; // do not output optional arguments
62 }
63
64
65 int InsetOptArg::docbook(odocstream &, OutputParams const &) const
66 {
67         return 0;
68 }
69
70
71 int InsetOptArg::latexOptional(odocstream & os,
72                                OutputParams const & runparams) const
73 {
74         odocstringstream ss;
75         int ret = InsetText::latex(ss, runparams);
76         docstring str = ss.str();
77         if (str.find(']') != docstring::npos)
78                 str = '{' + str + '}';
79         os << '[' << str << ']';
80         return ret;
81 }
82
83
84 } // namespace lyx