]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlCitation.h
* src/frontend/controllers/frontend_helpers.cpp: safety fix suggested by Andre
[lyx.git] / src / frontends / controllers / ControlCitation.h
1 // -*- C++ -*-
2 /**
3  * \file ControlCitation.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Angus Leeming
8  * \author Abdelrazak Younes
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef CONTROLCITATION_H
14 #define CONTROLCITATION_H
15
16
17 #include "ControlCommand.h"
18 #include "frontend_helpers.h"
19
20 namespace lyx {
21 namespace frontend {
22
23 /** A controller for Citation dialogs.
24  */
25 class ControlCitation : public ControlCommand {
26 public:
27         ///
28         ControlCitation(Dialog &);
29         virtual ~ControlCitation() {}
30         virtual bool initialiseParams(std::string const & data);
31
32         /// clean-up on hide.
33         virtual void clearParams();
34
35         /** Disconnect from the inset when the Apply button is pressed.
36          *  Allows easy insertion of multiple citations.
37          */
38         virtual bool disconnectOnApply() const { return true; }
39
40         /// \return the list of all available bibliography keys.
41         std::vector<std::string> const availableKeys() const;
42         ///
43         biblio::CiteEngine const getEngine() const;
44
45         /// \return information for this key.
46         docstring const getInfo(std::string const & key) const;
47
48         /// Search a given string within the passed keys.
49         /// \return the vector of matched keys.
50         std::vector<std::string> searchKeys(
51                 std::vector<std::string> const & keys_to_search, //< Keys to search.
52                 docstring const & search_expression, //< Search expression (regex possible)
53                 bool case_sensitive = false, // set to true is the search should be case sensitive
54                 bool regex = false /// \set to true if \c search_expression is a regex
55                 ); //
56
57         /// \return possible citations based on this key.
58         std::vector<docstring> const getCiteStrings(std::string const & key) const;
59
60         /// available CiteStyle-s (depends on availability of Natbib/Jurabib)
61         static std::vector<biblio::CiteStyle> const & getCiteStyles() {
62                 return citeStyles_;
63         }
64 private:
65         /// The info associated with each key
66         biblio::InfoMap bibkeysInfo_;
67
68         ///
69         static std::vector<biblio::CiteStyle> citeStyles_;
70 };
71
72 } // namespace frontend
73 } // namespace lyx
74
75 #endif // CONTROLCITATION_H