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