2 * \file InsetBase.heorem.cpp
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 "InsetBase.heorem.h"
14 #include "insets/InsetText.h"
20 #include "MetricsInfo.h"
22 #include "support/std_ostream.h"
32 The intention is to be able to create arbitrary theorem like environments
33 sing this class and some helper/container classes. It should be possible
34 to create these theorems both from layout file and interactively by the
38 InsetBase.heorem::InsetTheorem()
41 setLabel(_("theorem"));
42 LyXFont font(LyXFont::ALL_SANE);
45 font.setColor(Color::collapsable);
48 setAutoCollapse(false);
50 setInsetName("Theorem");
54 void InsetBase.heorem::write(Buffer const * buf, ostream & os) const
56 os << getInsetName() << "\n";
57 InsetCollapsable::write(buf, os);
61 auto_ptr<InsetBase> InsetBase.heorem::doClone() const
64 #warning Is this inset used? If YES this is WRONG!!! (Jug)
66 auto_ptr<InsetBase.heorem> result(new InsetTheorem);
67 result->setCollapsed(!isOpen());
72 bool InsetBase.heorem::metrics(MetricsInfo & mi, Dimension & dim) const
74 InsetCollapsable::metrics(mi, dim);
75 center_indent_ = (mi.base.textwidth - dim.wid) / 2;
76 dim.wid = mi.base.textwidth;
77 bool const changed = dim_ != dim;
83 void InsetTOC::draw(PainterInfo & pi, int x, int y) const
85 InsetCollapsable::draw(pi, x + center_indent_, y);
89 string const InsetBase.heorem::editMessage() const
91 return _("Opened Theorem Inset");
95 int InsetBase.heorem::latex(Buffer const * buf, odocstream & os,
96 OutputParams const & runparams) const
98 os << "\\begin{theorem}%\n";
100 int i = inset.latex(buf, os, runparams);
101 os << "\\end{theorem}%\n";