]> git.lyx.org Git - lyx.git/blob - src/frontends/Application.h
1ee5c13840191134b4322a44de613b44735d84f4
[lyx.git] / src / frontends / Application.h
1 /**
2  * \file frontend/Application.h
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Abdelrazak Younes
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #ifndef LYX_APPLICATION_H
12 #define LYX_APPLICATION_H
13
14 #include "bufferlist.h"
15 #include "lyxfunc.h"
16 #include "lyxserver.h"
17 #include "lyxsocket.h"
18
19 #include <boost/scoped_ptr.hpp>
20
21 #include <string>
22
23 class BufferView;
24 class LyXView;
25
26 namespace lyx {
27 namespace frontend {
28
29 class Clipboard;
30 class Gui;
31 class Selection;
32
33
34 /// The main application class
35 /**
36 There should be only one instance of this class. No Qt object
37 initialisation should be done before the instanciation of this class.
38
39 \todo The work areas handling could be moved to a base virtual class
40 comon to all frontends.
41 */
42 class Application
43 {
44 public:
45         ///
46         Application(int & argc, char ** argv);
47         ///
48         virtual ~Application() {}
49
50         int start(std::string const & batch);
51         ///
52         virtual Gui & gui() = 0;
53         ///
54         virtual int const exec() = 0;
55         ///
56         virtual void exit(int status) = 0;
57
58         ///
59         virtual Clipboard & clipboard() = 0;
60         ///
61         virtual Selection & selection() = 0;
62
63         ///
64         LyXFunc & lyxFunc();
65         LyXFunc const & lyxFunc() const;
66         ///
67         LyXServer & server();
68         LyXServer const & server() const;
69         ///
70         LyXServerSocket & socket();
71         LyXServerSocket const & socket() const;
72         ///
73         BufferList & bufferList();
74         BufferList const & bufferList() const;
75
76         void setBufferView(BufferView * buffer_view);
77
78 protected:
79         ///
80         BufferView * buffer_view_;
81
82         // FIXME: lyxfunc_ should be private. But the actual construction is done in
83         // GuiApplication for now.
84
85         /// our function handler
86         boost::scoped_ptr<LyXFunc> lyxfunc_;
87
88 private:
89         ///
90         boost::scoped_ptr<LyXServer> lyx_server_;
91         ///
92         boost::scoped_ptr<LyXServerSocket> lyx_socket_;
93         ///
94         BufferList buffer_list_;
95
96 }; // Application
97
98 } // namespace frontend
99 } // namespace lyx
100
101 extern lyx::frontend::Application * theApp;
102
103
104 #endif // LYX_APPLICATION_H