replace most &dquot;...&dquot; by <...>
[lyx.git] / src / lyxfunc.h
blob63a690f2a0e667dc370305836241d49e7c3b5975
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 "kbsequence.h"
19 #include "lfuns.h"
21 #include <boost/shared_ptr.hpp>
22 #include <boost/signals/trackable.hpp>
25 class BufferView;
26 class FuncRequest;
27 class FuncStatus;
28 class LyXKeySym;
29 class LyXText;
30 class LyXView;
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.
39 class LyXFunc : public boost::signals::trackable {
40 public:
41 ///
42 explicit LyXFunc(LyXView *);
44 /// LyX dispatcher, executes lyx actions.
45 void dispatch(FuncRequest const &, bool verbose = false);
47 /// return the status bar state string
48 std::string const viewStatusMessage();
50 ///
51 typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr;
52 ///
53 void processKeySym(LyXKeySymPtr key, key_modifier::state state);
55 ///
56 FuncStatus getStatus(FuncRequest const & action) const;
58 /// The last key was meta
59 bool wasMetaKey() const;
61 /// True if lyxfunc reports an error
62 bool errorStat() const { return errorstat; }
63 /// Buffer to store result messages
64 void setMessage(std::string const & m) const;
65 /// Buffer to store result messages
66 void setErrorMessage(std::string const &) const;
67 /// Buffer to store result messages from getStatus
68 void setStatusMessage(std::string const &) const;
69 /// Buffer to store result messages
70 std::string const getMessage() const { return dispatch_buffer; }
71 /// Buffer to store result messages
72 std::string const getStatusMessage() const { return status_buffer; }
73 /// Handle a accented char key sequence
74 void handleKeyFunc(kb_action action);
76 private:
77 ///
78 BufferView * view() const;
80 ///
81 LyXView * owner;
83 /// the last character added to the key sequence, in ISO encoded form
84 char encoded_last_key;
86 ///
87 kb_sequence keyseq;
88 ///
89 kb_sequence cancel_meta_seq;
90 ///
91 key_modifier::state meta_fake_bit;
92 ///
93 void setupLocalKeymap();
94 /// Error status, only Dispatch can change this flag
95 mutable bool errorstat;
97 /** Buffer to store messages and result data. Is there a
98 good reason to have this one as static in Dispatch? (Ale)
100 mutable std::string dispatch_buffer;
101 /// Buffer to store messages and result data from getStatus
102 mutable std::string status_buffer;
104 /// send a post-dispatch status message
105 void sendDispatchMessage(std::string const & msg,
106 FuncRequest const & ev, bool verbose);
108 // I think the following should be moved to BufferView. (Asger)
110 void menuNew(std::string const & argument, bool fromTemplate);
112 void open(std::string const &);
114 void doImport(std::string const &);
116 void closeBuffer();
119 #endif