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
17 #include "support/docstring.h"
25 /** Functions of use to the character GUI controller and view */
28 namespace support { class FileFilterList; }
47 typedef std::pair<docstring, Font::FONT_FAMILY> FamilyPair;
49 typedef std::pair<docstring, Font::FONT_SERIES> SeriesPair;
51 typedef std::pair<docstring, Font::FONT_SHAPE> ShapePair;
53 typedef std::pair<docstring, Font::FONT_SIZE> SizePair;
55 typedef std::pair<docstring, FONT_STATE> BarPair;
57 typedef std::pair<docstring, Color_color> ColorPair;
60 std::vector<FamilyPair> const getFamilyData();
62 std::vector<SeriesPair> const getSeriesData();
64 std::vector<ShapePair> const getShapeData();
66 std::vector<SizePair> const getSizeData();
68 std::vector<BarPair> const getBarData();
70 std::vector<ColorPair> const getColorData();
74 typedef std::pair<docstring, std::string> LanguagePair;
76 /** If the caller is the character dialog, add "No change" and "Reset"
79 std::vector<LanguagePair> const getLanguageData(bool character_dlg);
80 /// sort colors for the gui
81 std::vector<Color_color> const getSortedColors(std::vector<Color_color> colors);
83 /** Launch a file dialog and return the chosen file.
84 filename: a suggested filename.
85 title: the title of the dialog.
87 dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
90 browseFile(docstring const & filename,
91 docstring const & title,
92 support::FileFilterList const & filters,
94 std::pair<docstring, docstring> const & dir1 =
95 std::make_pair(docstring(), docstring()),
96 std::pair<docstring, docstring> const & dir2 =
97 std::make_pair(docstring(), docstring()));
100 /** Wrapper around browseFile which tries to provide a filename
101 relative to relpath. If the relative path is of the form "foo.txt"
102 or "bar/foo.txt", then it is returned as relative. OTOH, if it is
103 of the form "../baz/foo.txt", an absolute path is returned. This is
104 intended to be useful for insets which encapsulate files/
107 browseRelFile(docstring const & filename,
108 docstring const & refpath,
109 docstring const & title,
110 support::FileFilterList const & filters,
112 std::pair<docstring, docstring> const & dir1 =
113 std::make_pair(docstring(), docstring()),
114 std::pair<docstring, docstring> const & dir2 =
115 std::make_pair(docstring(), docstring()));
118 /** Wrapper around browseFile which tries to provide a filename
119 * relative to the user or system directory. The dir, name and ext
120 * parameters have the same meaning as in the
121 * support::LibFileSearch function.
124 browseLibFile(docstring const & dir,
125 docstring const & name,
126 docstring const & ext,
127 docstring const & title,
128 support::FileFilterList const & filters);
131 /** Launch a file dialog and return the chosen directory.
132 pathname: a suggested pathname.
133 title: the title of the dialog.
134 dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
137 browseDir(docstring const & pathname,
138 docstring const & title,
139 std::pair<docstring, docstring> const & dir1 =
140 std::make_pair(docstring(), docstring()),
141 std::pair<docstring, docstring> const & dir2 =
142 std::make_pair(docstring(), docstring()));
145 /// Returns a vector of units that can be used to create a valid LaTeX length.
146 std::vector<docstring> const getLatexUnits();
149 /** Build filelists of all availabe bst/cls/sty-files. Done through
150 * kpsewhich and an external script, saved in *Files.lst.
152 void rescanTexStyles();
154 /// rebuild the textree
157 /** Fill \c contents from one of the three texfiles.
158 * Each entry in the file list is returned as a name_with_path
160 void getTexFileList(std::string const & filename, std::vector<std::string> & contents);
162 /// get the options of stylefile
163 std::string const getListOfOptions(std::string const & classname, std::string const & type);
165 /// get a class with full path from the list
166 std::string const getTexFileFromList(std::string const & classname, std::string const & type);
168 } // namespace frontend
171 #endif // FRONTEND_HELPERS_H