]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlPreamble.C
fix crash due to invalidated iterator
[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 #include "ControlPreamble.h"
14
15 #include "buffer.h"
16 #include "bufferparams.h"
17
18 using std::string;
19
20 namespace lyx {
21 namespace frontend {
22
23 ControlPreamble::ControlPreamble(Dialog & parent)
24         : Dialog::Controller(parent)
25 {}
26
27
28 bool ControlPreamble::initialiseParams(std::string const &)
29 {
30         params_ = kernel().buffer().params().preamble;
31         return true;
32 }
33
34
35 void ControlPreamble::clearParams()
36 {
37         params_.erase();
38 }
39
40
41 void ControlPreamble::dispatchParams()
42 {
43         // This can stay because we're going to throw the class away
44         // as soon as xforms 1.1 is released.
45         // Ie, there's no need to define LFUN_BUFFERPREAMBLE_APPLY.
46         Buffer & buffer = kernel().buffer();
47         buffer.params().preamble = params();
48         buffer.markDirty();
49 }
50
51
52 string const & ControlPreamble::params() const
53 {
54         return params_;
55 }
56
57
58 void ControlPreamble::params(string const & newparams)
59 {
60         params_ = newparams;
61 }
62
63 } // namespace frontend
64 } // namespace lyx