]> git.lyx.org Git - lyx.git/blob - src/insets/InsetBibitem.h
Stupid bug fix.
[lyx.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 #include "BiblioInfo.h"
16 #include "InsetCommand.h"
17
18
19 namespace lyx {
20
21 /////////////////////////////////////////////////////////////////////////
22 //
23 // InsetBibItem
24 //
25 /////////////////////////////////////////////////////////////////////////
26
27 /// Used to insert bibitem's information (key and label)
28
29 //  Must be automatically inserted as the first object in a
30 //  bibliography paragraph.
31 class InsetBibitem : public InsetCommand
32 {
33 public:
34         ///
35         InsetBibitem(Buffer const &, InsetCommandParams const &);
36         ///
37         virtual ~InsetBibitem();
38         ///
39         static ParamInfo const & findInfo(std::string const &);
40         ///
41         static std::string defaultCommand() { return "bibitem"; }
42         ///
43         static bool isCompatibleCommand(std::string const & s) 
44                 { return s == "bibitem"; }
45 private:
46         /// verify label and update references.
47         /// Overloaded from Inset::initView.
48         void initView();
49         ///
50         bool isLabeled() const { return true; }
51         ///
52         void read(Lexer & lex);
53         ///
54         docstring screenLabel() const;
55         ///
56         EDITABLE editable() const { return IS_EDITABLE; }
57         ///
58         InsetCode lyxCode() const { return BIBITEM_CODE; }
59         ///
60         docstring bibLabel() const;
61         ///
62         int plaintext(odocstream &, OutputParams const &) const;
63         ///
64         virtual void fillWithBibKeys(BiblioInfo &, InsetIterator const &) const;
65         /// Update the counter of this inset
66         virtual void updateLabels(ParIterator const &);
67         ///
68         void updateCommand(docstring const & new_key, bool dummy = false);
69         ///
70         void doDispatch(Cursor & cur, FuncRequest & cmd);
71         ///
72         Inset * clone() const { return new InsetBibitem(*this); }
73
74         friend docstring bibitemWidest(Buffer const & buffer);
75         /// The label that is set by updateLabels
76         docstring autolabel_;
77         ///
78         static int key_counter;
79 };
80
81
82 /// Return the widest label in the Bibliography.
83 docstring bibitemWidest(Buffer const &);
84
85 } // namespace lyx
86
87 #endif // INSET_BIBITEM_H