1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 1998 The LyX Team.
8 * ======================================================
14 #pragma implementation
17 #include "insettheorem.h"
20 #include "BufferView.h"
22 #include "support/LOstream.h"
24 #include "insets/insettext.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);
45 setAutoCollapse(false);
46 setInsetName("Theorem");
50 void InsetTheorem::write(Buffer const * buf, ostream & os) const
52 os << getInsetName() << "\n";
53 InsetCollapsable::write(buf, os);
57 Inset * InsetTheorem::clone(Buffer const &) const
59 InsetTheorem * result = new InsetTheorem;
61 result->collapsed = collapsed;
66 string const InsetTheorem::editMessage() const
68 return _("Opened Theorem Inset");
72 int InsetTheorem::latex(Buffer const * buf,
73 ostream & os, bool fragile, bool fp) const
75 os << "\\begin{theorem}%\n";
77 int i = inset.latex(buf, os, fragile, fp);
78 os << "\\end{theorem}%\n";
84 bool InsetTheorem::insertInsetAllowed(Inset * inset) const
86 lyxerr << "InsetTheorem::InsertInsetAllowed" << endl;
88 if ((inset->lyxCode() == Inset::FOOT_CODE) ||
89 (inset->lyxCode() == Inset::MARGIN_CODE)) {