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