]> git.lyx.org Git - lyx.git/blob - src/insets/inset.C
cd9b7a27568de784daf0c2042233f1d8214ecc61
[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         xo_(0), yo_(0), scx(0), owner_(0),
30         background_color_(LColor::inherit)
31 {}
32
33
34 InsetOld::InsetOld(InsetOld const & in)
35         : InsetBase(),
36         xo_(0), yo_(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 void InsetOld::setBackgroundColor(LColor_color color)
78 {
79         background_color_ = color;
80 }
81
82
83 LColor_color InsetOld::backgroundColor() const
84 {
85         if (background_color_ == LColor::inherit) {
86                 if (owner())
87                         return owner()->backgroundColor();
88                 else
89                         return LColor::background;
90         } else
91                 return LColor::color(background_color_);
92 }
93
94
95 bool InsetOld::forceDefaultParagraphs(InsetOld const * inset) const
96 {
97         if (owner())
98                 return owner()->forceDefaultParagraphs(inset);
99         return false;
100 }
101
102 int InsetOld::latexTextWidth(BufferView * bv) const
103 {
104         if (owner())
105                 return (owner()->latexTextWidth(bv));
106         return bv->workWidth();
107 }
108
109
110 int InsetOld::ascent() const
111 {
112         return dim_.asc;
113 }
114
115
116 int InsetOld::descent() const
117 {
118         return dim_.des;
119 }
120
121
122 int InsetOld::width() const
123 {
124         return dim_.wid;
125 }
126
127
128 bool InsetOld::insetAllowed(InsetOld * in) const
129 {
130         return insetAllowed(in->lyxCode());
131 }
132
133
134 bool InsetOld::checkInsertChar(LyXFont &)
135 {
136         return false;
137 }
138
139
140 int InsetOld::scroll(bool recursive) const
141 {
142         if (!recursive || !owner_)
143                 return scx;
144         return 0;
145 }
146
147 bool isEditableInset(InsetOld const * i)
148 {
149         return i && i->editable();
150 }
151
152
153 bool isHighlyEditableInset(InsetOld const * i)
154 {
155         return i && i->editable() == InsetOld::HIGHLY_EDITABLE;
156 }