]> git.lyx.org Git - lyx.git/blob - src/insets/InsetFootlike.cpp
* ANNOUNCE
[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 "Font.h"
19 #include "MetricsInfo.h"
20
21 #include <iostream>
22
23 using namespace std;
24
25 namespace lyx {
26
27
28 InsetFootlike::InsetFootlike(Buffer * buf)
29         : InsetCollapsable(buf)
30 {}
31
32
33 void InsetFootlike::metrics(MetricsInfo & mi, Dimension & dim) const
34 {
35         FontInfo tmpfont = mi.base.font;
36         mi.base.font = mi.base.bv->buffer().params().getFont().fontInfo();
37         InsetCollapsable::metrics(mi, dim);
38         mi.base.font = tmpfont;
39 }
40
41
42 void InsetFootlike::draw(PainterInfo & pi, int x, int y) const
43 {
44         FontInfo tmpfont = pi.base.font;
45         pi.base.font = pi.base.bv->buffer().params().getFont().fontInfo();
46         InsetCollapsable::draw(pi, x, y);
47         pi.base.font = tmpfont;
48 }
49
50
51 void InsetFootlike::write(ostream & os) const
52 {
53         os << to_utf8(name()) << "\n";
54         InsetCollapsable::write(os);
55 }
56
57
58 bool InsetFootlike::insetAllowed(InsetCode code) const
59 {
60         if (code == FOOT_CODE || code == MARGIN_CODE || code == FLOAT_CODE)
61                 return false;
62         return InsetCollapsable::insetAllowed(code);
63 }
64
65
66 } // namespace lyx