]> git.lyx.org Git - lyx.git/blob - src/insets/InsetCitation.h
do what the FIXME suggested
[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 screenLabel() const;
34         ///
35         EDITABLE editable() const { return IS_EDITABLE; }
36         ///
37         InsetCode lyxCode() const { return CITE_CODE; }
38         ///
39         int latex(odocstream &, OutputParams const &) const;
40         ///
41         int plaintext(odocstream &, OutputParams const &) const;
42         ///
43         int docbook(odocstream &, OutputParams const &) const;
44         /// the string that is passed to the TOC
45         void textString(odocstream &) const;
46         ///
47         void validate(LaTeXFeatures &) const;
48         ///
49         void updateLabels(ParIterator const & it);
50         ///
51         void addToToc(ParConstIterator const &) const;
52
53         ///
54         static ParamInfo const & findInfo(std::string const &);
55         //FIXME This is the locus of the design problem we have.
56         //It really ought to do what default_cite_command() does,
57         //but to do that it needs to know what CiteEngine we are
58         //using.
59         ///
60         static std::string defaultCommand() { return "cite"; };
61         ///
62         static bool isCompatibleCommand(std::string const & cmd);
63 private:
64         ///
65         Inset * clone() const { return new InsetCitation(*this); }
66         /// we'll eventually want to be able to get info on this from the 
67         /// various CiteEngines
68         static ParamInfo param_info_;
69         /// This function does the donkey work of creating the pretty label
70         docstring generateLabel() const;
71
72         ///
73         class Cache {
74         public:
75                 ///
76                 Cache() : engine(biblio::ENGINE_BASIC), params(CITE_CODE) {}
77                 ///
78                 biblio::CiteEngine engine;
79                 ///
80                 InsetCommandParams params;
81                 ///
82                 docstring generated_label;
83                 ///
84                 docstring screen_label;
85         };
86         ///
87         mutable Cache cache;
88 };
89
90
91 } // namespace lyx
92
93 #endif // INSET_CITE_H