]> git.lyx.org Git - lyx.git/blob - src/insets/insetert.h
move 'Inline' state from InsetERT to InsetCollapsable
[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
17 #include "insetcollapsable.h"
18
19 /** A collapsable text inset for LaTeX insertions.
20
21   To write full ert (including styles and other insets) in a given
22   space.
23
24   Note that collapsed_ encompasses both the inline and collapsed button
25   versions of this inset.
26 */
27
28 class Language;
29
30 class InsetERT : public InsetCollapsable {
31 public:
32         ///
33         InsetERT(BufferParams const &, bool collapsed = false);
34         ///
35         InsetERT(InsetERT const &);
36         ///
37         virtual std::auto_ptr<InsetBase> clone() const;
38         ///
39         InsetERT(BufferParams const &,
40                  Language const *, std::string const & contents, bool collapsed);
41         ///
42         ~InsetERT();
43         ///
44         InsetOld::Code lyxCode() const { return InsetOld::ERT_CODE; }
45         ///
46         void read(Buffer const & buf, LyXLex & lex);
47         ///
48         void write(Buffer const & buf, std::ostream & os) const;
49         ///
50         std::string const editMessage() const;
51         ///
52         bool insertInset(BufferView *, InsetOld *);
53         ///
54         bool insetAllowed(InsetOld::Code code) const;
55         ///
56         int latex(Buffer const &, std::ostream &,
57                   OutputParams const &) const;
58         ///
59         int plaintext(Buffer const &, std::ostream &,
60                   OutputParams const & runparams) const;
61         ///
62         int linuxdoc(Buffer const &, std::ostream &,
63                      OutputParams const &) const;
64         ///
65         int docbook(Buffer const &, std::ostream &,
66                     OutputParams const & runparams) const;
67         ///
68         void validate(LaTeXFeatures &) const {}
69         ///
70         void metrics(MetricsInfo &, Dimension &) const;
71         ///
72         void draw(PainterInfo & pi, int x, int y) const;
73         ///
74         bool showInsetDialog(BufferView *) const;
75         ///
76         void getDrawFont(LyXFont &) const;
77         ///
78         bool forceDefaultParagraphs(InsetOld const *) const { return true; }
79         ///
80         void setStatus(CollapseStatus st);
81 protected:
82         ///
83         virtual
84         DispatchResult
85         priv_dispatch(FuncRequest const &, idx_type &, pos_type &);
86 private:
87         ///
88         void lfunMousePress(FuncRequest const &);
89         ///
90         // the bool return is used to see if we opened a dialog so that we can
91         // check this from an outer inset and open the dialog of the outer inset
92         // if that one has one!
93         ///
94         bool lfunMouseRelease(FuncRequest const &);
95         ///
96         void lfunMouseMotion(FuncRequest const &);
97         ///
98         void init();
99         ///
100         void setButtonLabel() const;
101         ///
102         void setLatexFont(BufferView *);
103         /// update status on button
104         void updateStatus(bool = false) const;
105         ///
106         void edit(BufferView * bv, bool left);
107         ///
108         bool allowSpellCheck() const { return false; }
109 };
110
111
112 #include "mailinset.h"
113
114 class InsetERTMailer : public MailInset {
115 public:
116         ///
117         InsetERTMailer(InsetERT & inset);
118         ///
119         virtual InsetBase & inset() const { return inset_; }
120         ///
121         virtual std::string const & name() const { return name_; }
122         ///
123         virtual std::string const inset2string(Buffer const &) const;
124         ///
125         static void string2params(std::string const &,
126                 InsetCollapsable::CollapseStatus &);
127         ///
128         static std::string const params2string(InsetCollapsable::CollapseStatus);
129 private:
130         ///
131         static std::string const name_;
132         ///
133         InsetERT & inset_;
134 };
135
136 #endif