]> git.lyx.org Git - lyx.git/blob - src/insets/insetcite.h
Forgotten header file.
[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 Voss
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 #ifdef __GNUG__
17 #pragma interface
18 #endif
19
20 #include "insetcommand.h"
21
22 /** Used to insert citations
23  */
24 class InsetCitation : public InsetCommand {
25 public:
26         ///
27         InsetCitation(InsetCommandParams const &, bool same_id = false);
28         ///
29         Inset * clone(Buffer const &, bool same_id = false) const {
30                 return new InsetCitation(params(), same_id);
31         }
32         ///
33         string const getScreenLabel(Buffer const *) const;
34         ///
35         EDITABLE editable() const { return IS_EDITABLE; }
36         ///
37         Inset::Code lyxCode() const { return Inset::CITE_CODE; }
38         ///
39         void edit(BufferView *, int, int, mouse_button::state);
40         ///
41         void edit(BufferView * bv, bool front = true);
42         ///
43         int ascii(Buffer const *, std::ostream &, int linelen) const;
44         ///
45         int latex(Buffer const *, std::ostream &, bool, bool) const;
46         ///
47         void validate(LaTeXFeatures &) const;
48         /** Invoked by BufferView::Pimpl::dispatch when a new citation key
49             is inserted. Tells us that the buffer is no longer being loaded
50             and that the cache of BibTeX keys should be reloaded in the future.
51         */
52         void setLoadingBuffer(Buffer const * buffer, bool state) const;
53 private:
54         struct Cache {
55                 ///
56                 enum Style {
57                         ///
58                         BASIC,
59                         ///
60                         NATBIB_AY,
61                         ///
62                         NATBIB_NUM
63                 };
64                 ///
65                 Cache() : style(BASIC) {}
66                 ///
67                 Style style;
68                 ///
69                 InsetCommandParams params;
70                 ///
71                 string generated_label;
72                 ///
73                 string screen_label;
74         };
75
76         /// This function does the donkey work of creating the pretty label
77         string const generateLabel(Buffer const *) const;
78         ///
79         Cache::Style getStyle(Buffer const * buffer) const;
80
81         ///
82         mutable Cache cache;
83 };
84
85 #endif // INSET_CITE_H