]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/biblio.h
Rob Lahaye's "iconify dialogs with main window if so desired" patch.
[lyx.git] / src / frontends / controllers / biblio.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ====================================================== 
4  *
5  *           LyX, The Document Processor
6  *
7  *           Copyright 2001 The LyX Team.
8  *
9  * ======================================================
10  *
11  * \file biblio.h
12  * \author Angus Leeming <a.leeming@ic.ac.uk>
13  */
14
15 #ifndef BIBLIOHELPERS_H
16 #define BIBLIOHELPERS_H
17
18 #include <map>
19
20 #ifdef __GNUG__
21 #pragma interface
22 #endif
23
24 /** Functions of use to citation and bibtex GUI controllers and views */
25 namespace biblio 
26 {
27         ///
28         enum CiteStyle {
29                 CITE,
30                 CITET,
31                 CITEP,
32                 CITEALT,
33                 CITEALP,
34                 CITEAUTHOR,
35                 CITEYEAR,
36                 CITEYEARPAR
37         };
38         ///
39         enum Search {
40                 ///
41                 SIMPLE,
42                 ///
43                 REGEX
44         };
45         ///
46         enum Direction {
47                 ///
48                 FORWARD,
49                 ///
50                 BACKWARD
51         };
52
53         /// First entry is the bibliography key, second the data
54         typedef std::map<string, string> InfoMap;
55
56         /// Returns a vector of bibliography keys
57         std::vector<string> const getKeys(InfoMap const &);
58
59         /** Returns the BibTeX data associated with a given key.
60             Empty if no info exists. */
61         string const getInfo(InfoMap const &, string const &);
62
63         /** Search a BibTeX info field for the given key and return the
64             associated field. */
65         string const parseBibTeX(string data, string const & findkey);
66
67         /** Returns an iterator to the first key that meets the search
68             criterion, or end() if unsuccessful.
69
70             User supplies :
71             the InfoMap of bibkeys info,
72             the vector of keys to be searched,
73             the search criterion,
74             an iterator defining the starting point of the search,
75             an enum defining a Simple or Regex search,
76             an enum defining the search direction.
77         */
78
79         std::vector<string>::const_iterator
80                 searchKeys(InfoMap const & map,
81                            std::vector<string> const & keys_to_search,
82                            string const & search_expression,
83                            std::vector<string>::const_iterator start,
84                            Search,
85                            Direction,
86                            bool caseSensitive=false);
87
88         /// Type returned by getCitationStyle, below
89         struct CitationStyle {
90                 ///
91                 CitationStyle() : style(CITE), full(false), forceUCase(false) {}
92                 ///
93                 CiteStyle style;
94                 ///
95                 bool full;
96                 ///
97                 bool forceUCase;
98         };
99         /// Given the LaTeX command, return the appropriate CitationStyle
100         CitationStyle const getCitationStyle(string const & command);
101
102         /** Returns the LaTeX citation command
103
104             User supplies :
105             The CiteStyle enum,
106             a flag forcing the full author list,
107             a flag forcing upper case, e.g. "della Casa" becomes "Della Case"
108          */
109         string const getCiteCommand(CiteStyle, bool full, bool forceUCase);
110
111         /// Returns a vector of available Citation styles.
112         std::vector<CiteStyle> const getCiteStyles(bool usingNatbib);
113
114         /**
115            "Translates" the available Citation Styles into strings for this key.
116            The returned string is displayed by the GUI.
117
118
119            [XX] is used in place of the actual reference
120            Eg, the vector will contain: [XX], Jones et al. [XX], ...
121            
122            User supplies :
123            the key,
124            the InfoMap of bibkeys info,
125            the available citation styles
126          */
127         std::vector<string> const
128                 getNumericalStrings(string const & key,
129                                     InfoMap const & map,
130                                     std::vector<CiteStyle> const & styles);
131
132         /**
133            "Translates" the available Citation Styles into strings for this key.
134            The returned string is displayed by the GUI.
135            
136            Eg, the vector will contain:
137            Jones et al. (1990), (Jones et al. 1990), Jones et al. 1990, ...
138            
139            User supplies :
140            the key,
141            the InfoMap of bibkeys info,
142            the available citation styles
143          */
144         std::vector<string> const
145                 getAuthorYearStrings(string const & key,
146                                      InfoMap const & map,
147                                      std::vector<CiteStyle> const & styles);
148 } // namespace biblio 
149
150 #endif // BIBLIOHELPERS_H