]> git.lyx.org Git - lyx.git/blob - src/insets/InsetIPA.h
124516349c1ed72341568e69b47da5dbb1594029
[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         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
60
61         void addPreview(DocIterator const & inset_pos,
62                 graphics::PreviewLoader & ploader) const;
63
64         bool notifyCursorLeaves(Cursor const & old, Cursor & cur);
65
66         void write(std::ostream & os) const;
67
68         void edit(Cursor & cur, bool front, EntryDirection entry_from);
69         
70         ///
71         void latex(otexstream &, OutputParams const &) const;
72         ///
73         void validate(LaTeXFeatures & features) const;
74         ///
75         bool allowSpellCheck() const { return false; }
76         ///
77         bool insetAllowed(InsetCode code) const;
78         //@}
79         
80 protected:
81         /// Retrieves the preview state. Returns true if preview
82         /// is enabled and the preview image is availabled.
83         bool previewState(BufferView * bv) const;
84         /// Recreates the preview if preview is enabled.
85         void reloadPreview(DocIterator const & pos) const;
86         /// Prepare the preview if preview is enabled.
87         void preparePreview(DocIterator const & pos) const;
88
89         ///
90         boost::scoped_ptr<RenderPreview> preview_;
91         ///
92         mutable bool use_preview_;
93
94 private:
95         ///
96         mutable Dimension dim_;
97 };
98
99
100 } // namespace lyx
101
102
103 #endif
104