]> git.lyx.org Git - features.git/blob - src/insets/InsetBibitem.h
Fix InsetBibitem::clone.
[features.git] / src / insets / InsetBibitem.h
1 // -*- C++ -*-
2 /**
3  * \file InsetBibitem.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Alejandro Aguilar Sierra
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef INSET_BIBITEM_H
13 #define INSET_BIBITEM_H
14
15
16 #include "InsetCommand.h"
17 #include "BiblioInfo.h"
18
19
20 namespace lyx {
21
22 /** Used to insert bibitem's information (key and label)
23
24   Must be automatically inserted as the first object in a
25   bibliography paragraph.
26   */
27 class InsetBibitem : public InsetCommand {
28 public:
29         ///
30         InsetBibitem(InsetCommandParams const &);
31         ///
32         void read(Lexer & lex);
33         ///
34         docstring screenLabel() const;
35         ///
36         EDITABLE editable() const { return IS_EDITABLE; }
37         ///
38         InsetCode lyxCode() const { return BIBITEM_CODE; }
39         ///
40         docstring bibLabel() const;
41         ///
42         int plaintext(odocstream &, OutputParams const &) const;
43         ///
44         virtual void fillWithBibKeys(BiblioInfo &, InsetIterator const &) const;
45         /// Update the counter of this inset
46         virtual void updateLabels(ParIterator const &);
47         ///
48         static ParamInfo const & findInfo(std::string const &);
49         ///
50         static std::string defaultCommand() { return "bibitem"; };
51         ///
52         static bool isCompatibleCommand(std::string const & s) 
53                 { return s == "bibitem"; }
54 protected:
55         ///
56         virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
57 private:
58         ///
59         virtual Inset * clone() const { return new InsetBibitem(*this); }
60         /// The label that is set by updateLabels
61         docstring autolabel_;
62         ///
63         static int key_counter;
64 };
65
66
67 /// Return the widest label in the Bibliography.
68 docstring const bibitemWidest(Buffer const &);
69
70
71 } // namespace lyx
72
73 #endif // INSET_BIBITEM_H