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 *, 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(XHTMLStream &, OutputParams const &) const;
66 int latex(odocstream &, OutputParams const &) const;
68 virtual void fillWithBibKeys(BiblioInfo &, InsetIterator const &) const;
69 /// Update the counter of this inset
70 void updateLabels(ParIterator const &, UpdateType);
72 void updateCommand(docstring const & new_key, bool dummy = false);
74 void doDispatch(Cursor & cur, FuncRequest & cmd);
76 Inset * clone() const { return new InsetBibitem(*this); }
78 friend docstring bibitemWidest(Buffer const & buffer, OutputParams const &);
79 /// The label that is set by updateLabels
82 static int key_counter;
86 /// Return the widest label in the Bibliography.
87 docstring bibitemWidest(Buffer const &, OutputParams const &);
91 #endif // INSET_BIBITEM_H