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