]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlDocument.h
next one
[lyx.git] / src / frontends / controllers / ControlDocument.h
1 // -*- C++ -*-
2 /**
3  * \file ControlDocument.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Edwin Leuven
8  * \author Richard Heck (modules)
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef CONTROLDOCUMENT_H
14 #define CONTROLDOCUMENT_H
15
16 #include "Dialog.h"
17 #include "BufferParams.h"
18 #include "support/FileName.h"
19 #include "support/filetools.h"
20 #include "support/types.h"
21 #include <map>
22 #include <vector>
23
24 namespace lyx {
25
26 class BufferParams;
27 class TextClass;
28
29 namespace frontend {
30
31 ///
32 typedef void const * BufferId;
33 ///
34 typedef std::map<std::string, support::FileName> ModuleMap;
35
36 /** A controller for Document dialogs.
37  */
38 class ControlDocument : public Controller
39 {
40 public:
41         /// font family names for BufferParams::fontsDefaultFamily
42         static char const * const fontfamilies[5];
43         /// GUI names corresponding fontfamilies
44         static char const * fontfamilies_gui[5];
45         ///
46         ControlDocument(Dialog &);
47         ///
48         ~ControlDocument();
49         ///
50         virtual bool initialiseParams(std::string const & data);
51         ///
52         virtual void clearParams();
53         ///
54         virtual void dispatchParams();
55         ///
56         virtual bool isBufferDependent() const { return true; }
57         /// always true since we don't manipulate document contents
58         virtual bool canApply() const { return true; }
59         ///
60         TextClass const & textClass() const;
61         ///
62         BufferParams & params() { return bp_; }
63         ///
64         BufferParams const & params() const { return bp_; }
65         ///
66         BufferId id() const;
67         /// List of available modules
68         std::vector<std::string> getModuleNames();
69         /// Modules in use in current buffer
70         std::vector<std::string> const & getSelectedModules();
71         ///
72         std::string getModuleDescription(std::string const & modName) const;
73         ///
74         std::vector<std::string> getPackageList(std::string const & modName) const;
75         ///
76         void setLanguage() const;
77         ///
78         void saveAsDefault() const;
79         ///
80         bool isFontAvailable(std::string const & font) const;
81         /// does this font provide Old Style figures?
82         bool providesOSF(std::string const & font) const;
83         /// does this font provide true Small Caps?
84         bool providesSC(std::string const & font) const;
85         /// does this font provide size adjustment?
86         bool providesScale(std::string const & font) const;
87 private:
88         ///
89         void loadModuleNames();
90         ///
91         BufferParams bp_;
92         /// List of names of available modules
93         std::vector<std::string> moduleNames_;
94 };
95
96 } // namespace frontend
97 } // namespace lyx
98
99 #endif // CONTROLDOCUMENT_H