]> git.lyx.org Git - lyx.git/blob - src/insets/InsetArgument.cpp
Cocoa based Qt-4.6 needs to paint every character separately to match metrics computa...
[lyx.git] / src / insets / InsetArgument.cpp
1 /**
2  * \file InsetArgument.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 "InsetArgument.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 InsetArgument::InsetArgument(Buffer * buf)
25         : InsetCollapsable(buf)
26 {}
27
28
29 void InsetArgument::write(ostream & os) const
30 {
31         os << "Argument" << "\n";
32         InsetCollapsable::write(os);
33 }
34
35
36 void InsetArgument::latex(otexstream &, OutputParams const &) const
37 {}
38
39
40 int InsetArgument::plaintext(odocstream &, OutputParams const &) const
41 {
42         return 0; // do not output optional arguments
43 }
44
45
46 int InsetArgument::docbook(odocstream &, OutputParams const &) const
47 {
48         return 0;
49 }
50
51
52 docstring InsetArgument::xhtml(XHTMLStream &, OutputParams const &) const
53 {
54         return docstring();
55 }
56
57 void InsetArgument::latexArgument(otexstream & os,
58                 OutputParams const & runparams, bool optional) const
59 {
60         TexRow texrow;
61         odocstringstream ss;
62         otexstream ots(ss, texrow);
63         InsetText::latex(ots, runparams);
64         docstring str = ss.str();
65         if (optional && str.find(']') != docstring::npos)
66                 str = '{' + str + '}';
67         os << (optional ? '[' : '{') << str
68            << (optional ? ']' : '}');
69 }
70
71
72 } // namespace lyx