X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathScript.h;h=bc048e2f1c2f61ab30c44e5c3a734d8a891127b3;hb=21c92c8a129b5f3ff56de33bf2941a25967cffbb;hp=7917f0cd8c96091879bf49f29f4e708640150819;hpb=0facb603fefec1ecc927f77bcf6228ca1f035444;p=lyx.git diff --git a/src/mathed/InsetMathScript.h b/src/mathed/InsetMathScript.h index 7917f0cd8c..bc048e2f1c 100644 --- a/src/mathed/InsetMathScript.h +++ b/src/mathed/InsetMathScript.h @@ -25,14 +25,16 @@ namespace lyx { class InsetMathScript : public InsetMathNest { public: /// create inset without scripts - InsetMathScript(); + explicit InsetMathScript(Buffer * buf); /// create inset with single script - explicit InsetMathScript(bool up); + explicit InsetMathScript(Buffer * buf, bool up); /// create inset with single script and given nucleus - InsetMathScript(MathAtom const & at, bool up); + InsetMathScript(Buffer * buf, MathAtom const & at, bool up); /// mode_type currentMode() const { return MATH_MODE; } /// + MathClass mathClass() const; + /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// void draw(PainterInfo & pi, int x, int y) const; @@ -47,10 +49,8 @@ public: bool idxForward(Cursor & cur) const; /// move cursor up or down bool idxUpDown(Cursor & cur, bool up) const; - /// Target pos when we enter the inset while moving forward - bool idxFirst(Cursor & cur) const; - /// Target pos when we enter the inset while moving backwards - bool idxLast(Cursor & cur) const; + /// The index of the cell entered while moving backward + size_type lastIdx() const { return 0; } /// write LaTeX and Lyx code void write(WriteStream & os) const; @@ -60,8 +60,10 @@ public: void maple(MapleStream &) const; /// write content as something readable by Mathematica void mathematica(MathematicaStream &) const; - /// write content as something resembling MathML + /// write content as MathML void mathmlize(MathStream &) const; + /// write content as HTML + void htmlize(HtmlStream &) const; /// write content as something readable by Octave void octave(OctaveStream &) const; @@ -70,10 +72,6 @@ public: /// InsetMathScript * asScriptInset(); - /// set limits - void limits(int lim) { limits_ = lim; } - /// get limits - int limits() const { return limits_; } /// returns subscript. Always run 'hasDown' or 'has(false)' before! MathData const & down() const; /// returns subscript. Always run 'hasDown' or 'has(false)' before! @@ -104,9 +102,8 @@ public: void infoize2(odocstream & os) const; /// InsetCode lyxCode() const { return MATH_SCRIPT_CODE; } - -protected: - virtual void doDispatch(Cursor & cur, FuncRequest & cmd); + /// + void validate(LaTeXFeatures &features) const; private: virtual Inset * clone() const; /// returns x offset for main part @@ -127,17 +124,20 @@ private: int nasc(BufferView const &) const; /// returns descent of nucleus if any int ndes(BufferView const &) const; - /// returns superscript kerning of nucleus if any + /// Italic correction: amount of displacement between subscript and + /// superscript in math mode as per Appendix G, rule 18f. A positive value + /// shifts the superscript to the right, and a negative value shifts the + /// subscript to the left. int nker(BufferView const * bv) const; - /// where do we have to draw the scripts? - bool hasLimits() const; + /// do we we have to draw the scripts above/below nucleus? + bool hasLimits(FontInfo const &) const; /// clean up empty cells and return true if a cell has been deleted. bool notifyCursorLeaves(Cursor const & old, Cursor & cur); /// possible subscript (index 0) and superscript (index 1) bool cell_1_is_up_; - /// 1 - "limits", -1 - "nolimits", 0 - "default" - int limits_; + /// remember whether we are in display mode (used by mathml output) + mutable bool has_limits_ = false; };