4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
12 #ifndef INSET_SCRIPT_H
13 #define INSET_SCRIPT_H
15 #include "InsetText.h"
20 class InsetScriptParams
27 /// \c type defaults to Subscript
30 void write(std::ostream & os) const;
32 void read(Lexer & lex);
34 int shift(FontInfo const & font) const;
40 /////////////////////////////////////////////////////////////////////////
44 /////////////////////////////////////////////////////////////////////////
46 /// The subscript and superscript inset
47 class InsetScript : public InsetText
51 InsetScript(Buffer *, InsetScriptParams const & = InsetScriptParams());
53 InsetScript(Buffer *, std::string const &);
57 static std::string params2string(InsetScriptParams const &);
59 static void string2params(std::string const &, InsetScriptParams &);
61 InsetScriptParams const & params() const { return params_; }
64 InsetCode lyxCode() const { return SCRIPT_CODE; }
66 docstring name() const;
68 DisplayType display() const;
70 void metrics(MetricsInfo &, Dimension &) const;
72 void draw(PainterInfo & pi, int x, int y) const;
74 virtual void cursorPos(BufferView const & bv,
75 CursorSlice const & sl, bool boundary, int & x, int & y) const;
77 void write(std::ostream &) const;
79 void read(Lexer & lex);
81 bool neverIndent() const { return true; }
83 virtual bool forcePlainLayout(idx_type = 0) const { return true; }
85 virtual bool allowMultiPar() const { return false; }
87 virtual bool allowParagraphCustomization(idx_type = 0) const { return false; }
89 virtual void validate(LaTeXFeatures &) const;
91 int latex(odocstream &, OutputParams const &) const;
93 int plaintext(odocstream &, OutputParams const &) const;
95 int docbook(odocstream &, OutputParams const &) const;
97 docstring xhtml(XHTMLStream &, OutputParams const &) const;
99 void edit(Cursor & cur, bool front,
100 EntryDirection entry_from = ENTRY_DIRECTION_IGNORE);
102 Inset * editXY(Cursor & cur, int x, int y);
104 virtual bool insetAllowed(InsetCode code) const;
106 bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
108 void doDispatch(Cursor & cur, FuncRequest & cmd);
110 docstring toolTip(BufferView const & bv, int x, int y) const;
112 Inset * clone() const { return new InsetScript(*this); }
113 /// used by the constructors
116 docstring contextMenu(BufferView const & bv, int x, int y) const;
118 friend class InsetScriptParams;
121 InsetScriptParams params_;