]> git.lyx.org Git - features.git/blob - src/frontends/controllers/ControlCitation.h
4bf16fde4e456942b936b4ddbeeca928115e0cb8
[features.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 #include "Biblio.h"
17 #include "ControlCommand.h"
18
19 namespace lyx {
20 namespace frontend {
21
22 /** A controller for Citation dialogs.
23  */
24 class ControlCitation : public ControlCommand {
25 public:
26         ///
27         ControlCitation(Dialog &);
28         virtual ~ControlCitation() {}
29         virtual bool initialiseParams(std::string const & data);
30
31         /// clean-up on hide.
32         virtual void clearParams();
33
34         /** Disconnect from the inset when the Apply button is pressed.
35          *  Allows easy insertion of multiple citations.
36          */
37         virtual bool disconnectOnApply() const { return true; }
38
39         /// \return the list of all available bibliography keys.
40         std::vector<std::string> const availableKeys() const;
41         ///
42         biblio::CiteEngine const getEngine() const;
43
44         /// \return information for this key.
45         docstring const getInfo(std::string const & key) const;
46
47         /// Search a given string within the passed keys.
48         /// \return the vector of matched keys.
49         std::vector<std::string> searchKeys(
50                 std::vector<std::string> const & keys_to_search, //< Keys to search.
51                 docstring const & search_expression, //< Search expression (regex possible)
52                 bool case_sensitive = false, // set to true is the search should be case sensitive
53                 bool regex = false /// \set to true if \c search_expression is a regex
54                 ); //
55
56         /// \return possible citations based on this key.
57         std::vector<docstring> const getCiteStrings(std::string const & key) const;
58
59         /// available CiteStyle-s (depends on availability of Natbib/Jurabib)
60         static std::vector<biblio::CiteStyle> const & getCiteStyles() {
61                 return citeStyles_;
62         }
63 private:
64         /// The info associated with each key
65         biblio::InfoMap bibkeysInfo_;
66
67         ///
68         static std::vector<biblio::CiteStyle> citeStyles_;
69 };
70
71 } // namespace frontend
72 } // namespace lyx
73
74 #endif // CONTROLCITATION_H