]> git.lyx.org Git - lyx.git/blob - src/insets/insettheorem.C
Don't remove cell selections after fontchange.
[lyx.git] / src / insets / insettheorem.C
1 /* This file is part of
2  * ======================================================
3  * 
4  *           LyX, The Document Processor
5  *       
6  *          Copyright 1998 The LyX Team.
7  *
8  * ======================================================
9  */
10
11 #include <config.h>
12
13 #ifdef __GNUG__
14 #pragma implementation
15 #endif
16
17 #include "insettheorem.h"
18 #include "gettext.h"
19 #include "lyxfont.h"
20 #include "BufferView.h"
21 #include "lyxtext.h"
22 #include "support/LOstream.h"
23 #include "debug.h"
24 #include "insets/insettext.h"
25
26 using std::ostream;
27 using std::endl;
28
29 /*
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
33    user.
34 */
35
36 InsetTheorem::InsetTheorem()
37         : InsetCollapsable()
38 {
39         setLabel(_("theorem"));
40         LyXFont font(LyXFont::ALL_SANE);
41         font.decSize();
42         font.decSize();
43         font.setColor(LColor::collapsable);
44         setLabelFont(font);
45 #if 0
46         setAutoCollapse(false);
47 #endif
48         setInsetName("Theorem");
49 }
50
51
52 void InsetTheorem::write(Buffer const * buf, ostream & os) const 
53 {
54         os << getInsetName() << "\n";
55         InsetCollapsable::write(buf, os);
56 }
57
58
59 Inset * InsetTheorem::clone(Buffer const &, bool) const
60 {
61 #warning Is this inset used? If YES this is WRONG!!! (Jug)
62         InsetTheorem * result = new InsetTheorem;
63         
64         result->collapsed_ = collapsed_;
65         return result;
66 }
67
68
69 string const InsetTheorem::editMessage() const
70 {
71         return _("Opened Theorem Inset");
72 }
73
74
75 int InsetTheorem::latex(Buffer const * buf,
76                         ostream & os, bool fragile, bool fp) const
77 {
78         os << "\\begin{theorem}%\n";
79         
80         int i = inset.latex(buf, os, fragile, fp);
81         os << "\\end{theorem}%\n";
82         
83         return i + 2;
84 }