]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathSideset.h
Make undo action no-ops when the buffer is read-only
[lyx.git] / src / mathed / InsetMathSideset.h
index 67f7eaa06f877104d9efc8d7606dcd35bfa519e6..f084d61c48078e85aa1b3081f8614386512aa284 100644 (file)
@@ -25,68 +25,67 @@ namespace lyx {
 class InsetMathSideset : public InsetMathNest {
 public:
        ///
-       InsetMathSideset(Buffer * buf);
+       InsetMathSideset(Buffer * buf, bool scriptl, bool scriptr);
        /// create inset with given nucleus
-       InsetMathSideset(Buffer * buf, MathAtom const & at);
+       InsetMathSideset(Buffer * buf, bool scriptl, bool scriptr,
+                        MathAtom const & at);
        ///
-       mode_type currentMode() const { return MATH_MODE; }
+       mode_type currentMode() const override { return MATH_MODE; }
        ///
-       void metrics(MetricsInfo & mi, Dimension & dim) const;
+       void metrics(MetricsInfo & mi, Dimension & dim) const override;
        ///
-       void draw(PainterInfo & pi, int x, int y) const;
+       void draw(PainterInfo & pi, int x, int y) const override;
        ///
-       void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
+       void metricsT(TextMetricsInfo const & mi, Dimension & dim) const override;
        ///
-       void drawT(TextPainter & pi, int x, int y) const;
+       void drawT(TextPainter & pi, int x, int y) const override;
 
        /// move cursor backwards
-       bool idxBackward(Cursor & cur) const;
+       bool idxBackward(Cursor & cur) const override;
        /// move cursor forward
-       bool idxForward(Cursor & cur) const;
+       bool idxForward(Cursor & cur) const override;
        /// 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;
+       bool idxUpDown(Cursor & cur, bool up) const override;
+       /// The index of the cell entered while moving backward
+       size_type lastIdx() const override { return 0; }
 
        /// write LaTeX and Lyx code
-       void write(WriteStream & os) const;
+       void write(TeXMathStream & os) const override;
        /// write normalized content
-       void normalize(NormalStream &) const;
+       void normalize(NormalStream &) const override;
        /// write content as MathML
-       void mathmlize(MathStream &) const;
+       void mathmlize(MathMLStream &) const override;
        /// write content as HTML
-       void htmlize(HtmlStream &) const;
+       void htmlize(HtmlStream &) const override;
 
        /// returns nucleus
-       MathData const & nuc() const { return cell(0); };
+       MathData const & nuc() const { return cell(0); }
        /// returns nucleus
-       MathData & nuc()             { return cell(0); };
-       /// bottom left index
+       MathData & nuc()             { return cell(0); }
+       /// bottom left index or single left cell
        MathData const & bl() const  { return cell(1); }
-       /// bottom left index
+       /// bottom left index or single left cell
        MathData & bl()              { return cell(1); }
-       /// top left index
-       MathData const & tl() const  { return cell(2); }
-       /// top left index
-       MathData & tl()              { return cell(2); }
-       /// bottom right index
-       MathData const & br() const  { return cell(3); }
-       /// bottom right index
-       MathData & br()              { return cell(3); }
-       /// top right index
-       MathData const & tr() const  { return cell(4); }
-       /// top right index
-       MathData & tr()              { return cell(4); }
+       /// top left index or single left cell
+       MathData const & tl() const  { return cell(1 + scriptl_); }
+       /// top left index or single left cell
+       MathData & tl()              { return cell(1 + scriptl_); }
+       /// bottom right index or single right cell
+       MathData const & br() const  { return cell(2 + scriptl_); }
+       /// bottom right index or single right cell
+       MathData & br()              { return cell(2 + scriptl_); }
+       /// top right index or single right cell
+       MathData const & tr() const  { return cell(2 + scriptl_ + scriptr_); }
+       /// top right index or single right cell
+       MathData & tr()              { return cell(2 + scriptl_ + scriptr_); }
        /// say that we have scripts
-       void infoize(odocstream & os) const;
+       void infoize(odocstream & os) const override;
        ///
-       InsetCode lyxCode() const { return MATH_SCRIPT_CODE; }
+       InsetCode lyxCode() const override { return MATH_SCRIPT_CODE; }
        ///
-       void validate(LaTeXFeatures &features) const;
+       void validate(LaTeXFeatures &features) const override;
 private:
-       virtual Inset * clone() const;
+       Inset * clone() const override;
        /// returns x offset of nucleus
        int dxn(BufferView const & bv) const;
        /// returns width of nucleus if any
@@ -103,8 +102,12 @@ private:
        int nasc(BufferView const &) const;
        /// returns descent of nucleus if any
        int ndes(BufferView const &) const;
-       /// returns subscript and superscript kerning of nucleus if any
+       /// Italic correction as described in InsetMathScript.h
        int nker(BufferView const * bv) const;
+       /// Whether there are two left scripts or one single cell
+       bool scriptl_;
+       /// Whether there are two right scripts or one single cell
+       bool scriptr_;
 };