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
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 override { return BIBITEM_CODE; }
47 bool hasSettings() const override { return true; }
48 /// \copydoc Inset::initView()
49 /// verify label and update references.
50 void initView() override;
52 bool isLabeled() const override { return true; }
54 void read(Lexer & lex) override;
56 int plaintext(odocstringstream &, OutputParams const &,
57 size_t max_length = INT_MAX) const override;
59 docstring xhtml(XMLStream &, OutputParams const &) const override;
61 void docbook(XMLStream &, OutputParams const &) const override;
63 void collectBibKeys(InsetIterator const &, support::FileNameList &) const override;
64 /// update the counter of this inset
65 void updateBuffer(ParIterator const &, UpdateType, bool const deleted = false) override;
68 /// \name Static public methods obligated for InsetCommand derived classes
71 static ParamInfo const & findInfo(std::string const &);
73 static std::string defaultCommand() { return "bibitem"; }
75 static bool isCompatibleCommand(std::string const & s)
76 { return s == "bibitem"; }
78 docstring bibLabel() const;
82 /// \name Private functions inherited from Inset class
85 void doDispatch(Cursor & cur, FuncRequest & cmd) override;
87 Inset * clone() const override { return new InsetBibitem(*this); }
88 /// Is the content of this inset part of the immediate (visible) text sequence?
89 bool isPartOfTextSequence() const override { return false; }
92 /// \name Private functions inherited from InsetCommand class
95 docstring screenLabel() const override;
98 friend docstring bibitemWidest(Buffer const & buffer, OutputParams const &);
100 /// The label that is set by updateBuffer
101 docstring autolabel_;
103 static int key_counter;
107 /// Return the widest label in the Bibliography.
108 docstring bibitemWidest(Buffer const &, OutputParams const &);
113 #endif // INSET_BIBITEM_H