2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 1998 The LyX Team.
9 *======================================================
11 // The pristine updatable inset: Text
21 #include "insetcollapsable.h"
22 #include <sigc++/signal_system.h>
24 /** A collapsable text inset for LaTeX insertions.
26 To write full ert (including styles and other insets) in a given
29 Note that collapsed_ encompasses both the inline and collapsed button
30 versions of this inset.
32 class InsetERT : public InsetCollapsable {
41 InsetERT(bool collapsed=false);
43 InsetERT(InsetERT const &, bool same_id = false);
45 Inset * clone(Buffer const &, bool same_id = false) const;
47 InsetERT(string const & contents, bool collapsed);
51 Inset::Code lyxCode() const { return Inset::ERT_CODE; }
53 void read(Buffer const * buf, LyXLex & lex);
55 void write(Buffer const * buf, std::ostream & os) const;
57 string const editMessage() const;
59 bool insertInset(BufferView *, Inset *);
61 bool insetAllowed(Inset::Code) const { return false; }
63 void setFont(BufferView *, LyXFont const &,
64 bool toggleall = false, bool selectall = false);
66 void edit(BufferView *, int, int, unsigned int);
68 void edit(BufferView * bv, bool front = true);
70 EDITABLE editable() const;
72 SigC::Signal0<void> hideDialog;
74 void insetButtonRelease(BufferView * bv, int x, int y, int button);
76 int latex(Buffer const *, std::ostream &, bool fragile,
79 int ascii(Buffer const *,
80 std::ostream &, int linelen = 0) const;
82 int linuxdoc(Buffer const *, std::ostream &) const;
84 int docbook(Buffer const *, std::ostream &) const;
86 void validate(LaTeXFeatures &) const {}
88 UpdatableInset::RESULT localDispatch(BufferView *, kb_action,
91 bool checkInsertChar(LyXFont &);
93 // this are needed here because of the label/inlined functionallity
95 bool needFullRow() const { return status_ == Open; }
97 bool isOpen() const { return status_ == Open || status_ == Inlined; }
99 bool inlined() const { return status_ == Inlined; }
101 ERTStatus status() const { return status_; }
103 void open(BufferView *);
105 void close(BufferView *) const;
107 bool allowSpellcheck() { return false; }
108 string const selectNextWordToSpellcheck(BufferView *, float &) const;
110 int ascent(BufferView *, LyXFont const &) const;
112 int descent(BufferView *, LyXFont const &) const;
114 int width(BufferView *, LyXFont const &) const;
116 void draw(BufferView *, const LyXFont &, int , float &, bool) const;
117 /// set the status of the inset
118 void status(BufferView *, ERTStatus const st) const;
120 bool showInsetDialog(BufferView *) const;
126 string const get_new_label() const;
128 void setButtonLabel() const;
130 void set_latex_font(BufferView *);
131 /// update status on button
132 void updateStatus(BufferView *, bool = false) const;
135 mutable ERTStatus status_;