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.
7 * \author Angus Leeming
10 * Full author contact details are available in file CREDITS.
13 #ifndef FRONTEND_HELPERS_H
14 #define FRONTEND_HELPERS_H
16 #include "support/docstring.h"
24 namespace support { class FileFilterList; }
29 typedef std::pair<docstring, std::string> LanguagePair;
31 /** If the caller is the character dialog, add "No change" and "Reset"
34 std::vector<LanguagePair> const getLanguageData(bool character_dlg);
36 /** Launch a file dialog and return the chosen file.
37 filename: a suggested filename.
38 title: the title of the dialog.
40 dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
43 browseFile(docstring const & filename,
44 docstring const & title,
45 support::FileFilterList const & filters,
47 std::pair<docstring, docstring> const & dir1 =
48 std::make_pair(docstring(), docstring()),
49 std::pair<docstring, docstring> const & dir2 =
50 std::make_pair(docstring(), docstring()));
53 /** Wrapper around browseFile which tries to provide a filename
54 relative to relpath. If the relative path is of the form "foo.txt"
55 or "bar/foo.txt", then it is returned as relative. OTOH, if it is
56 of the form "../baz/foo.txt", an absolute path is returned. This is
57 intended to be useful for insets which encapsulate files/
60 browseRelFile(docstring const & filename,
61 docstring const & refpath,
62 docstring const & title,
63 support::FileFilterList const & filters,
65 std::pair<docstring, docstring> const & dir1 =
66 std::make_pair(docstring(), docstring()),
67 std::pair<docstring, docstring> const & dir2 =
68 std::make_pair(docstring(), docstring()));
71 /** Wrapper around browseFile which tries to provide a filename
72 * relative to the user or system directory. The dir, name and ext
73 * parameters have the same meaning as in the
74 * support::LibFileSearch function.
77 browseLibFile(docstring const & dir,
78 docstring const & name,
79 docstring const & ext,
80 docstring const & title,
81 support::FileFilterList const & filters);
84 /** Launch a file dialog and return the chosen directory.
85 pathname: a suggested pathname.
86 title: the title of the dialog.
87 dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
90 browseDir(docstring const & pathname,
91 docstring const & title,
92 std::pair<docstring, docstring> const & dir1 =
93 std::make_pair(docstring(), docstring()),
94 std::pair<docstring, docstring> const & dir2 =
95 std::make_pair(docstring(), docstring()));
98 /** Build filelists of all availabe bst/cls/sty-files. Done through
99 * kpsewhich and an external script, saved in *Files.lst.
101 void rescanTexStyles();
103 /** Fill \c contents from one of the three texfiles.
104 * Each entry in the file list is returned as a name_with_path
106 void getTexFileList(std::string const & filename, std::vector<std::string> & contents);
108 } // namespace frontend
111 #endif // FRONTEND_HELPERS_H