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"
22 namespace support { class FileFilterList; }
27 typedef std::pair<docstring, std::string> LanguagePair;
29 /** If the caller is the character dialog, add "No change" and "Reset"
32 std::vector<LanguagePair> const getLanguageData(bool character_dlg);
34 /** Launch a file dialog and return the chosen file.
35 filename: a suggested filename.
36 title: the title of the dialog.
38 dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
40 docstring browseFile(docstring const & filename,
41 docstring const & title,
42 support::FileFilterList const & filters,
44 docstring const & label1 = docstring(),
45 docstring const & dir1 = docstring(),
46 docstring const & label2 = docstring(),
47 docstring const & dir2 = docstring());
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/
56 docstring browseRelFile(docstring const & filename,
57 docstring const & refpath,
58 docstring const & title,
59 support::FileFilterList const & filters,
61 docstring const & label1 = docstring(),
62 docstring const & dir1 = docstring(),
63 docstring const & label2 = docstring(),
64 docstring const & dir2 = docstring());
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.
72 docstring browseLibFile(docstring const & dir,
73 docstring const & name,
74 docstring const & ext,
75 docstring const & title,
76 support::FileFilterList const & filters);
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.
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());
92 /** Build filelists of all availabe bst/cls/sty-files. Done through
93 * kpsewhich and an external script, saved in *Files.lst.
95 void rescanTexStyles();
97 /** Fill \c contents from one of the three texfiles.
98 * Each entry in the file list is returned as a name_with_path
100 void getTexFileList(std::string const & filename, std::vector<std::string> & contents);
102 } // namespace frontend
105 #endif // FRONTEND_HELPERS_H