]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlTexinfo.C
rename getExtFromContents() to getFormatFromContents()
[lyx.git] / src / frontends / controllers / ControlTexinfo.C
1 /**
2  * \file ControlTexinfo.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Herbert Voß
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "ControlTexinfo.h"
14 #include "funcrequest.h"
15
16
17 using std::string;
18
19 namespace lyx {
20 namespace frontend {
21
22 void getTexFileList(ControlTexinfo::texFileSuffix type,
23                     std::vector<string> & list)
24 {
25         string filename;
26         switch (type) {
27         case ControlTexinfo::bst:
28                 filename = "bstFiles.lst";
29                 break;
30         case ControlTexinfo::cls:
31                 filename = "clsFiles.lst";
32                 break;
33         case ControlTexinfo::sty:
34                 filename = "styFiles.lst";
35                 break;
36         }
37         getTexFileList(filename, list);
38         if (list.empty()) {
39                 // build filelists of all availabe bst/cls/sty-files.
40                 // Done through kpsewhich and an external script,
41                 // saved in *Files.lst
42                 rescanTexStyles();
43                 getTexFileList(filename, list);
44         }
45 }
46
47
48 ControlTexinfo::ControlTexinfo(Dialog & parent)
49         : Dialog::Controller(parent)
50 {}
51
52
53 void ControlTexinfo::viewFile(string const & filename) const
54 {
55         string const arg = "file " + filename;
56         kernel().dispatch(FuncRequest(LFUN_DIALOG_SHOW, arg));
57 }
58
59
60 string const ControlTexinfo::getClassOptions(string const & filename) const
61 {
62         return getListOfOptions(filename, "cls");
63 }
64
65 } // namespace frontend
66 } // namespace lyx