* de.po: sync with branch.
[lyx.git] / src / LyXFunc.h
blob9b8fe7ffbd89a5a87b53b498156a6d8b420920fa
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.
7 * \author Lars Gullik Bjønnes
8 * \author Jean-Marc Lasgouttes
9 * \author John Levon
10 * \author André Pönitz
12 * Full author contact details are available in file CREDITS.
15 #ifndef LYXFUNC_H
16 #define LYXFUNC_H
18 #include "FuncCode.h"
19 #include "KeySequence.h"
21 #include "support/docstring.h"
23 namespace lyx {
25 class Buffer;
26 class BufferView;
27 class DocumentClass;
28 class FuncRequest;
29 class FuncStatus;
30 class KeySymbol;
31 class Text;
33 namespace support {
34 class FileName;
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.
43 class LyXFunc
45 public:
46 ///
47 explicit LyXFunc();
49 /// LyX dispatcher, executes lyx actions.
50 void dispatch(FuncRequest const &);
52 ///
53 FuncStatus getStatus(FuncRequest const & action) const;
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);
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_; }
74 private:
75 /// cursor position before dispatch started
76 int cursorPosBeforeDispatchX_;
77 int cursorPosBeforeDispatchY_;
79 /// Error status, only Dispatch can change this flag
80 mutable bool errorstat;
82 /** Buffer to store messages and result data. Is there a
83 good reason to have this one as static in Dispatch? (Ale)
85 mutable docstring dispatch_buffer;
88 /// Implementation is in LyX.cpp
89 extern LyXFunc & theLyXFunc();
91 /// Implementation is in LyX.cpp
92 extern FuncStatus getStatus(FuncRequest const & action);
94 /// Implementation is in LyX.cpp
95 extern void dispatch(FuncRequest const & action);
97 } // namespace lyx
99 #endif