]> git.lyx.org Git - lyx.git/blob - src/insets/InsetCitation.h
Math.lyx, Tutorial.lyx: fix some typos spotted by a user
[lyx.git] / src / insets / InsetCitation.h
1 // -*- C++ -*-
2 /**
3  * \file InsetCitation.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_CITATION_H
14 #define INSET_CITATION_H
15
16 #include "InsetCommand.h"
17
18 #include "Citation.h"
19
20 namespace lyx {
21
22 /////////////////////////////////////////////////////////////////////////
23 //
24 // InsetCitation
25 //
26 /////////////////////////////////////////////////////////////////////////
27
28 /// Used to insert citations
29 class InsetCitation : public InsetCommand
30 {
31 public:
32         ///
33         InsetCitation(Buffer * buf, InsetCommandParams const &);
34         ///
35         ~InsetCitation();
36
37         ///
38         bool addKey(std::string const & key);
39
40         /// \name Public functions inherited from Inset class
41         //@{
42         ///
43         bool isLabeled() const { return true; }
44         ///
45         bool hasSettings() const { return true; }
46         ///
47         docstring toolTip(BufferView const & bv, int x, int y) const;
48         ///
49         void doDispatch(Cursor & cur, FuncRequest & cmd);
50         ///
51         InsetCode lyxCode() const { return CITE_CODE; }
52         ///
53         void latex(otexstream &, OutputParams const &) const;
54         ///
55         int plaintext(odocstream &, OutputParams const &) const;
56         ///
57         int docbook(odocstream &, OutputParams const &) const;
58         ///
59         docstring xhtml(XHTMLStream &, OutputParams const &) const;
60         ///
61         void toString(odocstream &) const;
62         ///
63         void forToc(docstring &, size_t) const;
64         ///
65         void validate(LaTeXFeatures &) const {}
66         ///
67         void updateBuffer(ParIterator const & it, UpdateType);
68         ///
69         void addToToc(DocIterator const &) const;
70         ///
71         std::string contextMenuName() const;
72         //@}
73
74         /// \name Static public methods obligated for InsetCommand derived classes
75         //@{
76         ///
77         static ParamInfo const & findInfo(std::string const &);
78         ///
79         static std::string defaultCommand() { return "cite"; }
80         ///
81         static bool isCompatibleCommand(std::string const & cmd);
82         //@}
83
84 private:
85         /// tries to make a pretty label and makes a basic one if not
86         docstring generateLabel(bool for_xhtml = false) const;
87         /// makes a pretty label
88         docstring complexLabel(bool for_xhtml = false) const;
89         /// makes a very basic label, in case we can't make a pretty one
90         docstring basicLabel(bool for_xhtml = false) const;
91
92         /// \name Private functions inherited from Inset class
93         //@{
94         ///
95         Inset * clone() const { return new InsetCitation(*this); }
96         //@}
97
98         /// \name Private functions inherited from InsetCommand class
99         //@{
100         ///
101         docstring screenLabel() const;
102         //@}
103
104         /// we'll eventually want to be able to get info on this from the
105         /// various CiteEngines
106         static ParamInfo param_info_;
107
108         ///
109         struct Cache {
110                 Cache() : recalculate(true) {};
111                 ///
112                 bool recalculate;
113                 ///
114                 docstring generated_label;
115                 ///
116                 docstring screen_label;
117         };
118         ///
119         mutable Cache cache;
120 };
121
122
123 } // namespace lyx
124
125 #endif // INSET_CITATION_H