]> git.lyx.org Git - lyx.git/blob - src/insets/insetbib.h
Various small fixes, look in ChangeLog
[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 "insetcommand.h"
20
21 using std::ostream;
22
23 class Buffer;
24
25 /** Used to insert citations  
26  */
27 class InsetCitation: public InsetCommand {
28 public:
29         ///
30         InsetCitation() : InsetCommand("cite") {}
31         ///
32         InsetCitation(string const & key, string const & note = string());
33         ///
34         ~InsetCitation();
35         ///
36         Inset * Clone() const {
37                 return new InsetCitation(contents, options);
38         }
39         ///
40         string getScreenLabel()const;
41         ///
42         void Edit(BufferView *, int x, int y, unsigned int button);
43         ///
44         EDITABLE Editable() const {
45                 return IS_EDITABLE;
46         }
47         ///
48         struct Holder {
49                 InsetCitation * inset;
50                 BufferView * view;
51         };
52
53 private:
54         ///
55         Holder holder;
56 };
57
58
59 /** Used to insert bibitem's information (key and label)
60   
61   Must be automatically inserted as the first object in a
62   bibliography paragraph. 
63   */
64 class InsetBibKey: public InsetCommand {
65 public:
66         ///
67         InsetBibKey() : InsetCommand("bibitem") { counter = 1; }
68         ///
69         InsetBibKey(string const & key, string const & label = string());
70         ///
71         InsetBibKey(InsetBibKey const *);
72         ///
73         ~InsetBibKey();
74         ///
75         Inset * Clone() const { return new InsetBibKey(this); }
76         /// Currently \bibitem is used as a LyX2.x command, so we need this method.
77         void Write(ostream &) const;
78         ///
79         virtual string getScreenLabel() const;
80         ///
81         void Edit(BufferView *, int x, int y, unsigned int button);
82         ///
83         EDITABLE Editable() const {
84                 return IS_EDITABLE;
85         }
86         /// A user can't neither insert nor delete this inset
87         bool Deletable() const {
88                 return false;
89         }
90         ///
91         void setCounter(int);
92         ///
93         int  getCounter() const { return counter; }
94         ///
95         struct Holder {
96                 InsetBibKey * inset;
97                 BufferView * view;
98         };
99
100  private:
101         ///
102         int counter;
103
104         ///
105         Holder holder;
106 };
107
108
109 /** Used to insert BibTeX's information 
110   */
111 class InsetBibtex: public InsetCommand {
112 public:
113         /// 
114         InsetBibtex() : InsetCommand("BibTeX") { owner = 0; }
115         ///
116         InsetBibtex(string const & dbase, string const & style,
117                     Buffer *);
118         ///
119         ~InsetBibtex();
120
121         ///
122         Inset * Clone() const {
123                 return new InsetBibtex(contents, options, 0);
124         }
125         ///  
126         Inset::Code LyxCode() const
127         {
128                 return Inset::BIBTEX_CODE;
129         }
130         ///
131         string getScreenLabel() const;
132         ///
133         void Edit(BufferView *, int x, int y, unsigned int button);
134         /// 
135         int Latex(ostream &, signed char, bool) const;
136         ///
137         string getKeys(char delim);
138         ///
139         EDITABLE Editable() const {
140                 return IS_EDITABLE;
141         }
142         ///
143         bool addDatabase(string const &);
144         ///
145         bool delDatabase(string const &);
146         ///
147         bool display() const { return true; } 
148
149         struct Holder {
150                 InsetBibtex * inset;
151                 BufferView * view;
152         };
153
154 private:
155         ///
156         mutable Buffer * owner;
157
158         ///
159         Holder holder;
160 };
161
162 #endif