]> git.lyx.org Git - lyx.git/blob - src/insets/inset.C
Strip out redundant includes (193 of 'em).
[lyx.git] / src / insets / inset.C
1 /**
2  * \file inset.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Alejandro Aguilar Sierra
7  * \author Jürgen Vigna
8  * \author Lars Gullik Bjønnes
9  * \author Matthias Ettrich
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #include <config.h>
15
16 #include "inset.h"
17 #include "updatableinset.h"
18
19 #include "BufferView.h"
20 #include "gettext.h"
21
22
23 // Initialization of the counter for the inset id's,
24 unsigned int InsetOld::inset_id = 0;
25
26 InsetOld::InsetOld()
27         : InsetBase(),
28         top_x(0), top_baseline(0), scx(0),
29         id_(inset_id++), owner_(0),
30         background_color_(LColor::inherit)
31 {}
32
33
34 InsetOld::InsetOld(InsetOld const & in)
35         : InsetBase(),
36         top_x(0), top_baseline(0), scx(0),
37         id_(in.id_), owner_(0),
38         name_(in.name_), background_color_(in.background_color_)
39 {}
40
41
42 bool InsetOld::directWrite() const
43 {
44         return false;
45 }
46
47
48 InsetOld::EDITABLE InsetOld::editable() const
49 {
50         return NOT_EDITABLE;
51 }
52
53
54 bool InsetOld::autoDelete() const
55 {
56         return false;
57 }
58
59
60 #if 0
61 LyXFont const InsetOld::convertFont(LyXFont const & font) const
62 {
63 #if 1
64         return font;
65 #else
66         return LyXFont(font);
67 #endif
68 }
69 #endif
70
71
72 string const InsetOld::editMessage() const
73 {
74         return _("Opened inset");
75 }
76
77
78 LyXText * InsetOld::getLyXText(BufferView const * bv, bool /*recursive*/) const
79 {
80         if (owner())
81                 return owner()->getLyXText(bv, false);
82         else
83                 return bv->text;
84 }
85
86
87 void InsetOld::setBackgroundColor(LColor::color color)
88 {
89         background_color_ = color;
90 }
91
92
93 LColor::color InsetOld::backgroundColor() const
94 {
95         if (background_color_ == LColor::inherit) {
96                 if (owner())
97                         return owner()->backgroundColor();
98                 else
99                         return LColor::background;
100         } else
101                 return background_color_;
102 }
103
104
105 int InsetOld::id() const
106 {
107         return id_;
108 }
109
110 void InsetOld::id(int id_arg)
111 {
112         id_ = id_arg;
113 }
114
115 void InsetOld::setFont(BufferView *, LyXFont const &, bool, bool)
116 {}
117
118
119 bool InsetOld::forceDefaultParagraphs(InsetOld const * inset) const
120 {
121         if (owner())
122                 return owner()->forceDefaultParagraphs(inset);
123         return false;
124 }
125
126 int InsetOld::latexTextWidth(BufferView * bv) const
127 {
128         if (owner())
129                 return (owner()->latexTextWidth(bv));
130         return bv->workWidth();
131 }
132
133
134 int InsetOld::ascent() const
135 {
136         return dim_.asc;
137 }
138
139
140 int InsetOld::descent() const
141 {
142         return dim_.des;
143 }
144
145
146 int InsetOld::width() const
147 {
148         return dim_.wid;
149 }
150
151
152 bool InsetOld::insetAllowed(InsetOld * in) const
153 {
154         return insetAllowed(in->lyxCode());
155 }
156
157
158 bool InsetOld::checkInsertChar(LyXFont &)
159 {
160         return false;
161 }
162
163
164 bool isEditableInset(InsetOld const * i)
165 {
166         return i && i->editable();
167 }
168
169
170 bool isHighlyEditableInset(InsetOld const * i)
171 {
172         return i && i->editable() == InsetOld::HIGHLY_EDITABLE;
173 }
174