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 "support/lstrings.h"
22
23 #include <iostream>
24
25 using namespace std;
26
27 namespace lyx {
28
29 using support::token;
30
InsetFootlike(Buffer * buf)31 InsetFootlike::InsetFootlike(Buffer * buf)
32 : InsetCollapsible(buf)
33 {}
34
35
metrics(MetricsInfo & mi,Dimension & dim) const36 void InsetFootlike::metrics(MetricsInfo & mi, Dimension & dim) const
37 {
38 FontInfo tmpfont = mi.base.font;
39 mi.base.font = mi.base.bv->buffer().params().getFont().fontInfo();
40 InsetCollapsible::metrics(mi, dim);
41 mi.base.font = tmpfont;
42 }
43
44
draw(PainterInfo & pi,int x,int y) const45 void InsetFootlike::draw(PainterInfo & pi, int x, int y) const
46 {
47 FontInfo tmpfont = pi.base.font;
48 pi.base.font = pi.base.bv->buffer().params().getFont().fontInfo();
49 InsetCollapsible::draw(pi, x, y);
50 pi.base.font = tmpfont;
51 }
52
53
write(ostream & os) const54 void InsetFootlike::write(ostream & os) const
55 {
56 // The layoutName may contain a "InTitle" qualifier
57 os << to_utf8(token(layoutName(), char_type(':'), 0)) << "\n";
58 InsetCollapsible::write(os);
59 }
60
61
insetAllowed(InsetCode code) const62 bool InsetFootlike::insetAllowed(InsetCode code) const
63 {
64 if (code == FOOT_CODE || code == MARGIN_CODE || code == FLOAT_CODE)
65 return false;
66 return InsetCollapsible::insetAllowed(code);
67 }
68
69
70 } // namespace lyx
71