* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author André Pönitz
+ * \author André Pönitz
* \author Stefan Schimanski
*
* Full author contact details are available in file CREDITS.
}
-void MathMacroTemplate::removeArguments(Cursor & cur, int from, int to) {
- for (DocIterator it = doc_iterator_begin(*this); it; it.forwardChar()) {
+void MathMacroTemplate::removeArguments(Cursor & cur, int from, int to)
+{
+ for (DocIterator it = doc_iterator_begin(&buffer(), this); it; it.forwardChar()) {
if (!it.nextInset())
continue;
if (it.nextInset()->lyxCode() != MATHMACROARG_CODE)
}
-void MathMacroTemplate::shiftArguments(size_t from, int by) {
- for (DocIterator it = doc_iterator_begin(*this); it; it.forwardChar()) {
+void MathMacroTemplate::shiftArguments(size_t from, int by)
+{
+ for (DocIterator it = doc_iterator_begin(&buffer(), this); it; it.forwardChar()) {
if (!it.nextInset())
continue;
if (it.nextInset()->lyxCode() != MATHMACROARG_CODE)
int MathMacroTemplate::maxArgumentInDefinition() const
{
int maxArg = 0;
- MathMacroTemplate * nonConst = const_cast<MathMacroTemplate *>(this);
- DocIterator it = doc_iterator_begin(*nonConst);
+ DocIterator it = doc_iterator_begin(&buffer(), this);
it.idx() = defIdx();
for (; it; it.forwardChar()) {
if (!it.nextInset())
idx_type idx = cell(displayIdx()).empty() ? defIdx() : displayIdx();
// search for #n macros arguments
- DocIterator it = doc_iterator_begin(*this);
+ DocIterator it = doc_iterator_begin(&buffer(), this);
it.idx() = idx;
for (; it && it[0].idx() == idx; it.forwardChar()) {
if (!it.nextInset())
}
os << "]";
} else {
- // macros without optionals use standard _global_ \def macros:
- // \global\def\foo#1#2{#1,#2}
+ // Macros without optionals use standard _global_ \def macros:
+ // \global\def\long\foo#1#2{#1,#2}
+ // We use the \long prefix as this is the equivalent to \newcommand.
+ // We cannot use \newcommand directly because \global does not work with it.
os << "\\global\\long\\def\\" << name();
docstring param = from_ascii("#0");
for (int i = 1; i <= numargs_; ++i) {