]> git.lyx.org Git - lyx.git/blob - src/lyxfunc.h
* remove various xforms relicts, in particular:
[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 "kbsequence.h"
19 #include "lfuns.h"
20
21 #include <boost/shared_ptr.hpp>
22 #include <boost/signals/trackable.hpp>
23
24
25 class BufferView;
26 class FuncRequest;
27 class FuncStatus;
28 class LyXKeySym;
29 class LyXText;
30 class LyXView;
31
32
33 /** This class encapsulates all the LyX command operations.
34     This is the class of the LyX's "high level event handler".
35     Every user command is processed here, either invocated from
36     keyboard or from the GUI. All GUI objects, including buttons and
37     menus should use this class and never call kernel functions directly.
38 */
39 class LyXFunc : public boost::signals::trackable {
40 public:
41         ///
42         explicit LyXFunc(LyXView *);
43
44         /// LyX dispatcher, executes lyx actions.
45         void dispatch(FuncRequest const &);
46
47         /// return the status bar state string
48         std::string const viewStatusMessage();
49
50         ///
51         void processKeySym(LyXKeySymPtr key, key_modifier::state state);
52
53         ///
54         FuncStatus getStatus(FuncRequest const & action) const;
55
56         /// The last key was meta
57         bool wasMetaKey() const;
58
59         /// True if lyxfunc reports an error
60         bool errorStat() const { return errorstat; }
61         /// Buffer to store result messages
62         void setMessage(std::string const & m) const;
63         /// Buffer to store result messages
64         void setErrorMessage(std::string const &) const;
65         /// Buffer to store result messages
66         std::string const getMessage() const { return dispatch_buffer; }
67         /// Handle a accented char key sequence
68         void handleKeyFunc(kb_action action);
69
70 private:
71         ///
72         BufferView * view() const;
73
74         ///
75         LyXView * owner;
76
77         /// the last character added to the key sequence, in ISO encoded form
78         char encoded_last_key;
79
80         ///
81         kb_sequence keyseq;
82         ///
83         kb_sequence cancel_meta_seq;
84         ///
85         key_modifier::state meta_fake_bit;
86         ///
87         void setupLocalKeymap();
88         /// Error status, only Dispatch can change this flag
89         mutable bool errorstat;
90
91         /** Buffer to store messages and result data. Is there a
92             good reason to have this one as static in Dispatch? (Ale)
93         */
94         mutable std::string dispatch_buffer;
95
96         /// send a post-dispatch status message
97         void sendDispatchMessage(std::string const & msg,
98                 FuncRequest const & ev);
99
100         // I think the following should be moved to BufferView. (Asger)
101         ///
102         void menuNew(std::string const & argument, bool fromTemplate);
103         ///
104         void open(std::string const &);
105         ///
106         void doImport(std::string const &);
107         ///
108         void closeBuffer();
109 };
110
111 #endif