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.
16 #include "InsetCollapsable.h"
17 #include "MailInset.h"
22 /** A collapsable text inset for LaTeX insertions.
24 To write full ert (including styles and other insets) in a given
27 Note that collapsed_ encompasses both the inline and collapsed button
28 versions of this inset.
33 class InsetERT : public InsetCollapsable {
36 InsetERT(BufferParams const &, CollapseStatus status = Open);
39 InsetERT(BufferParams const &,
40 Language const *, std::string const & contents, CollapseStatus status);
45 InsetCode lyxCode() const { return ERT_CODE; }
47 docstring name() const { return from_ascii("ERT"); }
49 void write(std::ostream & os) const;
51 docstring editMessage() const;
53 bool insetAllowed(InsetCode code) const;
55 int latex(odocstream &, OutputParams const &) const;
57 int plaintext(odocstream &, OutputParams const &) const;
59 int docbook(odocstream &, OutputParams const &) const;
61 void validate(LaTeXFeatures &) const {}
63 void draw(PainterInfo & pi, int x, int y) const;
65 bool showInsetDialog(BufferView *) const;
67 virtual bool forceEmptyLayout() const { return true; }
69 virtual bool allowParagraphCustomization(idx_type) const { return false; }
70 /// should paragraph indendation be omitted in any case?
71 bool neverIndent() const { return true; }
73 InsetERT(InsetERT const &);
75 virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
77 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
80 virtual Inset * clone() const;
82 void setButtonLabel();
84 bool allowSpellCheck() const { return false; }
88 class InsetERTMailer : public MailInset {
91 InsetERTMailer(InsetERT & inset);
93 virtual Inset & inset() const { return inset_; }
95 virtual std::string const & name() const { return name_; }
97 virtual std::string const inset2string(Buffer const &) const;
99 static void string2params(std::string const &,
100 InsetCollapsable::CollapseStatus &);
102 static std::string const params2string(InsetCollapsable::CollapseStatus);
105 static std::string const name_;