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.
12 #ifndef BIBLIOHELPERS_H
13 #define BIBLIOHELPERS_H
15 #include "support/docstring.h"
22 /** Functions of use to citation and bibtex GUI controllers and views */
28 ENGINE_NATBIB_AUTHORYEAR,
29 ENGINE_NATBIB_NUMERICAL,
58 /** Each citation engine recognizes only a subset of all possible
59 * citation commands. Given a latex command \c input, this function
60 * returns an appropriate command, valid for \c engine.
62 std::string const asValidLatexCommand(std::string const & input,
63 CiteEngine const engine);
65 /// First entry is the bibliography key, second the data
66 typedef std::map<std::string, docstring> InfoMap;
68 /// Returns a vector of bibliography keys
69 std::vector<std::string> const getKeys(InfoMap const &);
71 /** Returns the BibTeX data associated with a given key.
72 Empty if no info exists. */
73 docstring const getInfo(InfoMap const &, std::string const & key);
75 /// return the year from the bibtex data record
76 docstring const getYear(InfoMap const & map, std::string const & key);
78 /// return the short form of an authorlist
79 docstring const getAbbreviatedAuthor(InfoMap const & map, std::string const & key);
81 // return only the family name
82 docstring const familyName(docstring const & name);
84 /** Search a BibTeX info field for the given key and return the
86 docstring const parseBibTeX(docstring data, std::string const & findkey);
88 /** Returns an iterator to the first key that meets the search
89 criterion, or end() if unsuccessful.
92 the InfoMap of bibkeys info,
93 the vector of keys to be searched,
95 an iterator defining the starting point of the search,
96 an enum defining a Simple or Regex search,
97 an enum defining the search direction.
100 std::vector<std::string>::const_iterator
101 searchKeys(InfoMap const & map,
102 std::vector<std::string> const & keys_to_search,
103 docstring const & search_expression,
104 std::vector<std::string>::const_iterator start,
107 bool caseSensitive=false);
110 class CitationStyle {
113 CitationStyle(CiteStyle s = CITE, bool f = false, bool force = false)
114 : style(s), full(f), forceUCase(force) {}
115 /// \param latex_str a LaTeX command, "cite", "Citep*", etc
116 CitationStyle(std::string const & latex_str);
118 std::string const asLatexStr() const;
128 /// Returns a vector of available Citation styles.
129 std::vector<CiteStyle> const getCiteStyles(CiteEngine const );
132 "Translates" the available Citation Styles into strings for this key.
133 The returned string is displayed by the GUI.
136 [XX] is used in place of the actual reference
137 Eg, the vector will contain: [XX], Jones et al. [XX], ...
141 the InfoMap of bibkeys info,
142 the available citation styles
144 std::vector<docstring> const
145 getNumericalStrings(std::string const & key,
147 std::vector<CiteStyle> const & styles);
150 "Translates" the available Citation Styles into strings for this key.
151 The returned string is displayed by the GUI.
153 Eg, the vector will contain:
154 Jones et al. (1990), (Jones et al. 1990), Jones et al. 1990, ...
158 the InfoMap of bibkeys info,
159 the available citation styles
161 std::vector<docstring> const
162 getAuthorYearStrings(std::string const & key,
164 std::vector<CiteStyle> const & styles);
166 } // namespace biblio
169 #endif // BIBLIOHELPERS_H
173 * This file is part of LyX, the document processor.
174 * Licence details can be found in the file COPYING.
176 * \author Angus Leeming
178 * Full author contact details are available in file CREDITS.
181 #ifndef CHARACTERHELPERS_H
182 #define CHARACTERHELPERS_H
194 /** Functions of use to the character GUI controller and view */
213 typedef std::pair<docstring, LyXFont::FONT_FAMILY> FamilyPair;
215 typedef std::pair<docstring, LyXFont::FONT_SERIES> SeriesPair;
217 typedef std::pair<docstring, LyXFont::FONT_SHAPE> ShapePair;
219 typedef std::pair<docstring, LyXFont::FONT_SIZE> SizePair;
221 typedef std::pair<docstring, FONT_STATE> BarPair;
223 typedef std::pair<docstring, LColor_color> ColorPair;
226 std::vector<FamilyPair> const getFamilyData();
228 std::vector<SeriesPair> const getSeriesData();
230 std::vector<ShapePair> const getShapeData();
232 std::vector<SizePair> const getSizeData();
234 std::vector<BarPair> const getBarData();
236 std::vector<ColorPair> const getColorData();
238 } // namespace frontend
241 #endif // CHARACTERHELPERS
245 * This file is part of LyX, the document processor.
246 * Licence details can be found in the file COPYING.
248 * \author Angus Leeming
250 * Full author contact details are available in file CREDITS.
252 * Ease the use of internationalised language strings in the dialogs.
258 #include "support/docstring.h"
267 typedef std::pair<docstring, std::string> LanguagePair;
269 /** If the caller is the character dialog, add "No change" and "Reset"
272 std::vector<LanguagePair> const getLanguageData(bool character_dlg);
274 } // namespace frontend
277 #endif // FRNT_LANG_H
280 * \file helper_funcs.h
281 * This file is part of LyX, the document processor.
282 * Licence details can be found in the file COPYING.
284 * \author Angus Leeming
286 * Full author contact details are available in file CREDITS.
289 #ifndef HELPERFUNCS_H
290 #define HELPERFUNCS_H
292 #include "support/docstring.h"
294 #include <boost/bind.hpp>
303 namespace support { class FileFilterList; }
308 /** Launch a file dialog and return the chosen file.
309 filename: a suggested filename.
310 title: the title of the dialog.
312 dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
315 browseFile(docstring const & filename,
316 docstring const & title,
317 support::FileFilterList const & filters,
319 std::pair<docstring, docstring> const & dir1 =
320 std::make_pair(docstring(), docstring()),
321 std::pair<docstring, docstring> const & dir2 =
322 std::make_pair(docstring(), docstring()));
325 /** Wrapper around browseFile which tries to provide a filename
326 relative to relpath. If the relative path is of the form "foo.txt"
327 or "bar/foo.txt", then it is returned as relative. OTOH, if it is
328 of the form "../baz/foo.txt", an absolute path is returned. This is
329 intended to be useful for insets which encapsulate files/
332 browseRelFile(docstring const & filename,
333 docstring const & refpath,
334 docstring const & title,
335 support::FileFilterList const & filters,
337 std::pair<docstring, docstring> const & dir1 =
338 std::make_pair(docstring(), docstring()),
339 std::pair<docstring, docstring> const & dir2 =
340 std::make_pair(docstring(), docstring()));
343 /** Wrapper around browseFile which tries to provide a filename
344 * relative to the user or system directory. The dir, name and ext
345 * parameters have the same meaning as in the
346 * support::LibFileSearch function.
349 browseLibFile(docstring const & dir,
350 docstring const & name,
351 docstring const & ext,
352 docstring const & title,
353 support::FileFilterList const & filters);
356 /** Launch a file dialog and return the chosen directory.
357 pathname: a suggested pathname.
358 title: the title of the dialog.
359 dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
362 browseDir(docstring const & pathname,
363 docstring const & title,
364 std::pair<docstring, docstring> const & dir1 =
365 std::make_pair(docstring(), docstring()),
366 std::pair<docstring, docstring> const & dir2 =
367 std::make_pair(docstring(), docstring()));
370 /// Returns a vector of units that can be used to create a valid LaTeX length.
371 std::vector<docstring> const getLatexUnits();
374 /** Functions to extract vectors of the first and second elems from a
378 std::vector<typename Pair::first_type> const
379 getFirst(std::vector<Pair> const & pr)
381 std::vector<typename Pair::first_type> tmp(pr.size());
382 std::transform(pr.begin(), pr.end(), tmp.begin(),
383 boost::bind(&Pair::first, _1));
388 std::vector<typename Pair::second_type> const
389 getSecond(std::vector<Pair> const & pr)
391 std::vector<typename Pair::second_type> tmp(pr.size());
392 std::transform(pr.begin(), pr.end(), tmp.begin(),
393 boost::bind(&Pair::second, _1));
397 } // namespace frontend
400 #endif // NOT HELPERFUNCS_H
403 * \file tex_helpers.h
404 * This file is part of LyX, the document processor.
405 * Licence details can be found in the file COPYING.
407 * \author Herbert Voß
409 * Full author contact details are available in file CREDITS.
412 #ifndef TEX_HELPERS_H
413 #define TEX_HELPERS_H
421 /** Build filelists of all availabe bst/cls/sty-files. Done through
422 * kpsewhich and an external script, saved in *Files.lst.
424 void rescanTexStyles();
426 /// rebuild the textree
429 /** Fill \c contents from one of the three texfiles.
430 * Each entry in the file list is returned as a name_with_path
432 void getTexFileList(std::string const & filename, std::vector<std::string> & contents);
434 /// get the options of stylefile
435 std::string const getListOfOptions(std::string const & classname, std::string const & type);
437 /// get a class with full path from the list
438 std::string const getTexFileFromList(std::string const & classname, std::string const & type);
440 } // namespace frontend
443 #endif // TEX_HELPERS_H