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-11-09 08:35:57 +00:00
|
|
|
|
void write(WriteStream & os) const;
|
2001-07-26 06:46:50 +00:00
|
|
|
|
///
|
2001-11-09 08:35:57 +00:00
|
|
|
|
void normalize(NormalStream & 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-11-08 12:06:56 +00:00
|
|
|
|
void metrics(MathInset const * nuc, MathMetricsInfo const & st) const;
|
2001-10-12 12:02:49 +00:00
|
|
|
|
///
|
2001-11-08 12:06:56 +00:00
|
|
|
|
void draw(MathInset const * nuc, Painter &, int x, int y) const;
|
2001-10-24 16:10:38 +00:00
|
|
|
|
///
|
2001-11-08 12:06:56 +00:00
|
|
|
|
int ascent(MathInset const * nuc) const;
|
2001-10-12 12:02:49 +00:00
|
|
|
|
///
|
2001-11-08 12:06:56 +00:00
|
|
|
|
int descent(MathInset const * nuc) const;
|
2001-10-12 12:02:49 +00:00
|
|
|
|
///
|
2001-11-08 12:06:56 +00:00
|
|
|
|
int width(MathInset const * nuc) const;
|
2001-10-12 12:02:49 +00:00
|
|
|
|
|
2001-10-12 15:38:58 +00:00
|
|
|
|
///
|
2001-11-15 09:51:57 +00:00
|
|
|
|
bool idxLeft(idx_type &, pos_type &) const;
|
2001-10-12 15:38:58 +00:00
|
|
|
|
///
|
2001-11-15 09:51:57 +00:00
|
|
|
|
bool idxRight(idx_type &, pos_type &) const;
|
|
|
|
|
///
|
|
|
|
|
bool idxFirstUp(idx_type &, pos_type &) const;
|
|
|
|
|
///
|
|
|
|
|
bool idxFirstDown(idx_type &, pos_type &) const;
|
|
|
|
|
///
|
|
|
|
|
bool idxLastUp(idx_type &, pos_type &) const;
|
|
|
|
|
///
|
|
|
|
|
bool idxLastDown(idx_type &, pos_type &) const;
|
2001-10-12 15:38:58 +00:00
|
|
|
|
|
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_; }
|
|
|
|
|
///
|
2001-11-08 12:06:56 +00:00
|
|
|
|
bool hasLimits(MathInset const * nuc) const;
|
2001-10-12 12:02:49 +00:00
|
|
|
|
/// 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-13 14:45:08 +00:00
|
|
|
|
/// suppresses empty braces if necessary
|
2001-11-09 08:35:57 +00:00
|
|
|
|
void write(MathInset const * nuc, WriteStream & os) const;
|
2001-11-08 12:06:56 +00:00
|
|
|
|
///
|
2001-11-09 08:35:57 +00:00
|
|
|
|
void normalize(MathInset const * nuc, NormalStream & os) const;
|
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
|
|
|
|
|