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