]> git.lyx.org Git - lyx.git/blob - src/insets/insetbibitem.h
The markDirty() and fitCursor() changes
[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 class Buffer;
19
20 /** Used to insert bibitem's information (key and label)
21
22   Must be automatically inserted as the first object in a
23   bibliography paragraph.
24   */
25 class InsetBibitem : public InsetCommand {
26 public:
27         ///
28         InsetBibitem(InsetCommandParams const &);
29         ///
30         ~InsetBibitem();
31         ///
32         Inset * clone(Buffer const &, bool same_id = false) const;
33         ///
34         virtual dispatch_result localDispatch(FuncRequest const & cmd);
35         /** Currently \bibitem is used as a LyX2.x command,
36             so we need this method.
37         */
38         void write(Buffer const *, std::ostream &) const;
39         ///
40         void read(Buffer const *, LyXLex & lex);
41         ///
42         virtual string const getScreenLabel(Buffer const *) const;
43         ///
44         void edit(BufferView *, int x, int y, mouse_button::state button);
45         ///
46         void edit(BufferView * bv, bool front = true);
47         ///
48         EDITABLE editable() const { return IS_EDITABLE; }
49         ///
50         Inset::Code lyxCode() const { return Inset::BIBITEM_CODE; }
51         /// keep .lyx format compatible
52         bool directWrite() const { return true; }
53         ///
54         void setCounter(int);
55         ///
56         int  getCounter() const { return counter; }
57         ///
58         string const getBibLabel() const;
59         ///
60         struct Holder {
61                 InsetBibitem * inset;
62                 BufferView * view;
63         };
64
65 private:
66         ///
67         int counter;
68         ///
69         Holder holder;
70         ///
71         static int key_counter;
72 };
73
74 #endif // INSET_BIBITEM_H