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 "BiblioInfo.h"
16 #include "InsetCommand.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(Buffer const &, InsetCommandParams const &);
37 virtual ~InsetBibitem();
39 static ParamInfo const & findInfo(std::string const &);
41 static std::string defaultCommand() { return "bibitem"; }
43 static bool isCompatibleCommand(std::string const & s)
44 { return s == "bibitem"; }
46 /// verify label and update references.
47 /// Overloaded from Inset::initView.
50 bool isLabeled() const { return true; }
52 void read(Lexer & lex);
54 docstring screenLabel() const;
56 bool hasSettings() const { return true; }
58 InsetCode lyxCode() const { return BIBITEM_CODE; }
60 docstring bibLabel() const;
62 int plaintext(odocstream &, OutputParams const &) const;
64 docstring xhtml(odocstream &, OutputParams const &) const;
66 virtual void fillWithBibKeys(BiblioInfo &, InsetIterator const &) const;
67 /// Update the counter of this inset
68 virtual void updateLabels(ParIterator const &);
70 void updateCommand(docstring const & new_key, bool dummy = false);
72 void doDispatch(Cursor & cur, FuncRequest & cmd);
74 Inset * clone() const { return new InsetBibitem(*this); }
76 friend docstring bibitemWidest(Buffer const & buffer);
77 /// The label that is set by updateLabels
80 static int key_counter;
84 /// Return the widest label in the Bibliography.
85 docstring bibitemWidest(Buffer const &);
89 #endif // INSET_BIBITEM_H