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 class InsetERT : public InsetCollapsable {
38 InsetERT(bool collapsed=false);
40 InsetERT(InsetERT const &, bool same_id = false);
42 Inset * clone(Buffer const &, bool same_id = false) const;
44 InsetERT(string const & contents, bool collapsed);
48 Inset::Code lyxCode() const { return Inset::ERT_CODE; }
50 void read(Buffer const * buf, LyXLex & lex);
52 void write(Buffer const * buf, std::ostream & os) const;
54 string const editMessage() const;
56 bool insertInset(BufferView *, Inset *);
58 bool insetAllowed(Inset::Code) const { return false; }
60 void setFont(BufferView *, LyXFont const &,
61 bool toggleall = false, bool selectall = false);
63 void edit(BufferView *, int, int, unsigned int);
65 void edit(BufferView * bv, bool front = true);
67 EDITABLE editable() const;
69 SigC::Signal0<void> hideDialog;
71 void insetButtonRelease(BufferView * bv, int x, int y, int button);
73 int latex(Buffer const *, std::ostream &, bool fragile,
76 int ascii(Buffer const *,
77 std::ostream &, int linelen = 0) const;
79 int linuxdoc(Buffer const *, std::ostream &) const;
81 int docBook(Buffer const *, std::ostream &) const;
83 UpdatableInset::RESULT localDispatch(BufferView *, kb_action,
86 bool checkInsertChar(LyXFont &);
88 // this are needed here because of the label/inlined functionallity
90 bool needFullRow() const { return status_ == Open; }
92 bool isOpen() const { return status_ == Open || status_ == Inlined; }
94 void open(BufferView *);
96 void close(BufferView *) const;
98 bool inlined() const { return status_ == Inlined; }
100 int ascent(BufferView *, LyXFont const &) const;
102 int descent(BufferView *, LyXFont const &) const;
104 int width(BufferView *, LyXFont const &) const;
106 void draw(BufferView *, const LyXFont &, int , float &, bool) const;
108 ERTStatus status() const { return status_; }
110 void status(BufferView *, ERTStatus const st) const;
112 bool showInsetDialog(BufferView *) const;
118 string const get_new_label() const;
120 void setButtonLabel() const;
122 void set_latex_font(BufferView *);
125 mutable ERTStatus status_;