]> git.lyx.org Git - lyx.git/blob - src/insets/InsetCitation.h
This should be the last of the commits refactoring the InsetLayout code.
[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         void textString(Buffer const &, odocstream &) const;
49         ///
50         void validate(LaTeXFeatures &) const;
51         ///
52         static CommandInfo const * findInfo(std::string const &);
53         //FIXME This is the locus of the design problem we have.
54         //It really ought to do what default_cite_command() does,
55         //but to do that it needs to know what CiteEngine we are
56         //using.
57         ///
58         static std::string defaultCommand() { return "cite"; };
59         ///
60         static bool isCompatibleCommand(std::string const & cmd);
61 private:
62         virtual Inset * clone() const
63         {
64                 return new InsetCitation(params());
65         }
66
67         /// This function does the donkey work of creating the pretty label
68         docstring const generateLabel(Buffer const &) const;
69
70         class Cache {
71         public:
72                 ///
73                 Cache() : engine(biblio::ENGINE_BASIC), params(CITE_CODE) {}
74                 ///
75                 biblio::CiteEngine engine;
76                 ///
77                 InsetCommandParams params;
78                 ///
79                 docstring generated_label;
80                 ///
81                 docstring screen_label;
82         };
83         ///
84         mutable Cache cache;
85 };
86
87
88 } // namespace lyx
89
90 #endif // INSET_CITE_H