2001-02-13 17:08:51 +00:00
|
|
|
// -*- C++ -*-
|
2003-08-19 13:00:56 +00:00
|
|
|
/**
|
2017-07-05 12:31:28 +00:00
|
|
|
* \file InsetMathMacroArgument.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.
|
|
|
|
*
|
|
|
|
* \author Alejandro Aguilar Sierra
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author André Pönitz
|
2003-08-19 13:00:56 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
2001-02-13 17:08:51 +00:00
|
|
|
#ifndef MATHMACROARGUMENT_H
|
|
|
|
#define MATHMACROARGUMENT_H
|
|
|
|
|
2007-04-30 10:31:51 +00:00
|
|
|
#include "InsetMath.h"
|
2001-02-13 17:08:51 +00:00
|
|
|
|
2008-03-15 00:22:54 +00:00
|
|
|
#include "support/docstring.h"
|
|
|
|
|
2001-02-26 12:53:35 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
|
|
|
|
2017-01-03 19:17:20 +00:00
|
|
|
// A # that failed to parse
|
|
|
|
class InsetMathHash : public InsetMath {
|
2001-02-13 17:08:51 +00:00
|
|
|
public:
|
2019-09-15 21:56:17 +00:00
|
|
|
explicit InsetMathHash(docstring const & str = docstring()) : str_('#' + str) {};
|
2001-02-26 12:53:35 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void metrics(MetricsInfo & mi, Dimension & dim) const override;
|
2001-02-26 12:53:35 +00:00
|
|
|
///
|
2003-03-21 14:20:48 +00:00
|
|
|
void draw(PainterInfo &, int x, int y) const;
|
2001-02-26 12:53:35 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void normalize(NormalStream &) const override;
|
2017-01-03 19:17:20 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void write(WriteStream & os) const override;
|
2017-01-03 19:17:20 +00:00
|
|
|
|
|
|
|
private:
|
2020-10-01 07:42:11 +00:00
|
|
|
Inset * clone() const override;
|
2017-01-03 19:17:20 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
///
|
|
|
|
docstring str_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// A macro argument.
|
2017-07-05 12:31:28 +00:00
|
|
|
class InsetMathMacroArgument : public InsetMathHash {
|
2017-01-03 19:17:20 +00:00
|
|
|
public:
|
|
|
|
/// Assumes 0 < number <= 9
|
2017-07-05 12:31:28 +00:00
|
|
|
explicit InsetMathMacroArgument(int number);
|
2004-04-13 06:27:29 +00:00
|
|
|
///
|
2017-01-03 19:17:20 +00:00
|
|
|
int number() const { return number_; }
|
|
|
|
/// Assumes 0 < n <= 9
|
2008-03-15 00:22:54 +00:00
|
|
|
void setNumber(int n);
|
2007-11-01 11:13:07 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
InsetCode lyxCode() const override { return MATH_MACROARG_CODE; }
|
2001-11-09 14:23:44 +00:00
|
|
|
|
2001-02-26 12:53:35 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void normalize(NormalStream &) const override;
|
2001-04-24 16:13:38 +00:00
|
|
|
|
|
|
|
private:
|
2020-10-01 07:42:11 +00:00
|
|
|
Inset * clone() const override;
|
2001-04-24 16:13:38 +00:00
|
|
|
/// A number between 1 and 9
|
2008-03-15 00:22:54 +00:00
|
|
|
int number_;
|
2001-02-13 17:08:51 +00:00
|
|
|
};
|
2001-04-24 16:13:38 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
2001-02-13 17:08:51 +00:00
|
|
|
#endif
|