]> git.lyx.org Git - lyx.git/blob - src/insets/insetert.h
Rename insets/insetxxx to insets/InsetXxx, part 1
[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         InsetBase::Code lyxCode() const { return InsetBase::ERT_CODE; }
46         ///
47         void write(Buffer const & buf, std::ostream & os) const;
48         ///
49         void read(Buffer const & buf, LyXLex & lex);
50         ///
51         virtual docstring const editMessage() const;
52         ///
53         bool insetAllowed(InsetBase::Code 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         bool metrics(MetricsInfo &, Dimension &) const;
67         ///
68         void draw(PainterInfo & pi, int x, int y) const;
69         ///
70         bool showInsetDialog(BufferView *) const;
71         ///
72         void getDrawFont(LyXFont &) const;
73         ///
74         bool forceDefaultParagraphs(idx_type) const { return true; }
75         /// should paragraph indendation be ommitted in any case?
76         bool neverIndent(Buffer const &) const { return true; }
77 protected:
78         InsetERT(InsetERT const &);
79         ///
80         virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
81         ///
82         bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
83 private:
84         virtual std::auto_ptr<InsetBase> doClone() const;
85         ///
86         void init();
87         ///
88         void setButtonLabel();
89         ///
90         bool allowSpellCheck() const { return false; }
91 };
92
93
94 class InsetERTMailer : public MailInset {
95 public:
96         ///
97         InsetERTMailer(InsetERT & inset);
98         ///
99         virtual InsetBase & inset() const { return inset_; }
100         ///
101         virtual std::string const & name() const { return name_; }
102         ///
103         virtual std::string const inset2string(Buffer const &) const;
104         ///
105         static void string2params(std::string const &,
106                 InsetCollapsable::CollapseStatus &);
107         ///
108         static std::string const params2string(InsetCollapsable::CollapseStatus);
109 private:
110         ///
111         static std::string const name_;
112         ///
113         InsetERT & inset_;
114 };
115
116
117 } // namespace lyx
118
119 #endif