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"
17 #include "BufferView.h"
21 #include "metricsinfo.h"
23 #include "support/std_ostream.h"
30 The intention is to be able to create arbitrary theorem like environments
31 sing this class and some helper/container classes. It should be possible
32 to create these theorems both from layout file and interactively by the
36 InsetTheorem::InsetTheorem()
39 setLabel(_("theorem"));
40 LyXFont font(LyXFont::ALL_SANE);
43 font.setColor(LColor::collapsable);
46 setAutoCollapse(false);
48 setInsetName("Theorem");
52 void InsetTheorem::write(Buffer const * buf, ostream & os) const
54 os << getInsetName() << "\n";
55 InsetCollapsable::write(buf, os);
59 auto_ptr<InsetBase> InsetTheorem::clone() const
62 #warning Is this inset used? If YES this is WRONG!!! (Jug)
64 auto_ptr<InsetTheorem> result(new InsetTheorem);
65 result->setCollapsed(!isOpen());
70 void InsetTheorem::metrics(MetricsInfo & mi, Dimension & dim) const
72 InsetCollapsable::metrics(mi, dim);
73 center_indent_ = (mi.base.textwidth - dim.wid) / 2;
74 dim.wid = mi.base.textwidth;
79 void InsetTOC::draw(PainterInfo & pi, int x, int y) const
81 InsetCollapsable::draw(pi, x + center_indent_, y);
85 string const InsetTheorem::editMessage() const
87 return _("Opened Theorem Inset");
91 int InsetTheorem::latex(Buffer const * buf, ostream & os,
92 LatexRunParams const & runparams) const
94 os << "\\begin{theorem}%\n";
96 int i = inset.latex(buf, os, runparams);
97 os << "\\end{theorem}%\n";