lyx_mirror/src/mathed/InsetMathFrac.h
Dov Feldstern cd95a4bae8 Getting rid of LTR bias --- part 4/4
This is the final patch (at least for now). This one deals with the idxFoo
methods in the math insets. The previous patches in the series are r21128, 
r21244 and r21448.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21449 a592a061-630c-0410-9148-cb99ea01b6c8
2007-11-05 19:44:03 +00:00

205 lines
3.8 KiB
C++

// -*- C++ -*-
/**
* \file InsetMathFrac.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Alejandro Aguilar Sierra
* \author André Pönitz
*
* Full author contact details are available in file CREDITS.
*/
#ifndef MATH_FRAC_H
#define MATH_FRAC_H
#include "InsetMathNest.h"
namespace lyx {
class InsetMathFracBase : public InsetMathNest {
public:
///
explicit InsetMathFracBase(idx_type ncells = 2);
///
bool idxUpDown(Cursor &, bool up) const;
///
bool idxBackward(Cursor &) const { return false; }
///
bool idxForward(Cursor &) const { return false; }
};
/// Fraction like objects (frac, binom)
class InsetMathFrac : public InsetMathFracBase {
public:
///
enum Kind {
FRAC,
OVER,
ATOP,
NICEFRAC,
UNITFRAC,
UNIT
};
///
explicit InsetMathFrac(Kind kind = FRAC, idx_type ncells = 2);
///
bool idxForward(Cursor &) const;
///
bool idxBackward(Cursor &) const;
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo &, int x, int y) const;
///
void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
///
void drawT(TextPainter &, int x, int y) const;
/// identifies FracInsets
InsetMathFrac * asFracInset();
/// identifies FracInsets
InsetMathFrac const * asFracInset() const;
///
docstring name() const;
///
bool extraBraces() const;
///
void write(WriteStream & os) const;
///
void maple(MapleStream &) const;
///
void mathematica(MathematicaStream &) const;
///
void octave(OctaveStream &) const;
///
void mathmlize(MathStream &) const;
///
void validate(LaTeXFeatures & features) const;
public:
Inset * clone() const;
///
Kind kind_;
};
/// \dfrac support
class InsetMathDFrac : public InsetMathFrac {
public:
///
InsetMathDFrac() {}
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo &, int x, int y) const;
///
docstring name() const;
///
void mathmlize(MathStream &) const;
///
void validate(LaTeXFeatures & features) const;
private:
Inset * clone() const;
};
/// \tfrac support
class InsetMathTFrac : public InsetMathFrac {
public:
///
InsetMathTFrac() {}
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo &, int x, int y) const;
///
docstring name() const;
///
void mathmlize(MathStream &) const;
///
void validate(LaTeXFeatures & features) const;
private:
Inset * clone() const;
};
/// Binom like objects
class InsetMathBinom : public InsetMathFracBase {
public:
///
explicit InsetMathBinom(bool choose = false);
///
void write(WriteStream & os) const;
///
void normalize(NormalStream &) const;
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo &, int x, int y) const;
/// draw decorations.
void drawDecoration(PainterInfo & pi, int x, int y) const
{ drawMarkers2(pi, x, y); }
///
bool extraBraces() const;
private:
Inset * clone() const;
///
int dw(int height) const;
///
bool choose_;
};
/// \dbinom support
class InsetMathDBinom : public InsetMathFracBase {
public:
///
InsetMathDBinom() {}
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo &, int x, int y) const;
///
docstring name() const;
///
void mathmlize(MathStream &) const;
///
void validate(LaTeXFeatures & features) const;
private:
Inset * clone() const;
///
int dw(int height) const;
};
/// \tbinom support
class InsetMathTBinom : public InsetMathFracBase {
public:
///
InsetMathTBinom() {}
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo &, int x, int y) const;
///
docstring name() const;
///
void mathmlize(MathStream &) const;
///
void validate(LaTeXFeatures & features) const;
private:
Inset * clone() const;
///
int dw(int height) const;
};
} // namespace lyx
#endif