]> git.lyx.org Git - lyx.git/blob - src/frontends/Application.h
a141bf54d45e6d99e2949ae5b5c2da5fe7fb86e0
[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 <boost/scoped_ptr.hpp>
15
16 #include <string>
17
18 class BufferList;
19 class BufferView;
20 class LyXFunc;
21 class LyXServer;
22 class LyXServerSocket;
23 class LyXView;
24         
25 namespace lyx {
26 namespace frontend {
27
28 struct Application_pimpl;
29 class Clipboard;
30 class Gui;
31 class Selection;
32
33 /// The main application class
34 /**
35 There should be only one instance of this class. No Qt object
36 initialisation should be done before the instanciation of this class.
37
38 \todo The work areas handling could be moved to a base virtual class
39 comon to all frontends.
40 */
41 class Application
42 {
43 public:
44         ///
45         Application(int & argc, char ** argv);
46         ///
47         virtual ~Application() {}
48
49         int start(std::string const & batch);
50         ///
51         virtual Gui & gui() = 0;
52         ///
53         virtual int const exec() = 0;
54         ///
55         virtual void exit(int status) = 0;
56
57         ///
58         virtual Clipboard & clipboard() = 0;
59         ///
60         virtual Selection & selection() = 0;
61
62         /// return a suitable serif font name.
63         virtual std::string const romanFontName() = 0;
64
65         /// return a suitable sans serif font name.
66         virtual std::string const sansFontName() = 0;
67
68         /// return a suitable monospaced font name.
69         virtual std::string const typewriterFontName() = 0;
70
71         ///
72         LyXFunc & lyxFunc();
73         LyXFunc const & lyxFunc() const;
74         ///
75         LyXServer & server();
76         LyXServer const & server() const;
77         ///
78         LyXServerSocket & socket();
79         LyXServerSocket const & socket() const;
80         ///
81         BufferList & bufferList();
82         BufferList const & bufferList() const;
83
84         ///
85         LyXView & createView(unsigned int width, unsigned int height,
86                 int posx, int posy, bool maximize);
87         
88         ///
89         void setBufferView(BufferView * buffer_view);
90
91 protected:
92         /// This BufferView is the one receiving Clipboard and Selection
93         /// Events
94         /// FIXME: \todo use Gui::currentView() in the future
95         BufferView * buffer_view_;
96
97 private:
98         /// Application private implementation.
99         Application_pimpl * pimpl_;
100
101 }; // Application
102
103 } // namespace frontend
104 } // namespace lyx
105
106 extern lyx::frontend::Application * theApp;
107
108
109 #endif // LYX_APPLICATION_H