]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlPreamble.C
This file is part of LyX, the document processor.
[lyx.git] / src / frontends / controllers / ControlPreamble.C
1 /**
2  * \file ControlPreamble.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Edwin Leuven
7  *
8  * Full author contact details are available in file CREDITS
9  */
10
11 #include <config.h>
12
13 #ifdef __GNUG__
14 #pragma implementation
15 #endif
16
17 #include "ControlPreamble.h"
18
19 #include "ViewBase.h"
20
21 #include "buffer.h"
22 #include "gettext.h"
23
24 #include "frontends/Liason.h"
25
26
27 ControlPreamble::ControlPreamble(LyXView & lv, Dialogs & d)
28         : ControlDialogBD(lv, d),
29           params_(0)
30 {}
31
32
33 void ControlPreamble::apply()
34 {
35         if (!bufferIsAvailable())
36                 return;
37
38         view().apply();
39
40         buffer()->params.preamble = params();
41         buffer()->markDirty();
42         Liason::setMinibuffer(&lv_, _("LaTeX preamble set"));
43 }
44
45
46 string & ControlPreamble::params() const
47 {
48         lyx::Assert(params_);
49         return *params_;
50 }
51
52
53 void ControlPreamble::setParams()
54 {
55         delete params_;
56         params_ = new string(buffer()->params.preamble);
57 }
58
59
60 void ControlPreamble::clearParams()
61 {
62         delete params_;
63         params_ = 0;
64 }