]> git.lyx.org Git - lyx.git/blob - src/insets/insettheorem.C
Rename LatexRunParams::fragile as moving_arg.
[lyx.git] / src / insets / insettheorem.C
1 /**
2  * \file insettheorem.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Lars Gullik Bjønnes
7  *
8  * Full author contact details are available in file CREDITS
9  */
10
11 #include <config.h>
12
13
14 #include "insettheorem.h"
15 #include "gettext.h"
16 #include "lyxfont.h"
17 #include "BufferView.h"
18 #include "lyxtext.h"
19 #include "support/LOstream.h"
20 #include "debug.h"
21 #include "insets/insettext.h"
22
23 using std::ostream;
24 using std::endl;
25
26 /*
27   The intention is to be able to create arbitrary theorem like environments
28    sing this class and some helper/container classes. It should be possible
29    to create these theorems both from layout file and interactively by the
30    user.
31 */
32
33 InsetTheorem::InsetTheorem()
34         : InsetCollapsable()
35 {
36         setLabel(_("theorem"));
37         LyXFont font(LyXFont::ALL_SANE);
38         font.decSize();
39         font.decSize();
40         font.setColor(LColor::collapsable);
41         setLabelFont(font);
42 #if 0
43         setAutoCollapse(false);
44 #endif
45         setInsetName("Theorem");
46 }
47
48
49 void InsetTheorem::write(Buffer const * buf, ostream & os) const
50 {
51         os << getInsetName() << "\n";
52         InsetCollapsable::write(buf, os);
53 }
54
55
56 Inset * InsetTheorem::clone(Buffer const &, bool) const
57 {
58 #ifdef WITH_WARNINGS
59 #warning Is this inset used? If YES this is WRONG!!! (Jug)
60 #endif
61         InsetTheorem * result = new InsetTheorem;
62
63         result->collapsed_ = collapsed_;
64         return result;
65 }
66
67
68 string const InsetTheorem::editMessage() const
69 {
70         return _("Opened Theorem Inset");
71 }
72
73
74 int InsetTheorem::latex(Buffer const * buf, ostream & os,
75                         LatexRunParams const & runparams) const
76 {
77         os << "\\begin{theorem}%\n";
78
79         int i = inset.latex(buf, os, runparams);
80         os << "\\end{theorem}%\n";
81
82         return i + 2;
83 }