\end_document replaces \the_end.
[lyx.git] / src / lyxfunc.h
blob5926a265f6800264948aa0e161773c01549e57c3
1 // -*- C++ -*-
2 #ifndef LYXFUNC_H
3 #define LYXFUNC_H
5 #include "FuncStatus.h"
6 #include "kbsequence.h"
7 #include "lfuns.h"
8 #include "LString.h"
10 #include <boost/signals/trackable.hpp>
12 class LyXView;
13 class LyXText;
14 class FuncRequest;
15 class BufferView;
18 /** This class encapsulates all the LyX command operations.
19 This is the class of the LyX's "high level event handler".
20 Every user command is processed here, either invocated from
21 keyboard or from the GUI. All GUI objects, including buttons and
22 menus should use this class and never call kernel functions directly.
24 class LyXFunc : public boost::signals::trackable {
25 public:
26 ///
27 explicit
28 LyXFunc(LyXView *);
30 /// LyX dispatcher, executes lyx actions.
31 void dispatch(FuncRequest const &, bool verbose = false);
33 /// Dispatch via a string argument
34 void dispatch(string const & s, bool verbose = false);
36 /// Dispatch via a pseudo action, also displaying shortcut/command name
37 void dispatch(int ac, bool verbose = false);
39 /// return the status bar state string
40 string const view_status_message();
42 ///
43 void processKeySym(LyXKeySymPtr key, key_modifier::state state);
45 /// we need one internal which is called from inside LyXAction and
46 /// can contain the string argument.
47 FuncStatus getStatus(int ac) const;
48 ///
49 FuncStatus getStatus(FuncRequest const & action) const;
51 /// The last key was meta
52 bool wasMetaKey() const;
54 /// True if lyxfunc reports an error
55 bool errorStat() const { return errorstat; }
56 /// Buffer to store result messages
57 void setMessage(string const & m) const;
58 /// Buffer to store result messages
59 void setErrorMessage(string const &) const;
60 /// Buffer to store result messages from getStatus
61 void setStatusMessage(string const &) const;
62 /// Buffer to store result messages
63 string const getMessage() const { return dispatch_buffer; }
64 /// Buffer to store result messages
65 string const getStatusMessage() const { return status_buffer; }
66 /// Handle a accented char key sequence
67 void handleKeyFunc(kb_action action);
69 private:
70 ///
71 BufferView * view() const;
73 ///
74 LyXView * owner;
76 /// the last character added to the key sequence, in ISO encoded form
77 char encoded_last_key;
79 ///
80 kb_sequence keyseq;
81 ///
82 kb_sequence cancel_meta_seq;
83 ///
84 key_modifier::state meta_fake_bit;
85 ///
86 void moveCursorUpdate(bool flag = true, bool selecting = false);
87 ///
88 void setupLocalKeymap();
89 /// Error status, only Dispatch can change this flag
90 mutable bool errorstat;
92 /** Buffer to store messages and result data. Is there a
93 good reason to have this one as static in Dispatch? (Ale)
95 mutable string dispatch_buffer;
96 /** Buffer to store messages and result data from getStatus
98 mutable string status_buffer;
100 /// send a post-dispatch status message
101 void sendDispatchMessage(string const & msg, FuncRequest const & ev, bool verbose);
103 // I think the following should be moved to BufferView. (Asger)
106 void menuNew(string const & argument, bool fromTemplate);
109 void open(string const &);
112 void doImport(string const &);
115 void closeBuffer();
117 // This return or directly text (default) of getLyXText()
119 LyXText * TEXT(bool) const;
124 /*-------------------- inlines --------------------------*/
126 inline
127 bool LyXFunc::wasMetaKey() const
129 return (meta_fake_bit != key_modifier::none);
133 #endif