]> git.lyx.org Git - lyx.git/blob - src/insets/InsetERT.h
Further cleanup of InsetFlex, InsetCollapsable and InsetLayout:
[lyx.git] / src / insets / InsetERT.h
1 // -*- C++ -*-
2 /**
3  * \file InsetERT.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Jürgen Vigna
8  * \author Lars Gullik Bjønnes
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef INSETERT_H
14 #define INSETERT_H
15
16 #include "InsetCollapsable.h"
17 #include "MailInset.h"
18
19
20 namespace lyx {
21
22 /** A collapsable text inset for LaTeX insertions.
23
24   To write full ert (including styles and other insets) in a given
25   space.
26
27   Note that collapsed_ encompasses both the inline and collapsed button
28   versions of this inset.
29 */
30
31 class Language;
32
33 class InsetERT : public InsetCollapsable {
34 public:
35         ///
36         InsetERT(BufferParams const &, CollapseStatus status = Open);
37 #if 0
38         ///
39         InsetERT(BufferParams const &,
40                  Language const *, std::string const & contents, CollapseStatus status);
41 #endif
42         ///
43         ~InsetERT();
44         ///
45         InsetCode lyxCode() const { return ERT_CODE; }
46         ///
47         docstring name() const { return from_ascii("ERT"); }
48         ///
49         void write(Buffer const & buf, std::ostream & os) const;
50         ///
51         virtual docstring const editMessage() const;
52         ///
53         bool insetAllowed(InsetCode code) const;
54         ///
55         int latex(Buffer const &, odocstream &,
56                   OutputParams const &) const;
57         ///
58         int plaintext(Buffer const &, odocstream &,
59                       OutputParams const &) const;
60         ///
61         int docbook(Buffer const &, odocstream &,
62                     OutputParams const &) const;
63         ///
64         void validate(LaTeXFeatures &) const {}
65         ///
66         void draw(PainterInfo & pi, int x, int y) const;
67         ///
68         bool showInsetDialog(BufferView *) const;
69         ///
70         bool forceDefaultParagraphs(idx_type) const { return true; }
71         /// should paragraph indendation be ommitted in any case?
72         bool neverIndent(Buffer const &) const { return true; }
73 protected:
74         InsetERT(InsetERT const &);
75         ///
76         virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
77         ///
78         bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
79
80 private:
81         virtual Inset * clone() const;
82         ///
83         void setButtonLabel();
84         ///
85         bool allowSpellCheck() const { return false; }
86 };
87
88
89 class InsetERTMailer : public MailInset {
90 public:
91         ///
92         InsetERTMailer(InsetERT & inset);
93         ///
94         virtual Inset & inset() const { return inset_; }
95         ///
96         virtual std::string const & name() const { return name_; }
97         ///
98         virtual std::string const inset2string(Buffer const &) const;
99         ///
100         static void string2params(std::string const &,
101                 InsetCollapsable::CollapseStatus &);
102         ///
103         static std::string const params2string(InsetCollapsable::CollapseStatus);
104 private:
105         ///
106         static std::string const name_;
107         ///
108         InsetERT & inset_;
109 };
110
111
112 } // namespace lyx
113
114 #endif