2001-06-25 00:06:33 +00:00
|
|
|
|
// -*- C++ -*-
|
|
|
|
|
#ifndef MATH_SCRIPTINSET_H
|
|
|
|
|
#define MATH_SCRIPTINSET_H
|
|
|
|
|
|
2001-08-03 17:10:22 +00:00
|
|
|
|
#include "math_nestinset.h"
|
2001-06-25 00:06:33 +00:00
|
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
|
#pragma interface
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/** Inset for super- and subscripts
|
|
|
|
|
\author Andr<EFBFBD> P<EFBFBD>nitz
|
|
|
|
|
*/
|
|
|
|
|
|
2001-08-03 17:10:22 +00:00
|
|
|
|
class MathScriptInset : public MathNestInset {
|
2001-06-25 00:06:33 +00:00
|
|
|
|
public:
|
2001-10-12 12:02:49 +00:00
|
|
|
|
///
|
|
|
|
|
MathScriptInset();
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-09-24 16:25:06 +00:00
|
|
|
|
explicit MathScriptInset(bool up);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
MathInset * clone() const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-10-19 11:25:48 +00:00
|
|
|
|
void write(MathWriteInfo & os) const;
|
2001-07-26 06:46:50 +00:00
|
|
|
|
///
|
2001-10-24 18:10:21 +00:00
|
|
|
|
void writeNormal(std::ostream & os) const;
|
2001-10-24 16:10:38 +00:00
|
|
|
|
///
|
2001-10-19 11:25:48 +00:00
|
|
|
|
void metrics(MathMetricsInfo const & st) const;
|
2001-07-26 06:46:50 +00:00
|
|
|
|
///
|
2001-08-06 17:20:26 +00:00
|
|
|
|
void draw(Painter &, int x, int y) const;
|
2001-10-12 12:02:49 +00:00
|
|
|
|
|
|
|
|
|
///
|
2001-10-19 11:25:48 +00:00
|
|
|
|
void write(MathInset const *, MathWriteInfo & os) const;
|
2001-10-12 12:02:49 +00:00
|
|
|
|
///
|
2001-10-24 18:10:21 +00:00
|
|
|
|
void writeNormal(MathInset const *, std::ostream & os) const;
|
2001-10-24 16:10:38 +00:00
|
|
|
|
///
|
2001-10-19 11:25:48 +00:00
|
|
|
|
void metrics(MathInset const * nucleus, MathMetricsInfo const & st) const;
|
2001-10-12 12:02:49 +00:00
|
|
|
|
///
|
|
|
|
|
void draw(MathInset const * nucleus, Painter &, int x, int y) const;
|
|
|
|
|
///
|
|
|
|
|
int ascent(MathInset const * nucleus) const;
|
|
|
|
|
///
|
|
|
|
|
int descent(MathInset const * nucleus) const;
|
|
|
|
|
///
|
|
|
|
|
int width(MathInset const * nucleus) const;
|
|
|
|
|
|
2001-10-12 15:38:58 +00:00
|
|
|
|
///
|
|
|
|
|
bool idxLeft(MathInset::idx_type &, MathInset::pos_type &) const;
|
|
|
|
|
///
|
|
|
|
|
bool idxRight(MathInset::idx_type &, MathInset::pos_type &) const;
|
|
|
|
|
|
2001-09-24 16:25:06 +00:00
|
|
|
|
///
|
|
|
|
|
MathScriptInset const * asScriptInset() const;
|
|
|
|
|
///
|
2001-10-12 12:02:49 +00:00
|
|
|
|
MathScriptInset * asScriptInset();
|
|
|
|
|
|
|
|
|
|
/// set limits
|
|
|
|
|
void limits(int lim) { limits_ = lim; }
|
|
|
|
|
///
|
|
|
|
|
int limits() const { return limits_; }
|
|
|
|
|
///
|
|
|
|
|
bool hasLimits(MathInset const * nucleus) const;
|
|
|
|
|
/// true if we have an "inner" position
|
|
|
|
|
MathXArray const & up() const;
|
|
|
|
|
/// returns subscript
|
|
|
|
|
MathXArray const & down() const;
|
|
|
|
|
/// returns superscript
|
|
|
|
|
MathXArray & up();
|
|
|
|
|
/// returns subscript
|
|
|
|
|
MathXArray & down();
|
|
|
|
|
/// do we have a superscript?
|
|
|
|
|
bool hasUp() const;
|
|
|
|
|
/// do we have a subscript?
|
|
|
|
|
bool hasDown() const;
|
|
|
|
|
/// do we have a script?
|
|
|
|
|
bool has(bool up) const;
|
|
|
|
|
/// remove script
|
|
|
|
|
void removeScript(bool up);
|
|
|
|
|
/// remove script
|
|
|
|
|
void removeEmptyScripts();
|
2001-09-24 16:25:06 +00:00
|
|
|
|
///
|
2001-10-12 12:02:49 +00:00
|
|
|
|
void ensure(bool up);
|
|
|
|
|
|
2001-11-07 08:51:35 +00:00
|
|
|
|
///
|
2001-11-07 17:30:26 +00:00
|
|
|
|
void octavize(MathInset const * nuc, OctaveStream & os) const;
|
2001-11-07 08:51:35 +00:00
|
|
|
|
///
|
2001-11-07 17:30:26 +00:00
|
|
|
|
void maplize(MathInset const * nuc, MapleStream & os) const;
|
2001-11-07 08:51:35 +00:00
|
|
|
|
///
|
2001-11-07 17:30:26 +00:00
|
|
|
|
void mathmlize(MathInset const * nuc, MathMLStream & os) const;
|
2001-11-07 08:51:35 +00:00
|
|
|
|
|
2001-10-12 12:02:49 +00:00
|
|
|
|
public:
|
|
|
|
|
/// returns x offset for main part
|
|
|
|
|
int dxx(MathInset const * nuc) const;
|
|
|
|
|
/// returns width of nucleus if any
|
|
|
|
|
int nwid(MathInset const * nuc) const;
|
2001-07-26 06:46:50 +00:00
|
|
|
|
private:
|
2001-10-12 12:02:49 +00:00
|
|
|
|
/// returns y offset for superscript
|
|
|
|
|
int dy0(MathInset const * nuc) const;
|
|
|
|
|
/// returns y offset for subscript
|
|
|
|
|
int dy1(MathInset const * nuc) const;
|
|
|
|
|
/// returns x offset for superscript
|
|
|
|
|
int dx0(MathInset const * nuc) const;
|
|
|
|
|
/// returns x offset for subscript
|
|
|
|
|
int dx1(MathInset const * nuc) const;
|
|
|
|
|
/// returns ascent of nucleus if any
|
|
|
|
|
int nasc(MathInset const * nuc) const;
|
|
|
|
|
/// returns descent of nucleus if any
|
|
|
|
|
int ndes(MathInset const * nuc) const;
|
|
|
|
|
|
|
|
|
|
/// possible subscript (index 0) and superscript (index 1)
|
|
|
|
|
bool script_[2];
|
2001-07-26 06:46:50 +00:00
|
|
|
|
///
|
2001-10-12 12:02:49 +00:00
|
|
|
|
int limits_;
|
2001-10-22 15:37:49 +00:00
|
|
|
|
///
|
|
|
|
|
mutable MathMetricsInfo mi_;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|
2001-09-11 10:58:17 +00:00
|
|
|
|
|