+#include <config.h>
+
#ifdef __GNUG__
#pragma implementation
#endif
-#include <vector>
-
#include "math_hullinset.h"
+#include "math_mathmlstream.h"
+#include "math_streamstr.h"
#include "math_support.h"
#include "debug.h"
#include "Painter.h"
#include "LaTeXFeatures.h"
-#include "math_mathmlstream.h"
+#include "support/LAssert.h"
+
+#include <vector>
+using std::endl;
namespace {
// returns position of first relation operator in the array
// used for "intelligent splitting"
- int firstRelOp(MathArray const & ar)
+ MathArray::size_type firstRelOp(MathArray const & ar)
{
for (MathArray::const_iterator it = ar.begin(); it != ar.end(); ++it)
if ((*it)->isRelOp())
return (col & 1) ? 40 : 0;
default:;
}
- return 10;
+ return 0;
}
string MathHullInset::label(row_type row) const
{
+ row_type n = nrows();
+ lyx::Assert(row < n);
return label_[row];
}
bool MathHullInset::ams() const
{
return true;
-
+/*
return
objtype_ == LM_OT_ALIGN ||
objtype_ == LM_OT_MULTLINE ||
objtype_ == LM_OT_ALIGNAT ||
objtype_ == LM_OT_XALIGNAT ||
objtype_ == LM_OT_XXALIGNAT;
+*/
}
void MathHullInset::validate(LaTeXFeatures & features) const
{
if (ams())
- features.require("amsstyle");
+ features.require("amsmath");
// Validation is necessary only if not using AMS math.
default:
lyxerr << "mutation from '" << getType()
- << "' to '" << newtype << "' not implemented\n";
+ << "' to '" << newtype << "' not implemented"
+ << endl;
break;
}
break;
break;
default:
lyxerr << "mutation from '" << getType()
- << "' to '" << newtype << "' not implemented\n";
+ << "' to '" << newtype << "' not implemented"
+ << endl;
break;
}
break;
default:
lyxerr << "mutation from '" << getType()
- << "' to '" << newtype << "' not implemented\n";
+ << "' to '" << newtype << "' not implemented"
+ << endl;
break;
}
default:
lyxerr << "mutation from '" << getType()
- << "' to '" << newtype << "' not implemented\n";
+ << "' to '" << newtype << "' not implemented"
+ << endl;
+ break;
}
}
void MathHullInset::write(WriteStream & os) const
{
- header_write(os);
-
+ header_write(os);
+
bool n = numberedType();
-
+
for (row_type row = 0; row < nrows(); ++row) {
for (col_type col = 0; col < ncols(); ++col)
- os << cell(index(row, col)) << eocString(col).c_str();
+ os << cell(index(row, col)) << eocString(col);
if (n) {
if (!label_[row].empty())
- os << "\\label{" << label_[row].c_str() << "}";
+ os << "\\label{" << label_[row] << "}";
if (nonum_[row])
os << "\\nonumber ";
}
- os << eolString(row).c_str();
+ os << eolString(row);
}
-
- footer_write(os);
+
+ footer_write(os);
}
void MathHullInset::normalize(NormalStream & os) const
{
- os << "[formula " << normalName(getType()).c_str() << " ";
+ os << "[formula " << normalName(getType()) << " ";
MathGridInset::normalize(os);
os << "] ";
}
}
+void MathHullInset::check() const
+{
+ lyx::Assert(nonum_.size() == nrows());
+ lyx::Assert(label_.size() == nrows());
+}
+
+