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