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 insetAllowed(InsetOld::Code code) const;
54 int latex(Buffer const &, std::ostream &,
55 OutputParams const &) const;
57 int plaintext(Buffer const &, std::ostream &,
58 OutputParams const & runparams) const;
60 int linuxdoc(Buffer const &, std::ostream &,
61 OutputParams const &) const;
63 int docbook(Buffer const &, std::ostream &,
64 OutputParams const & runparams) const;
66 void validate(LaTeXFeatures &) const {}
68 void metrics(MetricsInfo &, Dimension &) const;
70 void draw(PainterInfo & pi, int x, int y) const;
72 bool showInsetDialog(BufferView *) const;
74 void getDrawFont(LyXFont &) const;
76 bool forceDefaultParagraphs(InsetOld const *) const { return true; }
78 void setStatus(CollapseStatus st);
83 priv_dispatch(FuncRequest const &, idx_type &, pos_type &);
86 void lfunMousePress(FuncRequest const &);
88 // the bool return is used to see if we opened a dialog so that we can
89 // check this from an outer inset and open the dialog of the outer inset
90 // if that one has one!
92 bool lfunMouseRelease(FuncRequest const &);
94 void lfunMouseMotion(FuncRequest const &);
98 void setButtonLabel() const;
99 /// update status on button
100 void updateStatus(bool = false) const;
102 void edit(BufferView * bv, bool left);
104 bool allowSpellCheck() const { return false; }
108 #include "mailinset.h"
110 class InsetERTMailer : public MailInset {
113 InsetERTMailer(InsetERT & inset);
115 virtual InsetBase & inset() const { return inset_; }
117 virtual std::string const & name() const { return name_; }
119 virtual std::string const inset2string(Buffer const &) const;
121 static void string2params(std::string const &,
122 InsetCollapsable::CollapseStatus &);
124 static std::string const params2string(InsetCollapsable::CollapseStatus);
127 static std::string const name_;