4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Angus Leeming
9 * Full author contact details are available in file CREDITS.
15 #include <boost/bind.hpp>
25 } // namespace support
30 /** Launch a file dialog and return the chosen file.
31 filename: a suggested filename.
32 title: the title of the dialog.
34 dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
37 browseFile(std::string const & filename,
38 std::string const & title,
39 support::FileFilterList const & filters,
41 std::pair<std::string,std::string> const & dir1 =
42 std::make_pair(std::string(), std::string()),
43 std::pair<std::string,std::string> const & dir2 =
44 std::make_pair(std::string(), std::string()));
47 /** Wrapper around browseFile which tries to provide a filename
48 relative to relpath. If the relative path is of the form "foo.txt"
49 or "bar/foo.txt", then it is returned as relative. OTOH, if it is
50 of the form "../baz/foo.txt", an absolute path is returned. This is
51 intended to be useful for insets which encapsulate files/
54 browseRelFile(std::string const & filename,
55 std::string const & refpath,
56 std::string const & title,
57 support::FileFilterList const & filters,
59 std::pair<std::string,std::string> const & dir1 =
60 std::make_pair(std::string(), std::string()),
61 std::pair<std::string,std::string> const & dir2 =
62 std::make_pair(std::string(), std::string()));
65 /** Wrapper around browseFile which tries to provide a filename
66 * relative to the user or system directory. The dir, name and ext
67 * parameters have the same meaning as in the
68 * lyx::support::LibFileSearch function.
71 browseLibFile(std::string const & dir,
72 std::string const & name,
73 std::string const & ext,
74 std::string const & title,
75 support::FileFilterList const & filters);
78 /** Launch a file dialog and return the chosen directory.
79 pathname: a suggested pathname.
80 title: the title of the dialog.
81 dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
84 browseDir(std::string const & pathname,
85 std::string const & title,
86 std::pair<std::string,std::string> const & dir1 =
87 std::make_pair(std::string(), std::string()),
88 std::pair<std::string,std::string> const & dir2 =
89 std::make_pair(std::string(), std::string()));
92 /// Returns a vector of units that can be used to create a valid LaTeX length.
93 std::vector<std::string> const getLatexUnits();
96 /** Functions to extract vectors of the first and second elems from a
100 std::vector<typename Pair::first_type> const
101 getFirst(std::vector<Pair> const & pr)
103 std::vector<typename Pair::first_type> tmp(pr.size());
104 std::transform(pr.begin(), pr.end(), tmp.begin(),
105 boost::bind(&Pair::first, _1));
110 std::vector<typename Pair::second_type> const
111 getSecond(std::vector<Pair> const & pr)
113 std::vector<typename Pair::second_type> tmp(pr.size());
114 std::transform(pr.begin(), pr.end(), tmp.begin(),
115 boost::bind(&Pair::second, _1));
119 } // namespace frontend
122 #endif // NOT HELPERFUNCS_H