]> git.lyx.org Git - lyx.git/blob - src/insets/insetcite.h
Clean up natbib, jurabib code as posted to the list last Friday.
[lyx.git] / src / insets / insetcite.h
1 // -*- C++ -*-
2 /**
3  * \file insetcite.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 "frontends/controllers/biblio.h"
19
20 /** Used to insert citations
21  */
22 class InsetCitation : public InsetCommand {
23 public:
24         ///
25         InsetCitation(InsetCommandParams const &);
26         ///
27         std::auto_ptr<InsetBase> clone() const {
28                 return std::auto_ptr<InsetBase>(new InsetCitation(params()));
29         }
30         ///
31         std::string const getScreenLabel(Buffer const &) const;
32         ///
33         EDITABLE editable() const { return IS_EDITABLE; }
34         ///
35         InsetOld::Code lyxCode() const { return InsetOld::CITE_CODE; }
36         ///
37         int plaintext(Buffer const &, std::ostream &, int linelen) const;
38         ///
39         int latex(Buffer const &, std::ostream &,
40                   OutputParams const &) const;
41         ///
42         void validate(LaTeXFeatures &) const;
43
44 private:
45         /// This function does the donkey work of creating the pretty label
46         std::string const generateLabel(Buffer const &) const;
47
48         struct Cache {
49                 ///
50                 Cache() : engine(biblio::ENGINE_BASIC) {}
51                 ///
52                 biblio::CiteEngine engine;
53                 ///
54                 InsetCommandParams params;
55                 ///
56                 std::string generated_label;
57                 ///
58                 std::string screen_label;
59         };
60         ///
61         mutable Cache cache;
62 };
63
64 #endif // INSET_CITE_H