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