]> git.lyx.org Git - lyx.git/blob - src/insets/InsetCitation.h
b232b86afd6d408299f219a46a96a87b71bf1507
[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_CITATION_H
14 #define INSET_CITATION_H
15
16 #include "InsetCommand.h"
17 #include "InsetCode.h"
18
19 #include "BiblioInfo.h"
20
21
22 namespace lyx {
23
24 /////////////////////////////////////////////////////////////////////////
25 //
26 // InsetCitation
27 //
28 /////////////////////////////////////////////////////////////////////////
29
30 /// Used to insert citations
31 class InsetCitation : public InsetCommand
32 {
33 public:
34         ///
35         explicit InsetCitation(InsetCommandParams const &);
36         ///
37         bool isLabeled() const { return true; }
38         ///
39         docstring screenLabel() const;
40         ///
41         EDITABLE editable() const { return IS_EDITABLE; }
42         ///
43         InsetCode lyxCode() const { return CITE_CODE; }
44         ///
45         int latex(odocstream &, OutputParams const &) const;
46         ///
47         int plaintext(odocstream &, OutputParams const &) const;
48         ///
49         int docbook(odocstream &, OutputParams const &) const;
50         /// the string that is passed to the TOC
51         void tocString(odocstream &) const;
52         ///
53         void validate(LaTeXFeatures &) const;
54         ///
55         void updateLabels(ParIterator const & it);
56         ///
57         void addToToc(DocIterator const &);
58
59         ///
60         static ParamInfo const & findInfo(std::string const &);
61         // FIXME This is the locus of the design problem we have.
62         // It really ought to do what default_cite_command() does,
63         // but to do that it needs to know what CiteEngine we are
64         // using.
65         static std::string defaultCommand() { return "cite"; }
66         ///
67         static bool isCompatibleCommand(std::string const & cmd);
68         ///
69         virtual docstring contextMenu(BufferView const & bv, int x, int y) const;
70 private:
71         ///
72         Inset * clone() const { return new InsetCitation(*this); }
73         /// we'll eventually want to be able to get info on this from the 
74         /// various CiteEngines
75         static ParamInfo param_info_;
76         /// This function does the donkey work of creating the pretty label
77         docstring generateLabel() const;
78
79         ///
80         class Cache {
81         public:
82                 ///
83                 Cache() : engine(ENGINE_BASIC), params(CITE_CODE) {}
84                 ///
85                 CiteEngine engine;
86                 ///
87                 InsetCommandParams params;
88                 ///
89                 docstring generated_label;
90                 ///
91                 docstring screen_label;
92         };
93         ///
94         mutable Cache cache;
95 };
96
97 } // namespace lyx
98
99 #endif // INSET_CITATION_H