]> git.lyx.org Git - lyx.git/blob - src/insets/InsetMarginal.cpp
83a42f287a67939b16ca305af5ca9bf14b98b70e
[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 "gettext.h"
17 #include "Paragraph.h"
18 #include "OutputParams.h"
19
20 #include "support/std_ostream.h"
21
22
23 namespace lyx {
24
25 using std::string;
26 using std::auto_ptr;
27 using std::ostream;
28
29
30 InsetMarginal::InsetMarginal(BufferParams const & bp)
31         : InsetFootlike(bp)
32 {
33         setLabel(_("margin"));
34 }
35
36
37 InsetMarginal::InsetMarginal(InsetMarginal const & in)
38         : InsetFootlike(in)
39 {
40         setLabel(_("margin"));
41 }
42
43
44 auto_ptr<InsetBase> InsetMarginal::doClone() const
45 {
46         return auto_ptr<InsetBase>(new InsetMarginal(*this));
47 }
48
49
50 docstring const InsetMarginal::editMessage() const
51 {
52         return _("Opened Marginal Note Inset");
53 }
54
55
56 int InsetMarginal::latex(Buffer const & buf, odocstream & os,
57                          OutputParams const & runparams) const
58 {
59         os << "%\n\\marginpar{";
60         int const i = InsetText::latex(buf, os, runparams);
61         os << "%\n}";
62         return i + 2;
63 }
64
65
66 int InsetMarginal::plaintext(Buffer const & buf, odocstream & os,
67                              OutputParams const & runparams) const
68 {
69         os << '[' << _("margin") << ":\n";
70         InsetText::plaintext(buf, os, runparams);
71         os << "\n]";
72
73         return PLAINTEXT_NEWLINE + 1; // one char on a separate line
74 }
75
76
77 int InsetMarginal::docbook(Buffer const & buf, odocstream & os,
78                            OutputParams const & runparams) const
79 {
80         os << "<note role=\"margin\">";
81         int const i = InsetText::docbook(buf, os, runparams);
82         os << "</note>";
83
84         return i;
85 }
86
87
88 } // namespace lyx