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(Buffer const & buf, std::ostream & os) const;
51 virtual docstring const editMessage() const;
53 bool insetAllowed(InsetCode code) const;
55 int latex(Buffer const &, odocstream &,
56 OutputParams const &) const;
58 int plaintext(Buffer const &, odocstream &,
59 OutputParams const &) const;
61 int docbook(Buffer const &, odocstream &,
62 OutputParams const &) const;
64 void validate(LaTeXFeatures &) const {}
66 void metrics(MetricsInfo &, Dimension &) const;
68 void draw(PainterInfo & pi, int x, int y) const;
70 bool showInsetDialog(BufferView *) const;
72 bool forceDefaultParagraphs(idx_type) const { return true; }
73 /// should paragraph indendation be ommitted in any case?
74 bool neverIndent(Buffer const &) const { return true; }
76 InsetERT(InsetERT const &);
78 virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
80 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
82 void resetParagraphsFont();
84 void getDrawFont(FontInfo &) const;
87 virtual Inset * clone() const;
91 void setButtonLabel();
93 bool allowSpellCheck() const { return false; }
97 class InsetERTMailer : public MailInset {
100 InsetERTMailer(InsetERT & inset);
102 virtual Inset & inset() const { return inset_; }
104 virtual std::string const & name() const { return name_; }
106 virtual std::string const inset2string(Buffer const &) const;
108 static void string2params(std::string const &,
109 InsetCollapsable::CollapseStatus &);
111 static std::string const params2string(InsetCollapsable::CollapseStatus);
114 static std::string const name_;