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
|
|
|
*/
|
|
|
|
|
2017-04-02 19:04:06 +00:00
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
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
|
|
|
|
2017-04-02 19:04:06 +00:00
|
|
|
class MathAtom : public std::unique_ptr<InsetMath> {
|
2002-03-21 17:42:56 +00:00
|
|
|
public:
|
2017-04-02 19:04:06 +00:00
|
|
|
MathAtom() = default;
|
|
|
|
MathAtom(MathAtom &&) = default;
|
|
|
|
MathAtom & operator=(MathAtom &&) = default;
|
2001-12-11 07:38:02 +00:00
|
|
|
/// the "real constructor"
|
2010-10-26 16:45:21 +00:00
|
|
|
explicit MathAtom(InsetMath * p);
|
2017-04-02 19:04:06 +00:00
|
|
|
/// copy constructor, invokes clone()
|
2001-12-11 07:38:02 +00:00
|
|
|
MathAtom(MathAtom const &);
|
2004-11-23 23:04:52 +00:00
|
|
|
MathAtom & operator=(MathAtom const &);
|
2001-12-11 07:38:02 +00:00
|
|
|
/// access to the inset
|
2017-04-02 19:04:06 +00:00
|
|
|
InsetMath * nucleus() { return get(); }
|
|
|
|
InsetMath const * nucleus() const { return get(); }
|
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
|