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"
23 #include "support/LOstream.h"
25 #include "insets/insettext.h"
31 The intention is to be able to create arbitrary theorem like environments
32 sing this class and some helper/container classes. It should be possible
33 to create these theorems both from layout file and interactively by the
37 InsetTheorem::InsetTheorem()
40 setLabel(_("theorem"));
41 LyXFont font(LyXFont::ALL_SANE);
44 font.setColor(LColor::footnote);
46 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 Inset * InsetTheorem::Clone() const
60 InsetTheorem * result = new InsetTheorem;
62 result->collapsed = collapsed;
67 char const * InsetTheorem::EditMessage() const
69 return _("Opened Theorem Inset");
73 int InsetTheorem::Latex(Buffer const * buf,
74 ostream & os, bool fragile, bool fp) const
76 os << "\\begin{theorem}%\n";
78 int i = inset->Latex(buf, os, fragile, fp);
79 os << "\\end{theorem}%\n";
85 bool InsetTheorem::InsertInsetAllowed(Inset * inset) const
87 lyxerr << "InsetTheorem::InsertInsetAllowed" << endl;
89 if ((inset->LyxCode() == Inset::FOOT_CODE) ||
90 (inset->LyxCode() == Inset::MARGIN_CODE)) {
98 LyXFont InsetTheorem::GetDrawFont(BufferView * bv,
99 LyXParagraph * p, int pos) const
101 LyXFont fn = getLyXText(bv)->GetFont(bv->buffer(), p, pos);
102 fn.decSize().decSize();