* Licence details can be found in the file COPYING.
*
* \author Alejandro Aguilar Sierra
- * \author André Pönitz
+ * \author André Pönitz
*
* Full author contact details are available in file CREDITS.
*/
#include "InsetMath.h"
+#include "support/docstring.h"
+
namespace lyx {
-/// A macro argument.
-class MathMacroArgument : public InsetMath {
+// A # that failed to parse
+class InsetMathHash : public InsetMath {
public:
- ///
- explicit MathMacroArgument(std::size_t);
+ InsetMathHash(docstring const & str = docstring()) : str_('#' + str) {};
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo &, int x, int y) const;
///
- std::size_t number() const { return number_; }
+ void normalize(NormalStream &) const;
+ ///
+ void write(WriteStream & os) const;
+
+private:
+ Inset * clone() const;
+
+protected:
+ ///
+ docstring str_;
+};
+
+
+/// A macro argument.
+class MathMacroArgument : public InsetMathHash {
+public:
+ /// Assumes 0 < number <= 9
+ explicit MathMacroArgument(int number);
///
- void setNumber(std::size_t n);
+ int number() const { return number_; }
+ /// Assumes 0 < n <= 9
+ void setNumber(int n);
///
- InsetCode lyxCode() const { return MATHMACROARG_CODE; }
+ InsetCode lyxCode() const { return MATH_MACROARG_CODE; }
///
void normalize(NormalStream &) const;
- ///
- void write(WriteStream & os) const;
private:
- virtual Inset * clone() const;
+ Inset * clone() const;
/// A number between 1 and 9
- std::size_t number_;
- ///
- docstring str_;
+ int number_;
};