3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
8 * Full author contact details are available in file CREDITS.
13 #include "insettheorem.h"
14 #include "insets/insettext.h"
20 #include "metricsinfo.h"
22 #include "support/std_ostream.h"
29 The intention is to be able to create arbitrary theorem like environments
30 sing this class and some helper/container classes. It should be possible
31 to create these theorems both from layout file and interactively by the
35 InsetTheorem::InsetTheorem()
38 setLabel(_("theorem"));
39 LyXFont font(LyXFont::ALL_SANE);
42 font.setColor(LColor::collapsable);
45 setAutoCollapse(false);
47 setInsetName("Theorem");
51 void InsetTheorem::write(Buffer const * buf, ostream & os) const
53 os << getInsetName() << "\n";
54 InsetCollapsable::write(buf, os);
58 auto_ptr<InsetBase> InsetTheorem::doClone() const
61 #warning Is this inset used? If YES this is WRONG!!! (Jug)
63 auto_ptr<InsetTheorem> result(new InsetTheorem);
64 result->setCollapsed(!isOpen());
69 void InsetTheorem::metrics(MetricsInfo & mi, Dimension & dim) const
71 InsetCollapsable::metrics(mi, dim);
72 center_indent_ = (mi.base.textwidth - dim.wid) / 2;
73 dim.wid = mi.base.textwidth;
78 void InsetTOC::draw(PainterInfo & pi, int x, int y) const
80 InsetCollapsable::draw(pi, x + center_indent_, y);
84 string const InsetTheorem::editMessage() const
86 return _("Opened Theorem Inset");
90 int InsetTheorem::latex(Buffer const * buf, odocstream & os,
91 OutputParams const & runparams) const
93 os << "\\begin{theorem}%\n";
95 int i = inset.latex(buf, os, runparams);
96 os << "\\end{theorem}%\n";