]> git.lyx.org Git - lyx.git/blob - src/frontends/frontend_helpers.h
* src/LyXRC.{cpp,h}:
[lyx.git] / src / frontends / frontend_helpers.h
1 // -*- C++ -*-
2 /**
3  * \file frontend_helpers.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Angus Leeming
8  * \author Herbert Voß
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef FRONTEND_HELPERS_H
14 #define FRONTEND_HELPERS_H
15
16 #include "support/docstring.h"
17
18 #include <vector>
19
20 namespace lyx {
21
22 namespace support { class FileFilterList; }
23
24 namespace frontend {
25
26 ///
27 typedef std::pair<docstring, std::string> LanguagePair;
28
29 /** If the caller is the character dialog, add "No change" and "Reset"
30 *  to the vector.
31 */
32 std::vector<LanguagePair> const getLanguageData(bool character_dlg);
33
34 /** Launch a file dialog and return the chosen file.
35         filename: a suggested filename.
36         title: the title of the dialog.
37         pattern: *.ps etc.
38         dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
39 */
40 docstring browseFile(docstring const & filename,
41         docstring const & title,
42         support::FileFilterList const & filters,
43         bool save = false,
44         docstring const & label1 = docstring(),
45         docstring const & dir1 = docstring(),
46         docstring const & label2 = docstring(),
47         docstring const & dir2 = docstring());
48
49
50 /** Wrapper around browseFile which tries to provide a filename
51         relative to relpath.  If the relative path is of the form "foo.txt"
52         or "bar/foo.txt", then it is returned as relative. OTOH, if it is
53         of the form "../baz/foo.txt", an absolute path is returned. This is
54         intended to be useful for insets which encapsulate files/
55 */
56 docstring browseRelFile(docstring const & filename,
57         docstring const & refpath,
58         docstring const & title,
59         support::FileFilterList const & filters,
60         bool save = false,
61         docstring const & label1 = docstring(),
62         docstring const & dir1 = docstring(),
63         docstring const & label2 = docstring(),
64         docstring const & dir2 = docstring());
65
66
67 /** Wrapper around browseFile which tries to provide a filename
68 *  relative to the user or system directory. The dir, name and ext
69 *  parameters have the same meaning as in the
70 *  support::LibFileSearch function.
71 */
72 docstring browseLibFile(docstring const & dir,
73         docstring const & name,
74         docstring const & ext,
75         docstring const & title,
76         support::FileFilterList const & filters);
77
78
79 /** Launch a file dialog and return the chosen directory.
80         pathname: a suggested pathname.
81         title: the title of the dialog.
82         dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
83 */
84 docstring browseDir(docstring const & pathname,
85         docstring const & title,
86         docstring const & label1 = docstring(),
87         docstring const & dir1 = docstring(),
88         docstring const & label2 = docstring(),
89         docstring const & dir2 = docstring());
90
91
92 /** Build filelists of all availabe bst/cls/sty-files. Done through
93 *  kpsewhich and an external script, saved in *Files.lst.
94 */
95 void rescanTexStyles();
96
97 /** Fill \c contents from one of the three texfiles.
98  *  Each entry in the file list is returned as a name_with_path
99  */
100 void getTexFileList(std::string const & filename, std::vector<std::string> & contents);
101
102 } // namespace frontend
103 } // namespace lyx
104
105 #endif // FRONTEND_HELPERS_H