4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Alejandro Aguilar Sierra
9 * Full author contact details are available in file CREDITS.
12 #ifndef INSET_BIBITEM_H
13 #define INSET_BIBITEM_H
15 #include "InsetCommand.h"
16 #include "BiblioInfo.h"
21 /////////////////////////////////////////////////////////////////////////
25 /////////////////////////////////////////////////////////////////////////
27 /// Used to insert bibitem's information (key and label)
29 // Must be automatically inserted as the first object in a
30 // bibliography paragraph.
31 class InsetBibitem : public InsetCommand
35 InsetBibitem(InsetCommandParams const &);
37 static ParamInfo const & findInfo(std::string const &);
39 static std::string defaultCommand() { return "bibitem"; }
41 static bool isCompatibleCommand(std::string const & s)
42 { return s == "bibitem"; }
44 /// verify label and update references.
45 /// Overloaded from Inset::initView.
48 bool isLabeled() const { return true; }
50 void read(Lexer & lex);
52 docstring screenLabel() const;
54 EDITABLE editable() const { return IS_EDITABLE; }
56 InsetCode lyxCode() const { return BIBITEM_CODE; }
58 docstring bibLabel() const;
60 int plaintext(odocstream &, OutputParams const &) const;
62 virtual void fillWithBibKeys(BiblioInfo &, InsetIterator const &) const;
63 /// Update the counter of this inset
64 virtual void updateLabels(ParIterator const &);
66 void updateCommand(docstring const & new_key, bool dummy = false);
68 void doDispatch(Cursor & cur, FuncRequest & cmd);
70 Inset * clone() const { return new InsetBibitem(*this); }
72 friend docstring bibitemWidest(Buffer const & buffer);
73 /// The label that is set by updateLabels
76 static int key_counter;
80 /// Return the widest label in the Bibliography.
81 docstring bibitemWidest(Buffer const &);
85 #endif // INSET_BIBITEM_H