]> git.lyx.org Git - lyx.git/blob - src/insets/InsetCitation.h
0bc7ee0ab7848214f564ff4db73b75de0fba5035
[lyx.git] / src / insets / InsetCitation.h
1 // -*- C++ -*-
2 /**
3  * \file InsetCitation.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 Herbert Voß
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef INSET_CITE_H
14 #define INSET_CITE_H
15
16
17 #include "InsetCommand.h"
18 #include "InsetCode.h"
19
20 #include "BiblioInfo.h"
21
22
23 namespace lyx {
24
25
26 /** Used to insert citations
27  */
28 class InsetCitation : public InsetCommand {
29 public:
30         ///
31         InsetCitation(InsetCommandParams const &);
32         ///
33         docstring const getScreenLabel(Buffer const &) const;
34         ///
35         EDITABLE editable() const { return IS_EDITABLE; }
36         ///
37         InsetCode lyxCode() const { return CITE_CODE; }
38         ///
39         int latex(Buffer const &, odocstream &,
40                   OutputParams const &) const;
41         ///
42         int plaintext(Buffer const &, odocstream &,
43                       OutputParams const &) const;
44         ///
45         int docbook(Buffer const &, odocstream &,
46                     OutputParams const &) const;
47         /// the string that is passed to the TOC
48         virtual int textString(Buffer const &, odocstream &,
49                 OutputParams const &) const;
50         ///
51         void validate(LaTeXFeatures &) const;
52         ///
53         void replaceContents(std::string const & from, std::string const & to);
54
55 private:
56         virtual Inset * clone() const
57         {
58                 return new InsetCitation(params());
59         }
60
61         /// This function does the donkey work of creating the pretty label
62         docstring const generateLabel(Buffer const &) const;
63
64         class Cache {
65         public:
66                 ///
67                 Cache() : engine(biblio::ENGINE_BASIC), params(CITE_CODE) {}
68                 ///
69                 biblio::CiteEngine engine;
70                 ///
71                 InsetCommandParams params;
72                 ///
73                 docstring generated_label;
74                 ///
75                 docstring screen_label;
76         };
77         ///
78         mutable Cache cache;
79 };
80
81
82 } // namespace lyx
83
84 #endif // INSET_CITE_H