#ifndef INSET_BIBITEM_H
#define INSET_BIBITEM_H
-
+#include "BiblioInfo.h"
#include "InsetCommand.h"
-#include "Biblio_typedefs.h"
namespace lyx {
-/** Used to insert bibitem's information (key and label)
+/////////////////////////////////////////////////////////////////////////
+//
+// InsetBibItem
+//
+/////////////////////////////////////////////////////////////////////////
+
+/// Used to insert bibitem's information (key and label)
- Must be automatically inserted as the first object in a
- bibliography paragraph.
- */
-class InsetBibitem : public InsetCommand {
+// Must be automatically inserted as the first object in a
+// bibliography paragraph.
+class InsetBibitem : public InsetCommand
+{
public:
///
- InsetBibitem(InsetCommandParams const &);
+ InsetBibitem(Buffer *, InsetCommandParams const &);
///
- void read(Buffer const &, Lexer & lex);
+ virtual ~InsetBibitem();
///
- docstring const getScreenLabel(Buffer const &) const;
+ static ParamInfo const & findInfo(std::string const &);
///
- EDITABLE editable() const { return IS_EDITABLE; }
+ static std::string defaultCommand() { return "bibitem"; }
///
- Inset::Code lyxCode() const { return Inset::BIBITEM_CODE; }
+ static bool isCompatibleCommand(std::string const & s)
+ { return s == "bibitem"; }
+private:
+ /// verify label and update references.
+ /// Overloaded from Inset::initView.
+ void initView();
///
- void setCounter(int);
+ bool isLabeled() const { return true; }
///
- int getCounter() const { return counter; }
+ void read(Lexer & lex);
///
- docstring const getBibLabel() const;
+ docstring screenLabel() const;
///
- int plaintext(Buffer const &, odocstream &, OutputParams const &) const;
+ bool hasSettings() const { return true; }
///
- virtual void fillWithBibKeys(Buffer const &,
- biblio::BibKeyList &, InsetIterator const &) const;
-
-protected:
+ InsetCode lyxCode() const { return BIBITEM_CODE; }
///
- virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
-private:
- virtual std::auto_ptr<Inset> doClone() const;
-
+ docstring bibLabel() const;
+ ///
+ int plaintext(odocstream &, OutputParams const &) const;
///
- int counter;
+ docstring xhtml(XHTMLStream &, OutputParams const &) const;
+ ///
+ virtual void fillWithBibKeys(BiblioInfo &, InsetIterator const &) const;
+ /// Update the counter of this inset
+ virtual void updateLabels(ParIterator const &, bool);
+ ///
+ void updateCommand(docstring const & new_key, bool dummy = false);
+ ///
+ void doDispatch(Cursor & cur, FuncRequest & cmd);
+ ///
+ Inset * clone() const { return new InsetBibitem(*this); }
+
+ friend docstring bibitemWidest(Buffer const & buffer);
+ /// The label that is set by updateLabels
+ docstring autolabel_;
///
static int key_counter;
};
/// Return the widest label in the Bibliography.
-docstring const bibitemWidest(Buffer const &);
-
+docstring bibitemWidest(Buffer const &);
} // namespace lyx