]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlPreamble.C
do not include language.h and gettext.h in lyxfont.h and lyxparagraph.h
[lyx.git] / src / frontends / controllers / ControlPreamble.C
1 /**
2  * \file FormPreamble.C
3  * Copyright 2001 The LyX Team.
4  * See the file COPYING.
5  *
6  * \author Edwin Leuven, leuven@fee.uva.nl
7  */
8
9 #include <config.h>
10
11 #ifdef __GNUG__
12 #pragma implementation
13 #endif
14
15 #include "ControlPreamble.h"
16 #include "LyXView.h"
17 #include "Dialogs.h"
18 #include "buffer.h"
19 #include "lyxrc.h"
20 #include "Liason.h"
21 #include "gettext.h"
22
23
24 ControlPreamble::ControlPreamble(LyXView & lv, Dialogs & d)
25         : ControlDialog<ControlConnectBD>(lv, d)
26 {
27     d_.showPreamble.connect(SigC::slot(this, &ControlPreamble::show));
28 }
29
30
31 void ControlPreamble::apply()
32 {
33         if (!lv_.view()->available())
34                 return;
35    
36         view().apply();
37
38         lv_.buffer()->params.preamble = params();
39         lv_.buffer()->markDirty();
40         Liason::setMinibuffer(&lv_, _("LaTeX preamble set"));
41 }
42
43
44 string & ControlPreamble::params() const
45 {
46         Assert(params_);
47         return *params_;
48 }
49
50
51 void ControlPreamble::setParams()
52 {
53         if (params_) delete params_;
54         params_ = new string(lv_.buffer()->params.preamble);
55 }
56
57
58 void ControlPreamble::clearParams()
59 {
60         if (params_) {
61                 delete params_;
62                 params_ = 0;
63         }
64 }