]> git.lyx.org Git - lyx.git/blob - src/insets/insetmarginal.C
* In the process of fixing the math background color bug, this commit transfer backgr...
[lyx.git] / src / insets / insetmarginal.C
1 /**
2  * \file insetmarginal.C
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         setInsetName(from_ascii("Marginal"));
35 }
36
37
38 InsetMarginal::InsetMarginal(InsetMarginal const & in)
39         : InsetFootlike(in)
40 {
41         setLabel(_("margin"));
42         setInsetName(from_ascii("Marginal"));
43 }
44
45
46 auto_ptr<InsetBase> InsetMarginal::doClone() const
47 {
48         return auto_ptr<InsetBase>(new InsetMarginal(*this));
49 }
50
51
52 docstring const InsetMarginal::editMessage() const
53 {
54         return _("Opened Marginal Note Inset");
55 }
56
57
58 int InsetMarginal::latex(Buffer const & buf, odocstream & os,
59                          OutputParams const & runparams) const
60 {
61         os << "%\n\\marginpar{";
62         int const i = InsetText::latex(buf, os, runparams);
63         os << "%\n}";
64         return i + 2;
65 }
66
67
68 int InsetMarginal::plaintext(Buffer const & buf, odocstream & os,
69                              OutputParams const & runparams) const
70 {
71         os << '[' << _("margin") << ":\n";
72         InsetText::plaintext(buf, os, runparams);
73         os << "\n]";
74
75         return PLAINTEXT_NEWLINE + 1; // one char on a separate line
76 }
77
78
79 int InsetMarginal::docbook(Buffer const & buf, odocstream & os,
80                            OutputParams const & runparams) const
81 {
82         os << "<note role=\"margin\">";
83         int const i = InsetText::docbook(buf, os, runparams);
84         os << "</note>";
85
86         return i;
87 }
88
89
90 } // namespace lyx