]> git.lyx.org Git - lyx.git/blob - src/insets/InsetMarginal.cpp
use bald pointers in clone()
[lyx.git] / src / insets / InsetMarginal.cpp
1 /**
2  * \file InsetMarginal.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Jürgen Vigna
7  * \author Lars Gullik Bjønnes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "InsetMarginal.h"
15
16 #include "Buffer.h"
17 #include "gettext.h"
18 #include "OutputParams.h"
19
20 #include "support/std_ostream.h"
21
22
23 namespace lyx {
24
25
26 InsetMarginal::InsetMarginal(BufferParams const & bp)
27         : InsetFootlike(bp)
28 {
29         setLayout(bp);
30 }
31
32
33 InsetMarginal::InsetMarginal(InsetMarginal const & in)
34         : InsetFootlike(in)
35 {}
36
37
38 Inset * InsetMarginal::clone() const
39 {
40         new InsetMarginal(*this);
41 }
42
43
44 docstring const InsetMarginal::editMessage() const
45 {
46         return _("Opened Marginal Note Inset");
47 }
48
49
50 int InsetMarginal::latex(Buffer const & buf, odocstream & os,
51                          OutputParams const & runparams) const
52 {
53         os << "%\n\\marginpar{";
54         int const i = InsetText::latex(buf, os, runparams);
55         os << "%\n}";
56         return i + 2;
57 }
58
59
60 int InsetMarginal::plaintext(Buffer const & buf, odocstream & os,
61                              OutputParams const & runparams) const
62 {
63         os << '[' << buf.B_("margin") << ":\n";
64         InsetText::plaintext(buf, os, runparams);
65         os << "\n]";
66
67         return PLAINTEXT_NEWLINE + 1; // one char on a separate line
68 }
69
70
71 int InsetMarginal::docbook(Buffer const & buf, odocstream & os,
72                            OutputParams const & runparams) const
73 {
74         os << "<note role=\"margin\">";
75         int const i = InsetText::docbook(buf, os, runparams);
76         os << "</note>";
77
78         return i;
79 }
80
81
82 } // namespace lyx