2001-09-11 10:58:17 +00:00
|
|
|
// -*- C++ -*-
|
2002-12-01 22:59:25 +00:00
|
|
|
/**
|
2006-09-17 09:14:18 +00:00
|
|
|
* \file MathAtom.h
|
2003-08-19 13:00:56 +00:00
|
|
|
* 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
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author André Pönitz
|
2002-09-11 08:26:02 +00:00
|
|
|
*
|
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
|
|
|
/**
|
2006-09-16 18:11:38 +00:00
|
|
|
Wrapper for InsetMath * with copy-semantics
|
2003-08-19 13:00:56 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
|
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
|
2006-09-16 18:11:38 +00:00
|
|
|
hackish. We use MathAtom only as a wrapper around InsetMath * with value
|
2001-10-23 09:03:07 +00:00
|
|
|
semantics.
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
The MathAtom owns the InsetMath * and is responsible for proper cloning and
|
|
|
|
destruction. Every InsetMath * should be put into a MathAtom after its
|
2001-12-11 07:38:02 +00:00
|
|
|
creation as soon as possible.
|
|
|
|
|
2001-10-23 09:03:07 +00:00
|
|
|
Andre'
|
|
|
|
|
2001-09-11 10:58:17 +00:00
|
|
|
*/
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
class Inset;
|
2006-09-16 18:11:38 +00:00
|
|
|
class InsetMath;
|
2001-09-11 10:58:17 +00:00
|
|
|
|
|
|
|
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
|
2009-11-14 23:28:50 +00:00
|
|
|
/// std::containers
|
2001-09-11 10:58:17 +00:00
|
|
|
MathAtom();
|
2001-12-11 07:38:02 +00:00
|
|
|
/// the "real constructor"
|
2010-10-26 16:45:21 +00:00
|
|
|
explicit MathAtom(InsetMath * 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)
|
2006-09-16 18:11:38 +00:00
|
|
|
InsetMath * nucleus() { return nucleus_; }
|
|
|
|
InsetMath const * nucleus() const { return nucleus_; }
|
2001-12-11 07:38:02 +00:00
|
|
|
/// access to the inset
|
2006-09-16 18:11:38 +00:00
|
|
|
InsetMath const * operator->() const { return nucleus_; }
|
2001-09-11 10:58:17 +00:00
|
|
|
|
2001-10-12 12:02:49 +00:00
|
|
|
private:
|
2001-09-11 10:58:17 +00:00
|
|
|
///
|
2006-09-16 18:11:38 +00:00
|
|
|
InsetMath * nucleus_;
|
2001-09-11 10:58:17 +00:00
|
|
|
};
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
2001-09-11 10:58:17 +00:00
|
|
|
#endif
|