]> git.lyx.org Git - lyx.git/blob - src/insets/InsetERT.h
4be3ece467e55f6e14784e15dd43a8662f359524
[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 "RenderPreview.h"
18 #include "graphics/PreviewLoader.h"
19
20 #include <boost/scoped_ptr.hpp>
21
22 namespace lyx {
23
24 /** A collapsable text inset for LaTeX insertions.
25
26   To write full ert (including styles and other insets) in a given
27   space.
28
29   Note that collapsed_ encompasses both the inline and collapsed button
30   versions of this inset.
31 */
32
33 class Language;
34
35 class InsetERT : public InsetCollapsable {
36 public:
37         ///
38         InsetERT(Buffer *, CollapseStatus status = Open);
39         ///
40         InsetERT(InsetERT const & other);
41         ///
42         ~InsetERT();
43         //
44         InsetERT & operator=(InsetERT const & other);
45         ///
46         static CollapseStatus string2params(std::string const &);
47         ///
48         static std::string params2string(CollapseStatus);
49         ///
50         void addPreview(DocIterator const & inset_pos,
51                 graphics::PreviewLoader & ploader) const;
52         ///
53         void preparePreview(DocIterator const & pos) const;
54         ///
55         void reloadPreview(DocIterator const & pos) const;
56         ///
57         bool notifyCursorLeaves(Cursor const & old, Cursor & cur);
58         ///
59         void draw(PainterInfo & pi, int x, int y) const;
60         ///
61         Inset * editXY(Cursor & cur, int x, int y);
62         ///
63         void metrics(MetricsInfo & mi, Dimension & dim) const;
64         ///
65         bool previewState(BufferView * bv) const;
66 private:
67         ///
68         InsetCode lyxCode() const { return ERT_CODE; }
69         ///
70         docstring name() const { return from_ascii("ERT"); }
71         ///
72         void write(std::ostream & os) const;
73         ///
74         int plaintext(odocstream &, OutputParams const &) const;
75         ///
76         int docbook(odocstream &, OutputParams const &) const;
77         ///
78         docstring xhtml(XHTMLStream &, OutputParams const &) const;
79         ///
80         void validate(LaTeXFeatures &) const {}
81         ///
82         bool showInsetDialog(BufferView *) const;
83         /// should paragraph indendation be omitted in any case?
84         bool neverIndent() const { return true; }
85         ///
86         void doDispatch(Cursor & cur, FuncRequest & cmd);
87         ///
88         bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
89         ///
90         Inset * clone() const { return new InsetERT(*this); }
91         ///
92         docstring const buttonLabel(BufferView const & bv) const;
93         ///
94         bool allowSpellCheck() const { return false; }
95         ///
96         boost::scoped_ptr<RenderPreview> preview_;
97         ///
98         mutable bool use_preview_;
99 };
100
101
102 } // namespace lyx
103
104 #endif