]> git.lyx.org Git - lyx.git/blob - src/insets/InsetMarginal.cpp
Improve handling of top and bottom margin
[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 "BufferParams.h"
18 #include "OutputParams.h"
19 #include "output_docbook.h"
20 #include "TocBackend.h"
21
22 #include "support/docstream.h"
23 #include "support/gettext.h"
24 #include "support/lstrings.h"
25
26 namespace lyx {
27
28
29 InsetMarginal::InsetMarginal(Buffer * buf)
30         : InsetFootlike(buf)
31 {}
32
33
34 int InsetMarginal::plaintext(odocstringstream & os,
35                              OutputParams const & runparams, size_t max_length) const
36 {
37         os << '[' << buffer().B_("margin") << ":\n";
38         InsetText::plaintext(os, runparams, max_length);
39         os << "\n]";
40
41         return PLAINTEXT_NEWLINE + 1; // one char on a separate line
42 }
43
44
45 void InsetMarginal::docbook(XMLStream & xs, OutputParams const & runparams) const
46 {
47         // Implementation as per http://www.sagehill.net/docbookxsl/SideFloats.html
48         // Unfortunately, only for XSL-FO output with the default style sheets, hence the role.
49         xs << xml::StartTag("sidebar", "role=\"margin\"");
50         xs << xml::CR();
51         xs << "<?dbfo float-type=\"margin.note\"?>";
52         InsetText::docbook(xs, runparams);
53         xs << xml::EndTag("sidebar");
54 }
55
56
57 } // namespace lyx