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