]> git.lyx.org Git - lyx.git/blob - src/format.h
split LyXText::rowlist_ into individual Paragraph::rows_ chunks
[lyx.git] / src / format.h
1 // -*- C++ -*-
2
3
4 #ifndef FORMAT_H
5 #define FORMAT_H
6
7
8 /**
9  * \file format.h
10  * This file is part of LyX, the document processor.
11  * Licence details can be found in the file COPYING.
12  *
13  * \author Dekel Tsur
14  *
15  * Full author contact details are available in file CREDITS
16  */
17
18
19
20 #include "LString.h"
21
22 #include <vector>
23
24 class Buffer;
25
26 class Format {
27 public:
28         ///
29         Format(string const & n, string const & e, string const & p,
30                string const & s, string const & v);
31         ///
32         bool dummy() const;
33         ///
34         bool isChildFormat() const;
35         ///
36         string const parentFormat() const;
37         ///
38         string const & name() const {
39                 return name_;
40         }
41         ///
42         string const & extension() const {
43                 return extension_;
44         }
45         ///
46         string const & prettyname() const {
47                 return prettyname_;
48         }
49         ///
50         string const & shortcut() const {
51                 return shortcut_;
52         }
53         ///
54         string const & viewer() const {
55                 return viewer_;
56         }
57         ///
58         void setViewer(string const & v) {
59                 viewer_ = v;
60         }
61 private:
62         string name_;
63         ///
64         string extension_;
65         ///
66         string prettyname_;
67         ///
68         string shortcut_;
69         ///
70         string viewer_;
71 };
72
73
74 bool operator<(Format const & a, Format const & b);
75
76 ///
77 class Formats {
78 public:
79         ///
80         typedef std::vector<Format> FormatList;
81         ///
82         typedef FormatList::const_iterator const_iterator;
83         ///
84         Format const & get(FormatList::size_type i) const {
85                 return formatlist[i];
86         }
87         ///
88         Format const * getFormat(string const & name) const;
89         ///
90         int getNumber(string const & name) const;
91         ///
92         void add(string const & name);
93         ///
94         void add(string const & name, string const & extension,
95                  string const & prettyname, string const & shortcut);
96         ///
97         void erase(string const & name);
98         ///
99         void sort();
100         ///
101         void setViewer(string const & name, string const & command);
102         ///
103         bool view(Buffer const * buffer, string const & filename,
104                   string const & format_name) const;
105         ///
106         string const prettyName(string const & name) const;
107         ///
108         string const extension(string const & name) const;
109         ///
110         const_iterator begin() const {
111                 return formatlist.begin();
112         }
113         ///
114         const_iterator end() const {
115                 return formatlist.end();
116         }
117         ///
118         FormatList::size_type size() const {
119                 return formatlist.size();
120         }
121 private:
122         ///
123         FormatList formatlist;
124 };
125
126 extern Formats formats;
127
128 extern Formats system_formats;
129
130 #endif //FORMAT_H