4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
8 * \author Lars Gullik Bjønnes
10 * Full author contact details are available in file CREDITS.
17 #include "insetcollapsable.h"
19 /** A collapsable text inset for LaTeX insertions.
21 To write full ert (including styles and other insets) in a given
24 Note that collapsed_ encompasses both the inline and collapsed button
25 versions of this inset.
30 class InsetERT : public InsetCollapsable {
33 InsetERT(BufferParams const &, bool collapsed = false);
35 InsetERT(InsetERT const &);
37 virtual std::auto_ptr<InsetBase> clone() const;
39 InsetERT(BufferParams const &,
40 Language const *, std::string const & contents, bool collapsed);
44 InsetOld::Code lyxCode() const { return InsetOld::ERT_CODE; }
46 void read(Buffer const & buf, LyXLex & lex);
48 void write(Buffer const & buf, std::ostream & os) const;
50 std::string const editMessage() const;
52 bool insertInset(BufferView *, InsetOld *);
54 bool insetAllowed(InsetOld::Code code) const;
56 int latex(Buffer const &, std::ostream &,
57 OutputParams const &) const;
59 int plaintext(Buffer const &, std::ostream &,
60 OutputParams const & runparams) const;
62 int linuxdoc(Buffer const &, std::ostream &,
63 OutputParams const &) const;
65 int docbook(Buffer const &, std::ostream &,
66 OutputParams const & runparams) const;
68 void validate(LaTeXFeatures &) const {}
70 void metrics(MetricsInfo &, Dimension &) const;
72 void draw(PainterInfo & pi, int x, int y) const;
74 bool showInsetDialog(BufferView *) const;
76 void getDrawFont(LyXFont &) const;
78 bool forceDefaultParagraphs(InsetOld const *) const { return true; }
80 void setStatus(CollapseStatus st);
85 priv_dispatch(FuncRequest const &, idx_type &, pos_type &);
88 void lfunMousePress(FuncRequest const &);
90 // the bool return is used to see if we opened a dialog so that we can
91 // check this from an outer inset and open the dialog of the outer inset
92 // if that one has one!
94 bool lfunMouseRelease(FuncRequest const &);
96 void lfunMouseMotion(FuncRequest const &);
100 void setButtonLabel() const;
101 /// update status on button
102 void updateStatus(bool = false) const;
104 void edit(BufferView * bv, bool left);
106 bool allowSpellCheck() const { return false; }
110 #include "mailinset.h"
112 class InsetERTMailer : public MailInset {
115 InsetERTMailer(InsetERT & inset);
117 virtual InsetBase & inset() const { return inset_; }
119 virtual std::string const & name() const { return name_; }
121 virtual std::string const inset2string(Buffer const &) const;
123 static void string2params(std::string const &,
124 InsetCollapsable::CollapseStatus &);
126 static std::string const params2string(InsetCollapsable::CollapseStatus);
129 static std::string const name_;