]> git.lyx.org Git - lyx.git/blob - src/insets/InsetERT.h
176c412fd99c1eb8dc05b4aa0a20589c2f96c031
[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(std::ostream & os) const;
50         ///
51         docstring editMessage() const;
52         ///
53         bool insetAllowed(InsetCode code) const;
54         ///
55         int latex(odocstream &, OutputParams const &) const;
56         ///
57         int plaintext(odocstream &, OutputParams const &) const;
58         ///
59         int docbook(odocstream &, OutputParams const &) const;
60         ///
61         void validate(LaTeXFeatures &) const {}
62         ///
63         void draw(PainterInfo & pi, int x, int y) const;
64         ///
65         bool showInsetDialog(BufferView *) const;
66         ///
67         virtual bool forceEmptyLayout() const { return true; }
68         ///
69         virtual bool allowParagraphCustomization(idx_type) const { return false; }
70         /// should paragraph indendation be omitted in any case?
71         bool neverIndent() const { return true; }
72 protected:
73         InsetERT(InsetERT const &);
74         ///
75         virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
76         ///
77         bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
78
79 private:
80         virtual Inset * clone() const;
81         ///
82         void setButtonLabel();
83         ///
84         bool allowSpellCheck() const { return false; }
85 };
86
87
88 class InsetERTMailer : public MailInset {
89 public:
90         ///
91         InsetERTMailer(InsetERT & inset);
92         ///
93         virtual Inset & inset() const { return inset_; }
94         ///
95         virtual std::string const & name() const { return name_; }
96         ///
97         virtual std::string const inset2string(Buffer const &) const;
98         ///
99         static void string2params(std::string const &,
100                 InsetCollapsable::CollapseStatus &);
101         ///
102         static std::string const params2string(InsetCollapsable::CollapseStatus);
103 private:
104         ///
105         static std::string const name_;
106         ///
107         InsetERT & inset_;
108 };
109
110
111 } // namespace lyx
112
113 #endif