]> git.lyx.org Git - lyx.git/blob - src/insets/insetbib.h
prepare for 1.1.6pre2
[lyx.git] / src / insets / insetbib.h
1 // -*- C++ -*-
2 /* This file is part of*
3  * ====================================================== 
4  *
5  *           LyX, The Document Processor
6  *       
7  *           Copyright 1995 Matthias Ettrich
8  *           Copyright 1995-2000 The LyX Team.
9  * 
10  * ====================================================== */
11
12 #ifndef INSET_BIB_H
13 #define INSET_BIB_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include <vector>
20 #include "insetcommand.h"
21
22 class Buffer;
23 struct FD_bibitem_form;
24
25 /** Used to insert bibitem's information (key and label)
26   
27   Must be automatically inserted as the first object in a
28   bibliography paragraph. 
29   */
30 class InsetBibKey : public InsetCommand {
31 public:
32         ///
33         InsetBibKey(InsetCommandParams const &);
34         ///
35         ~InsetBibKey();
36         ///
37         Inset * Clone(Buffer const &) const;
38         /** Currently \bibitem is used as a LyX2.x command,
39             so we need this method.
40         */
41         void Write(Buffer const *, std::ostream &) const;
42         ///
43         void Read(Buffer const *, LyXLex & lex);
44         ///
45         virtual string const getScreenLabel() const;
46         ///
47         void Edit(BufferView *, int x, int y, unsigned int button);
48         ///
49         EDITABLE Editable() const {
50                 return IS_EDITABLE;
51         }
52         /// A user can't neither insert nor delete this inset
53         bool Deletable() const {
54                 return false;
55         }
56         ///
57         void setCounter(int);
58         ///
59         int  getCounter() const { return counter; }
60         ///
61         void callback( FD_bibitem_form *, long );
62         ///
63         struct Holder {
64                 InsetBibKey * inset;
65                 BufferView * view;
66         };
67  
68 private:
69         ///
70         int counter;
71         ///
72         Holder holder;
73 };
74
75
76 /** Used to insert BibTeX's information 
77   */
78 class InsetBibtex : public InsetCommand {
79 public:
80         ///
81         InsetBibtex(InsetCommandParams const &);
82         ///
83         ~InsetBibtex();
84         ///
85         Inset * Clone(Buffer const &) const {
86                 return new InsetBibtex(params());
87         }
88         ///
89         string const getScreenLabel() const;
90         ///
91         EDITABLE Editable() const { return IS_EDITABLE; }
92         ///
93         Inset::Code LyxCode() const { return Inset::BIBTEX_CODE; }
94         ///
95         void Edit(BufferView *, int x, int y, unsigned int button);
96         /// 
97         int Latex(Buffer const *, std::ostream &,
98                   bool fragile, bool freespace) const;
99         ///
100         std::vector<std::pair<string,string> > const getKeys(Buffer const *) const;
101         ///
102         bool addDatabase(string const &);
103         ///
104         bool delDatabase(string const &);
105         ///
106         bool display() const { return true; } 
107         ///
108         struct Holder {
109                 InsetBibtex * inset;
110                 BufferView * view;
111         };
112
113 private:
114         ///
115         Holder holder;
116 };
117
118 #endif