]> git.lyx.org Git - lyx.git/blob - src/insets/insetert.h
Use UTF8 for LaTeX export.
[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 &, CollapseStatus status = Open);
34 #if 0
35         ///
36         InsetERT(BufferParams const &,
37                  Language const *, std::string const & contents, CollapseStatus status);
38 #endif
39         ///
40         ~InsetERT();
41         ///
42         InsetBase::Code lyxCode() const { return InsetBase::ERT_CODE; }
43         ///
44         void write(Buffer const & buf, std::ostream & os) const;
45         ///
46         void read(Buffer const & buf, LyXLex & lex);
47         ///
48         virtual lyx::docstring const editMessage() const;
49         ///
50         bool insetAllowed(InsetBase::Code code) const;
51         ///
52         int latex(Buffer const &, lyx::odocstream &,
53                   OutputParams const &) const;
54         ///
55         int plaintext(Buffer const &, lyx::odocstream &,
56                   OutputParams const & runparams) const;
57         ///
58         int docbook(Buffer const &, std::ostream &,
59                     OutputParams const & runparams) const;
60         ///
61         void validate(LaTeXFeatures &) const {}
62         ///
63         void metrics(MetricsInfo &, Dimension &) const;
64         ///
65         void draw(PainterInfo & pi, int x, int y) const;
66         ///
67         bool showInsetDialog(BufferView *) const;
68         ///
69         void getDrawFont(LyXFont &) const;
70         ///
71         bool forceDefaultParagraphs(idx_type) const { return true; }
72         /// should paragraph indendation be ommitted in any case?
73         bool neverIndent() const { return true; }
74 protected:
75         InsetERT(InsetERT const &);
76         ///
77         virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
78         ///
79         bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
80 private:
81         virtual std::auto_ptr<InsetBase> doClone() const;
82         ///
83         void init();
84         ///
85         void setButtonLabel();
86         ///
87         bool allowSpellCheck() const { return false; }
88 };
89
90
91 #include "mailinset.h"
92
93 class InsetERTMailer : public MailInset {
94 public:
95         ///
96         InsetERTMailer(InsetERT & inset);
97         ///
98         virtual InsetBase & inset() const { return inset_; }
99         ///
100         virtual std::string const & name() const { return name_; }
101         ///
102         virtual std::string const inset2string(Buffer const &) const;
103         ///
104         static void string2params(std::string const &,
105                 InsetCollapsable::CollapseStatus &);
106         ///
107         static std::string const params2string(InsetCollapsable::CollapseStatus);
108 private:
109         ///
110         static std::string const name_;
111         ///
112         InsetERT & inset_;
113 };
114
115 #endif