]> git.lyx.org Git - lyx.git/blob - src/LyXFunc.h
This should do it for the delimiters.
[lyx.git] / src / LyXFunc.h
1 // -*- C++ -*-
2 /**
3  * \file LyXFunc.h
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  * \author Jean-Marc Lasgouttes
9  * \author John Levon
10  * \author André Pönitz
11  *
12  * Full author contact details are available in file CREDITS.
13  */
14
15 #ifndef LYXFUNC_H
16 #define LYXFUNC_H
17
18 #include "FuncCode.h"
19 #include "KeySequence.h"
20
21 #include "support/docstring.h"
22
23 namespace lyx {
24
25 class Buffer;
26 class BufferView;
27 class DocumentClass;
28 class FuncRequest;
29 class FuncStatus;
30 class KeySymbol;
31 class Text;
32
33 namespace support {
34 class FileName;
35 }
36
37 /** This class encapsulates all the LyX command operations.
38     This is the class of the LyX's "high level event handler".
39     Every user command is processed here, either invocated from
40     keyboard or from the GUI. All GUI objects, including buttons and
41     menus should use this class and never call kernel functions directly.
42 */
43 class LyXFunc
44 {
45 public:
46         ///
47         explicit LyXFunc();
48
49         /// LyX dispatcher, executes lyx actions.
50         void dispatch(FuncRequest const &);
51
52         ///
53         FuncStatus getStatus(FuncRequest const & action) const;
54
55         /// True if lyxfunc reports an error
56         bool errorStat() const { return errorstat; }
57         /// Buffer to store result messages
58         void setMessage(docstring const & m) const;
59         /// Buffer to store result messages
60         void setErrorMessage(docstring const &) const;
61         /// Buffer to store result messages
62         docstring const getMessage() const { return dispatch_buffer; }
63         /// goto a bookmark
64         /// openFile: whether or not open a file if the file is not opened
65         /// switchToBuffer: whether or not switch to buffer if the buffer is
66         ///             not the current buffer
67         void gotoBookmark(unsigned int idx, bool openFile, bool switchToBuffer);
68
69         /// cursor x position before dispatch started
70         int cursorBeforeDispatchX() const { return cursorPosBeforeDispatchX_; }
71         /// cursor y position before dispatch started
72         int cursorBeforeDispatchY() const { return cursorPosBeforeDispatchY_; }
73
74 private:
75         /// cursor position before dispatch started
76         int cursorPosBeforeDispatchX_;
77         int cursorPosBeforeDispatchY_;
78
79         /// Error status, only Dispatch can change this flag
80         mutable bool errorstat;
81
82         /** Buffer to store messages and result data. Is there a
83             good reason to have this one as static in Dispatch? (Ale)
84         */
85         mutable docstring dispatch_buffer;
86 };
87
88 /// Implementation is in LyX.cpp
89 extern LyXFunc & theLyXFunc();
90
91 /// Implementation is in LyX.cpp
92 extern FuncStatus getStatus(FuncRequest const & action);
93
94 /// Implementation is in LyX.cpp
95 extern void dispatch(FuncRequest const & action);
96
97 } // namespace lyx
98
99 #endif