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
10 * \author André Pönitz
12 * Full author contact details are available in file CREDITS.
18 #include "kbsequence.h"
21 #include "support/docstring.h"
23 #include <boost/shared_ptr.hpp>
24 #include <boost/signals/trackable.hpp>
35 /** This class encapsulates all the LyX command operations.
36 This is the class of the LyX's "high level event handler".
37 Every user command is processed here, either invocated from
38 keyboard or from the GUI. All GUI objects, including buttons and
39 menus should use this class and never call kernel functions directly.
41 class LyXFunc : public boost::signals::trackable {
44 explicit LyXFunc(LyXView * lv = 0);
46 /// LyX dispatcher, executes lyx actions.
47 void dispatch(FuncRequest const &);
50 void setLyXView(LyXView * lv);
52 /// return the status bar state string
53 std::string const viewStatusMessage();
56 void processKeySym(LyXKeySymPtr key, key_modifier::state state);
59 FuncStatus getStatus(FuncRequest const & action) const;
61 /// The last key was meta
62 bool wasMetaKey() const;
64 /// True if lyxfunc reports an error
65 bool errorStat() const { return errorstat; }
66 /// Buffer to store result messages
67 void setMessage(lyx::docstring const & m) const;
68 /// Buffer to store result messages
69 void setErrorMessage(lyx::docstring const &) const;
70 /// Buffer to store result messages
71 lyx::docstring const getMessage() const { return dispatch_buffer; }
72 /// Handle a accented char key sequence
73 void handleKeyFunc(kb_action action);
77 BufferView * view() const;
82 /// the last character added to the key sequence, in ISO encoded form
83 lyx::char_type encoded_last_key;
88 kb_sequence cancel_meta_seq;
90 key_modifier::state meta_fake_bit;
92 void setupLocalKeymap();
93 /// Error status, only Dispatch can change this flag
94 mutable bool errorstat;
96 /** Buffer to store messages and result data. Is there a
97 good reason to have this one as static in Dispatch? (Ale)
99 mutable lyx::docstring dispatch_buffer;
101 /// send a post-dispatch status message
102 void sendDispatchMessage(lyx::docstring const & msg,
103 FuncRequest const & ev);
105 // I think the following should be moved to BufferView. (Asger)
107 void menuNew(std::string const & argument, bool fromTemplate);
109 void open(std::string const &);
111 void doImport(std::string const &);
115 bool ensureBufferClean(BufferView * bv);
118 extern LyXFunc & theLyXFunc();
122 extern FuncStatus getStatus(FuncRequest const & action);
124 extern void dispatch(FuncRequest const & action);