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>
26 } // namespace support
31 /** Launch a file dialog and return the chosen file.
32 filename: a suggested filename.
33 title: the title of the dialog.
35 dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
38 browseFile(std::string const & filename,
39 std::string const & title,
40 support::FileFilterList const & filters,
42 std::pair<std::string,std::string> const & dir1 =
43 std::make_pair(std::string(), std::string()),
44 std::pair<std::string,std::string> const & dir2 =
45 std::make_pair(std::string(), std::string()));
48 /** Wrapper around browseFile which tries to provide a filename
49 relative to relpath. If the relative path is of the form "foo.txt"
50 or "bar/foo.txt", then it is returned as relative. OTOH, if it is
51 of the form "../baz/foo.txt", an absolute path is returned. This is
52 intended to be useful for insets which encapsulate files/
55 browseRelFile(std::string const & filename,
56 std::string const & refpath,
57 std::string const & title,
58 support::FileFilterList const & filters,
60 std::pair<std::string,std::string> const & dir1 =
61 std::make_pair(std::string(), std::string()),
62 std::pair<std::string,std::string> const & dir2 =
63 std::make_pair(std::string(), std::string()));
66 /** Wrapper around browseFile which tries to provide a filename
67 * relative to the user or system directory. The dir, name and ext
68 * parameters have the same meaning as in the
69 * lyx::support::LibFileSearch function.
72 browseLibFile(std::string const & dir,
73 std::string const & name,
74 std::string const & ext,
75 std::string 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.
85 browseDir(std::string const & pathname,
86 std::string const & title,
87 std::pair<std::string,std::string> const & dir1 =
88 std::make_pair(std::string(), std::string()),
89 std::pair<std::string,std::string> const & dir2 =
90 std::make_pair(std::string(), std::string()));
93 /// Returns a vector of units that can be used to create a valid LaTeX length.
94 std::vector<std::string> const getLatexUnits();
97 /** Functions to extract vectors of the first and second elems from a
101 std::vector<typename Pair::first_type> const
102 getFirst(std::vector<Pair> const & pr)
104 std::vector<typename Pair::first_type> tmp(pr.size());
105 std::transform(pr.begin(), pr.end(), tmp.begin(),
106 boost::bind(&Pair::first, _1));
111 std::vector<typename Pair::second_type> const
112 getSecond(std::vector<Pair> const & pr)
114 std::vector<typename Pair::second_type> tmp(pr.size());
115 std::transform(pr.begin(), pr.end(), tmp.begin(),
116 boost::bind(&Pair::second, _1));
120 } // namespace frontend
123 #endif // NOT HELPERFUNCS_H