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-07-26 06:56:43 +00:00
|
|
|
|
void write(std::ostream &, bool fragile) const;
|
2001-07-26 06:46:50 +00:00
|
|
|
|
///
|
2001-08-06 17:20:26 +00:00
|
|
|
|
void metrics(MathStyles 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
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
void write(MathInset const * nucleus, std::ostream &, bool fragile) const;
|
|
|
|
|
///
|
|
|
|
|
void metrics(MathInset const * nucleus, MathStyles st) const;
|
|
|
|
|
///
|
|
|
|
|
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-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);
|
|
|
|
|
|
|
|
|
|
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-06-25 00:06:33 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|
2001-09-11 10:58:17 +00:00
|
|
|
|
|