1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 1998 The LyX Team.
8 *======================================================*/
13 #pragma implementation
20 #include "insets/insettext.h"
21 #include "support/LOstream.h"
22 #include "lyx_gui_misc.h"
28 setLabel(_("666"), true);
29 labelfont = LyXFont(LyXFont::ALL_SANE);
33 labelfont.setLatex(LyXFont::ON);
35 labelfont.setColor(LColor::latex);
37 setAutoCollapse(false);
41 InsetERT::InsetERT() : InsetCollapsable()
47 InsetERT::InsetERT(string const & contents, bool collapsed)
48 : InsetCollapsable(collapsed)
52 LyXFont const font(LyXFont::ALL_INHERIT);
53 string::const_iterator cit = contents.begin();
54 string::const_iterator end = contents.end();
55 Paragraph::size_type pos = 0;
56 for (; cit != end; ++cit) {
57 inset.paragraph()->insertChar(pos++, *cit, font);
62 void InsetERT::write(Buffer const * buf, ostream & os) const
64 os << getInsetName() << "\n";
65 InsetCollapsable::write(buf, os);
69 Inset * InsetERT::clone(Buffer const &, bool same_id) const
71 InsetERT * result = new InsetERT;
72 result->inset.init(&inset, same_id);
74 result->collapsed_ = collapsed_;
81 string const InsetERT::editMessage() const
83 return _("Opened ERT Inset");
87 bool InsetERT::insertInset(BufferView *, Inset *)
93 void InsetERT::setFont(BufferView *, LyXFont const &, bool, bool selectall)
95 // if selectall is activated then the fontchange was an outside general
96 // fontchange and this messages is not needed
98 WriteAlert(_("Impossible Operation!"),
99 _("Not permitted to change font-types inside ERT-insets!"),
104 void InsetERT::edit(BufferView * bv, int x, int y, unsigned int button)
106 InsetCollapsable::edit(bv, x, y, button);
108 LyXFont font(LyXFont::ALL_SANE);
109 font.setLatex (LyXFont::ON);
114 void InsetERT::edit(BufferView * bv, bool)
120 int InsetERT::latex(Buffer const *, std::ostream & os, bool /*fragile*/,
121 bool /*free_spc*/) const
123 Paragraph * par = inset.paragraph();
125 Paragraph::size_type siz = inset.paragraph()->size();
126 for (Paragraph::size_type i = 0; i != siz; ++i) {
127 char c = inset.paragraph()->getChar(i);
129 case Paragraph::META_NEWLINE:
144 int InsetERT::ascii(Buffer const *,
145 std::ostream &, int /*linelen*/) const
151 int InsetERT::linuxdoc(Buffer const *, std::ostream &) const
157 int InsetERT::docBook(Buffer const *, std::ostream &) const