]> git.lyx.org Git - lyx.git/blob - src/insets/InsetFootlike.cpp
c0647b0824f99b6bafcbabc9ef4c1f0f9d137df1
[lyx.git] / src / insets / InsetFootlike.cpp
1 /**
2  * \file InsetFootlike.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Lars Gullik Bjønnes
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "InsetFootlike.h"
14
15 #include "Buffer.h"
16 #include "BufferView.h"
17 #include "BufferParams.h"
18 #include "MetricsInfo.h"
19
20 #include <iostream>
21
22 namespace lyx {
23
24
25 InsetFootlike::InsetFootlike(BufferParams const & bp)
26         : InsetCollapsable(bp)
27 {}
28
29
30 InsetFootlike::InsetFootlike(InsetFootlike const & in)
31         : InsetCollapsable(in)
32 {}
33
34
35 void InsetFootlike::metrics(MetricsInfo & mi, Dimension & dim) const
36 {
37         FontInfo tmpfont = mi.base.font;
38         mi.base.font = mi.base.bv->buffer().params().getFont().fontInfo();
39         InsetCollapsable::metrics(mi, dim);
40         mi.base.font = tmpfont;
41 }
42
43
44 void InsetFootlike::draw(PainterInfo & pi, int x, int y) const
45 {
46         FontInfo tmpfont = pi.base.font;
47         pi.base.font = pi.base.bv->buffer().params().getFont().fontInfo();
48         InsetCollapsable::draw(pi, x, y);
49         pi.base.font = tmpfont;
50 }
51
52
53 void InsetFootlike::write(Buffer const & buf, std::ostream & os) const
54 {
55         os << to_utf8(name()) << "\n";
56         InsetCollapsable::write(buf, os);
57 }
58
59
60 bool InsetFootlike::insetAllowed(InsetCode code) const
61 {
62         if (code == FOOT_CODE || code == MARGIN_CODE || code == FLOAT_CODE)
63                 return false;
64         return InsetCollapsable::insetAllowed(code);
65 }
66
67
68 } // namespace lyx