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