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>
24 } // namespace support
27 /** Launch a file dialog and return the chosen file.
28 filename: a suggested filename.
29 title: the title of the dialog.
31 dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
34 browseFile(std::string const & filename,
35 std::string const & title,
36 lyx::support::FileFilterList const & filters,
38 std::pair<std::string,std::string> const & dir1 =
39 std::make_pair(std::string(), std::string()),
40 std::pair<std::string,std::string> const & dir2 =
41 std::make_pair(std::string(), std::string()));
44 /* Wrapper around browseFile which tries to provide a filename
45 relative to relpath. If the relative path is of the form "foo.txt"
46 or "bar/foo.txt", then it is returned as relative. OTOH, if it is
47 of the form "../baz/foo.txt", an absolute path is returned. This is
48 intended to be useful for insets which encapsulate files/
51 browseRelFile(std::string const & filename,
52 std::string const & refpath,
53 std::string const & title,
54 lyx::support::FileFilterList const & filters,
56 std::pair<std::string,std::string> const & dir1 =
57 std::make_pair(std::string(), std::string()),
58 std::pair<std::string,std::string> const & dir2 =
59 std::make_pair(std::string(), std::string()));
62 /** Launch a file dialog and return the chosen directory.
63 pathname: a suggested pathname.
64 title: the title of the dialog.
65 dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
68 browseDir(std::string const & pathname,
69 std::string const & title,
70 std::pair<std::string,std::string> const & dir1 =
71 std::make_pair(std::string(), std::string()),
72 std::pair<std::string,std::string> const & dir2 =
73 std::make_pair(std::string(), std::string()));
76 /// Returns a vector of units that can be used to create a valid LaTeX length.
77 std::vector<std::string> const getLatexUnits();
80 /** Functions to extract vectors of the first and second elems from a
84 std::vector<typename Pair::first_type> const
85 getFirst(std::vector<Pair> const & pr)
87 std::vector<typename Pair::first_type> tmp(pr.size());
88 std::transform(pr.begin(), pr.end(), tmp.begin(),
89 boost::bind(&Pair::first, _1));
94 std::vector<typename Pair::second_type> const
95 getSecond(std::vector<Pair> const & pr)
97 std::vector<typename Pair::second_type> tmp(pr.size());
98 std::transform(pr.begin(), pr.end(), tmp.begin(),
99 boost::bind(&Pair::second, _1));
103 #endif // NOT HELPERFUNCS_H