]> git.lyx.org Git - lyx.git/blob - src/insets/InsetIPA.h
Fix crash on recursive include (bug #8994)
[lyx.git] / src / insets / InsetIPA.h
1 // -*- C++ -*-
2 /**
3  * \file InsetIPA.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 Spitzmüller
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef INSETIPA_H
13 #define INSETIPA_H
14
15 #include "InsetText.h"
16
17 #include "Dimension.h"
18
19 #include <boost/scoped_ptr.hpp>
20
21 namespace lyx {
22
23 class RenderPreview;
24
25 namespace graphics {
26         class PreviewLoader;
27 }
28
29 /// An IPA inset with instant preview
30 class InsetIPA : public InsetText {
31         
32 public:
33         ///
34         InsetIPA(Buffer *);
35         ///
36         ~InsetIPA();
37         ///
38         InsetIPA(InsetIPA const & other);
39
40         /// \name Methods inherited from Inset class
41         //@{
42         Inset * clone() const { return new InsetIPA(*this); }
43
44         bool neverIndent() const { return true; }
45         
46         InsetCode lyxCode() const { return IPA_CODE; }
47         
48         docstring layoutName() const { return from_ascii("IPA"); }
49         
50         bool descendable(BufferView const & /*bv*/) const { return true; }
51
52         void metrics(MetricsInfo & mi, Dimension & dim) const;
53
54         Inset * editXY(Cursor & cur, int x, int y);
55
56         void draw(PainterInfo & pi, int x, int y) const;
57
58         ///
59         void doDispatch(Cursor & cur, FuncRequest & cmd);
60         ///
61         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
62
63         void addPreview(DocIterator const & inset_pos,
64                 graphics::PreviewLoader & ploader) const;
65
66         bool notifyCursorLeaves(Cursor const & old, Cursor & cur);
67
68         void write(std::ostream & os) const;
69
70         void edit(Cursor & cur, bool front, EntryDirection entry_from);
71         
72         ///
73         void latex(otexstream &, OutputParams const &) const;
74         ///
75         void validate(LaTeXFeatures & features) const;
76         ///
77         bool allowSpellCheck() const { return false; }
78         ///
79         bool insetAllowed(InsetCode code) const;
80         //@}
81         
82 protected:
83         /// Retrieves the preview state. Returns true if preview
84         /// is enabled and the preview image is availabled.
85         bool previewState(BufferView * bv) const;
86         /// Recreates the preview if preview is enabled.
87         void reloadPreview(DocIterator const & pos) const;
88         /// Prepare the preview if preview is enabled.
89         void preparePreview(DocIterator const & pos) const;
90
91         ///
92         boost::scoped_ptr<RenderPreview> preview_;
93         ///
94         mutable bool use_preview_;
95
96 private:
97         ///
98         mutable Dimension dim_;
99 };
100
101
102 } // namespace lyx
103
104
105 #endif
106