]> git.lyx.org Git - lyx.git/blob - src/insets/insetbibitem.h
The speed patch: redraw only rows that have changed
[lyx.git] / src / insets / insetbibitem.h
1 // -*- C++ -*-
2 /**
3  * \file insetbibitem.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Alejandro Aguilar Sierra
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef INSET_BIBITEM_H
13 #define INSET_BIBITEM_H
14
15
16 #include "insetcommand.h"
17
18 /** Used to insert bibitem's information (key and label)
19
20   Must be automatically inserted as the first object in a
21   bibliography paragraph.
22   */
23 class InsetBibitem : public InsetCommand {
24 public:
25         ///
26         InsetBibitem(InsetCommandParams const &);
27         /** Currently \bibitem is used as a LyX2.x command,
28             so we need this method.
29         */
30         void write(Buffer const &, std::ostream &) const;
31         ///
32         void read(Buffer const &, LyXLex & lex);
33         ///
34         virtual std::string const getScreenLabel(Buffer const &) const;
35         ///
36         EDITABLE editable() const { return IS_EDITABLE; }
37         ///
38         InsetBase::Code lyxCode() const { return InsetBase::BIBITEM_CODE; }
39         /// keep .lyx format compatible
40         bool directWrite() const { return true; }
41         ///
42         void setCounter(int);
43         ///
44         int getCounter() const { return counter; }
45         ///
46         std::string const getBibLabel() const;
47         ///
48         int plaintext(Buffer const &, std::ostream &,
49                       OutputParams const &) const;
50 protected:
51         ///
52         virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
53 private:
54         virtual std::auto_ptr<InsetBase> doClone() const;
55
56         ///
57         int counter;
58         ///
59         static int key_counter;
60 };
61
62
63 /// Return the widest label in the Bibliography.
64 std::string const bibitemWidest(Buffer const &);
65
66 #endif // INSET_BIBITEM_H