2001-09-11 10:58:17 +00:00
|
|
|
|
// -*- C++ -*-
|
2002-12-01 22:59:25 +00:00
|
|
|
|
/**
|
2003-08-19 13:00:56 +00:00
|
|
|
|
* \file math_atom.h
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-09-11 08:26:02 +00:00
|
|
|
|
*
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
|
|
|
|
*
|
2003-08-19 13:00:56 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-09-11 08:26:02 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2003-08-19 13:00:56 +00:00
|
|
|
|
#ifndef MATH_ATOM_H
|
|
|
|
|
#define MATH_ATOM_H
|
|
|
|
|
|
|
|
|
|
|
2002-03-21 17:42:56 +00:00
|
|
|
|
/**
|
2003-08-19 13:00:56 +00:00
|
|
|
|
Wrapper for MathInset * with copy-semantics
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
|
2001-09-11 10:58:17 +00:00
|
|
|
|
The 'atom' is the major blob in math typesetting. And 'atom' consists
|
|
|
|
|
of a nucleus, an optional superscript, and an optional subscript.
|
|
|
|
|
|
|
|
|
|
Exactly where the subscript and superscript are drawn depends on the
|
2002-03-21 17:42:56 +00:00
|
|
|
|
size, and type, of the nucleus they are attached to.
|
2001-09-11 10:58:17 +00:00
|
|
|
|
|
|
|
|
|
Jules
|
2001-10-23 09:03:07 +00:00
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
|
|
|
|
|
Ok: Implementing it thusly is not feasible since cursor movement gets
|
|
|
|
|
hackish. We use MathAtom only as a wrapper around MathInset * with value
|
|
|
|
|
semantics.
|
|
|
|
|
|
2001-12-11 07:38:02 +00:00
|
|
|
|
The MathAtom owns the MathInset * and is responsible for proper cloning and
|
|
|
|
|
destruction. Every MathInset * should be put into a MathAtom after its
|
|
|
|
|
creation as soon as possible.
|
|
|
|
|
|
2001-10-23 09:03:07 +00:00
|
|
|
|
Andre'
|
|
|
|
|
|
2001-09-11 10:58:17 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2003-06-16 11:49:38 +00:00
|
|
|
|
class InsetBase;
|
2001-09-11 10:58:17 +00:00
|
|
|
|
class MathInset;
|
|
|
|
|
|
|
|
|
|
class MathAtom {
|
2002-03-21 17:42:56 +00:00
|
|
|
|
public:
|
2001-12-11 07:38:02 +00:00
|
|
|
|
/// default constructor, object is useless, but we need it to put it into
|
|
|
|
|
// std::containers
|
2001-09-11 10:58:17 +00:00
|
|
|
|
MathAtom();
|
2001-12-11 07:38:02 +00:00
|
|
|
|
/// the "real constructor"
|
2003-06-16 11:49:38 +00:00
|
|
|
|
explicit MathAtom(InsetBase * p);
|
2001-12-11 07:38:02 +00:00
|
|
|
|
/// copy constructor, invokes nucleus_->clone()
|
|
|
|
|
MathAtom(MathAtom const &);
|
|
|
|
|
/// we really need to clean up
|
2002-03-21 17:42:56 +00:00
|
|
|
|
~MathAtom();
|
2001-12-11 07:38:02 +00:00
|
|
|
|
/// assignment invokes nucleus_->clone()
|
2004-11-23 23:04:52 +00:00
|
|
|
|
MathAtom & operator=(MathAtom const &);
|
2002-03-12 14:59:08 +00:00
|
|
|
|
/// access to the inset (checked with gprof)
|
2002-08-08 16:08:11 +00:00
|
|
|
|
MathInset * nucleus() { return nucleus_; }
|
2004-01-28 16:21:29 +00:00
|
|
|
|
MathInset const * nucleus() const { return nucleus_; }
|
2001-12-11 07:38:02 +00:00
|
|
|
|
/// access to the inset
|
2002-08-09 07:01:17 +00:00
|
|
|
|
MathInset const * operator->() const { return nucleus_; }
|
2001-09-11 10:58:17 +00:00
|
|
|
|
|
2003-05-28 13:22:36 +00:00
|
|
|
|
/// width cache. Not nice...
|
2004-02-02 17:32:56 +00:00
|
|
|
|
//mutable int width_;
|
2003-05-28 13:22:36 +00:00
|
|
|
|
|
2001-10-12 12:02:49 +00:00
|
|
|
|
private:
|
2001-09-11 10:58:17 +00:00
|
|
|
|
///
|
|
|
|
|
MathInset * nucleus_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|