]> git.lyx.org Git - lyx.git/blob - src/insets/insetert.C
Added using directive.
[lyx.git] / src / insets / insetert.C
1 /* This file is part of
2  * ======================================================
3  * 
4  *           LyX, The Document Processor
5  *       
6  *          Copyright 1998 The LyX Team.
7  *
8  *======================================================*/
9
10 #include <config.h>
11
12 #ifdef __GNUG__
13 #pragma implementation
14 #endif
15
16 #include "insetert.h"
17 #include "gettext.h"
18 #include "lyxfont.h"
19 #include "buffer.h"
20 #include "insets/insettext.h"
21 #include "support/LOstream.h"
22 #include "lyx_gui_misc.h"
23
24 using std::ostream;
25
26 InsetERT::InsetERT() : InsetCollapsable()
27 {
28         setLabel(_("666"));
29 #ifndef NO_LATEX
30         LyXFont font(LyXFont::ALL_SANE);
31         font.setLatex (LyXFont::ON);
32 #endif
33         labelfont = LyXFont(LyXFont::ALL_SANE);
34         labelfont.decSize();
35         labelfont.decSize();
36         labelfont.setColor(LColor::latex);
37         setAutoCollapse(false);
38         setInsetName("ERT");
39 }
40
41
42 void InsetERT::write(Buffer const * buf, ostream & os) const 
43 {
44         os << getInsetName() << "\n";
45         InsetCollapsable::write(buf, os);
46 }
47
48
49 Inset * InsetERT::clone(Buffer const &) const
50 {
51         InsetERT * result = new InsetERT;
52         result->inset.init(&inset);
53         
54         result->collapsed = collapsed;
55         return result;
56 }
57
58
59 string const InsetERT::editMessage() const 
60 {
61         return _("Opened ERT Inset");
62 }
63
64
65 bool InsetERT::insertInset(BufferView *, Inset *)
66 {
67         return false;
68 }
69
70
71 void InsetERT::setFont(BufferView *, LyXFont const &, bool, bool selectall)
72 {
73         // if selectall is activated then the fontchange was an outside general
74         // fontchange and this messages is not needed
75         if (!selectall)
76                 WriteAlert(_("Impossible Operation!"),
77                            _("Not permitted to change font-types inside ERT-insets!"),
78                            _("Sorry."));
79 }
80
81
82 void InsetERT::edit(BufferView * bv, int x, int y, unsigned int button)
83 {
84         InsetCollapsable::edit(bv, x, y, button);
85 #ifndef NO_LATEX
86         LyXFont font(LyXFont::ALL_SANE);
87         font.setLatex (LyXFont::ON);
88 #endif
89 }
90
91
92 int InsetERT::latex(Buffer const *, std::ostream & os, bool /*fragile*/,
93                     bool /*free_spc*/) const
94 {
95         Paragraph::size_type siz = inset.par->size();
96         for (Paragraph::size_type i = 0; i != siz; ++i) {
97                 os << inset.par->getChar(i);
98         }
99         return 1;
100 }
101
102
103 int InsetERT::ascii(Buffer const *,
104                     std::ostream &, int /*linelen*/) const 
105 {
106         return 0;
107 }
108
109
110 int InsetERT::linuxdoc(Buffer const *, std::ostream &) const
111 {
112         return 0;
113 }
114
115
116 int InsetERT::docBook(Buffer const *, std::ostream &) const
117 {
118         return 0;
119 }