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 &);
40 void updateCommand(docstring const & new_key, bool dummy = false);
42 /// \name Public functions inherited from Inset class
45 InsetCode lyxCode() const { return BIBITEM_CODE; }
47 bool hasSettings() const { return true; }
48 /// \copydoc Inset::initView()
49 /// verify label and update references.
52 bool isLabeled() const { return true; }
54 void read(Lexer & lex);
56 int plaintext(odocstream &, OutputParams const &) const;
58 docstring xhtml(XHTMLStream &, OutputParams const &) const;
60 void fillWithBibKeys(BiblioInfo &, InsetIterator const &) const;
61 /// update the counter of this inset
62 void updateBuffer(ParIterator const &, UpdateType);
65 /// \name Static public methods obligated for InsetCommand derived classes
68 static ParamInfo const & findInfo(std::string const &);
70 static std::string defaultCommand() { return "bibitem"; }
72 static bool isCompatibleCommand(std::string const & s)
73 { return s == "bibitem"; }
78 docstring bibLabel() const;
80 /// \name Private functions inherited from Inset class
83 void doDispatch(Cursor & cur, FuncRequest & cmd);
85 Inset * clone() const { return new InsetBibitem(*this); }
88 /// \name Private functions inherited from InsetCommand class
91 docstring screenLabel() const;
94 friend docstring bibitemWidest(Buffer const & buffer, OutputParams const &);
96 /// The label that is set by updateBuffer
99 static int key_counter;
103 /// Return the widest label in the Bibliography.
104 docstring bibitemWidest(Buffer const &, OutputParams const &);
109 #endif // INSET_BIBITEM_H