]> git.lyx.org Git - lyx.git/blob - src/insets/InsetTheorem.cpp
This should be the last of the commits refactoring the InsetLayout code.
[lyx.git] / src / insets / InsetTheorem.cpp
1 #if 0
2 /**
3  * \file InsetTheorem.cpp
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "InsetTheorem.h"
15 #include "insets/InsetText.h"
16
17 #include "support/debug.h"
18 #include "support/gettext.h"
19 #include "FontInfo.h"
20 #include "Text.h"
21 #include "MetricsInfo.h"
22
23 #include <ostream>
24
25 using namespace std;
26
27 namespace lyx {
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 Inset.heorem::InsetTheorem()
37         : InsetCollapsable()
38 {
39         setLabel(_("theorem"));
40 #if 0
41         setAutoCollapse(false);
42 #endif
43         setInsetName("Theorem");
44 }
45
46
47 void Inset.heorem::write(Buffer const * buf, ostream & os) const
48 {
49         os << name() << "\n";
50         InsetCollapsable::write(buf, os);
51 }
52
53
54 Inset * InsetTheorem::clone() const
55 {
56         // FIXME: Is this inset used? If YES this is WRONG!!! (Jug)
57         InsetTheorem * result = new InsetTheorem;
58         result->setCollapsed(!isOpen());
59         return result;
60 }
61
62
63 void Inset.heorem::metrics(MetricsInfo & mi, Dimension & dim) const
64 {
65         InsetCollapsable::metrics(mi, dim);
66         center_indent_ = (mi.base.textwidth - dim.wid) / 2;
67         dim.wid = mi.base.textwidth;
68 }
69
70
71 void InsetTOC::draw(PainterInfo & pi, int x, int y) const
72 {
73         InsetCollapsable::draw(pi, x + center_indent_, y);
74 }
75
76
77 string const Inset.heorem::editMessage() const
78 {
79         return _("Opened Theorem Inset");
80 }
81
82
83 int Inset.heorem::latex(Buffer const * buf, odocstream & os,
84                         OutputParams const & runparams) const
85 {
86         os << "\\begin{theorem}%\n";
87
88         int i = inset.latex(buf, os, runparams);
89         os << "\\end{theorem}%\n";
90
91         return i + 2;
92 }
93
94
95 } // namespace lyx
96
97 #endif