]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MathMacroArgument.h
Fix drawing of empty boxes
[lyx.git] / src / mathed / MathMacroArgument.h
index 1fe0f2ea9ff1ab7cf1a6931c40b043bf4ad61bcb..bb9fa1dc304f8742229caf04065f5460b89445f6 100644 (file)
@@ -5,7 +5,7 @@
  * 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.
  */
 #ifndef MATHMACROARGUMENT_H
 #define MATHMACROARGUMENT_H
 
-#include "InsetMathDim.h"
+#include "InsetMath.h"
+
+#include "support/docstring.h"
 
 
 namespace lyx {
 
 
-/// A macro argument.
-class MathMacroArgument : public InsetMathDim {
+// A # that failed to parse
+class InsetMathHash : public InsetMath {
 public:
+       InsetMathHash(docstring const & str = docstring()) : str_('#' + str) {};
        ///
-       explicit MathMacroArgument(std::size_t);
-       ///
-       bool metrics(MetricsInfo & mi, Dimension & dim) const;
+       void metrics(MetricsInfo & mi, Dimension & dim) const;
        ///
        void draw(PainterInfo &, int x, int y) const;
-       ///
-       std::size_t number() const { return number_; }
-       ///
-       InsetBase::Code lyxCode() const { return MATHMACROARG_CODE; }
-
        ///
        void normalize(NormalStream &) const;
        ///
        void write(WriteStream & os) const;
 
 private:
-       virtual std::auto_ptr<InsetBase> doClone() const;
-       /// A number between 1 and 9
-       std::size_t number_;
+       Inset * clone() const;
+
+protected:
        ///
        docstring str_;
 };
 
 
+/// A macro argument.
+class MathMacroArgument : public InsetMathHash {
+public:
+       /// Assumes 0 < number <= 9
+       explicit MathMacroArgument(int number);
+       ///
+       int number() const { return number_; }
+       /// Assumes 0 < n <= 9
+       void setNumber(int n);
+       ///
+       InsetCode lyxCode() const { return MATH_MACROARG_CODE; }
+
+       ///
+       void normalize(NormalStream &) const;
+
+private:
+       Inset * clone() const;
+       /// A number between 1 and 9
+       int number_;
+};
+
+
 } // namespace lyx
 
 #endif