diff --git a/src/mathed/array.C b/src/mathed/array.C index 47034105ec..0cec697b09 100644 --- a/src/mathed/array.C +++ b/src/mathed/array.C @@ -5,9 +5,11 @@ #pragma implementation #endif +#include "debug.h" #include "array.h" #include "math_iter.h" #include "math_inset.h" +#include "math_macro.h" #include "support/LOstream.h" @@ -79,6 +81,29 @@ void MathedArray::deep_copy() } } +void MathedArray::substitute(MathMacro * m) +{ + if (m->nargs() == 0) + return; + + MathedIter it(this); + while (it.OK()) { + if (it.IsInset()) { + MathedInset * inset = it.GetInset(); + if (inset->GetType() == LM_OT_MACRO_ARG) { + int n = static_cast(inset)->number() - 1; + //lyxerr << "substituting an argument inset: " << n << "\n"; + inset = m->arg(n)->Clone(); + } else { + inset->substitute(m); + //lyxerr << "substituting in an ordinary inset\n"; + } + raw_pointer_insert(inset, it.getPos() + 1); + } + it.Next(); + } +} + MathedArray & MathedArray::operator=(MathedArray const & array) { @@ -284,7 +309,7 @@ byte & MathedArray::operator[](int i) } -void MathedArray::dump(ostream & os) const +void MathedArray::dump2(ostream & os) const { buffer_type::const_iterator cit = bf_.begin(); buffer_type::const_iterator end = bf_.end(); @@ -294,4 +319,28 @@ void MathedArray::dump(ostream & os) const os << endl; } +void MathedArray::dump(ostream & os) const +{ + MathedIter it( const_cast(this) ); + while (it.OK()) { + if (it.IsInset()) { + MathedInset * inset = it.GetInset(); + os << ""; + } + else if (it.IsTab()) + os << ""; + else if (it.IsCR()) + os << ""; + else if (it.IsScript()) + os << "