+ ///
+ size_t optionals() const;
+ ///
+ void setOptionals(int n);
+ /// Return the maximal number of arguments the macro is greedy for.
+ size_t appetite() const;
+ ///
+ InsetCode lyxCode() const { return MATH_MACRO_CODE; }
+ /// This is not used for display; however whether it is mathrel determines
+ /// how to split equations intelligently.
+ MathClass mathClass() const; //override
+
+protected:
+ friend class MathData;
+ friend class ArgumentProxy;
+ friend class Cursor;
+
+ /// update the display mode (should only be called after detaching arguments)
+ void setDisplayMode(DisplayMode mode, int appetite = -1);
+ /// compute the next display mode
+ DisplayMode computeDisplayMode() const;
+ /// update macro definition
+ void updateMacro(MacroContext const & mc);
+ /// check if macro definition changed, argument changed etc. and adapt
+ void updateRepresentation(Cursor * cur, MacroContext const & mc,
+ UpdateType, int nesting);
+ /// empty macro, put arguments into args, possibly strip arity-attachedArgsNum_ empty ones.
+ /// Includes the optional arguments.
+ void detachArguments(std::vector<MathData> & args, bool strip);
+ /// attach arguments (maybe less than arity at the end of an MathData),
+ /// including the optional ones (even if it can be empty here)
+ void attachArguments(std::vector<MathData> const & args, size_t arity, int optionals);
+
+private:
+ /// Math mode for output and display. UNDECIDED for user macros: they could
+ /// be either.
+ mode_type modeToEnsure() const;
+ /// This function is needed for now because of two shortfalls of the current
+ /// implementation: the macro() pointer is often dangling, in which case we
+ /// fall back to a backup copy, and the macro is not known at inset
+ /// creation, in which case we fall back to the global macro with this name.
+ MacroData const * macroBackup() const;
+ ///
+ virtual Inset * clone() const;
+ ///
+ bool editMode(BufferView const * bv) const;