]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathMacroArgument.h
Amend 6c3447c8: FindAdv: sometimes a space is added on some math symbols
[lyx.git] / src / mathed / InsetMathMacroArgument.h
1 // -*- C++ -*-
2 /**
3  * \file InsetMathMacroArgument.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Alejandro Aguilar Sierra
8  * \author André Pönitz
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef MATHMACROARGUMENT_H
14 #define MATHMACROARGUMENT_H
15
16 #include "InsetMath.h"
17
18 #include "support/docstring.h"
19
20
21 namespace lyx {
22
23
24 // A # that failed to parse
25 class InsetMathHash : public InsetMath {
26 public:
27         explicit InsetMathHash(Buffer * buf, docstring const & str = docstring())
28                 : InsetMath(buf), str_('#' + str) {}
29         ///
30         void metrics(MetricsInfo & mi, Dimension & dim) const override;
31         ///
32         void draw(PainterInfo &, int x, int y) const override;
33         ///
34         void normalize(NormalStream &) const override;
35         ///
36         void write(TeXMathStream & os) const override;
37
38 private:
39         Inset * clone() const override;
40
41 protected:
42         ///
43         docstring str_;
44 };
45
46
47 /// A macro argument.
48 class InsetMathMacroArgument : public InsetMathHash {
49 public:
50         /// Assumes 0 < number <= 9
51         explicit InsetMathMacroArgument(Buffer * buf, int number);
52         ///
53         int number() const { return number_; }
54         /// Assumes 0 < n <= 9
55         void setNumber(int n);
56         ///
57         InsetCode lyxCode() const override { return MATH_MACROARG_CODE; }
58
59         ///
60         void normalize(NormalStream &) const override;
61
62 private:
63         Inset * clone() const override;
64         /// A number between 1 and 9
65         int number_;
66 };
67
68
69 } // namespace lyx
70
71 #endif