]> git.lyx.org Git - lyx.git/blob - src/insets/insetcite.h
* src/insets/insetbititem.C:
[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 "bufferparams.h"
19
20
21 namespace lyx {
22
23
24 /** Used to insert citations
25  */
26 class InsetCitation : public InsetCommand {
27 public:
28         ///
29         InsetCitation(InsetCommandParams const &);
30         ///
31         docstring const getScreenLabel(Buffer const &) const;
32         ///
33         EDITABLE editable() const { return IS_EDITABLE; }
34         ///
35         InsetBase::Code lyxCode() const { return InsetBase::CITE_CODE; }
36         ///
37         int latex(Buffer const &, odocstream &,
38                   OutputParams const &) const;
39         ///
40         int plaintext(Buffer const &, odocstream &,
41                       OutputParams const &) const;
42         ///
43         int docbook(Buffer const &, odocstream &,
44                     OutputParams const &) const;
45         /// the string that is passed to the TOC
46         virtual int textString(Buffer const &, odocstream &,
47                 OutputParams const &) const;
48         ///
49         void validate(LaTeXFeatures &) const;
50         ///
51         void replaceContents(std::string const & from, std::string const & to);
52
53 private:
54         virtual std::auto_ptr<InsetBase> doClone() const
55         {
56                 return std::auto_ptr<InsetBase>(new InsetCitation(params()));
57         }
58
59         /// This function does the donkey work of creating the pretty label
60         docstring const generateLabel(Buffer const &) const;
61
62         class Cache {
63         public:
64                 ///
65                 Cache() : engine(biblio::ENGINE_BASIC), params("cite") {}
66                 ///
67                 biblio::CiteEngine engine;
68                 ///
69                 InsetCommandParams params;
70                 ///
71                 docstring generated_label;
72                 ///
73                 docstring screen_label;
74         };
75         ///
76         mutable Cache cache;
77 };
78
79
80 } // namespace lyx
81
82 #endif // INSET_CITE_H