X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathTabular.cpp;h=083b0e5ef52d99b4d6bd59886ed5f0ed53edea4a;hb=872c71ffa61e52918a12c847ef7f87b10741d75a;hp=ac4381aa46149f51f28051b5301e6e7be98366e7;hpb=6e3a75969b97a5db4c80c46be49d4deb122abfe7;p=lyx.git diff --git a/src/mathed/InsetMathTabular.cpp b/src/mathed/InsetMathTabular.cpp index ac4381aa46..083b0e5ef5 100644 --- a/src/mathed/InsetMathTabular.cpp +++ b/src/mathed/InsetMathTabular.cpp @@ -3,7 +3,7 @@ * 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. */ @@ -11,55 +11,49 @@ #include #include "InsetMathTabular.h" -#include "MathArray.h" + +#include "MathData.h" #include "MathStream.h" #include "MathStream.h" #include "support/lstrings.h" -#include "support/std_ostream.h" - -#include +#include namespace lyx { - -using std::string; -using std::auto_ptr; - - -InsetMathTabular::InsetMathTabular(docstring const & name, int m, int n) - : InsetMathGrid(m, n), name_(name) +InsetMathTabular::InsetMathTabular(Buffer * buf, docstring const & name, int m, + int n) + : InsetMathGrid(buf, m, n), name_(name) {} -InsetMathTabular::InsetMathTabular(docstring const & name, int m, int n, - char valign, docstring const & halign) - : InsetMathGrid(m, n, valign, halign), name_(name) +InsetMathTabular::InsetMathTabular(Buffer * buf, docstring const & name, int m, + int n, char valign, docstring const & halign) + : InsetMathGrid(buf, m, n, valign, halign), name_(name) {} -InsetMathTabular::InsetMathTabular(docstring const & name, char valign, - docstring const & halign) - : InsetMathGrid(valign, halign), name_(name) -{} - -auto_ptr InsetMathTabular::doClone() const +Inset * InsetMathTabular::clone() const { - return auto_ptr(new InsetMathTabular(*this)); + return new InsetMathTabular(*this); } -bool InsetMathTabular::metrics(MetricsInfo & mi, Dimension & dim) const +void InsetMathTabular::metrics(MetricsInfo & mi, Dimension & dim) const { FontSetChanger dummy(mi.base, "textnormal"); InsetMathGrid::metrics(mi, dim); dim.wid += 6; - if (dim_ == dim) - return false; - dim_ = dim; - return true; +} + + +Dimension const InsetMathTabular::dimension(BufferView const & bv) const +{ + Dimension dim = InsetMathGrid::dimension(bv); + dim.wid += 6; + return dim; } @@ -72,13 +66,16 @@ void InsetMathTabular::draw(PainterInfo & pi, int x, int y) const void InsetMathTabular::write(WriteStream & os) const { + ModeSpecifier specifier(os, TEXT_MODE); + if (os.fragile()) os << "\\protect"; os << "\\begin{" << name_ << '}'; - if (v_align_ == 't' || v_align_ == 'b') - os << '[' << char(v_align_) << ']'; - os << '{' << halign() << "}\n"; + char const v = verticalAlignment(); + if (v == 't' || v == 'b') + os << '[' << v << ']'; + os << '{' << horizontalAlignments() << "}\n"; InsetMathGrid::write(os);