]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/Kernel.h
Add a buffer_path arg to InsetGraphicsMailer's params2string, string2params.
[lyx.git] / src / frontends / controllers / Kernel.h
1 // -*- C++ -*-
2 /**
3  * \file Kernel.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Angus Leeming
8  *
9  * Full author contact details are available in file CREDITS
10  */
11
12 #ifndef KERNEL_H
13 #define KERNEL_H
14
15
16 #include "LString.h"
17
18
19 class Buffer;
20 class BufferView;
21 class FuncRequest;
22 class LyXView;
23
24
25 /** \c Kernel is a wrapper making the LyX kernel available to the dialog.
26  * (Ie, it provides an interface to the Model part of the Model-Controller-
27  *  View split.
28  *  In an ideal world, it will shrink as more info is passed to the
29  *  Dialog::show() and Dialog::update() methods.
30  */
31 class Kernel {
32 public:
33         /// \param lv is the access point for the dialog to the LyX kernel.
34         Kernel(LyXView & lv);
35
36         /** This method is the primary puypose of the class. It provides
37          *  the "gateway" by which the dialog can send a request (of a
38          *  change in the data, for more information) to the kernel.
39          *  \param fr is the encoding of the request.
40          *  \param verbose is set to true if the completed action should
41          *  be displayed in the minibuffer.
42          */
43         void dispatch(FuncRequest const & fr, bool verbose = false) const;
44
45         /** The dialog has received a request from the user
46          *  (who pressed the "Restore" buuton) to update contents.
47          *  It must, therefore, ask the kernel to provide this information.
48          *  \param name is used to identify the dialog to the kernel.
49          */
50         void updateDialog(string const & name) const;
51
52         /** A request from the Controller that future changes to the data
53          *  stored by the dialog are not applied to the inset currently
54          *  connected to the dialog. Instead, they will be used to generate
55          *  a new inset at the cursor position.
56          *  \param name is used to identify the dialog to the kernel.
57          */
58         void disconnect(string const & name) const;
59
60         /** \name Kernel Wrappers
61          *  Simple wrapper functions to Buffer methods.
62          */
63         //@{
64         bool isBufferAvailable() const;
65         bool isBufferReadonly() const;
66         //@}
67
68         /** \enum DocTypes used to flag the different kinds of buffer
69          *  without making the kernel header files available to the
70          *  dialog's Controller or View.
71          */
72         enum DocTypes {
73                 LATEX,
74                 LITERATE,
75                 LINUXDOC,
76                 DOCBOOK
77         };
78         /// The type of the current buffer.
79         DocTypes docType() const;
80
81
82         /** \name Kernel Nasties
83          *  Unpleasantly public internals of the LyX kernel.
84          *  We should aim to reduce/remove these from the interface.
85          */
86         //@{
87         LyXView & lyxview() { return lyxview_; }
88         LyXView const & lyxview() const { return lyxview_; }
89
90         Buffer * buffer();
91         Buffer const * buffer() const;
92
93         BufferView * bufferview();
94         BufferView const * bufferview() const;
95         //@}
96
97 private:
98         LyXView & lyxview_;
99 };
100
101
102 #endif // KERNEL_H