* 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
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "InsetMathSplit.h"
+
#include "MathData.h"
#include "MathStream.h"
#include "MathStream.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "LaTeXFeatures.h"
#include "support/lstrings.h"
-#include "support/std_ostream.h"
+#include <ostream>
+
+using namespace std;
namespace lyx {
using support::bformat;
-using std::string;
-using std::auto_ptr;
-
-InsetMathSplit::InsetMathSplit(docstring const & name, char valign)
- : InsetMathGrid(1, 1, valign, docstring()), name_(name)
+InsetMathSplit::InsetMathSplit(Buffer * buf, docstring const & name,
+ char valign)
+ : InsetMathGrid(buf, 1, 1, valign, docstring()), name_(name)
{
}
-auto_ptr<Inset> InsetMathSplit::doClone() const
+Inset * InsetMathSplit::clone() const
{
- return auto_ptr<Inset>(new InsetMathSplit(*this));
+ return new InsetMathSplit(*this);
}
if (s == "add-vline-left" || s == "add-vline-right") {
flag.message(bformat(
from_utf8(N_("Can't add vertical grid lines in '%1$s'")), name_));
- flag.enabled(false);
+ flag.setEnabled(false);
return true;
}
return InsetMathGrid::getStatus(cur, cmd, flag);
void InsetMathSplit::write(WriteStream & ws) const
{
+ MathEnsurer ensurer(ws);
if (ws.fragile())
ws << "\\protect";
ws << "\\begin{" << name_ << '}';
- if (name_ != "split" && valign() != 'c')
- ws << '[' << valign() << ']';
+ if (name_ != "split" && verticalAlignment() != 'c')
+ ws << '[' << verticalAlignment() << ']';
if (name_ == "alignedat")
ws << '{' << static_cast<unsigned int>((ncols() + 1)/2) << '}';
InsetMathGrid::write(ws);
}
+void InsetMathSplit::mathmlize(MathStream & ms) const
+{
+ // split, gathered, aligned, alignedat
+ // At the moment, those seem to display just fine without any
+ // special treatment.
+ // FIXME
+ // lgathered and rgathered could use the proper alignment, but
+ // it's not clear how to do that without copying a lot of code.
+ // One idea would be to wrap the table in an <mrow>, and set the
+ // alignment there via CSS.
+ InsetMathGrid::mathmlize(ms);
+}
+
+
void InsetMathSplit::validate(LaTeXFeatures & features) const
{
if (name_ == "split" || name_ == "gathered" || name_ == "aligned" ||