]> git.lyx.org Git - lyx.git/blob - src/insets/inset.C
ws changes only
[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 #include "LColor.h"
22
23
24 using std::string;
25
26
27 // Initialization of the counter for the inset id's,
28 unsigned int InsetOld::inset_id = 0;
29
30 InsetOld::InsetOld()
31         : InsetBase(),
32         top_x(0), top_baseline(0), scx(0),
33         id_(inset_id++), owner_(0),
34         background_color_(LColor::inherit)
35 {}
36
37
38 InsetOld::InsetOld(InsetOld const & in)
39         : InsetBase(),
40         top_x(0), top_baseline(0), scx(0),
41         id_(in.id_), owner_(0),
42         name_(in.name_), background_color_(in.background_color_)
43 {}
44
45
46 bool InsetOld::directWrite() const
47 {
48         return false;
49 }
50
51
52 InsetOld::EDITABLE InsetOld::editable() const
53 {
54         return NOT_EDITABLE;
55 }
56
57
58 bool InsetOld::autoDelete() const
59 {
60         return false;
61 }
62
63
64 #if 0
65 LyXFont const InsetOld::convertFont(LyXFont const & font) const
66 {
67 #if 1
68         return font;
69 #else
70         return LyXFont(font);
71 #endif
72 }
73 #endif
74
75
76 string const InsetOld::editMessage() const
77 {
78         return _("Opened inset");
79 }
80
81
82 LyXText * InsetOld::getLyXText(BufferView const * bv, bool /*recursive*/) const
83 {
84         if (owner())
85                 return owner()->getLyXText(bv, false);
86         else
87                 return bv->text;
88 }
89
90
91 void InsetOld::setBackgroundColor(LColor_color color)
92 {
93         background_color_ = color;
94 }
95
96
97 LColor_color InsetOld::backgroundColor() const
98 {
99         if (background_color_ == LColor::inherit) {
100                 if (owner())
101                         return owner()->backgroundColor();
102                 else
103                         return LColor::background;
104         } else
105                 return LColor::color(background_color_);
106 }
107
108
109 int InsetOld::id() const
110 {
111         return id_;
112 }
113
114 void InsetOld::id(int id_arg)
115 {
116         id_ = id_arg;
117 }
118
119 void InsetOld::setFont(BufferView *, LyXFont const &, bool, bool)
120 {}
121
122
123 bool InsetOld::forceDefaultParagraphs(InsetOld const * inset) const
124 {
125         if (owner())
126                 return owner()->forceDefaultParagraphs(inset);
127         return false;
128 }
129
130 int InsetOld::latexTextWidth(BufferView * bv) const
131 {
132         if (owner())
133                 return (owner()->latexTextWidth(bv));
134         return bv->workWidth();
135 }
136
137
138 int InsetOld::ascent() const
139 {
140         return dim_.asc;
141 }
142
143
144 int InsetOld::descent() const
145 {
146         return dim_.des;
147 }
148
149
150 int InsetOld::width() const
151 {
152         return dim_.wid;
153 }
154
155
156 bool InsetOld::insetAllowed(InsetOld * in) const
157 {
158         return insetAllowed(in->lyxCode());
159 }
160
161
162 bool InsetOld::checkInsertChar(LyXFont &)
163 {
164         return false;
165 }
166
167
168 bool isEditableInset(InsetOld const * i)
169 {
170         return i && i->editable();
171 }
172
173
174 bool isHighlyEditableInset(InsetOld const * i)
175 {
176         return i && i->editable() == InsetOld::HIGHLY_EDITABLE;
177 }