X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathBox.h;h=898376583648135bb344f9f03d74b9b8464482a8;hb=d9082639080b9de993742bd352f92e5183058cf5;hp=e3bd98277dc9476f4691eff0ac50ea850ad24f59;hpb=6c300f72a217722652dc27db9108e1050028979c;p=lyx.git diff --git a/src/mathed/InsetMathBox.h b/src/mathed/InsetMathBox.h index e3bd98277d..8983765836 100644 --- a/src/mathed/InsetMathBox.h +++ b/src/mathed/InsetMathBox.h @@ -4,7 +4,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. */ @@ -14,41 +14,132 @@ #include "InsetMathNest.h" -#include - namespace lyx { +/// Support for \\mbox +class InsetMathBox : public InsetMathNest { +public: + /// + explicit InsetMathBox(Buffer * buf, docstring const & name); + /// + mode_type currentMode() const override { return TEXT_MODE; } + /// + void metrics(MetricsInfo & mi, Dimension & dim) const override; + /// + void draw(PainterInfo & pi, int x, int y) const override; + /// + void write(TeXMathStream & os) const override; + /// + void normalize(NormalStream & ns) const override; + /// + void mathmlize(MathMLStream & ms) const override; + /// + void htmlize(HtmlStream & ms) const override; + /// + void infoize(odocstream & os) const override; + /// + void validate(LaTeXFeatures & features) const override; + /// + InsetCode lyxCode() const override { return MATH_BOX_CODE; } -class LyXFont; +private: + Inset * clone() const override { return new InsetMathBox(*this); } + /// + docstring name_; +}; -/// Support for \\mbox -class InsetMathBox : public InsetMathNest { +/// Non-AMS-style frame +class InsetMathFBox : public InsetMathNest { public: /// - explicit InsetMathBox(std::string const & name); + explicit InsetMathFBox(Buffer * buf); /// - mode_type currentMode() const { return TEXT_MODE; } + mode_type currentMode() const override { return TEXT_MODE; } /// - void metrics(MetricsInfo & mi, Dimension & dim) const; + marker_type marker(BufferView const *) const override { return marker_type::NO_MARKER; } /// - void draw(PainterInfo & pi, int x, int y) const; + void metrics(MetricsInfo & mi, Dimension & dim) const override; /// - void write(WriteStream & os) const; + void draw(PainterInfo & pi, int x, int y) const override; /// - void normalize(NormalStream & ns) const; + void write(TeXMathStream & os) const override; + /// write normalized content + void normalize(NormalStream & ns) const override; /// - void infoize(std::ostream & os) const; + void mathmlize(MathMLStream & ms) const override; + /// + void htmlize(HtmlStream & ms) const override; + /// + void infoize(odocstream & os) const override; + /// + void validate(LaTeXFeatures & features) const override; +private: + /// + Inset * clone() const override { return new InsetMathFBox(*this); } +}; + +/// Extra nesting: \\makebox or \\framebox. +class InsetMathMakebox : public InsetMathNest { +public: + /// + InsetMathMakebox(Buffer * buf, bool framebox); + /// + void metrics(MetricsInfo & mi, Dimension & dim) const override; + /// + void draw(PainterInfo & pi, int x, int y) const override; + /// + void write(TeXMathStream & os) const override; + /// write normalized content + void normalize(NormalStream & ns) const override; + /// + void mathmlize(MathMLStream & ms) const override; + /// + void htmlize(HtmlStream & ms) const override; + /// + mode_type currentMode() const override { return TEXT_MODE; } + /// + void infoize(odocstream & os) const override; + /// + void validate(LaTeXFeatures & features) const override; private: - virtual std::auto_ptr doClone() const; + Inset * clone() const override { return new InsetMathMakebox(*this); } /// - std::string name_; + bool framebox_; }; +/// AMS-style frame +class InsetMathBoxed : public InsetMathNest { +public: + /// + explicit InsetMathBoxed(Buffer * buf); + /// + marker_type marker(BufferView const *) const override { return marker_type::NO_MARKER; } + /// + void validate(LaTeXFeatures & features) const override; + /// + void metrics(MetricsInfo & mi, Dimension & dim) const override; + /// + void draw(PainterInfo & pi, int x, int y) const override; + /// + void write(TeXMathStream & os) const override; + /// + void mathmlize(MathMLStream & ms) const override; + /// + void htmlize(HtmlStream & ms) const override; + /// write normalized content + void normalize(NormalStream & ns) const override; + /// + void infoize(odocstream & os) const override; +private: + Inset * clone() const override { return new InsetMathBoxed(*this); } +}; + + } // namespace lyx -#endif +#endif // MATH_MBOX