]> git.lyx.org Git - lyx.git/blob - src/insets/InsetCitation.h
Force BibTeX rerun upon add/remove/change citation (fixes #6955).
[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         /// \name Public functions inherited from Inset class
38         //@{
39         ///
40         bool isLabeled() const { return true; }
41         ///
42         bool hasSettings() const { return true; }
43         ///
44         docstring toolTip(BufferView const & bv, int x, int y) const;
45         ///
46         void doDispatch(Cursor & cur, FuncRequest & cmd);
47         ///
48         InsetCode lyxCode() const { return CITE_CODE; }
49         ///
50         void latex(otexstream &, OutputParams const &) const;
51         ///
52         int plaintext(odocstream &, OutputParams const &) const;
53         ///
54         int docbook(odocstream &, OutputParams const &) const;
55         ///
56         docstring xhtml(XHTMLStream &, OutputParams const &) const;
57         ///
58         void toString(odocstream &) const;
59         ///
60         void forToc(docstring &, size_t) const;
61         ///
62         void validate(LaTeXFeatures &) const {}
63         ///
64         void updateBuffer(ParIterator const & it, UpdateType);
65         ///
66         void addToToc(DocIterator const &) const;
67         ///
68         std::string contextMenuName() const;
69         //@}
70
71         /// \name Static public methods obligated for InsetCommand derived classes
72         //@{
73         ///
74         static ParamInfo const & findInfo(std::string const &);
75         ///
76         static std::string defaultCommand() { return "cite"; }
77         ///
78         static bool isCompatibleCommand(std::string const & cmd);
79         //@}
80
81 private:
82         /// tries to make a pretty label and makes a basic one if not
83         docstring generateLabel(bool for_xhtml = false) const;
84         /// makes a pretty label
85         docstring complexLabel(bool for_xhtml = false) const;
86         /// makes a very basic label, in case we can't make a pretty one
87         docstring basicLabel(bool for_xhtml = false) const;
88
89         /// \name Private functions inherited from Inset class
90         //@{
91         ///
92         Inset * clone() const { return new InsetCitation(*this); }
93         //@}
94
95         /// \name Private functions inherited from InsetCommand class
96         //@{
97         ///
98         docstring screenLabel() const;
99         //@}
100
101         /// we'll eventually want to be able to get info on this from the
102         /// various CiteEngines
103         static ParamInfo param_info_;
104
105         ///
106         struct Cache {
107                 Cache() : recalculate(true) {};
108                 ///
109                 bool recalculate;
110                 ///
111                 docstring generated_label;
112                 ///
113                 docstring screen_label;
114         };
115         ///
116         mutable Cache cache;
117 };
118
119
120 } // namespace lyx
121
122 #endif // INSET_CITATION_H