]> git.lyx.org Git - lyx.git/blob - src/insets/InsetIPA.h
Fix trailing whitespace in cpp files.
[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 "support/unique_ptr.h"
20
21
22 namespace lyx {
23
24 class RenderPreview;
25
26 namespace graphics {
27         class PreviewLoader;
28 }
29
30 /// An IPA inset with instant preview
31 class InsetIPA : public InsetText {
32
33 public:
34         ///
35         InsetIPA(Buffer *);
36         ///
37         ~InsetIPA();
38         ///
39         InsetIPA(InsetIPA const & other);
40         ///
41         InsetIPA & operator=(InsetIPA const & other);
42
43         /// \name Methods inherited from Inset class
44         //@{
45         Inset * clone() const { return new InsetIPA(*this); }
46
47         bool neverIndent() const { return true; }
48
49         bool forceLocalFontSwitch() const { return true; }
50
51         InsetCode lyxCode() const { return IPA_CODE; }
52
53         docstring layoutName() const { return from_ascii("IPA"); }
54
55         bool descendable(BufferView const & /*bv*/) const { return true; }
56
57         void metrics(MetricsInfo & mi, Dimension & dim) const;
58
59         Inset * editXY(Cursor & cur, int x, int y);
60
61         void draw(PainterInfo & pi, int x, int y) const;
62
63         ///
64         void doDispatch(Cursor & cur, FuncRequest & cmd);
65         ///
66         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
67
68         void addPreview(DocIterator const & inset_pos,
69                 graphics::PreviewLoader & ploader) const;
70
71         bool notifyCursorLeaves(Cursor const & old, Cursor & cur);
72
73         void write(std::ostream & os) const;
74
75         void edit(Cursor & cur, bool front, EntryDirection entry_from);
76
77         ///
78         void latex(otexstream &, OutputParams const &) const;
79         ///
80         docstring xhtml(XHTMLStream & xs, OutputParams const &) const;
81         ///
82         void validate(LaTeXFeatures & features) const;
83         ///
84         bool allowSpellCheck() const { return false; }
85         ///
86         bool insetAllowed(InsetCode code) const;
87         //@}
88
89 protected:
90         /// Retrieves the preview state. Returns true if preview
91         /// is enabled and the preview image is availabled.
92         bool previewState(BufferView * bv) const;
93         /// Recreates the preview if preview is enabled.
94         void reloadPreview(DocIterator const & pos) const;
95         /// Prepare the preview if preview is enabled.
96         void preparePreview(DocIterator const & pos) const;
97
98         ///
99         unique_ptr<RenderPreview> preview_;
100 };
101
102
103 } // namespace lyx
104
105
106 #endif
107