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