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 "Dimension.h"
19 #include "support/unique_ptr.h"
30 /// An IPA inset with instant preview
31 class InsetIPA : public InsetText {
35 explicit InsetIPA(Buffer *);
39 InsetIPA(InsetIPA const & other);
41 InsetIPA & operator=(InsetIPA const & other);
43 /// \name Methods inherited from Inset class
45 Inset * clone() const { return new InsetIPA(*this); }
47 bool neverIndent() const { return true; }
49 bool forceLocalFontSwitch() const { return true; }
51 InsetCode lyxCode() const { return IPA_CODE; }
53 docstring layoutName() const { return from_ascii("IPA"); }
55 bool descendable(BufferView const & /*bv*/) const { return true; }
57 void metrics(MetricsInfo & mi, Dimension & dim) const;
59 Inset * editXY(Cursor & cur, int x, int y);
61 void draw(PainterInfo & pi, int x, int y) const;
64 void doDispatch(Cursor & cur, FuncRequest & cmd);
66 bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
68 void addPreview(DocIterator const & inset_pos,
69 graphics::PreviewLoader & ploader) const;
71 bool notifyCursorLeaves(Cursor const & old, Cursor & cur);
73 void write(std::ostream & os) const;
75 void edit(Cursor & cur, bool front, EntryDirection entry_from);
78 void latex(otexstream &, OutputParams const &) const;
80 void docbook(XMLStream &, OutputParams const &) const;
82 docstring xhtml(XMLStream & xs, OutputParams const &) const;
84 void validate(LaTeXFeatures & features) const;
86 bool allowSpellCheck() const { return false; }
88 bool insetAllowed(InsetCode code) const;
92 /// Retrieves the preview state. Returns true if preview
93 /// is enabled and the preview image is available.
94 bool previewState(BufferView * bv) const;
95 /// Recreates the preview if preview is enabled.
96 void reloadPreview(DocIterator const & pos) const;
97 /// Prepare the preview if preview is enabled.
98 void preparePreview(DocIterator const & pos) const;
101 unique_ptr<RenderPreview> preview_;