2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 2001 The LyX Team.
9 * ======================================================
11 * \file ControlCitation.h
12 * \author Angus Leeming <a.leeming@ic.ac.uk>
15 #ifndef CONTROLCITATION_H
16 #define CONTROLCITATION_H
22 #include "ControlCommand.h"
24 /** A controller for Citation dialogs. All citation-specific functionality
27 class ControlCitation : public ControlCommand
31 typedef std::map<string, string> InfoMap;
33 typedef std::map<string, string>::value_type InfoMapValue;
49 ControlCitation(LyXView &, Dialogs &);
50 /// A vector of bibliography keys
51 std::vector<string> const getBibkeys();
52 /// Returns a reference to the map of stored keys
53 InfoMap const & bibkeysInfo() const { return bibkeysInfo_; }
54 /** Returns the BibTeX data associated with a given key.
55 Empty if no info exists. */
56 string const getBibkeyInfo(string const &);
58 /// clean-up any daughter class-particular data on hide.
59 virtual void clearDaughterParams();
60 /// The info associated with each key
64 /** Helper functions, of possible use to all frontends
67 /** Search a BibTeX info field for the given key and return the
69 string const parseBibTeX(string data, string const & findkey);
71 /** Returns an iterator to the first key that meets the search criterion,
72 or end() if unsuccessful.
75 the controller with the map of bibkeys info,
76 the vector of keys to be searched,
78 an iterator defining the starting point of the search,
79 an enum defining a Simple or Regex search,
80 an enum defining the search direction.
83 std::vector<string>::const_iterator
84 searchKeys(ControlCitation const & controller,
85 std::vector<string> const & keys_to_search,
86 string const & search_expression,
87 std::vector<string>::const_iterator start,
88 ControlCitation::Search,
89 ControlCitation::Direction,
90 bool caseSensitive=false);
92 /// Do the dirty work for the search. Should use through the function above
93 std::vector<string>::const_iterator
94 simpleSearch(ControlCitation const & controller,
95 std::vector<string> const & keys_to_search,
96 string const & search_expression,
97 std::vector<string>::const_iterator start,
98 ControlCitation::Direction,
99 bool caseSensitive=false);
101 /// Should use through the function above
102 std::vector<string>::const_iterator
103 regexSearch(ControlCitation const & controller,
104 std::vector<string> const & keys_to_search,
105 string const & search_expression,
106 std::vector<string>::const_iterator start,
107 ControlCitation::Direction);
108 #endif // CONTROLCITATION_H