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 insetButtonPress(BufferView *, int x, int y, int button);
76 bool insetButtonRelease(BufferView * bv, int x, int y, int button);
78 void insetMotionNotify(BufferView *, int x, int y, int state);
80 int latex(Buffer const *, std::ostream &, bool fragile,
83 int ascii(Buffer const *,
84 std::ostream &, int linelen = 0) const;
86 int linuxdoc(Buffer const *, std::ostream &) const;
88 int docbook(Buffer const *, std::ostream &) const;
90 void validate(LaTeXFeatures &) const {}
92 UpdatableInset::RESULT localDispatch(BufferView *, kb_action,
95 bool checkInsertChar(LyXFont &);
97 // this are needed here because of the label/inlined functionallity
99 bool needFullRow() const { return status_ == Open; }
101 bool isOpen() const { return status_ == Open || status_ == Inlined; }
103 bool inlined() const { return status_ == Inlined; }
105 ERTStatus status() const { return status_; }
107 void open(BufferView *);
109 void close(BufferView *) const;
111 bool allowSpellcheck() { return false; }
112 string const selectNextWordToSpellcheck(BufferView *, float &) const;
114 int ascent(BufferView *, LyXFont const &) const;
116 int descent(BufferView *, LyXFont const &) const;
118 int width(BufferView *, LyXFont const &) const;
120 void draw(BufferView *, const LyXFont &, int , float &, bool) const;
121 /// set the status of the inset
122 void status(BufferView *, ERTStatus const st) const;
124 bool showInsetDialog(BufferView *) const;
130 string const get_new_label() const;
132 void setButtonLabel() const;
134 void set_latex_font(BufferView *);
135 /// update status on button
136 void updateStatus(BufferView *, bool = false) const;
139 mutable ERTStatus status_;