]> git.lyx.org Git - lyx.git/blob - src/insets/insetcite.h
setFont rework + some code simplification
[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 plaintext(Buffer const &, std::ostream &, int linelen) const;
39         ///
40         int latex(Buffer const &, std::ostream &,
41                   OutputParams const &) const;
42         ///
43         void validate(LaTeXFeatures &) const;
44 protected:
45         ///
46         virtual
47         DispatchResult
48         priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &);
49 private:
50         struct Cache {
51                 ///
52                 enum Style {
53                         ///
54                         BASIC,
55                         ///
56                         NATBIB_AY,
57                         ///
58                         NATBIB_NUM
59                 };
60                 ///
61                 Cache() : style(BASIC) {}
62                 ///
63                 Style style;
64                 ///
65                 InsetCommandParams params;
66                 ///
67                 std::string generated_label;
68                 ///
69                 std::string screen_label;
70         };
71
72         /// This function does the donkey work of creating the pretty label
73         std::string const generateLabel(Buffer const &) const;
74         ///
75         Cache::Style getStyle(Buffer const & buffer) const;
76
77         ///
78         mutable Cache cache;
79 };
80
81 #endif // INSET_CITE_H