]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlBibtex.C
std:: changes, stupid stuff
[lyx.git] / src / frontends / controllers / ControlBibtex.C
1 /**
2  * \file ControlBibtex.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  * \author Angus Leeming
8  * \author Herbert Voß
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #include <config.h>
14
15 #include "ControlBibtex.h"
16
17 #include "lyxrc.h"
18 #include "helper_funcs.h"
19 #include "tex_helpers.h"
20 #include "gettext.h"
21
22 #include "support/filetools.h"
23 #include "support/globbing.h"
24
25 using lyx::support::FileFilterList;
26 using lyx::support::OnlyFilename;
27
28 using std::pair;
29 using std::string;
30 using std::vector;
31
32
33 ControlBibtex::ControlBibtex(Dialog & d)
34         : ControlCommand(d, "bibtex")
35 {}
36
37
38 string const ControlBibtex::browse(string const & in_name,
39                                    string const & title,
40                                    FileFilterList const & filters) const
41 {
42         pair<string, string> dir1(_("Documents|#o#O"),
43                                   string(lyxrc.document_path));
44         return browseRelFile(in_name, kernel().bufferFilepath(),
45                              title, filters, false, dir1);
46 }
47
48
49 void ControlBibtex::getBibStyles(vector<string> & data) const
50 {
51         data.clear();
52
53         getTexFileList("bstFiles.lst", data);
54         // test, if we have a valid list, otherwise run rescan
55         if (data.empty()) {
56                 rescanBibStyles();
57                 getTexFileList("bstFiles.lst", data);
58         }
59         vector<string>::iterator it  = data.begin();
60         vector<string>::iterator end = data.end();
61         for (; it != end; ++it) {
62                 *it = OnlyFilename(*it);
63         }
64 }
65
66
67 void ControlBibtex::getBibFiles(vector<string> & data) const
68 {
69         data.clear();
70
71         getTexFileList("bibFiles.lst", data);
72         // test, if we have a valid list, otherwise run rescan
73         if (data.empty()) {
74                 rescanBibStyles();
75                 getTexFileList("bibFiles.lst", data);
76         }
77         vector<string>::iterator it  = data.begin();
78         vector<string>::iterator end = data.end();
79         for (; it != end; ++it) {
80                 *it = OnlyFilename(*it);
81         }
82 }
83
84
85 void ControlBibtex::rescanBibStyles() const
86 {
87         rescanTexStyles();
88 }