4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Jürgen Spitzmüller
9 * Full author contact details are available in file CREDITS.
15 #include "InsetText.h"
17 #include "support/unique_ptr.h"
29 /// An IPA inset with instant preview
30 class InsetIPA : public InsetText {
34 explicit InsetIPA(Buffer *);
38 InsetIPA(InsetIPA const & other);
40 InsetIPA & operator=(InsetIPA const & other);
42 /// \name Methods inherited from Inset class
44 Inset * clone() const override { return new InsetIPA(*this); }
46 bool neverIndent() const override { return true; }
48 bool forceLocalFontSwitch() const override { return true; }
50 InsetCode lyxCode() const override { return IPA_CODE; }
52 docstring layoutName() const override { return from_ascii("IPA"); }
54 bool descendable(BufferView const & /*bv*/) const override { return true; }
56 void metrics(MetricsInfo & mi, Dimension & dim) const override;
58 Inset * editXY(Cursor & cur, int x, int y) override;
60 void draw(PainterInfo & pi, int x, int y) const override;
63 void doDispatch(Cursor & cur, FuncRequest & cmd) override;
65 bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const override;
67 void addPreview(DocIterator const & inset_pos,
68 graphics::PreviewLoader & ploader) const override;
70 bool notifyCursorLeaves(Cursor const & old, Cursor & cur) override;
72 void write(std::ostream & os) const override;
74 void edit(Cursor & cur, bool front, EntryDirection entry_from) override;
77 void latex(otexstream &, OutputParams const &) const override;
79 void docbook(XMLStream &, OutputParams const &) const override;
81 docstring xhtml(XMLStream & xs, OutputParams const &) const override;
83 void validate(LaTeXFeatures & features) const override;
85 bool allowSpellCheck() const override { return false; }
87 bool insetAllowed(InsetCode code) const override;
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;
100 unique_ptr<RenderPreview> preview_;