]> git.lyx.org Git - lyx.git/blob - src/insets/insetcite.h
Add a Buffer::fully_loaded member function, returning true only when
[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
19 /** Used to insert citations
20  */
21 class InsetCitation : public InsetCommand {
22 public:
23         ///
24         InsetCitation(InsetCommandParams const &);
25         ///
26         ~InsetCitation();
27         ///
28         std::auto_ptr<InsetBase> clone() const {
29                 return std::auto_ptr<InsetBase>(new InsetCitation(params()));
30         }
31         ///
32         std::string const getScreenLabel(Buffer const &) const;
33         ///
34         EDITABLE editable() const { return IS_EDITABLE; }
35         ///
36         InsetOld::Code lyxCode() const { return InsetOld::CITE_CODE; }
37         ///
38         int ascii(Buffer const &, std::ostream &, int linelen) const;
39         ///
40         int latex(Buffer const &, std::ostream &,
41                   LatexRunParams const &) const;
42         ///
43         dispatch_result localDispatch(FuncRequest const & cmd);
44         ///
45         void validate(LaTeXFeatures &) const;
46 protected:
47         ///
48         virtual
49         dispatch_result
50         priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &);
51 private:
52         struct Cache {
53                 ///
54                 enum Style {
55                         ///
56                         BASIC,
57                         ///
58                         NATBIB_AY,
59                         ///
60                         NATBIB_NUM
61                 };
62                 ///
63                 Cache() : style(BASIC) {}
64                 ///
65                 Style style;
66                 ///
67                 InsetCommandParams params;
68                 ///
69                 std::string generated_label;
70                 ///
71                 std::string screen_label;
72         };
73
74         /// This function does the donkey work of creating the pretty label
75         std::string const generateLabel(Buffer const &) const;
76         ///
77         Cache::Style getStyle(Buffer const & buffer) const;
78
79         ///
80         mutable Cache cache;
81 };
82
83 #endif // INSET_CITE_H